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:
| Extension name | Description |
|---|---|
| cl_khr_fp64 | Double precision floating-point |
| cl_khr_int64_base_atomics | 64-bit integer base atomic operations |
| cl_khr_int64_extended_atomics | 64-bit integer extended atomic operations |
| cl_khr_3d_image_writes | Writes to 3D image objects |
| cl_khr_fp16 | Half-precision floating-point |
| CL_APPLE_gl_sharing | MacOS X OpenGL sharing |
| CL_KHR_gl_sharing | OpenGL sharing |
| cl_khr_gl_event | CL event objects from GL sync objects |
| cl_khr_d3d10_sharing | Sharing memory objects wth Direct3D 10 |
behavior
One of the following values:
| behavior | Description |
|---|---|
| require | Behave as specified by the extension |
| 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 #pragma OPENCL EXTENSION if the extension extension_name is not supported.
|
The #pragma OPENCL EXTENSION 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 #pragma OPENCL EXTENSION all : 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.
An extension which adds the extension string "cl_khr_fp64" should also add a preprocessor
#define called cl_khr_fp64. A kernel can now use this preprocessor #define to do something like the following:
| #ifdef cl_khr_fp64 // do something using the extension #else // do something else or #error! #endif |
Copyright © 2007-2010 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the condition that this copyright notice and permission notice shall be included
in all copies or substantial portions of the Materials.