yaxunl added a comment.

In https://reviews.llvm.org/D47154#1108813, @tra wrote:

> CUDA does not expose explicit AS on clang size. All pointers are treated as 
> generic and we infer specific address space only in LLVM.
>  `__nvvm_atom_*_[sg]_*` builtins should probably be removed as they are 
> indeed useless without pointers with explicit AS and NVCC itself does not 
> have such builtins either.  Instead, we should convert the generic AS builtin 
> to address-space specific instruction somewhere in LLVM.
>
> Using `attribute((address_space())` should probably produce an error during 
> CUDA compilation.


Sometimes we need to call functions defined in our device library which is 
written in OpenCL. Some function have pointer arguments in non-zero address 
space. To declare these functions in CUDA/HIP we need to use 
`__attribute__((address_space()))`. We use C-style cast to cast pointers in 
CUDA/HIP to a non-zero address space and pass them to the functions. I think 
`__attribute__((address_space()))` is still needed for this situation.


https://reviews.llvm.org/D47154



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to