Skip to content

[release/2.13] [test] Reuse device meshes across FSDP2 ND-mesh subtests (#198301) - #3695

Merged
pragupta merged 1 commit into
release/2.13from
users/chinmaydk99/cp-198301-release-2.13
Sep 24, 2026
Merged

pragupta merged 1 commit into
release/2.13from
users/chinmaydk99/cp-198301-release-2.13

Conversation

@chinmaydk99

Copy link
Copy Markdown

Cherry-pick of pytorch#198301 into release/2.13.

test_2d_mlp_with_nd_mesh and test_3d_mlp_with_nd_mesh build a global mesh
and pass it to their subtest helpers, but each helper overwrote it with a
freshly built mesh, so every subtest created new NCCL communicators.
test_shard_placement_fn_tp_ep rebuilt its meshes in every subtest even
though they depend only on tp_degree and dp_replicate.

On RCCL every communicator keeps a ~40 MB proxy-ops segment per rank in
/dev/shm until the test's processes exit, so each of these tests exceeded
a 10 GiB /dev/shm on 8 GPUs and failed with ENOSPC.

Use the mesh that is passed in, and build the tp_ep meshes once per
configuration. Peak /dev/shm on 8x MI300X at this commit:
2D 16.1 -> 1.3 GB, 3D 21.4 -> 1.6 GB, tp_ep 20.5 -> 8.8 GB.

Cherry-picked with -x from a13af274c73c022c92f42f7925947f960d52e12d; applied cleanly with no conflicts. Touches one file: test/distributed/_composable/fsdp/test_fully_shard_training.py (+8/-3).

Note: the upstream PR is still open at the time of this cherry-pick. If it is squashed or rebased on merge, the SHA in the (cherry picked from ...) trailer will not exist in main — the PR link above is the stable reference for provenance.

test_2d_mlp_with_nd_mesh and test_3d_mlp_with_nd_mesh build a global mesh
and pass it to their subtest helpers, but each helper overwrote it with a
freshly built mesh, so every subtest created new NCCL communicators.
test_shard_placement_fn_tp_ep rebuilt its meshes in every subtest even
though they depend only on tp_degree and dp_replicate.

On RCCL every communicator keeps a ~40 MB proxy-ops segment per rank in
/dev/shm until the test's processes exit, so each of these tests exceeded
a 10 GiB /dev/shm on 8 GPUs and failed with ENOSPC.

Use the mesh that is passed in, and build the tp_ep meshes once per
configuration. Peak /dev/shm on 8x MI300X at this commit:
2D 16.1 -> 1.3 GB, 3D 21.4 -> 1.6 GB, tp_ep 20.5 -> 8.8 GB.

(cherry picked from commit a13af27)
@pragupta
pragupta merged commit 036d780 into release/2.13 Sep 24, 2026
3 checks passed
@pragupta
pragupta deleted the users/chinmaydk99/cp-198301-release-2.13 branch September 24, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants