Skip to content

[SYCL][NFC] Drop <optional> from half_type.hpp / bfloat16.hpp#22039

Open
koparasy wants to merge 2 commits into
intel:syclfrom
koparasy:nfc/remove-functional
Open

[SYCL][NFC] Drop <optional> from half_type.hpp / bfloat16.hpp#22039
koparasy wants to merge 2 commits into
intel:syclfrom
koparasy:nfc/remove-functional

Conversation

@koparasy
Copy link
Copy Markdown
Contributor

half_type.hpp included only to make std::hash's primary template visible for the std::hashsycl::half specialization. Replace with a forward declaration (namespace std { template <class> struct hash; }) and inline the hash body so it no longer calls std::hash<uint16_t>{}, which requires the primary definition. Same treatment in bfloat16.hpp (already had sycl::bit_cast in scope).

Saves the transitive chain (~30 ms parse + 60+ headers) on every TU that pulls sycl::half.

half_type.hpp included <optional> only to make std::hash's primary
template visible for the std::hash<sycl::half> specialization. Replace
with a forward declaration (`namespace std { template <class> struct
hash; }`) and inline the hash body so it no longer calls
std::hash<uint16_t>{}, which requires the primary definition. Same
treatment in bfloat16.hpp (already had sycl::bit_cast in scope).

Saves the <optional> transitive chain (~30 ms parse + 60+ headers) on
every TU that pulls sycl::half.
@koparasy koparasy requested a review from a team as a code owner May 15, 2026 20:47
@koparasy koparasy requested a review from sergey-semenov May 15, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant