-
Notifications
You must be signed in to change notification settings - Fork 115
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
Make SYCL backend detection more portable #1881
Conversation
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.
I have a memory of us running into issues with some compilers providing sycl.hpp
, but not actually providing a working SYCL implementation when we were adding this to CMake detection of the availability of SYCL. Wouldn't this have the potential for some problems in that case?
My memory is that this was with clang++, but I may be mistaken. Let me see if I can pull up that discussion.
It turns out its the opposite issue in reality #959 (comment) |
Let's do some analysis first.
There are two SYCL availability tests we use:
According to the SYCL standard, eventually both checks need to pass. So the simplest generic SYCL availability test would be:
However, we do not want to include the SYCL header until it's needed. Also, if the header code depends on compiler support, Also note that the use cases (a) and (b) would treat "possibly available" differently:
The general procedure could be:
With this procedure, the SYCL backend might be enabled without requiring
|
Thank you for such a detailed analysis, Alexey. I've implemented this suggestion. |
f1fbb2d
to
e8cedef
Compare
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.
I have some questions and suggestions.
Also, there is no check in the backend that the language version macro is properly defined after the header is included.
99d3614
to
6e6e985
Compare
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Move hetero backend configuration into a separate file Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
b0c078b
to
85d7c67
Compare
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
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.
It looks good to me.
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, these are all good changes. If you want to take the optional nitpicks, I will approve after
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
3284e95
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, the clang format suggestion is bad and should be ignored.
SYCL specification allows SYCL to be implemented purely as a library: https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_library_only_implementation. It means that inclusion of
sycl/sycl.hpp
is a portable way to getSYCL_LANGUAGE_VERSION
, in contrast to expecting it to be defined by the compiler itself. Additionally, AdaptiveCPP defines this macro insycl/sycl.hpp
.