[SYCL] Decouple <sycl/builtins.hpp> from <sycl/usm.hpp>#22312
Open
koparasy wants to merge 1 commit into
Open
Conversation
<sycl/usm.hpp> transitively pulled in <sycl/builtins.hpp> (and through it
<sycl/half_type.hpp>, <algorithm>, vec/marray definitions, libc device
declarations like __assert_fail, etc.). User code and tests came to rely
on this implicit re-export chain.
Once sycl_khr_split_headers ships, <sycl/usm.hpp> is meant to deliver
only USM symbols. Keeping the <sycl/builtins.hpp> include would either
defeat the purpose of split-headers or force a source break later.
Fix the dependency now:
* Drop <sycl/builtins.hpp> and <algorithm> from <sycl/usm.hpp>.
* Replace four unqualified max(...) callsites (which previously
resolved to sycl::max via builtins) with inline ternaries.
* Add the explicit headers each affected test/common helper actually
needs:
- <algorithm> for std::any_of / all_of / find / sort etc.
- <sycl/half_type.hpp> for sycl::half as a complete type.
- <sycl/vector.hpp> for sycl::vec.
- <sycl/marray.hpp> for sycl::marray.
- <sycl/builtins.hpp> for sycl math builtins or device-side
assert / libc declarations.
Also fixes ordering bugs where <algorithm> was included after the
header that used it, or inside a function body.
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
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.
<sycl/usm.hpp> transitively pulled in <sycl/builtins.hpp> (and through it <sycl/half_type.hpp>, , vec/marray definitions, libc device declarations like __assert_fail, etc.). User code and tests came to rely on this implicit re-export chain.
Once
sycl_khr_split_headersships, <sycl/usm.hpp> is meant to deliver only USM symbols. Keeping the <sycl/builtins.hpp> include would either defeat the purpose of split-headers or force a source break later.Fix the dependency now:
assert / libc declarations.