@@ -2914,6 +2914,10 @@ Examples:
2914
2914
2915
2915
$ clang -cl-std=CL2.0 -cl-single-precision-constant test.cl
2916
2916
2917
+
2918
+ Many flags used for the compilation for C sources can also be passed while
2919
+ compiling for OpenCL, examples: ``-c ``, ``-O<1-4|s> ``, ``-o ``, ``-emit-llvm ``, etc.
2920
+
2917
2921
Some extra options are available to support special OpenCL features.
2918
2922
2919
2923
.. option :: -finclude-default-header
@@ -2944,56 +2948,7 @@ installation directory.
2944
2948
In this example it is assumed that the kernel code contains
2945
2949
``#include <opencl-c.h> `` just as a regular C include.
2946
2950
2947
- .. _opencl_cl_ext :
2948
-
2949
- .. option :: -cl-ext
2950
-
2951
- Disables support of OpenCL extensions. All OpenCL targets provide a list
2952
- of extensions that they support. Clang allows to amend this using the ``-cl-ext ``
2953
- flag with a comma-separated list of extensions prefixed with ``'+' `` or ``'-' ``.
2954
- The syntax: ``-cl-ext=<(['-'|'+']<extension>[,])+> ``, where extensions
2955
- can be either one of `the OpenCL published extensions
2956
- <https://www.khronos.org/registry/OpenCL> `_
2957
- or any vendor extension. Alternatively, ``'all' `` can be used to enable
2958
- or disable all known extensions.
2959
-
2960
- Note that this is a frontend-only flag and therefore it requires the use of
2961
- flags that forward options to the frontend e.g. ``-cc1 `` or ``-Xclang ``.
2962
-
2963
- Example disabling double support for the 64-bit SPIR target:
2964
-
2965
- .. code-block :: console
2966
-
2967
- $ clang -cc1 -triple spir64-unknown-unknown -cl-ext=-cl_khr_fp64 test.cl
2968
-
2969
- Enabling all extensions except double support in R600 AMD GPU can be done using:
2970
-
2971
- .. code-block :: console
2972
-
2973
- $ clang -cc1 -triple r600-unknown-unknown -cl-ext=-all,+cl_khr_fp16 test.cl
2974
-
2975
- .. _opencl_fake_address_space_map :
2976
-
2977
- .. option :: -ffake-address-space-map
2978
-
2979
- Overrides the target address space map with a fake map.
2980
- This allows adding explicit address space IDs to the bitcode for non-segmented
2981
- memory architectures that do not have separate IDs for each of the OpenCL
2982
- logical address spaces by default. Passing ``-ffake-address-space-map `` will
2983
- add/override address spaces of the target compiled for with the following values:
2984
- ``1-global ``, ``2-constant ``, ``3-local ``, ``4-generic ``. The private address
2985
- space is represented by the absence of an address space attribute in the IR (see
2986
- also :ref: `the section on the address space attribute <opencl_addrsp >`).
2987
-
2988
- .. code-block :: console
2989
-
2990
- $ clang -cc1 -ffake-address-space-map test.cl
2991
-
2992
- Note that this is a frontend-only flag and therefore it requires the use of
2993
- flags that forward options to the frontend e.g. ``-cc1 `` or ``-Xclang ``.
2994
-
2995
- Some other flags used for the compilation for C can also be passed while
2996
- compiling for OpenCL, examples: ``-c ``, ``-O<1-4|s> ``, ``-o ``, ``-emit-llvm ``, etc.
2951
+ More options are documented in :doc: `OpenCLSupport `.
2997
2952
2998
2953
OpenCL Targets
2999
2954
--------------
@@ -3058,10 +3013,10 @@ OpenCL Header
3058
3013
-------------
3059
3014
3060
3015
By default Clang will not include standard headers and therefore OpenCL builtin
3061
- functions and some types (i.e. vectors) are unknown. The default CL header is,
3062
- however, provided in the Clang installation and can be enabled by passing the
3063
- ``-finclude-default-header `` flag (see :ref: `flags description < opencl_cl_ext >`
3064
- for more details).
3016
+ functions and some types (i.e. vectors) are unknown during compilation. The
3017
+ default CL header is, however, provided in the Clang installation and can be
3018
+ enabled by passing the ``-finclude-default-header `` flag (see :ref: `flags
3019
+ description <opencl_cl_ext>` for more details).
3065
3020
3066
3021
.. code-block :: console
3067
3022
@@ -3125,27 +3080,6 @@ Clang also supports language extensions documented in `The OpenCL C Language
3125
3080
Extensions Documentation
3126
3081
<https://github.com/KhronosGroup/Khronosdotorg/blob/master/api/opencl/assets/OpenCL_LangExt.pdf> `_.
3127
3082
3128
- OpenCL Metadata
3129
- ---------------
3130
-
3131
- Clang uses metadata to provide additional OpenCL semantics in IR needed for
3132
- backends and OpenCL runtime.
3133
-
3134
- Each kernel will have function metadata attached to it, specifying the arguments.
3135
- Kernel argument metadata is used to provide source level information for querying
3136
- at runtime, for example using the `clGetKernelArgInfo
3137
- <https://www.khronos.org/registry/OpenCL/specs/opencl-1.2.pdf#167> `_
3138
- call.
3139
-
3140
- Note that ``-cl-kernel-arg-info `` enables more information about the original CL
3141
- code to be added e.g. kernel parameter names will appear in the OpenCL metadata
3142
- along with other information.
3143
-
3144
- The IDs used to encode the OpenCL's logical address spaces in the argument info
3145
- metadata follows the SPIR address space mapping as defined in the SPIR
3146
- specification `section 2.2
3147
- <https://www.khronos.org/registry/spir/specs/spir_spec-2.0.pdf#18> `_
3148
-
3149
3083
OpenCL-Specific Attributes
3150
3084
--------------------------
3151
3085
@@ -3247,48 +3181,6 @@ CFG that modify semantics of the original program.
3247
3181
``noduplicate `` is kept for backwards compatibility only and it considered to be
3248
3182
deprecated for future uses.
3249
3183
3250
- .. _opencl_addrsp :
3251
-
3252
- address_space
3253
- ^^^^^^^^^^^^^
3254
-
3255
- Clang has arbitrary address space support using the ``address_space(N) ``
3256
- attribute, where ``N `` is an integer number in the range ``0 `` to ``16777215 ``
3257
- (``0xffffffu ``).
3258
-
3259
- An OpenCL implementation provides a list of standard address spaces using
3260
- keywords: ``private ``, ``local ``, ``global ``, and ``generic ``. In the AST and
3261
- in the IR local, global, or generic will be represented by the address space
3262
- attribute with the corresponding unique number. Note that private does not have
3263
- any corresponding attribute added and, therefore, is represented by the absence
3264
- of an address space number. The specific IDs for an address space do not have to
3265
- match between the AST and the IR. Typically in the AST address space numbers
3266
- represent logical segments while in the IR they represent physical segments.
3267
- Therefore, machines with flat memory segments can map all AST address space
3268
- numbers to the same physical segment ID or skip address space attribute
3269
- completely while generating the IR. However, if the address space information
3270
- is needed by the IR passes e.g. to improve alias analysis, it is recommended
3271
- to keep it and only lower to reflect physical memory segments in the late
3272
- machine passes.
3273
-
3274
- OpenCL builtins
3275
- ---------------
3276
-
3277
- There are some standard OpenCL functions that are implemented as Clang builtins:
3278
-
3279
- - All pipe functions from `section 6.13.16.2/6.13.16.3
3280
- <https://www.khronos.org/registry/cl/specs/opencl-2.0-openclc.pdf#160> `_ of
3281
- the OpenCL v2.0 kernel language specification. `
3282
-
3283
- - Address space qualifier conversion functions ``to_global``/``to_local ``/``to_private ``
3284
- from `section 6.13.9
3285
- <https://www.khronos.org/registry/cl/specs/opencl-2.0-openclc.pdf#101> `_.
3286
-
3287
- - All the ``enqueue_kernel `` functions from `section 6.13.17.1
3288
- <https://www.khronos.org/registry/cl/specs/opencl-2.0-openclc.pdf#164> `_ and
3289
- enqueue query functions from `section 6.13.17.5
3290
- <https://www.khronos.org/registry/cl/specs/opencl-2.0-openclc.pdf#171> `_.
3291
-
3292
3184
.. _cxx_for_opencl :
3293
3185
3294
3186
C++ for OpenCL
0 commit comments