[PATCH] D106343: [OpenCL] Support cl_ext_float_atomics

Sven van Haastregt via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 18 06:22:57 PDT 2021


svenvh added inline comments.


================
Comment at: clang/lib/Sema/OpenCLBuiltins.td:1108
+
+let Extension = FuncExtFloatAtomics in {
+  let MinVersion = CL20 in {
----------------
So now all of those builtins are guarded by `cl_ext_float_atomics`, which is good, but not by any of the `__opencl_c_ext_...` macros yet.

To guard by multiple macros, we'd need to do something like:
```
def FuncExtFloatAtomicsFp32GlobalMinMax  : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_global_atomic_min_max">;
def FuncExtFloatAtomicsFp32LocalMinMax   : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_min_max">;
```

And then use `let Extension = FuncExtFloatAtomics...` around the corresponding builtins.  You shouldn't have to change the loop structure much for this, as you can hopefully use `#` concatenation to construct the appropriate FuncExt name (and then `!cast` it to a record).

However, I do see some problematic cases: the generic address space builtins are enabled by one of multiple feature macros, which is something that is currently not supported by the OpenCLBuiltins.td handling.  If it's not too late, could we ask the extension spec editors to provide a dedicated feature macro for generic perhaps?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106343/new/

https://reviews.llvm.org/D106343



More information about the cfe-commits mailing list