[clang] [NVPTX] Support the OpenCL generic addrspace feature by default (PR #137940)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 16:07:22 PDT 2025


================
@@ -170,6 +170,8 @@ class LLVM_LIBRARY_VISIBILITY NVPTXTargetInfo : public TargetInfo {
     Opts["cl_khr_global_int32_extended_atomics"] = true;
     Opts["cl_khr_local_int32_base_atomics"] = true;
     Opts["cl_khr_local_int32_extended_atomics"] = true;
+
+    Opts["__opencl_c_generic_address_space"] = true;
----------------
Artem-B wrote:

Does it have to be added here?

If I read Clang docs correctly it's supposed to be added in clang/lib/Headers/opencl-c-base.h
https://github.com/llvm/llvm-project/blob/050e49a93a41909e1f80d6e1d66917f53e4ba016/clang/docs/OpenCLSupport.rst?plain=1#L251-L257

E.g. SPIR-V defines it there: https://github.com/llvm/llvm-project/blob/c5191905a8b0ec0e10a8f72138571871ab1e99e9/clang/lib/Headers/opencl-c-base.h#L62


https://github.com/llvm/llvm-project/pull/137940


More information about the cfe-commits mailing list