-
Notifications
You must be signed in to change notification settings - Fork 159
CUDAStreamView (or similar name) object #314
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
Comments
The goal of For established projects, we already have (by design) |
The main possible value-add that I see is having a standard vocabulary type for processing objects that expose the protocol. Essentially if my lib exposes a function foo that takes a stream, the protocol approach would have you do this:
A standard view type in cuda.core would replace the need for
It's definitely not a requirement though, just a convenience. |
I think this issue was discussed in one of the design meetings last year. The conclusion was the same: We already have everything asked here in cuda.core, so inventing new types does not solve additional problems. For Vyas's example we can just do: from cuda.core import Device:
def foo(..., stream_like):
# this works as long as stream_like supports __cuda_stream__
stream = Device().create_stream(stream_like) |
A few more words on the design principle behind this and other topics: It is clear (at least to me 🙂) in 2025 that we want not only a data exchange protocol to communicate across library boundary, but also a concrete implementation of the said protocol, so that everyone can focus on getting the job done without re-implementing the protocol support (DLPack example), which can be non-trivial and sometimes error prone. It is the reason we provide |
Just like in the array case, where there are many different ways to define an array (Python Buffer Protocol,
__array_interface__
,__cuda_array_interface__
, DLPack, etc.), there is a similar issue with streams up to this point. To provide a few examples...__dlpack__
can contain a stream__cuda_array_interface__
can contain a streamtorch.cuda.stream
cupy.cuda.Stream
cudaStream_t
is passed around as an integer addressWith all these objects floating around that provide different APIs, there remains a need to wrangle them them into some kind of common object and that has proper RAII semantics and can be used in a standard way
A
CUDAStreamView
, much like theStridedMemoryView
, would help provide this standard way to consume these different objects and provide a standard object and API to use (including__cuda_stream__
)It could...
cudaStream_t
in an attributeThe text was updated successfully, but these errors were encountered: