================
@@ -23,4 +23,20 @@
 #define _CLC_DEF __attribute__((always_inline))
 #endif
 
+#if __OPENCL_C_VERSION__ == CL_VERSION_2_0 ||                                  
\
+    (__OPENCL_C_VERSION__ >= CL_VERSION_3_0 &&                                 
\
+     defined(__opencl_c_generic_address_space))
+#define _CLC_GENERIC_AS_SUPPORTED 1
+// Note that we hard-code the assumption that a non-distinct address space 
means
+// that the target maps the generic address space to the private address space.
+#ifdef __CLC_DISTINCT_GENERIC_ADDRSPACE__
+#define _CLC_DISTINCT_GENERIC_AS_SUPPORTED 1
+#else
+#define _CLC_DISTINCT_GENERIC_AS_SUPPORTED 0
+#endif
+#else
----------------
frasercrmck wrote:

> These macro names are too general for the implementation. I don't think this 
> works for anything other than the 0-is-private-and-generic case.

Yes the assumption is very much currently that it's either fully distinct or 
0-is-both. I didn't know how much effort to put into making it fully flexible 
given our list of targets is fairly static.

I'd be open to making it more flexible. I don't think there's anything 
technically stopping a target having two or more of `constant`, `local` and 
`global` mangle to the same target address space, for example. Do we want 
something in libclc that can take care of all possibilities, or just the 
`generic` space with another?

> What if you defined a qualifier macro with the value, and check if they are 
> equal

Could you expand on this, sorry?

https://github.com/llvm/llvm-project/pull/137183
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to