Correctly synchronise all _sync allocate/deallocations#2449
Conversation
| // TODO: Do we need this one? | ||
| RMM_CUDA_TRY(cudaStreamSynchronize(stream.get())); |
There was a problem hiding this comment.
I don't think so. If we throw, we're not returning a pointer to the caller, so I don't think we need any stream-sync guarantee.
But why did we delete the logger messages?
There was a problem hiding this comment.
We didn't, we defer to the async allocate on this class that emits log messages. Rather than previously where we deferred to upstream_mr_.allocate and therefore were on the hook to do the logging ourselves.
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAll ChangesFix sync allocation/deallocation contract across all resource adaptors
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
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 |
| std::stringstream msg; | ||
| msg << "Exceeded memory limit " << allocation_limit_ << "; Allocated bytes " << allocated_bytes_ | ||
| << "; Requested bytes " << bytes << "\n"; | ||
| RMM_FAIL(msg.str(), rmm::out_of_memory); |
There was a problem hiding this comment.
CI had this error https://github.com/rapidsai/rmm/actions/runs/27701750774/job/81941320252?pr=2449#step:12:704
that I am trying to understand.
| std::size_t alignment) noexcept | ||
| { | ||
| get_resource_ref(bytes).deallocate(cuda_stream_view{}, ptr, bytes, alignment); | ||
| return get_resource_ref(bytes).deallocate_sync(ptr, bytes, alignment); |
There was a problem hiding this comment.
This is void, and same for the upstream deallocation. Why return?
There was a problem hiding this comment.
No need for it, just habit.
| // TODO: Do we need this one? | ||
| RMM_CUDA_TRY(cudaStreamSynchronize(stream.get())); |
There was a problem hiding this comment.
I don't think so. If we throw, we're not returning a pointer to the caller, so I don't think we need any stream-sync guarantee.
But why did we delete the logger messages?
| std::size_t alignment) noexcept | ||
| { | ||
| auto const stream = cuda_stream_view{}; | ||
| logger_->info("free,%p,%zu,%s", ptr, bytes, rmm::detail::format_stream(stream)); |
There was a problem hiding this comment.
Why did we delete the logging?
There was a problem hiding this comment.
As for allocate, we're calling this->deallocate that emits logging now. Rather than upstream.deallocate that does not.
Description
Checklist