-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL][AOT] Define CL_TARGET_OPENCL_VERSION to OpenCL 2.2 #1608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes #1607. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
When using the Khronos OpenCL headers from GitHub, set the preprocessor symbol CL_TARGET_OPENCL_VERSION=220 to silence the compilation warning from the OpenCL header files, and define all OpenCL 2.2 symbols. Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
When using the Khronos OpenCL headers from GitHub, set the preprocessor symbol CL_TARGET_OPENCL_VERSION=220 to silence the compilation warning from the OpenCL header files, and define all OpenCL 2.2 symbols. Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
083e0e7
to
2043cd0
Compare
What will it be if someone continues to include <CL/cl.h> or <CL/opencl.h> directly? Will we just see the warning again? Can we somehow guard from doing this? Maybe add an error directive into some common SYCL header to check that CL_TARGET_OPENCL_VERSION is defined when CL is included/defined (there should be something robust to reflect that I believe), |
IIRC, it's not a warning - it's a remark. |
It's a "pragma message" - https://github.com/KhronosGroup/OpenCL-Headers/blob/master/CL/cl_version.h#L22 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
A few nits.
Include all OpenCL headers through CL/sycl/detail/cl.h, and define the CL_TARGET_OPENCL_VERSION to 220 (OpenCL 2.2) by default. Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
OK, but the point is that can we make something to get an error instead? |
Actually, I don't think we would see anything during the build, because CMake now does define
Mhm... the most robust thing I can think of would be to patch the version of An other possibility could be some check like #if defined __CL_VERSION_H && ! defined CL_TARGET_OPENCL_VERSION
#error Do not include <CL/cl.h> or <CL/opencl.h> directly, use <CL/sycl/detail/cl.h> instead
#endif but I have no idea how one could apply to all relevant cpp files. |
One of the check fails with
but in fact I can't find any reference to it - maybe it's related to #1622 ? |
I've reverted the |
@bader could you trigger the Lit_With_Cuda test ? |
…claration (#1608) This patch helps to avoid invalid SPV generation. When global variable contains a pointer to a function, translator tries to translate it as declaration. Then it translates this function the second time when going through the function list. This leads to double translation of the same function and to the usage of the same IDs in SPIR-V file. Original commit: KhronosGroup/SPIRV-LLVM-Translator@2b4ce42
When using the Khronos OpenCL headers from GitHub, set the preprocessor
symbol CL_TARGET_OPENCL_VERSION=220 to silence the compilation warning
from the OpenCL header files, and define all OpenCL 2.2 symbols.
Include the OpenCL headers through CL/sycl/detail/cl.h, and define
the CL_TARGET_OPENCL_VERSION to 220 (OpenCL 2.2) by default.
Protect the use of OpenCL 2.0 and 2.2 symbols with the relevant #ifdef.