fix(cuda): avoid null output-head dereference in distributed coordinators - #592
Open
hy-sde wants to merge 1 commit into
Open
fix(cuda): avoid null output-head dereference in distributed coordinators#592hy-sde wants to merge 1 commit into
hy-sde wants to merge 1 commit into
Conversation
|
i think i hit this bug as well on rocm on efdadd4: Edit: confirmed this patch prevents the crash. |
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.
Summary
Fix a startup segmentation fault when CUDA distributed inference assigns the output head to a worker, for example a two-DGX-Spark pipeline with coordinator
--layers 0:19and worker--layers 20:output.metal_graph_alloc_raw_cap()sized the logits buffer throughweights->output->dim[1]. A sliced coordinator intentionally does not map the worker-owned output tensor, soweights->outputisNULLduringds4_session_create().Use the model shape metadata (
DS4_N_VOCAB) instead. The allocator no longer needsds4_weights, so this also removes that unused parameter and updates its call sites.Reproduction
Hardware:
Start the worker first:
./ds4 --cuda \ -m "$MODEL" \ --role worker \ --layers 20:output \ --coordinator 192.168.100.10 9911 \ --ctx 8192 \ --debugThen start the coordinator:
Before this change, the coordinator completed model preparation and context planning, then exited with SIGSEGV before opening the listener.
GDB showed:
The faulting expression was:
Verification
After the fix, the same two-node command completes route registration and generation:
The generated response was coherent and all 64 requested decode steps completed.
Additional checks on the DGX Spark coordinator:
make ds4 make cuda-regression # cuda long-context regression: OK make cpuThe regression requires a CUDA accelerator, a sliced distributed route, and the model artifacts; no source-text test was added.