[PATCH] D101089: [OpenCL] Document legacy atomics with generic address space

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 22 10:33:45 PDT 2021


Anastasia created this revision.
Anastasia added a reviewer: svenvh.
Herald added subscribers: ebevhan, jfb, yaxunl.
Anastasia requested review of this revision.

There were multiple requests from the developers to allow this functionality in OpenCL 
https://github.com/KhronosGroup/OpenCL-Docs/issues/66

and this can be supported already in some tool flows i.e. using SPIRV-LLVM Translator. 
However, there hasn't been enough progress on the core spec side.

Therefore, I suggest documenting this as a clang extension for now.


https://reviews.llvm.org/D101089

Files:
  clang/docs/LanguageExtensions.rst


Index: clang/docs/LanguageExtensions.rst
===================================================================
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -1813,6 +1813,20 @@
   #pragma OPENCL EXTENSION __cl_clang_variadic_functions : disable
   void bar(int a, ...); // error - variadic prototype is not allowed
 
+Legacy 1.x atomics with generic address space
+---------------------------------------------
+
+Clang allows use of atomic functions from earlier than OpenCL 2.0
+standard with generic address space pointer in C++ for OpenCL mode. 
+
+**Example of Use**:
+
+.. code-block:: c++
+
+  void foo(__generic volatile unsigned int* a) {
+    atomic_add(a, 1);
+  }
+
 Builtin Functions
 =================
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101089.339711.patch
Type: text/x-patch
Size: 749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210422/4c8578c4/attachment.bin>


More information about the cfe-commits mailing list