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

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Tue May 20 02:47:58 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;
----------------
frasercrmck wrote:

I think that approach makes sense for mandatory features. The generic address space is indeed mandatory in OpenCL 2.0 but not in OpenCL 3.0 (see the preprocessor guard around that line). For optional cases we want target-specific logic.

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


More information about the cfe-commits mailing list