-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Don't include <cmath> from <sycl/sycl.hpp> #11274
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This follows intel#11196 that did the same with <complex> before. We still want to support `std::` math functions in user code (as part of `sycl/doc/extensions/supported/C-CXX-StandardLibrary.rst`). Also, often times STL implements math functions support somewhat like this: ``` extern "C" { extern double cos (double __x) noexcept (true); } extern "C++" { namespace std __attribute__ ((__visibility__ ("default"))) { using ::cos; } } ``` As such, we still want to let the compiler know which symbols in the global namespace are known (e.g. `::cos`) and which aren't and need an error ( `SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute`). One option to implement that is to recognize those functions as builtins in the front end (which intel#11014 tries to do). Another approach, taken in this PR, is to keep providing declaration in SYCL headers but only do so when customer included `<cmath>` explicitly (via `#include_next`, similarly to `<complex>` support added in intel#11196).
65e80ff
to
a174ee0
Compare
dkhaldi
approved these changes
Sep 25, 2023
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.
JM part LGTM
HIP:
Win, infrastructure issue:
|
steffenlarsen
approved these changes
Sep 25, 2023
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.
Since we can still consider #11014 with this in, I am okay with the solution.
aelovikov-intel
added a commit
to aelovikov-intel/llvm
that referenced
this pull request
Sep 27, 2023
…RMANT_APIS intel#11274 and intel#11196 could break customers code that relied on implicit inclusion of those headers. Don't break it before the next ABI breaking window.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This follows #11196 that did the same with before. We still want to support
std::
math functions in user code (as part ofsycl/doc/extensions/supported/C-CXX-StandardLibrary.rst
). Also, often times STL implements math functions support somewhat like this:As such, we still want to let the compiler know which symbols in the global namespace are known (e.g.
::cos
) and which aren't and need an error (SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute
).One option to implement that is to recognize those functions as builtins in the front end (which #11014 tries to do). Another approach, taken in this PR, is to keep providing declaration in SYCL headers but only do so when customer included
<cmath>
explicitly (via#include_next
, similarly to<complex>
support added in #11196).