[Fix] Bind ring drain workers to their CUDA device - #110
Merged
Conversation
XbzOnGit
requested review from
Samfisheryu and
zaoxing
and removed request for
zaoxing
August 25, 2026 05:33
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
Suppressed comments (1)
tests/native/ring/test_ring_engine.cu:285
- The wait loop for
callback_enteredalso busy-spins for up to 5 seconds. Adding a small sleep reduces CPU load in CI while still polling frequently enough for this test.
while (!callback.entered.load(std::memory_order_acquire) &&
std::chrono::steady_clock::now() < callback_deadline) {
std::this_thread::yield();
}
Collaborator
|
LGTM |
zaoxing
approved these changes
Aug 25, 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.
Closes #105.
Summary
Each native ring and D2H stream is created on the model worker's current CUDA device, but the background drain thread previously started with logical device 0 current. Under tight GPU-memory pressure, this caused the entire rank-1 capture to fail bit-for-bit validation—all 35,840 rank-1 rows failed—while model inference itself still completed.
This change records the owning device before creating the drain stream and selects that device at worker entry before any CUDA operation. A startup handshake makes
cudaSetDevice()failure visible synchronously to the caller.It also promotes failures from D2H enqueue, drain-stream synchronization, and the worker's final device synchronization from debug-only output to release-build diagnostics. This is diagnostic hardening only; transactional D2H failure handling is outside this PR.
Regression coverage
The new two-GPU native regression blocks work on device 0, constructs the ring and drain on device 1, and verifies that stopping the drain does not wait for device 0. This deterministically checks the worker's device binding without depending on GPU-memory pressure.
Validation
vllm-full, vLLM GPU-memory utilization0.96, 512 MiB payload and pinned-staging rings: