Synchronize CUDA async deallocate_sync#2401
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThree ChangesStream Reference Consistency Refactoring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
davidwendt
left a comment
There was a problem hiding this comment.
LGTM.
Seems all of these function definitions could be moved to a .cpp file.
| deallocate(cuda::stream_ref{cudaStream_t{nullptr}}, ptr, bytes, alignment); | ||
| auto const stream = cuda::stream_ref{cudaStream_t{nullptr}}; | ||
| deallocate(stream, ptr, bytes, alignment); | ||
| RMM_ASSERT_CUDA_SUCCESS_SAFE_SHUTDOWN(cudaStreamSynchronize(stream.get())); |
There was a problem hiding this comment.
question: what is the point of this synchronisation? It can't really be stream safety because after this call the ptr is not alive and cannot be reused. Is it that you want the freed memory to be immediately available on all streams?
There was a problem hiding this comment.
Yes, the name says "sync" so we should guarantee there is no asynchronous work ordered after the end of this function's scope. This should align with the allocation behavior.
I agree, this resource doesn't match the others for some reason. I'll file a follow-up to fix that. edit: Tracking in #2414 |
|
/merge |
Description
Ensures CUDA async memory resources wait for async frees before returning from
deallocate_sync(). The sync wrappers now deallocate on the default stream and synchronize that same stream before returning.Checklist