[clang] 8fb0d6d - [OpenCL][Docs] Describe extension for legacy atomics with generic addr space.

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 29 06:07:06 PDT 2021


Author: Anastasia Stulova
Date: 2021-04-29T14:02:34+01:00
New Revision: 8fb0d6df11e4d2b4a534c96fcc1b55459940151e

URL: https://github.com/llvm/llvm-project/commit/8fb0d6df11e4d2b4a534c96fcc1b55459940151e
DIFF: https://github.com/llvm/llvm-project/commit/8fb0d6df11e4d2b4a534c96fcc1b55459940151e.diff

LOG: [OpenCL][Docs] Describe extension for legacy atomics with generic addr space.

This extension is primarily targeting SPIR-V compilations flow
as the IR translation is the same between 1.x and 2.x atomics.

Differential Revision: https://reviews.llvm.org/D101089

Added: 
    

Modified: 
    clang/docs/LanguageExtensions.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 00759113775d4..5e5382879e0c8 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1813,6 +1813,23 @@ supporting the variadic arguments e.g. majority of CPU targets.
   #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 the OpenCL 1.x standards
+with the generic address space pointer in C++ for OpenCL mode.
+
+This is a non-portable feature and might not be supported by all
+targets.
+
+**Example of Use**:
+
+.. code-block:: c++
+
+  void foo(__generic volatile unsigned int* a) {
+    atomic_add(a, 1);
+  }
+
 Builtin Functions
 =================
 


        


More information about the cfe-commits mailing list