rmm
rmm copied to clipboard
[REVIEW] Add cuda_event type
- Add new
cuda_eventandcuda_event_viewwrappers, similar tocuda_streamandcuda_stream_view. - Add extra functionality to
cuda_streamandcuda_stream_viewto interact with the added event types.
A few days ago @jrhemstad mentioned you'd welcome this wrapper. I tried to follow cuda_stream approach as close as possible, so some copy-pasting is there.
Thanks, @jrhemstad ! I wouldn't mind moving the wait and record, but then we need to make a choice: shall I add another event_view, or better just make duplicate methods for rmm::cuda_event and cudaEvent_t? And there is also wait without arguments, which synchronises with the host (cudaEventSynchronize), which I cannot move to stream_view.
On the other hand, I can just change the wording to something like... synchronize/wait_by and push/record_in?
Yes, I think we will need an event_view type.
And there is also wait without arguments, which synchronises with the host (cudaEventSynchronize), which I cannot move to stream_view.
Good point. We should keep that as a wait function in the event type.
There would also be some inconvenience in having to explicitly convert stream types to the stream_view to access its member functions if we move wait and record there, right? Still better than having them in cuda_event? :)
We should design for a world where cudaStream_t isn't used directly anymore.
Eventually these types will all exist in libcu++.
Done. Sorry I don't have the rights to set github labels here.
Also note, I added a function that doesn't strictly belong to the PR (I hope it's ok). I need it in cuml to decide if I need one worker stream or two (if I cannot use the default). I thought it would be useful for others too: https://github.com/rapidsai/rmm/blob/b55088b3a1433b0248dddab319d10771cb8d97ba/include/rmm/cuda_stream_view.hpp#L96-L118
I think this still requires a bit of design work, and we are in burn down for 21.10 so I'm moving this to the next release. @achirkin please change the target branch.
Ok, though I hoped to push it in 21.10, cause I need events in https://github.com/rapidsai/cuml/pull/4201 .
@achirkin you can use CUDA events now without a wrapper class. We already use events in RMM. I think we should take our time and get this right, and perhaps it should just live in libcu++ from the beginning.
Removing ops-codeowners from the required reviews since it doesn't seem there are any file changes that we're responsible for. Feel free to add us back if necessary.
This PR has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates. This PR will be labeled inactive-90d if there is no activity in the next 60 days.
This PR has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates.