Skip to content
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

Add "std::byte" support to stream #183

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gmlueck
Copy link
Contributor

@gmlueck gmlueck commented Aug 13, 2021

Since we encourage people to migrate from the old sycl::byte to
std::byte, I presume we want to support std::byte in the stream
class.

Since we encourage people to migrate from the old `sycl::byte` to
`std::byte`, I presume we want to support `std::byte` in the `stream`
class.
@ProGTX
Copy link
Contributor

ProGTX commented Aug 25, 2021

Interesting, are bytes streamable? The example in https://en.cppreference.com/w/cpp/types/byte suggests you need to convert it to an integer first.

@keryell
Copy link
Member

keryell commented Aug 26, 2021

Interesting, are bytes streamable? The example in https://en.cppreference.com/w/cpp/types/byte suggests you need to convert it to an integer first.

Good point.
This suggest not adding it to the stream interface.

@gmlueck
Copy link
Contributor Author

gmlueck commented Aug 26, 2021

Yes, I agree that this is a good point. I think there should still be some way for applications to emit the value of an std::byte to a sycl::stream, though. If we think of sycl::stream as an analog of <iostream>, then device code should do something like this:

sycl::stream sstream(/* ... */);

// ...

std::byte b{42};
sstream << std::to_integer<int>(b);

For that to be legal, we need to say someplace that std::to_integer<>() is safe to call in device code. We should also list the other non-member functions related to std::byte (https://en.cppreference.com/w/cpp/types/byte) as safe.

Should we add a new section that lists functions and types from the standard C++ library that are safe in device code? It seems like the typical implementation of the functions related to std::byte would not require any changes in order to be safe in device code, so listing these in the spec would likely not be an implementation burden. Over time, we will probably find other std functions that we want to add to this section.

@fraggamuffin
Copy link

stream op for byte does not align with C++
setup section initially for byteops( std C++ fns called from device code)

@keryell
Copy link
Member

keryell commented Sep 2, 2021

2021/09/02 SYCL Khronos committee meeting

Waiting for new wording from @gmlueck.
This PR is not ready for merging yet.

@keryell keryell marked this pull request as draft October 14, 2021 15:36
@fraggamuffin
Copy link

awaiting draft for NEXT or KHR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants