cuda.bench currently does not support use case exemplified in examples/stream.cu we user can specify an existing stream to be used for benchmarking.
The proposed API would be cuda.bench.State.set_stream(stream_provider), where
stream_provider is not an instance of type cuda.bench.CudaStream
- needed to avoid lifetime footguns
stream_provider must support __cuda_stream__ protocol, which cuda.core.Stream does.
The stream would be set only if the handle in __cuda_stream__ is different from the one held by underlying nvbench::state object to avoid lifetime footgun issues.
Perhaps a dedicated convenience method cuda.bench.State.set_default_stream() should be implemented as well.
cuda.benchcurrently does not support use case exemplified in examples/stream.cu we user can specify an existing stream to be used for benchmarking.The proposed API would be
cuda.bench.State.set_stream(stream_provider), wherestream_provideris not an instance of typecuda.bench.CudaStreamstream_providermust support__cuda_stream__protocol, whichcuda.core.Streamdoes.The stream would be set only if the handle in
__cuda_stream__is different from the one held by underlyingnvbench::stateobject to avoid lifetime footgun issues.Perhaps a dedicated convenience method
cuda.bench.State.set_default_stream()should be implemented as well.