Skip to content

Conversation

@aelovikov-intel
Copy link
Contributor

  • std::istream/std::ostream aren't usable on device, so limit operator<</operator>> to declaration only to limit device includes to <iosfwd> instead of much heavier <istream>/<ostream>.
  • Use "lighter" <optional> to get std::hash

* `std::istream`/`std::ostream` aren't usable on device, so limit
  `operator<<`/`operator>>` to declaration only to limit device includes
  to `<iosfwd>` instead of much heavier `<istream>`/`<ostream>`.
* Use "lighter" `<optional>` to get `std::hash`
Comment on lines -118 to -129
// Misc
inline std::ostream &operator<<(std::ostream &O, sycl::half const &rhs) {
O << static_cast<float>(rhs);
return O;
}

inline std::istream &operator>>(std::istream &I, sycl::half &rhs) {
float ValFloat = 0.0f;
I >> ValFloat;
rhs = ValFloat;
return I;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

half's hidden friends already do this, no idea why ESIMD needed this in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we had an implementation of half in esimd before sycl::half was implemented, probably we forgot to remove it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we had an implementation of half in esimd before sycl::half was implemented, probably we forgot to remove it

I see stream operators implemented before ESIMD.

ESIMD implementation added by: f34ba2c

Here is sycl::half implementation for the same SHA:

inline std::ostream &operator<<(std::ostream &O, cl::sycl::half const &rhs) {
O << static_cast<float>(rhs);
return O;
}
inline std::istream &operator>>(std::istream &I, cl::sycl::half &rhs) {
float ValFloat = 0.0f;
I >> ValFloat;
rhs = ValFloat;
return I;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esimd doesn't work on the host now, im not sure about at the time, but there is no point in having this code for the host

Comment on lines -118 to -129
// Misc
inline std::ostream &operator<<(std::ostream &O, sycl::half const &rhs) {
O << static_cast<float>(rhs);
return O;
}

inline std::istream &operator>>(std::istream &I, sycl::half &rhs) {
float ValFloat = 0.0f;
I >> ValFloat;
rhs = ValFloat;
return I;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we had an implementation of half in esimd before sycl::half was implemented, probably we forgot to remove it

@aelovikov-intel aelovikov-intel merged commit 466de9c into intel:sycl Sep 11, 2025
28 checks passed
@aelovikov-intel aelovikov-intel deleted the half-bf16-device branch September 11, 2025 00:15
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.

4 participants