Skip to content

Feature/uma android - #5

Merged
EmbeddedFrime merged 27 commits into
feature/android-portfrom
feature/uma_android
Aug 17, 2026
Merged

Feature/uma android#5
EmbeddedFrime merged 27 commits into
feature/android-portfrom
feature/uma_android

Conversation

@EmbeddedFrime

Copy link
Copy Markdown
Owner

add UMA for androiddevice:

  • Create an opencl_common.hpp where you can find the function for UMA
  • implement the UMA in every main
  • didecated callin every opencl benchmark file to be compatible with every differenet name of variable

Copilot AI lite review requested due to automatic review settings August 17, 2026 08:43
@EmbeddedFrime
EmbeddedFrime merged commit b175fde into feature/android-port Aug 17, 2026
1 check passed
@EmbeddedFrime
EmbeddedFrime deleted the feature/uma_android branch August 17, 2026 08:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces Android/OpenCL Unified Memory (UMA) support across multiple benchmarks by centralizing common OpenCL helpers (error handling + buffer map/unmap) and adding a -u CLI flag to enable unified memory paths.

Changes:

  • Added gpu4s_benchmark/common/opencl_common.hpp with shared OpenCL error handling and UMA map/unmap helpers.
  • Updated many OpenCL backends to use shared openclError(...) and added per-benchmark UMA mapping/sync functions.
  • Updated benchmark main.cpp files to support -u (unified memory) and adjusted allocation/copy logic accordingly.

Reviewed changes

Copilot reviewed 100 out of 101 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
gpu4s_benchmark/wavelet_transform/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/wavelet_transform/opencl/lib_opencl.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/wavelet_transform/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/wavelet_transform/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/wavelet_transform/benchmark_library.h Declare UMA helper prototypes (wavelet-specific)
gpu4s_benchmark/softmax_bench/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/softmax_bench/opencl/lib_opencl_lib.cpp Remove OpenCL-lib variant source
gpu4s_benchmark/softmax_bench/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/softmax_bench/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/softmax_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/softmax_bench/CMakeLists.txt Switch to lib_opencl_common.cpp + drop OpenCL-lib target
gpu4s_benchmark/relu_bench/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/relu_bench/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/relu_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/relu_bench/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/memory_bandwidth_bench/opencl/lib_opencl.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/memory_bandwidth_bench/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/memory_bandwidth_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/max_pooling_bench/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/max_pooling_bench/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/max_pooling_bench/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/max_pooling_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/max_pooling_bench/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/matrix_multiplication_tensor_bench/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/matrix_multiplication_tensor_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/matrix_multiplication_tensor_bench/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/matrix_multiplication_bench/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/matrix_multiplication_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/matrix_multiplication_bench/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/matrix_multiplication_bench/benchmark_library.h Remove legacy UNIFIED_MEMORY prototypes
gpu4s_benchmark/matrix_multiplication_bench_fp16/opencl/lib_opencl_lib.cpp Use shared OpenCL helpers for error reporting
gpu4s_benchmark/matrix_multiplication_bench_fp16/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/matrix_multiplication_bench_fp16/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/matrix_multiplication_bench_fp16/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/matrix_multiplication_bench_fp16/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/LRN_bench/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/LRN_bench/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/LRN_bench/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/LRN_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/LRN_bench/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/finite_impulse_response_filter/openmp/openmp_common.h Remove unused OpenMP common header
gpu4s_benchmark/finite_impulse_response_filter/openmp/openmp_common.cpp Remove unused OpenMP common source
gpu4s_benchmark/finite_impulse_response_filter/openmp/lib_omp.cpp Fix host allocation sizing bug (sizeof(bench_t) vs pointer)
gpu4s_benchmark/finite_impulse_response_filter/opencl/opencl_common.cpp Remove unused OpenCL common source
gpu4s_benchmark/finite_impulse_response_filter/opencl/lib_opencl.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/finite_impulse_response_filter/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/finite_impulse_response_filter/hip/lib_hip.cpp Fix HIP variable typo in cleanup
gpu4s_benchmark/finite_impulse_response_filter/cpu/lib_cpu.cpp Fix host allocation sizing bug (sizeof(bench_t) vs pointer)
gpu4s_benchmark/finite_impulse_response_filter/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/finite_impulse_response_filter/benchmark_library.h Declare UMA helper prototypes (FIR-specific)
gpu4s_benchmark/fast_fourier_transform_window_bench/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/fast_fourier_transform_window_bench/opencl/lib_opencl_lib.cpp Fix profiling event usage/elapsed-time computation
gpu4s_benchmark/fast_fourier_transform_window_bench/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync + event fix
gpu4s_benchmark/fast_fourier_transform_window_bench/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/fast_fourier_transform_window_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/fast_fourier_transform_window_bench/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/fast_fourier_transform_window_bench/benchmark_library.h Add evt_copyA event pointer to OpenCL state
gpu4s_benchmark/fast_fourier_transform_bench/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/fast_fourier_transform_bench/opencl/lib_opencl_lib.cpp Minor profiling-time assignment fix
gpu4s_benchmark/fast_fourier_transform_bench/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/fast_fourier_transform_bench/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/fast_fourier_transform_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/fast_fourier_transform_bench/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/fast_fourier_transform_2D_bench/opencl/lib_opencl_lib.cpp Use shared OpenCL helpers + add UMA mapping/sync + event fixes
gpu4s_benchmark/fast_fourier_transform_2D_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/fast_fourier_transform_2D_bench/benchmark_library.h Update OpenCL state/events + declare UMA helper prototypes
gpu4s_benchmark/correlation_2D/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/correlation_2D/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/correlation_2D/main.cpp Add -u unified memory path + refactor allocations/copies
gpu4s_benchmark/correlation_2D/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/correlation_2D/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/convolution_2D_bench/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/convolution_2D_bench/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/convolution_2D_bench/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/convolution_2D_bench/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/convolution_2D_bench/benchmark_library.h Declare UMA helper prototypes (conv2D-specific)
gpu4s_benchmark/common/opencl_common.hpp New shared OpenCL error + UMA map/unmap helpers
gpu4s_benchmark/common/benchmark_common.h Define UMA_COMPATIBILITY + force profiling clock on Android OpenCL; init timing fields
gpu4s_benchmark/cifar_10/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/cifar_10/opencl/lib_opencl.cpp Minor formatting cleanup
gpu4s_benchmark/cifar_10/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/cifar_10/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/cifar_10/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/cifar_10/benchmark_library.h Declare UMA helper prototypes (cifar-specific)
gpu4s_benchmark/cifar_10_multiple/openmp/omp_common.h Remove unused OpenMP common header
gpu4s_benchmark/cifar_10_multiple/opencl/lib_opencl.cpp Update dense relu kernel usage and event wiring
gpu4s_benchmark/cifar_10_multiple/opencl/lib_opencl_opt.cpp Update dense relu kernel usage + stream sync fix
gpu4s_benchmark/cifar_10_multiple/opencl/lib_opencl_common.cpp Use shared OpenCL helpers + add UMA mapping/sync
gpu4s_benchmark/cifar_10_multiple/opencl/GEN_kernel.hcl Add kernel_relu_linear kernel
gpu4s_benchmark/cifar_10_multiple/opencl/GEN_kernel_opt.hcl Add kernel_relu_linear + adjust softmax reduction logic
gpu4s_benchmark/cifar_10_multiple/cpu_functions/cpu_functions.h Add unified_memory flag to args
gpu4s_benchmark/cifar_10_multiple/CMakeLists.txt Switch to lib_opencl_common.cpp
gpu4s_benchmark/cifar_10_multiple/benchmark_library.h Declare UMA helper prototypes (cifar-multiple specific)
doc.md Add Android build/push notes

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 258 to +262
free(arguments_parameters);
free(A);

if (!arguments_parameters->unified_memory)
{
free(A);
Comment on lines +73 to +80
for (int i=0; i < LOWPASSFILTERSIZE; i++){
lowpass_filter_ptr[i] = lowpass_filter[i];
}

//initiate
for (int i=0; i < HIGHPASSFILTERSIZE; i++){
highpass_filter_ptr[i] = highpass_filter[i];
}
Comment on lines 251 to +256
free(arguments_parameters);
free(A);

if (!arguments_parameters->unified_memory)
{
free(A);
free(d_B);
Comment on lines 215 to +223
free(arguments_parameters);
// free object memory
free(mem_bench);
free(A);

if (!arguments_parameters->unified_memory)
{
free(A);
free(d_B);
}
Comment on lines 245 to +254
clean(lrn_bench);
free(arguments_parameters);
// free object memory
free(lrn_bench);
free(A);

if (!arguments_parameters->unified_memory)
{
free(A);
free(d_B);
}
Comment on lines 241 to +246
free(arguments_parameters);
free(A);

if (!arguments_parameters->unified_memory)
{
free(A);
free(d_B);
Comment on lines 215 to +220
free(arguments_parameters);
free(A);
free(d_B);

if (!arguments_parameters->unified_memory)
{
free(A);
free(d_B);
Comment on lines 316 to +323
free(arguments_parameters);
free(cifar10_bench);
free(input_data);
free(d_output);
free(kernel_1);
free(kernel_2);
free(weights_1);
free(weights_2);

if (!arguments_parameters->unified_memory)
{
free(input_data);
free(d_output);
free(kernel_1);
Comment on lines 347 to +352
free(arguments_parameters);
free(cifar10_bench);
free(input_data);
free(d_output);
free(kernel_1);
free(kernel_2);
free(weights_1);
free(weights_2);
if (!arguments_parameters->unified_memory)
{
free(input_data);
free(d_output);
Comment on lines +246 to +257
void sync_unified_memory_to_device(GraficCommon* device_object, COMPLEX** &A, COMPLEX** &B){
GraficObject* deviceObj = static_cast<GraficObject*>(device_object);

bench_t* tmp_flat_A = (bench_t*)A[0];
bench_t* tmp_flat_B = (bench_t*)B[0];

// --- Call the openCL common function ---
unmap_unified_memory(device_object,
BufferMapCL{&tmp_flat_A, deviceObj->d_A, deviceObj->evt_copyA},
BufferMapCL{&tmp_flat_B, deviceObj->d_B, nullptr}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants