From 9ad4899862f95091c95754ed26981c57cb5a52e7 Mon Sep 17 00:00:00 2001 From: niranjanjoshi121 <43807392+niranjanjoshi121@users.noreply.github.com> Date: Thu, 1 Sep 2022 11:28:13 +0530 Subject: [PATCH] Use size_t instead of cl_int (#1414) * Use size_t instead of cl_int Memory is allocated for cl_int, but mapped as size_t. Use size_t instead of cl_int during allocation and mapping for consistency. * Use size_t instead of cl_int Memory is allocated for cl_int, but mapped as size_t. Use size_t instead of cl_int during allocation and mapping for consistency. * Use size_t instead of cl_int Memory is allocated for cl_int, but mapped as size_t. Use size_t instead of cl_int during allocation and mapping for consistency. * Remove test_half changes. Remove test_half changes from other fix that got included in this commit. * Final formatting fix. --- .../SVM/test_shared_address_space_coarse_grain.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test_conformance/SVM/test_shared_address_space_coarse_grain.cpp b/test_conformance/SVM/test_shared_address_space_coarse_grain.cpp index f26981bc..12358167 100644 --- a/test_conformance/SVM/test_shared_address_space_coarse_grain.cpp +++ b/test_conformance/SVM/test_shared_address_space_coarse_grain.cpp @@ -98,7 +98,9 @@ cl_int create_linked_lists_on_device(int ci, cl_command_queue cmdq, cl_mem alloc cl_int error = CL_SUCCESS; log_info("SVM: creating linked list on device: %d ", ci); - size_t *pAllocator = (size_t*) clEnqueueMapBuffer(cmdq, allocator, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, 0, sizeof(cl_int), 0, NULL,NULL, &error); + size_t *pAllocator = (size_t *)clEnqueueMapBuffer( + cmdq, allocator, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, 0, sizeof(size_t), + 0, NULL, NULL, &error); test_error2(error, pAllocator, "clEnqueueMapBuffer failed"); // reset allocator index *pAllocator = numLists; // the first numLists elements of the nodes array are already allocated (they hold the head of each list). @@ -206,7 +208,9 @@ int shared_address_space_coarse_grain(cl_device_id deviceID, cl_context context2 } // this buffer holds an index into the nodes buffer, it is used for node allocation - clMemWrapper allocator = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int), NULL, &error); + clMemWrapper allocator = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(size_t), NULL, &error); + test_error(error, "clCreateBuffer failed."); error = clGetMemObjectInfo(allocator, CL_MEM_USES_SVM_POINTER, sizeof(cl_bool), &usesSVMpointer, 0);