[clang] 30ad174 - [Docs] Document C++ for OpenCL 2021 support in clang.
Anastasia Stulova via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 4 03:19:06 PST 2022
Author: Anastasia Stulova
Date: 2022-01-04T11:18:15Z
New Revision: 30ad1742c08315498e5627fc4b01194564494cb3
URL: https://github.com/llvm/llvm-project/commit/30ad1742c08315498e5627fc4b01194564494cb3
DIFF: https://github.com/llvm/llvm-project/commit/30ad1742c08315498e5627fc4b01194564494cb3.diff
LOG: [Docs] Document C++ for OpenCL 2021 support in clang.
Along with the new language mode this commit contains misc
small updates for OpenCL 3 and GitHub issues for OpenCL.
Differential Revision: https://reviews.llvm.org/D116271
Added:
Modified:
clang/docs/OpenCLSupport.rst
clang/docs/UsersManual.rst
Removed:
################################################################################
diff --git a/clang/docs/OpenCLSupport.rst b/clang/docs/OpenCLSupport.rst
index 7ac5707a9901d..c1202601d48d3 100644
--- a/clang/docs/OpenCLSupport.rst
+++ b/clang/docs/OpenCLSupport.rst
@@ -18,15 +18,16 @@ OpenCL Support
==================
Clang has complete support of OpenCL C versions from 1.0 to 2.0.
+There is an ongoing work to support :ref:`OpenCL 3.0 <opencl_300>`.
Clang also supports :ref:`the C++ for OpenCL kernel language <cxx_for_opencl_impl>`.
-There is an ongoing work to support :ref:`OpenCL 3.0 <opencl_300>`.
-
-There are also other :ref:`new and experimental features <opencl_experimenal>` available.
+There are also other :ref:`new and experimental features <opencl_experimenal>`
+available.
-For general issues and bugs with OpenCL in clang refer to `Bugzilla
-<https://bugs.llvm.org/buglist.cgi?component=OpenCL&list_id=172679&product=clang&resolution=--->`__.
+For general issues and bugs with OpenCL in clang refer to `the GitHub issue
+list
+<https://github.com/llvm/llvm-project/issues?q=is%3Aopen+is%3Aissue+label%3Aopencl>`__.
Internals Manual
================
@@ -127,7 +128,7 @@ To enable modules for OpenCL:
.. code-block:: console
- $ clang -target spir-unknown-unknown -c -emit-llvm -Xclang -finclude-default-header -fmodules -fimplicit-module-maps -fm odules-cache-path=<path to the generated module> test.cl
+ $ clang -target spir-unknown-unknown -c -emit-llvm -Xclang -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=<path to the generated module> test.cl
Another way to circumvent long parsing latency for the OpenCL builtin
declarations is to use mechanism enabled by :ref:`-fdeclare-opencl-builtins
@@ -319,24 +320,32 @@ specified in the Clang's source code.
C++ for OpenCL Implementation Status
====================================
-Clang implements language version 1.0 published in `the official
+Clang implements language versions 1.0 and 2021 published in `the official
release of C++ for OpenCL Documentation
-<https://github.com/KhronosGroup/OpenCL-Docs/releases/tag/cxxforopencl-v1.0-r2>`_.
+<https://github.com/KhronosGroup/OpenCL-Docs/releases/tag/cxxforopencl-docrev2021.12>`_.
Limited support of experimental C++ libraries is described in the :ref:`experimental features <opencl_experimenal>`.
-Bugzilla bugs for this functionality are typically prefixed
+GitHub issues for this functionality are typically prefixed
with '[C++4OpenCL]' - click `here
-<https://bugs.llvm.org/buglist.cgi?component=OpenCL&list_id=204139&product=clang&query_format=advanced&resolution=---&short_desc=%5BC%2B%2B4OpenCL%5D&short_desc_type=allwordssubstr>`__
+<https://github.com/llvm/llvm-project/issues?q=is%3Aissue+is%3Aopen+%5BC%2B%2B4OpenCL%5D>`__
to view the full bug list.
Missing features or with limited support
----------------------------------------
-- IR generation for global destructors is incomplete (See:
+- Support of C++ for OpenCL 2021 is currently in experimental phase. Refer to
+ :ref:`OpenCL 3.0 status <opencl_300>` for details of common missing
+ functionality from OpenCL 3.0.
+
+- IR generation for non-trivial global destructors is incomplete (See:
`PR48047 <https://llvm.org/PR48047>`_).
+- Support of `destrutors with non-default address spaces
+ <https://www.khronos.org/opencl/assets/CXX_for_OpenCL.html#_construction_initialization_and_destruction>`_
+ is incomplete (See: `D109609 <https://reviews.llvm.org/D109609>`_).
+
.. _opencl_300:
OpenCL C 3.0 Usage
@@ -408,8 +417,8 @@ Experimental features
Clang provides the following new WIP features for the developers to experiment
and provide early feedback or contribute with further improvements.
Feel free to contact us on `cfe-dev
-<https://lists.llvm.org/mailman/listinfo/cfe-dev>`_ or via `Bugzilla
-<https://bugs.llvm.org/>`__.
+<https://lists.llvm.org/mailman/listinfo/cfe-dev>`_ or file `a GitHub issue
+<https://github.com/llvm/llvm-project/issues/new>`_.
.. _opencl_experimental_cxxlibs:
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 1173fd337841c..d83b7a27bb3bd 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -41,8 +41,8 @@ specific section:
variants depending on base language.
- :ref:`C++ Language <cxx>`
- :ref:`Objective C++ Language <objcxx>`
-- :ref:`OpenCL Kernel Language <opencl>`: OpenCL C v1.0, v1.1, v1.2, v2.0,
- plus C++ for OpenCL.
+- :ref:`OpenCL Kernel Language <opencl>`: OpenCL C 1.0, 1.1, 1.2, 2.0, 3.0,
+ and C++ for OpenCL 1.0 and 2021.
In addition to these base languages and their dialects, Clang supports a
broad variety of language extensions, which are documented in the
@@ -3321,20 +3321,25 @@ implementation of `OpenCL C++
<https://www.khronos.org/registry/OpenCL/specs/2.2/pdf/OpenCL_Cxx.pdf>`_ and
there is no plan to support it in clang in any new releases in the near future.
-
-Clang currently supports C++ for OpenCL v1.0.
+Clang currently supports C++ for OpenCL 1.0 and 2021.
For detailed information about this language refer to the C++ for OpenCL
Programming Language Documentation available
in `the latest build
<https://www.khronos.org/opencl/assets/CXX_for_OpenCL.html>`_
or in `the official release
-<https://github.com/KhronosGroup/OpenCL-Docs/releases/tag/cxxforopencl-v1.0-r2>`_.
+<https://github.com/KhronosGroup/OpenCL-Docs/releases/tag/cxxforopencl-docrev2021.12>`_.
To enable the C++ for OpenCL mode, pass one of following command line options when
-compiling ``.cl`` file ``-cl-std=clc++``, ``-cl-std=CLC++``, ``-cl-std=clc++1.0``,
-``-cl-std=CLC++1.0``, ``-std=clc++``, ``-std=CLC++``, ``-std=clc++1.0`` or
-``-std=CLC++1.0``.
+compiling ``.clcpp`` file:
+
+- C++ for OpenCL 1.0: ``-cl-std=clc++``, ``-cl-std=CLC++``, ``-cl-std=clc++1.0``,
+ ``-cl-std=CLC++1.0``, ``-std=clc++``, ``-std=CLC++``, ``-std=clc++1.0`` or
+ ``-std=CLC++1.0``.
+
+- C++ for OpenCL 2021: ``-cl-std=clc++2021``, ``-cl-std=CLC++2021``,
+ ``-std=clc++2021``, ``-std=CLC++2021``.
+Example of use:
.. code-block:: c++
template<class T> T add( T x, T y )
@@ -3351,15 +3356,27 @@ compiling ``.cl`` file ``-cl-std=clc++``, ``-cl-std=CLC++``, ``-cl-std=clc++1.0`
.. code-block:: console
- clang -cl-std=clc++ test.cl
+ clang -cl-std=clc++1.0 test.clcpp
+
-Alternatively, files with ``.clcpp`` extension are compiled with the C++ for OpenCL
-mode.
+By default, files with ``.clcpp`` extension are compiled with the C++ for
+OpenCL 1.0 mode.
.. code-block:: console
clang test.clcpp
+For backward compatibility files with ``.cl`` extensions can also be compiled
+in C++ for OpenCL mode but the desirable language mode must be activated with
+a flag.
+
+ .. code-block:: console
+
+ clang -cl-std=clc++ test.cl
+
+Support of C++ for OpenCL 2021 is currently in experimental phase, refer to
+:doc:`OpenCLSupport` for more details.
+
C++ for OpenCL kernel sources can also be compiled online in drivers supporting
`cl_ext_cxx_for_opencl
<https://www.khronos.org/registry/OpenCL/extensions/ext/cl_ext_cxx_for_opencl.html>`_
More information about the cfe-commits
mailing list