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

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 10:45:16 PDT 2020


arsenm added a comment.

In D77923#1978172 <https://reviews.llvm.org/D77923#1978172>, @scott.linder wrote:

> 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?


I don't know why you would ever use this; but the standard says it should be defined, so I guess we have to define it


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

https://reviews.llvm.org/D77923





More information about the cfe-commits mailing list