[clang] [clang][SYCL] Implement address space attributes for SYCL (PR #200849)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 08:11:37 PDT 2026


================
@@ -70,43 +70,89 @@ bool Qualifiers::isStrictSupersetOf(Qualifiers Other) const {
           (hasObjCLifetime() && !Other.hasObjCLifetime()));
 }
 
+// When targeting the OpenCL execution environment, corresponding SYCL and
+// OpenCL address spaces designate the same underlying address space and are
+// mutually convertible.
+static bool isConvertibleOpenCLSYCLAddressSpace(LangAS A, LangAS B) {
+  return (A == LangAS::sycl_global && B == LangAS::opencl_global) ||
+         (A == LangAS::opencl_global && B == LangAS::sycl_global) ||
+         (A == LangAS::sycl_global_device &&
+          B == LangAS::opencl_global_device) ||
+         (A == LangAS::opencl_global_device &&
+          B == LangAS::sycl_global_device) ||
+         (A == LangAS::sycl_global_host && B == LangAS::opencl_global_host) ||
+         (A == LangAS::opencl_global_host && B == LangAS::sycl_global_host) ||
+         (A == LangAS::sycl_local && B == LangAS::opencl_local) ||
+         (A == LangAS::opencl_local && B == LangAS::sycl_local) ||
+         (A == LangAS::sycl_private && B == LangAS::opencl_private) ||
+         (A == LangAS::opencl_private && B == LangAS::sycl_private) ||
+         (A == LangAS::sycl_generic && B == LangAS::opencl_generic) ||
+         (A == LangAS::opencl_generic && B == LangAS::sycl_generic) ||
+         (A == LangAS::sycl_constant && B == LangAS::opencl_constant) ||
+         (A == LangAS::opencl_constant && B == LangAS::sycl_constant);
----------------
elizabethandrews wrote:

Oh so much better. Thanks!

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


More information about the cfe-commits mailing list