From: Grigore Lupescu <grigore.lupescu at intel.com> Signed-off-by: Grigore Lupescu <grigore.lupescu at intel.com> --- benchmark/CMakeLists.txt | 13 +++---------- benchmark/benchmark_math.cpp | 10 ++++++---- utests/utest_helper.cpp | 18 ++++++++---------- 3 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 4c3c933..e3fa8cd 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -3,7 +3,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../include) -link_directories (${LLVM_LIBRARY_DIR} ${DRM_LIBDIR}) +link_directories (${LLVM_LIBRARY_DIR} ${DRM_LIBDIR} /opt/intel/opencl/) set (benchmark_sources ../utests/utest_error.c ../utests/utest_assert.cpp @@ -11,14 +11,6 @@ set (benchmark_sources ../utests/utest_file_map.cpp ../utests/utest_helper.cpp ../utests/vload_bench.cpp - benchmark_copy_buf.cpp - benchmark_use_host_ptr_buffer.cpp - benchmark_read_buffer.cpp - benchmark_read_image.cpp - benchmark_copy_buffer_to_image.cpp - benchmark_copy_image_to_buffer.cpp - benchmark_copy_buffer.cpp - benchmark_copy_image.cpp benchmark_math.cpp) @@ -28,7 +20,8 @@ SET(CMAKE_C_FLAGS "-DBUILD_BENCHMARK ${CMAKE_C_FLAGS}") ADD_LIBRARY(benchmarks SHARED ${ADDMATHFUNC} ${benchmark_sources}) #TARGET_LINK_LIBRARIES(benchmarks cl m ${OPENGL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) -TARGET_LINK_LIBRARIES(benchmarks cl m) + +TARGET_LINK_LIBRARIES(benchmarks OpenCL m rt pthread) ADD_EXECUTABLE(benchmark_run benchmark_run.cpp) TARGET_LINK_LIBRARIES(benchmark_run benchmarks) diff --git a/benchmark/benchmark_math.cpp b/benchmark/benchmark_math.cpp index 72bc316..7a5574b 100644 --- a/benchmark/benchmark_math.cpp +++ b/benchmark/benchmark_math.cpp @@ -32,9 +32,10 @@ double benchmark_generic_math(const char* str_filename, OCL_CREATE_BUFFER(buf[0], 0, (global_size) * sizeof(float), NULL); OCL_CREATE_BUFFER(buf[1], 0, (global_size) * sizeof(float), NULL); - OCL_MAP_BUFFER(0); + buf_data[0] = clEnqueueMapBuffer(queue, buf[0], true, CL_MAP_READ | CL_MAP_WRITE, + 0, (global_size) * sizeof(float), 0, NULL, NULL, NULL); memcpy(buf_data[0], src, global_size * sizeof(float)); - OCL_UNMAP_BUFFER(0); + clEnqueueUnmapMemObject(queue, buf[0], buf_data[0], 0, NULL, NULL); globals[0] = global_size; locals[0] = local_size; @@ -52,10 +53,11 @@ double benchmark_generic_math(const char* str_filename, elapsed = time_subtract(&stop, &start, 0); /* Show compute results */ - OCL_MAP_BUFFER(1); + buf_data[1] = clEnqueueMapBuffer(queue, buf[1], true, CL_MAP_READ | CL_MAP_WRITE, + 0, (global_size) * sizeof(float), 0, NULL, NULL, NULL); for(uint32_t i = 0; i < global_size; i += 8192) printf("\t%.3f", ((float*)buf_data[1])[i]); - OCL_UNMAP_BUFFER(1); + clEnqueueUnmapMemObject(queue, buf[1], buf_data[1], 0, NULL, NULL); return BANDWIDTH(global_size * loop, elapsed); } diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp index 0aab208..2f1ea0b 100644 --- a/utests/utest_helper.cpp +++ b/utests/utest_helper.cpp @@ -218,8 +218,8 @@ cl_do_kiss_path(const char *file, cl_device_id device) if (device == NULL) sub_path = ""; else { - if (clGetGenVersionIntel(device, &ver) != CL_SUCCESS) - clpanic("Unable to get Gen version", -1); + //if (clGetGenVersionIntel(device, &ver) != CL_SUCCESS) + // clpanic("Unable to get Gen version", -1); sub_path = ""; } @@ -244,9 +244,7 @@ cl_kernel_init(const char *file_name, const char *kernel_name, int format, const if (!program || (program && (!prevFileName || strcmp(prevFileName, file_name)))) { if (program) clReleaseProgram(program); ker_path = cl_do_kiss_path(file_name, device); - if (format == LLVM) - program = clCreateProgramWithLLVMIntel(ctx, 1, &device, ker_path, &status); - else if (format == SOURCE) { + if (format == SOURCE) { cl_file_map_t *fm = cl_file_map_new(); FATAL_IF (cl_file_map_open(fm, ker_path) != CL_FILE_MAP_SUCCESS, "Failed to open file \"%s\" with kernel \"%s\". Did you properly set OCL_KERNEL_PATH variable?", @@ -561,8 +559,8 @@ cl_test_destroy(void) { cl_kernel_destroy(); cl_ocl_destroy(); - printf("%i memory leaks\n", clReportUnfreedIntel()); - assert(clReportUnfreedIntel() == 0); + //printf("%i memory leaks\n", clReportUnfreedIntel()); + //assert(clReportUnfreedIntel() == 0); } void @@ -571,7 +569,7 @@ cl_buffer_destroy(void) int i; for (i = 0; i < MAX_BUFFER_N; ++i) { if (buf_data[i] != NULL) { - clUnmapBufferIntel(buf[i]); + clEnqueueUnmapMemObject(queue, buf[i], buf_data[i], 0, NULL, NULL); buf_data[i] = NULL; } if (buf[i] != NULL) { @@ -589,7 +587,7 @@ cl_report_perf_counters(cl_mem perf) uint32_t i; if (perf == NULL) return; - start = (uint32_t*) clMapBufferIntel(perf, &status); + start = (uint32_t*) clEnqueueMapBuffer(queue, perf, true, CL_MAP_READ|CL_MAP_WRITE, 0, 128, 0, NULL, NULL, NULL); assert(status == CL_SUCCESS && start != NULL); end = start + 128; @@ -614,7 +612,7 @@ cl_report_perf_counters(cl_mem perf) } printf("\n\n"); - clUnmapBufferIntel(perf); + clEnqueueUnmapMemObject(queue, perf, start, 0, NULL, NULL); } struct bmphdr { -- 2.5.0 _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/beignet