[cfe-dev] atom_add with int* and uint arguments

Tom Stellard via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 7 07:02:01 PDT 2016


On Wed, Sep 07, 2016 at 01:53:49PM +0000, Liu, Yaxun (Sam) via cfe-dev wrote:
> Hi Anastasia/Alexey/Xiuli,
> 
> When we compile some OpenCL conformance test for atom_add with clang trunk we got overloading resolution issue:
> 
> __kernel void test_atomic_fn(volatile __global uint *destMemory, __global uint *oldValues)
> {
>     int  tid = get_global_id(0);
> 
> oldValues[tid] = atom_add( &destMemory[0], tid + 3 );
> atom_add( &destMemory[0], tid + 3 );
>    atom_add( &destMemory[0], tid + 3 );
>    atom_add( &destMemory[0], tid + 3 );
> 
> }
> 
> /tmp/AMD_17652_49/t_17652_51.cl:6:19: error: call to 'atom_add' is ambiguous
>         oldValues[tid] = atom_add( &destMemory[0], tid + 3 );
>                          ^~~~~~~~
> /srv/opencl_rocm/drivers/opencl/library/amdgcn/headers/build/lnx64a/B_dbg/<stdin>:14336:12: note: candidate function
> int __ovld atom_add(volatile __global int *p, int val);
>            ^
> /srv/opencl_rocm/drivers/opencl/library/amdgcn/headers/build/lnx64a/B_dbg/<stdin>:14337:21: note: candidate function
> unsigned int __ovld atom_add(volatile __global unsigned int *p, unsigned int val);
>                     ^
> /srv/opencl_rocm/drivers/opencl/library/amdgcn/headers/build/lnx64a/B_dbg/<stdin>:14345:13: note: candidate function
> long __ovld atom_add(volatile __global long *p, long val);
>             ^
> /srv/opencl_rocm/drivers/opencl/library/amdgcn/headers/build/lnx64a/B_dbg/<stdin>:14346:22: note: candidate function
> unsigned long __ovld atom_add(volatile __global unsigned long *p, unsigned long val);
>                      ^
> /srv/opencl_rocm/drivers/opencl/library/amdgcn/headers/build/lnx64a/B_dbg/<stdin>:14347:13: note: candidate function
> long __ovld atom_add(volatile __local long *p, long val);
>             ^
> /srv/opencl_rocm/drivers/opencl/library/amdgcn/headers/build/lnx64a/B_dbg/<stdin>:14348:22: note: candidate function
> unsigned long __ovld atom_add(volatile __local unsigned long *p, unsigned long val);
>                      ^
> /tmp/AMD_17652_49/t_17652_51.cl:7:2: error: call to 'atom_add' is ambiguous
>         atom_add( &destMemory[0], tid + 3 );
>         ^~~~~~~~
> 
> The reason is that the call expects atom_add(volatile global uint*, int) but cannot find a better one from existing declarations.
> 
> I suggest to add the missing declarations for mixed-signedness arguments to opencl-c.h. What's your opioin?
> 

Hi,

This was a regression caused by: https://reviews.llvm.org/D24113.  I'm
not sure if this was intended or not.

-Tom

> Thanks.
> 
> Sam


> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list