You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
Not to mention cases where a cudaStream_t is passed around as an integer address
With 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 the StridedMemoryView, 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...
Identify the object
Keep a copy of the cudaStream_t in an attribute
Keep a reference to the exporting object
Query/store any other relevant info
The text was updated successfully, but these errors were encountered:
The goal of cuda.core is to not bifurcate the CUDA-owned objects in each Python project, and instead new projects should just use cuda.core and get streams.
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:
# lib.py
def foo(..., stream_like):
if not hasattr(stream_like, "__cuda_stream__"):
raise ValueError("Invalid stream object")
stream = process_stream_like(stream_like.__cuda__stream__) # This function needs to be defined.
A standard view type in cuda.core would replace the need for process_stream_like.
from cuda.core import StreamView
def foo(..., stream_like):
stream = StreamView(stream_like)
It's definitely not a requirement though, just a convenience.
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: