[PATCH] D29829: [OpenCL][Doc] Description for adding OpenCL vendor extension in user manual

2017-02-16 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia closed this revision.
Anastasia added a comment.

Committed in 295313!


https://reviews.llvm.org/D29829



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29829: [OpenCL][Doc] Description for adding OpenCL vendor extension in user manual

2017-02-10 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.

Adding a description of a new feature that allows to specify vendor extension 
in flexible way using compiler pragma instead of modifying source code directly.

Feature committed in Clang@r289979.


https://reviews.llvm.org/D29829

Files:
  docs/UsersManual.rst


Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -2056,6 +2056,8 @@
 In this case the kernel code should contain ``#include `` just as a
 regular C include.
 
+.. _opencl_cl_ext:
+
 .. option:: -cl-ext
 
 Disables support of OpenCL extensions. All OpenCL targets provide a list
@@ -2177,6 +2179,41 @@
 
  $ clang -target spir-unknown-unknown -c -emit-llvm -Xclang 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path= test.cl
 
+OpenCL Extensions
+-
+
+All of the ``cl_khr_*`` extensions from `the official OpenCL specification
+`_
+up to and including version 2.0 are available and set per target depending on 
the
+support available in the specific architecture.
+
+It is possible to alter the default extensions setting per target using
+``-cl-ext`` flag. (See :ref:`flags description ` for more 
details).
+
+Vendor extensions can be added flexibly by declaring the list of types and
+functions associated with each extensions enclosed within the following
+compiler pragma directives:
+
+  .. code-block:: c
+
+   #pragma OPENCL EXTENSION the_new_extension_name : begin
+   // declare types and functions associated with the extension here
+   #pragma OPENCL EXTENSION the_new_extension_name : end
+
+For example, parsing the following code adds ``my_t`` type and ``my_func``
+function to the custom ``my_ext`` extension.
+
+  .. code-block:: c
+
+   #pragma OPENCL EXTENSION my_ext : begin
+   typedef struct{
+ int a;
+   }my_t;
+   void my_func(my_t);
+   #pragma OPENCL EXTENSION my_ext : end
+
+Declaring the same types in different vendor extensions is disallowed.
+
 OpenCL Metadata
 ---
 
@@ -2215,7 +2252,7 @@
 `_
 
 
-opencl_hint_unroll
+opencl_unroll_hint
 ^^
 
 The implementation of this feature mirrors the unroll hint for C.


Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -2056,6 +2056,8 @@
 In this case the kernel code should contain ``#include `` just as a
 regular C include.
 
+.. _opencl_cl_ext:
+
 .. option:: -cl-ext
 
 Disables support of OpenCL extensions. All OpenCL targets provide a list
@@ -2177,6 +2179,41 @@
 
  $ clang -target spir-unknown-unknown -c -emit-llvm -Xclang -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path= test.cl
 
+OpenCL Extensions
+-
+
+All of the ``cl_khr_*`` extensions from `the official OpenCL specification
+`_
+up to and including version 2.0 are available and set per target depending on the
+support available in the specific architecture.
+
+It is possible to alter the default extensions setting per target using
+``-cl-ext`` flag. (See :ref:`flags description ` for more details).
+
+Vendor extensions can be added flexibly by declaring the list of types and
+functions associated with each extensions enclosed within the following
+compiler pragma directives:
+
+  .. code-block:: c
+
+   #pragma OPENCL EXTENSION the_new_extension_name : begin
+   // declare types and functions associated with the extension here
+   #pragma OPENCL EXTENSION the_new_extension_name : end
+
+For example, parsing the following code adds ``my_t`` type and ``my_func``
+function to the custom ``my_ext`` extension.
+
+  .. code-block:: c
+
+   #pragma OPENCL EXTENSION my_ext : begin
+   typedef struct{
+ int a;
+   }my_t;
+   void my_func(my_t);
+   #pragma OPENCL EXTENSION my_ext : end
+
+Declaring the same types in different vendor extensions is disallowed.
+
 OpenCL Metadata
 ---
 
@@ -2215,7 +2252,7 @@
 `_
 
 
-opencl_hint_unroll
+opencl_unroll_hint
 ^^
 
 The implementation of this feature mirrors the unroll hint for C.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits