llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.33k stars 12.13k forks source link

[Clang] Using address spaces in C/C++ assumes unspecified addresses are private instead of generic #112233

Open jhuber6 opened 1 month ago

jhuber6 commented 1 month ago

The OpenCL 2.0 rules allow us to implicitly convert specific address spaces into generic address spaces. This is also how languages like CUDA or OpenMP work. Using C/C++ for targeting the GPU should also allow this, but it is currently unnecessarily restrictive. See the example in https://godbolt.org/z/oa5Tob8v6.

jhuber6 commented 1 month ago

@AnastasiaStulova I would greatly appreciate some pointers on where to start looking to enable this for the C/C++ languages. We want this behavior when using the attributes directly in the C++ based languages. I tried hard-coding the OpenCL version to 2.0 but couldn't find exactly where this check lives.