diff --git a/clang/docs/OpenCLSupport.rst b/clang/docs/OpenCLSupport.rst index 7ac5707a9901de..c1202601d48d30 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 `. Clang also supports :ref:`the C++ for OpenCL kernel language `. -There is an ongoing work to support :ref:`OpenCL 3.0 `. - -There are also other :ref:`new and experimental features ` available. +There are also other :ref:`new and experimental features ` +available. -For general issues and bugs with OpenCL in clang refer to `Bugzilla -`__. +For general issues and bugs with OpenCL in clang refer to `the GitHub issue +list +`__. 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= test.cl + $ clang -target spir-unknown-unknown -c -emit-llvm -Xclang -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path= 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 -`_. +`_. Limited support of experimental C++ libraries is described in the :ref:`experimental features `. -Bugzilla bugs for this functionality are typically prefixed +GitHub issues for this functionality are typically prefixed with '[C++4OpenCL]' - click `here -`__ +`__ 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 ` for details of common missing + functionality from OpenCL 3.0. + +- IR generation for non-trivial global destructors is incomplete (See: `PR48047 `_). +- Support of `destrutors with non-default address spaces + `_ + is incomplete (See: `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 -`_ or via `Bugzilla -`__. +`_ or file `a GitHub issue +`_. .. _opencl_experimental_cxxlibs: diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst index 1173fd337841cc..d83b7a27bb3bd1 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 ` - :ref:`Objective C++ Language ` -- :ref:`OpenCL Kernel Language `: OpenCL C v1.0, v1.1, v1.2, v2.0, - plus C++ for OpenCL. +- :ref:`OpenCL Kernel Language `: 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++ `_ 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 `_ or in `the official release -`_. +`_. 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 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 `_