EXTENSION(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

✨ NAME ✨

okay so bestie, welcome to EXTENSION πŸ’– β€” it's a #pragma directive that sets the behavior for OpenCL extensions. that's it, that's the whole vibe. (this is the OpenCL Manual, if you were wondering where you wandered into πŸ¦‹)

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

🌸 PARAMETERS 🌸

extension_name

the name of the extension, babes. it'll be shaped like cl_khr_<name> for an extension approved by the OpenCL working group, and shaped like cl_<vendor_name>_<name> for vendor extensions. the token all means the behavior applies to all extensions supported by the compiler. here's the legal-values list for extension_name, no cap:

behavior

one of these two, pick your fighter 🫢:

  • enable β€” behave as specified by the extension extension_name. report an error on the #pragma OPENCL EXTENSION 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 #pragma OPENCL EXTENSION if the extension extension_name is not supported.

πŸ’œ DESCRIPTION πŸ’œ

the #pragma OPENCL EXTENSION directive is a simple, low-level mechanism to set the behavior for each extension. it does not define policies like which combinations are appropriate β€” those have to be defined elsewhere, not my problem, not yours either. πŸ™ˆ

the order of directives matters when 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. periodt.

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. so like, extensions start off, bestie. that's the default state of being.

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. iykyk. ✨


πŸŽ€ NOTES πŸŽ€

this document describes the list of optional features supported by OpenCL 1.2. optional extensions may be supported by some OpenCL devices. optional extensions are not required to be supported by a conformant OpenCL implementation, but are expected to be widely available; they define functionality that is likely to move into the required feature set in a future revision of the OpenCL specification. it's giving "optional but make it main character energy". πŸ‘‘

OpenCL extensions approved by the OpenCL working group can be promoted to required core features in later revisions of OpenCL. when this occurs, the extension specifications are merged into the core specification. functions and enumerants that are part of such promoted extensions will have the KHR affix removed. OpenCL implementations of such later revisions must also export the name strings of promoted extensions in the CL_PLATFORM_EXTENSIONS or CL_DEVICE_EXTENSIONS string, and support the KHR-affixed versions of functions and enumerants as a transition aid.

🌈 Example 🌈

an extension which adds the extension string "cl_khr_3d_image_writes" should also add a preprocessor #define called cl_khr_3d_image_writes. a kernel can now use this preprocessor #define to do something like the following:

#ifdef cl_khr_3d_image_writes
// do something using the extension
#else
// do something else or
#error!
#endif

πŸ“œ SPECIFICATION πŸ“œ

OpenCL Specification[1]


πŸ’– AUTHORS πŸ’–

The Khronos Group


Copyright Β© 2007-2011 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.


πŸ¦‹ NOTES πŸ¦‹

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

and that's the whole page, bestie!! πŸ’… this was The Khronos Group's page, dated 01/14/2021, living in the manual as EXTENSION(3clc). go forth and #pragma responsibly. πŸŽ€βœ¨πŸ«Ά

πŸ“¦ where this page comes from