-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL][NFC] Throw warning when sycl.hpp is included without -fsycl
flag.
#19279
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
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'm a little split on this. With all the new ways of doing RTC and offline compiling SYCL code, could we think of cases where users might actually want to include sycl.hpp without -fsycl
? Can we maybe offer them a preprocessor macro to define to switch off this warning?
9d01384
to
efbac5b
Compare
#define STRINGIFY(x) #x | ||
#define TOSTRING(x) STRINGIFY(x) | ||
|
||
#ifdef _MSC_VER |
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.
Note to reviewers: Here's a working example of warnings being thrown for different compilers: https://godbolt.org/z/bvoP3q3Gx
Totally. User could be intentionally including sycl.hpp without -fsycl flag, like for compilation of host-only APIs (like what we do in sycl-ls tool). I've added a macro |
#endif | ||
|
||
#if !defined(SYCL_LANGUAGE_VERSION) && \ | ||
!defined(SYCL_DISABLE_FSYCL_SYCLHPP_WARNING) |
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.
Thanks for adding this! Should we mention it in sycl/doc/PreprocessorMacros.md?
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.
Added in 8efc70e
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!
Created #19305 to track flaky Arc test failure. This PR just adds a compiler warning and should not be anyhow related to the failing test. |
After #19279, `ninja check-sycl` produces hundreds of warning about including `sycl.hpp` without `-fsycl` flag." This PR disables those warnings for unittests.
To improve user experience.
Fixes #12052