[PATCH] D77923: OpenCL: Fix some missing predefined macros

Scott Linder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 10:45:03 PDT 2020


scott.linder added a comment.

https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/preprocessorDirectives.html describes `__OPENCL_VERSION__` as "an integer reflecting the version number of the OpenCL supported by the OpenCL device." as contrasted with `__OPENCL_C_VERSION__` which is described as "an integer reflecting the OpenCL C version specified by the -cl-std build option to clBuildProgram or clCompileProgram. If the -cl-std build option is not specified, the OpenCL C version supported by the compiler for this OpenCL device will be used."

But I don't see where the correct use of these is defined? How should the user decide which to use? It does seem like `__OPENCL_VERSION__` and `__OPENCL_C_VERSION__` can differ, e.g. if you compile for a device supporting 2.0 with `-cl-std=1.2`, but why would `__OPENCL_VERSION__` ever be referenced then?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77923/new/

https://reviews.llvm.org/D77923





More information about the cfe-commits mailing list