Skip to content

Fix build failure with macro MEM_DEBUG_MSG #106

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 3 commits into from
Apr 21, 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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ target_compile_definitions(acl_objs PUBLIC
CL_USE_DEPRECATED_OPENCL_1_1_APIS=1
CL_USE_DEPRECATED_OPENCL_1_2_APIS=1
CL_TARGET_OPENCL_VERSION=300
$<$<CONFIG:Debug>:MEM_DEBUG_MSG>
)
target_include_directories(acl_objs PUBLIC include)
target_include_directories(acl_objs PRIVATE
Expand Down
5 changes: 3 additions & 2 deletions src/acl_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2848,7 +2848,9 @@ l_copy_and_adjust_arguments_for_device(cl_kernel kernel, cl_device_id device,
#ifdef MEM_DEBUG_MSG
printf("regular buffer ");
#endif
unsigned needed_mem_id = l_get_kernel_arg_mem_id(kernel, iarg);
const unsigned int needed_mem_id =
l_get_kernel_arg_mem_id(kernel, iarg);
const unsigned int needed_physical_id = device->def.physical_device_id;

// Always enqueue a migration, even if the memory is where it should be there
// could be something in the queue ahead of us which will move the memory.
Expand All @@ -2858,7 +2860,6 @@ l_copy_and_adjust_arguments_for_device(cl_kernel kernel, cl_device_id device,
#endif

// first, is there a reserved region?
unsigned needed_physical_id = device->def.physical_device_id;
if (mem_obj->reserved_allocations_count[needed_physical_id].size() ==
0) {
acl_resize_reserved_allocations_for_device(mem_obj, device->def);
Expand Down
11 changes: 6 additions & 5 deletions src/acl_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4467,14 +4467,15 @@ cl_int acl_reserve_buffer_block(cl_mem mem, acl_mem_region_t *region,
result = copy_image_metadata(mem);
}

if (result) {
mem->reserved_allocations[physical_device_id][target_mem_id] =
block_allocation;
block_allocation->mem_obj = mem;
} else {
if (!result) {
acl_delete(block_allocation);
return result;
}

mem->reserved_allocations[physical_device_id][target_mem_id] =
block_allocation;
block_allocation->mem_obj = mem;

#ifdef MEM_DEBUG_MSG
printf("acl_reserve_buffer_block finished block_allocation:%zx, range:%zx - "
"%zx \n",
Expand Down