Skip to content

Implement OpenCL Core 3.0 clCreateBufferWithProperties #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/acl_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions test/acl_mem_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down