Skip to content

Commit 2174715

Browse files
authored
Fix incompatiable pointer type warning for device_execution test (#2558)
There are multiple incompatiable pointer types warnings when compiling the device_execution test with clang. There was an upstream llvm patch that will turn these warnings into an error llvm/llvm-project#157364. To not encounter this issue in the future, fix these warnings by changing the parameter types. ``` warning: incompatible pointer types passing '__global ulong (*)[512]' (aka '__global unsigned long (*)[512]') to parameter of type 'const __generic ulong *' (aka 'const __generic unsigned long *') [-Wincompatible-pointer-types] 37 | void (^checkBlock) (void) = ^{ check_res(tid, &value, res); }; | ^~~~~~ note: passing argument to parameter 'value' here -- warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types] 10 | void (^kernelBlock)(void) = ^{ block_fn(len, val); }; | ^~~ note: passing argument to parameter 'val' here -- warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types] 10 | void (^kernelBlock)(void) = ^{ block_fn(len, val); }; | ^~~ note: passing argument to parameter 'val' here -- warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types] 10 | void (^kernelBlock)(void) = ^{ block_fn(len, val); }; | ^~~ note: passing argument to parameter 'val' here -- warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types] 10 | void (^kernelBlock)(void) = ^{ block_fn(len, val); }; | ^~~ note: passing argument to parameter 'val' here -- warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types] 10 | void (^kernelBlock)(void) = ^{ block_fn(len, val); }; | ^~~ note: passing argument to parameter 'val' here -- warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types] 10 | void (^kernelBlock)(void) = ^{ block_fn(len, val); }; | ^~~ note: passing argument to parameter 'val' here ```
1 parent 5b2c1ac commit 2174715

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

test_conformance/device_execution/enqueue_block.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static const char* enqueue_block_capture_event_profiling_info_before_execution[]
340340
341341
set_user_event_status(user_evt, CL_COMPLETE);
342342
343-
void (^checkBlock) (void) = ^{ check_res(tid, &value, res); };
343+
void (^checkBlock) (void) = ^{ check_res(tid, value, res); };
344344
345345
enq_res = enqueue_kernel(def_q, CLK_ENQUEUE_FLAGS_NO_WAIT, ndrange, 1, &block_evt1, &block_evt2, checkBlock);
346346
if (enq_res != CLK_SUCCESS) { res[tid] = -3; return; }

test_conformance/device_execution/enqueue_ndrange.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ static const char *helper_ndrange_2d_glo[] = {
129129
"}" NL,
130130
"" NL,
131131
"kernel void helper_ndrange_2d_glo(__global int* res, uint n, uint len, "
132-
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global int* "
133-
"val, __global uint* ofs_arr)" NL,
132+
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global "
133+
"atomic_uint* val, __global uint* ofs_arr)" NL,
134134
"{" NL,
135135
" size_t tid = get_global_id(0);" NL,
136136
" void (^kernelBlock)(void) = ^{ block_fn(len, val); };" NL,
@@ -156,8 +156,8 @@ static const char *helper_ndrange_2d_loc[] = {
156156
"}" NL,
157157
"" NL,
158158
"kernel void helper_ndrange_2d_loc(__global int* res, uint n, uint len, "
159-
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global int* "
160-
"val, __global uint* ofs_arr)" NL,
159+
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global "
160+
"atomic_uint* val, __global uint* ofs_arr)" NL,
161161
"{" NL,
162162
" size_t tid = get_global_id(0);" NL,
163163
" void (^kernelBlock)(void) = ^{ block_fn(len, val); };" NL,
@@ -193,8 +193,8 @@ static const char *helper_ndrange_2d_ofs[] = {
193193
"}" NL,
194194
"" NL,
195195
"kernel void helper_ndrange_2d_ofs(__global int* res, uint n, uint len, "
196-
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global int* "
197-
"val, __global uint* ofs_arr)" NL,
196+
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global "
197+
"atomic_uint* val, __global uint* ofs_arr)" NL,
198198
"{" NL,
199199
" size_t tid = get_global_id(0);" NL,
200200
" void (^kernelBlock)(void) = ^{ block_fn(len, val); };" NL,
@@ -233,8 +233,8 @@ static const char *helper_ndrange_3d_glo[] = {
233233
"}" NL,
234234
"" NL,
235235
"kernel void helper_ndrange_3d_glo(__global int* res, uint n, uint len, "
236-
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global int* "
237-
"val, __global uint* ofs_arr)" NL,
236+
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global "
237+
"atomic_uint* val, __global uint* ofs_arr)" NL,
238238
"{" NL,
239239
" size_t tid = get_global_id(0);" NL,
240240
" void (^kernelBlock)(void) = ^{ block_fn(len, val); };" NL,
@@ -266,8 +266,8 @@ static const char *helper_ndrange_3d_loc[] = {
266266
"}" NL,
267267
"" NL,
268268
"kernel void helper_ndrange_3d_loc(__global int* res, uint n, uint len, "
269-
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global int* "
270-
"val, __global uint* ofs_arr)" NL,
269+
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global "
270+
"atomic_uint* val, __global uint* ofs_arr)" NL,
271271
"{" NL,
272272
" size_t tid = get_global_id(0);" NL,
273273
" void (^kernelBlock)(void) = ^{ block_fn(len, val); };" NL,
@@ -306,8 +306,8 @@ static const char *helper_ndrange_3d_ofs[] = {
306306
"}" NL,
307307
"" NL,
308308
"kernel void helper_ndrange_3d_ofs(__global int* res, uint n, uint len, "
309-
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global int* "
310-
"val, __global uint* ofs_arr)" NL,
309+
"__global uint* glob_size_arr, __global uint* loc_size_arr, __global "
310+
"atomic_uint* val, __global uint* ofs_arr)" NL,
311311
"{" NL,
312312
" size_t tid = get_global_id(0);" NL,
313313
" void (^kernelBlock)(void) = ^{ block_fn(len, val); };" NL,

0 commit comments

Comments
 (0)