logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

EXTENSION - A #pragma directive to set the behavior for OpenCL extensions.

Authors

TheKhronosGroup

Description

       The #pragmaOPENCLEXTENSION directive is a simple, low-level mechanism to set the behavior for each
       extension. It does not define policies such as which combinations are appropriate; those must be defined
       elsewhere. The order of directives matter in setting the behavior for each extension. Directives that
       occur later override those seen earlier. The all variant sets the behavior for all extensions, overriding
       all previously issued extension directives, but only if the behavior is set to disable.

       The initial state of the compiler is as if the directive #pragmaOPENCLEXTENSIONall:disable was
       issued, telling the compiler that all error and warning reporting must be done according to this
       specification, ignoring any extensions.

       Every extension which affects the OpenCL language semantics, syntax or adds built-in functions to the
       language must create a preprocessor #define that matches the extension name string. This #define would be
       available in the language if and only if the extension is supported on a given implementation.

Name

       EXTENSION - A #pragma directive to set the behavior for OpenCL extensions.

       #pragma OPENCL EXTENSION extension_name : behavior
       #pragma OPENCL EXTENSION all : behavior

Notes

        1. OpenCL Specification
           page 6, section 9.1 - Compiler Directives for Optional Extensions

The Khronos Group                                  11/18/2024                                    EXTENSION(3clc)

Parameters

extension_name
           The name of the extension. The extension_name will have names of the form cl_khr_<name> for an
           extension approved by the OpenCL working group and will have names of the form
           cl_<vendor_name>_<name> for vendor extensions. The token all means that the behavior applies to all
           extensions supported by the compiler. The table below shows the legal values for extension_name:
           ┌─────────────────────────────────────┬───────────────────────────────────────┐
           │ ExtensionnameDescription                           │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_int64_base_atomics(3clc)     │ 64-bit integer base atomic operations │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_int64_extended_atomics(3clc) │ 64-bit integer extended atomic        │
           │                                     │ operations                            │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_3d_image_writes(3clc)        │ Writes to 3D image objects            │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_fp16(3clc)                   │ Half-precision floating-point         │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_apple_gl_sharing                 │ MacOS X OpenGL sharing                │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_gl_sharing(3clc)             │ OpenGL sharing                        │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_gl_event(3clc)               │ CL event objects from GL sync objects │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_d3d10_sharing(3clc)          │ Sharing memory objects wth Direct3D   │
           │                                     │ 10                                    │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_d3d11_sharing(3clc)          │ Sharing memory objects wth Direct3D   │
           │                                     │ 11                                    │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_dx9_media_sharing(3clc)      │ Sharing memory objects wth Direct3D 9 │
           ├─────────────────────────────────────┼───────────────────────────────────────┤
           │ cl_khr_icd(3clc)                    │ Access Khronos OpenCL installable     │
           │                                     │ client driver loader (ICD Loader.     │
           └─────────────────────────────────────┴───────────────────────────────────────┘

         behavior
           One of the following values:
           ┌──────────┬─────────────────────────────────────────────────────────────────────────┐
           │ behaviorDescription                                                             │
           ├──────────┼─────────────────────────────────────────────────────────────────────────┤
           │ enable   │                Behave as specified by the extension extension_name.     │
           │          │                                                                         │
           │          │                Report an error on the #pragmaOPENCLEXTENSION if the   │
           │          │                extension_name is not supported, or if all is specified. │
           │          │                                                                         │
           ├──────────┼─────────────────────────────────────────────────────────────────────────┤
           │ disable  │ Behave (including issuing errors and warnings) as if the extension      │
           │          │ extension_name is not part of the language definition.                  │
           │          │                                                                         │
           │          │ If all is specified, then behavior must revert back to that of the      │
           │          │ non-extended core version of the language being compiled to.            │
           │          │                                                                         │
           │          │ Warn on the #pragmaOPENCLEXTENSION if the extension extension_name is │
           │          │ not supported.                                                          │
           └──────────┴─────────────────────────────────────────────────────────────────────────┘

Specification

OpenCLSpecification[1]

See Also