-
Notifications
You must be signed in to change notification settings - Fork 260
Delegate logging_resource_adaptor_impl sync methods to their stream-ordered counterparts #2445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,24 +26,14 @@ logging_resource_adaptor_impl::logging_resource_adaptor_impl( | |
|
|
||
| void* logging_resource_adaptor_impl::allocate_sync(std::size_t bytes, std::size_t alignment) | ||
| { | ||
| auto const stream = cuda_stream_view{}; | ||
| try { | ||
| auto const ptr = upstream_mr_.allocate(stream, bytes, alignment); | ||
| logger_->info("allocate,%p,%zu,%s", ptr, bytes, rmm::detail::format_stream(stream)); | ||
| return ptr; | ||
| } catch (...) { | ||
| logger_->info("allocate failure,%p,%zu,%s", nullptr, bytes, rmm::detail::format_stream(stream)); | ||
| throw; | ||
| } | ||
| return allocate(cuda_stream_view{}, bytes, alignment); | ||
| } | ||
|
Comment on lines
27
to
30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL: Missing stream synchronization in allocate_sync The synchronous allocation contract requires blocking until the GPU allocation is complete. The current implementation delegates to the stream-ordered Compare to the base class pattern in auto const stream = cuda_stream_view{};
void* ptr = allocate(stream, bytes, alignment);
stream.synchronize(); // Required!
return ptr;Why this matters: Callers of 🔒 Correct implementation with synchronization void* logging_resource_adaptor_impl::allocate_sync(std::size_t bytes, std::size_t alignment)
{
- return allocate(cuda_stream_view{}, bytes, alignment);
+ auto const stream = cuda_stream_view{};
+ void* ptr = allocate(stream, bytes, alignment);
+ stream.synchronize();
+ return ptr;
}🤖 Prompt for AI Agents |
||
|
|
||
| void logging_resource_adaptor_impl::deallocate_sync(void* ptr, | ||
| std::size_t bytes, | ||
| std::size_t alignment) noexcept | ||
| { | ||
| auto const stream = cuda_stream_view{}; | ||
| logger_->info("free,%p,%zu,%s", ptr, bytes, rmm::detail::format_stream(stream)); | ||
| upstream_mr_.deallocate(stream, ptr, bytes, alignment); | ||
| deallocate(cuda_stream_view{}, ptr, bytes, alignment); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also wrong: it doesn't synchronise, so it doesn't change the stream synchronisation behaviour at all. Please follow the pattern in, for example, |
||
| } | ||
|
|
||
| void* logging_resource_adaptor_impl::allocate(cuda::stream_ref stream, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't change the synchronisation behaviour, which is the thing you're trying to fix.