Repository navigation
cuda(perf): don't drain the stream after host-to-device copies - #11634
Merged
Merged
Conversation
CudaExecutionCtx::copy_to_device and ensure_on_device awaited a stream callback after enqueueing the copy, which waits for all earlier work on the stream, not just the copy. Later work on the same stream is already ordered after the copy, and other streams wait for it through the buffer's access tracking, so return the buffer right away. Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
robert3005
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CudaExecutionCtx::copy_to_deviceandensure_on_devicewaited for a stream callback after enqueueing each copy. That callback fires only once all earlier work on the stream has finished, so every small host-to-device copy during decode and Arrow export (e.g. FSST symbol tables, binary-export pointer tables) stalled the host until the GPU drained, leaving the GPU idle while the host queued the next kernels.The wait isn't needed: later work on the same stream is already ordered after the copy, and readers on other streams wait for the buffer's recorded write. Both methods now return the buffer as soon as the copy is enqueued.
DeviceReadAt, which hands buffers across streams, keeps the waiting copy.Measured end to end with BenchPress (TPC-H SF10
lineitem, GPU read through the CUDA FFI, hot page cache, 5 iterations, two runs each):