From 72bf40f2aa3d361f53c6002ca88a038e228a64ab Mon Sep 17 00:00:00 2001 From: Sherry Yuan Date: Fri, 7 Jan 2022 17:23:38 -0500 Subject: [PATCH] Implement OpenCL Core 3.0 clCreateBufferWithProperties ------------------------------------------------------------- In the most recently imported headers, there is a new function called clCreateBufferWithProperties which is equivalent to our clCreateBufferWithPropertiesINTEL extension function. Implement this function. Closes #51 --- CMakeLists.txt | 2 +- src/acl_mem.cpp | 9 +++++++++ test/CMakeLists.txt | 2 +- test/acl_mem_test.cpp | 5 ++--- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 458da2d7..4dad9824 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,7 +211,7 @@ target_compile_definitions(acl_objs PUBLIC CL_USE_DEPRECATED_OPENCL_1_0_APIS=1 CL_USE_DEPRECATED_OPENCL_1_1_APIS=1 CL_USE_DEPRECATED_OPENCL_1_2_APIS=1 - CL_TARGET_OPENCL_VERSION=200 + CL_TARGET_OPENCL_VERSION=300 ) target_include_directories(acl_objs PUBLIC include) target_include_directories(acl_objs PRIVATE diff --git a/src/acl_mem.cpp b/src/acl_mem.cpp index 01d511af..ce3697d6 100644 --- a/src/acl_mem.cpp +++ b/src/acl_mem.cpp @@ -965,6 +965,15 @@ CL_API_ENTRY cl_mem CL_API_CALL clCreateBufferIntelFPGA(cl_context context, errcode_ret); } +// Create a buffer with additional properties +ACL_EXPORT +CL_API_ENTRY cl_mem CL_API_CALL clCreateBufferWithProperties( + cl_context context, const cl_mem_properties *properties, cl_mem_flags flags, + size_t size, void *host_ptr, cl_int *errcode_ret) { + return clCreateBufferWithPropertiesINTEL(context, properties, flags, size, + host_ptr, errcode_ret); +} + ACL_EXPORT CL_API_ENTRY cl_mem CL_API_CALL clCreateBuffer(cl_context context, cl_mem_flags flags, size_t size, diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d780bea9..733d73f5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -35,7 +35,7 @@ target_compile_definitions(acl_test PRIVATE CL_USE_DEPRECATED_OPENCL_1_0_APIS=1 CL_USE_DEPRECATED_OPENCL_1_1_APIS=1 CL_USE_DEPRECATED_OPENCL_1_2_APIS=1 - CL_TARGET_OPENCL_VERSION=200 + CL_TARGET_OPENCL_VERSION=300 ) target_include_directories(acl_test PRIVATE "${CMAKE_BINARY_DIR}/include" diff --git a/test/acl_mem_test.cpp b/test/acl_mem_test.cpp index 0e650576..497e2d4c 100644 --- a/test/acl_mem_test.cpp +++ b/test/acl_mem_test.cpp @@ -1381,7 +1381,7 @@ TEST(acl_mem, exhaustion) { (mem[0]->block_allocation->range).begin); props[1] = 2; - mem[3] = clCreateBufferWithPropertiesINTEL( + mem[3] = clCreateBufferWithProperties( m_context, props, 0, (size_t)m_context->max_mem_alloc_size / 4, 0, &status); sofar2 += m_context->max_mem_alloc_size / 4; @@ -1394,8 +1394,7 @@ TEST(acl_mem, exhaustion) { props[1] = 2; // the size of dimm#2 is m_context->max_mem_alloc_size/2 // mem[1] and mem[3] already exhausted dimm#2 - mem[4] = - clCreateBufferWithPropertiesINTEL(m_context, props, 0, 128, 0, &status); + mem[4] = clCreateBufferWithProperties(m_context, props, 0, 128, 0, &status); CHECK_EQUAL( CL_SUCCESS, status); // Buffer allocation should always succeed (allocation deferred)