Repository navigation
Conversation
…rity
test_all_gather_parity fails on ROCm 10.3.0-20261027 (torch 2.15.0+rocm10.3.0a20261027)
with "RuntimeError: Expected tensor on cuda:1 but found tensor on cuda:0".
The test allocated its tensors on cuda:{tensor_model_parallel_rank}. With a
tensor-parallel size of 1 every rank has TP rank 0, so global rank 1 passed a
cuda:0 tensor to a group bound to cuda:1. The torch 2.15 default "nccl" backend
rejects tensors that are not on the group's bound device; the legacy
ProcessGroupNCCL accepted them.
Allocate on torch.cuda.current_device(), which DistributedTestBase sets to the
rank's device. The tensor values still depend on the TP rank, so the parity
checks are unchanged. test_reduce_scatter_parity had the same line and gets
the same change.
Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
Validation, commit
|
2 tasks done
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.
Motivation
In short:
test_all_gather_parityandtest_reduce_scatter_parityput their tensors on the wrong GPU, and the torch 2.15 defaultncclbackend now rejects that.Both
test_layers.NcclTensorParallelLayerTesttests fail on ROCm 10.3.0-20261027 (torch2.15.0+rocm10.3.0a20261027) on every host where Apex_UT reaches them. They passed on 10.0.0-20260729. All runs use apex11867be, therelease/1.15.0pin inrelated_commits.test_all_gather_paritytest_reduce_scatter_parityctr-navi4x-aj63-ws13ctr-navi4x-at48-ws008quanta-ccs-aus-d10-19smci350-rck-g03-d13-03Technical Details
In short: allocate on the rank's current device instead of
cuda:{tensor_model_parallel_rank}.tests/L0/run_transformer/test_layers.py: both tests allocated oncuda:{tensor_model_parallel_rank}(lines 55 and 103). Whenever the tensor-parallel size is smaller than the world size, a rank whose tensor-parallel rank differs from its global rank passes a tensor on the wrong GPU.test_all_gather_parityhits this at tensor-parallel size 1 (global rank 1 passes acuda:0tensor to a group bound tocuda:1).test_reduce_scatter_paritystarts at tensor-parallel size 2, so it hits it only with 4 or more GPUs (global rank 2 passes acuda:0tensor). The torch 2.15 defaultncclbackend rejects tensors that are not on the group's bound device; the legacyProcessGroupNCCLaccepted them.The tensors now go on
torch.cuda.current_device(), whichDistributedTestBasesets to the rank's device. The values still depend on the tensor-parallel rank, so what the parity checks compare is unchanged.Effect on other suites: only these two tests change. The UCC variants of both tests are skipped without
torch_ucc. No library code changes.Related: the
test_pipeline_parallel_fwd_bwdout-of-memory errors in the same Apex_UT runs are a separate root cause: #345.Test Result
Full Apex_UT rerun through the frameworks-qa-ci Functional Test Runner on
ctr-navi4x-aj63-ws13with the same image (rocm/frameworks-internal:rocm10.3.0a20261027_ubuntu26.04_py3.14_pytorch_2.15.0_31b8278, wrapperfqa-ci-wrapper:9f4114214363), with apex checked out at this PR's commitd6c652f.11867be(pin)d6c652ftest_all_gather_paritytest_reduce_scatter_parityThe 6 errors left in the passing run are the
test_pipeline_parallel_fwd_bwdout-of-memory errors, fixed by #345. No new errors.apex-test-layers-fail-expected-tensor-on-cuda1.log (run 40688983363)
apex-test-layers-pass-current-device.log (run 40766959214)
How the PR commit was run: the job was dispatched from the frameworks-qa-ci branch
test/apex-ut-commit-override, which only letsapex_uttake anAPEX_COMMIT_OVERRIDEenv var instead of therelated_commitsSHA. Everything else is the same as the nightly job.Not run: a run with this fix on a host with 4 or more GPUs, which is where
test_reduce_scatter_parityfails.Not covered: CI picks the fix up once
related_commitspoints at an apex commit that contains it (it pinsrelease/1.15.0, so this needs a backport there too).Submission Checklist