Skip to content

[FIX] DynamicEmb: the hierarchical dist takes a node only when NVLink connects its GPUs - #553

Merged
shijieliu merged 2 commits into
NVIDIA:mainfrom
shijieliu:fea-hier-nvlink-guard
Nov 13, 2026
Merged

shijieliu merged 2 commits into
NVIDIA:mainfrom
shijieliu:fea-hier-nvlink-guard

Conversation

@shijieliu

@shijieliu shijieliu commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Makes the hierarchical output dist (#528) refuse a node whose GPUs NVLink does not connect. On such a node output_dist="hierarchical" raises, and "auto" takes TorchRec's dists with a warning.

Why

The dist's node is NCCL's LSA team. NCCL builds that team from the GPUs of a host whatever joins them, PCIe alone too. The dist moves a node's keys and rows over NVLink alone, and nothing checked that NVLink was there.

The CI's computelab pool includes 8-GPU hosts whose GPUs are joined by PCIe only. The only two computelab runs that reached the dist's tests ran on such hosts, and both failed:

  • on ipp1-2036 (8 × H100 PCIe), test_hier_pipeline.py hung in its DDP stress case;
  • on ipp1-2031 (8 × A100 80GB PCIe), a call of test_hier_dist.py read a status word its kernel had not written: remote_keys = 2^33 on one node, where the kernel writes 0.

Every run on NVLink passed: Eos on 1, 2 and 4 nodes, and GB300 on 1 and 2 trays.

What changes

  • The check. node_size reads each rank's GPU from NVML through nvidia-ml-py (pynvml, which NGC's PyTorch images ship). It reads:

    • the GPU's active NVLinks;
    • what is at their other ends, GPUs or NVSwitches;
    • its NVLink fabric clique, once it has joined one (MNNVL).

    The read rides on the all-gather node_size already does, so it adds no collective.

  • The rule. Two GPUs of a node count as connected when they are:

    • in one fabric clique, across hosts too; or
    • on one host, joined by an NVLink or each on an NVSwitch.
  • The outcome. Otherwise node_size raises NVLinkCheckError, a RuntimeError exported from dynamicemb.shard, on every rank alike. It names the first pair of ranks NVLink does not connect. It also raises when a rank of a node of more than one GPU cannot read its GPU. At a sharding's first input_dist():

    • "hierarchical" raises it, telling to set output_dist to "auto" or "torchrec";
    • "auto" warns and takes TorchRec's dists.
  • No C++ change, and no new tests: the CI runs the dist's tests on Eos and GB300 alone ([FEA] DynamicEmb: the hierarchical dist's tests leave the CI's fwd_bwd and load_dump groups for a hier group #550), where NVLink connects every node.

  • Design doc: sections 2, 4.2, 6, 7.2, 19 and 20.

Validation

  • Locally, against a stubbed NVML: the read and the rule for NVSwitches, PCIe alone, NVLink pairs, a link end NVML does not name, MNNVL cliques, an incomplete fabric registration, an nvidia-ml-py without fabric info, an NVML that does not start, and no nvidia-ml-py.

CI

🤖 Generated with Claude Code

shijieliu and others added 2 commits November 13, 2026 01:19
… connects its GPUs

NCCL's LSA team, the dist's node, is the GPUs of a host whatever joins
them, PCIe alone too. The dist moves a node's keys and rows over NVLink
alone. On two CI hosts of 8 PCIe GPUs (H100 PCIe and A100 PCIe), where the
team was the host's 8, test_hier_pipeline.py hung once, and a call of
test_hier_dist.py read a status word its kernel had not written.

node_size now reads, with each rank's team, its GPU from NVML
(nvidia-ml-py's pynvml, in NGC's PyTorch images): its active NVLinks and
the GPUs or NVSwitches at their other ends, and its NVLink fabric clique
once it joined one (MNNVL). Two GPUs of a node must be in one clique, or
on one host joined by an NVLink or each on an NVSwitch. Otherwise, or when
a rank of a node of more than one GPU cannot read its GPU, node_size
raises the same RuntimeError on every rank, naming the first such pair of
ranks, and a sharding warns and takes TorchRec's dists, under
"hierarchical" as under "auto", as for the other limits of the hardware
(a GPU before compute capability 8.0, a team the op's own communicator
does not get).

Tests: test_hier_dist.py checks the rule on lists of its own and with
the last rank's GPU read as linked to nothing. On a node NVLink does not
connect, test_hier_dist.py checks that a sharding takes TorchRec's dists,
test_hier_pipeline.py that "hierarchical" and "auto" train as TorchRec's
dists do, test_hier_overflow.py and the HSTU example's test skip, and the
existing tests run on the dist expect TorchRec's dists. Docs: sections 2,
4.2, 6, 7.2, 18, 19 and 20.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aleliu <[email protected]>
…Link does not connect

node_size raises NVLinkCheckError (a RuntimeError, exported from
dynamicemb.shard) when NVLink does not connect two GPUs of a node, or a
rank of a node of more than one GPU cannot read its GPU's NVLinks. A
sharding on "hierarchical" raises it at its first input_dist, on every
rank alike, as for a configuration the op refuses, and tells to set
output_dist to "auto" or "torchrec"; one on "auto" still warns and takes
TorchRec's dists.

The CI runs the dist's tests on Eos and GB300 alone (NVIDIA#550), where NVLink
connects every node, so the tests of nodes it does not connect go: the
dist's tests, hier_switch.py, benchmark_utils.py and the HSTU example's
test are as on main. Docs: sections 4.2, 6, 7.2, 19 and 20.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aleliu <[email protected]>
@shijieliu
shijieliu marked this pull request as ready for review November 13, 2026 10:15
@shijieliu
shijieliu merged commit 8accb87 into NVIDIA:main Nov 13, 2026
1 check passed
@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects DynamicEmb sharding setup when users choose its hierarchical or automatic output distribution.

Update the multi-host test before merging so the supported test run can finish.

Findings

  1. P1 Multi-host test now aborts ▶

Summary

Adds an NVLink check before DynamicEmb starts its hierarchical distribution path.

  • Hierarchical output distributions check that NVLink connects each node's GPUs.

The existing multi-host test needs updating: its simulated node now raises before reaching the check it intends to test. shijieliu explicitly chose not to add new tests because CI runs on NVLink-connected Eos and GB300 machines; missing new tests is not reported separately.

Reviews (1) · Last reviewed commit: "[FIX] DynamicEmb: "hierarchical" raises ..." · Reviewed by Greptile

Comment on lines +206 to +208
why = _first_unlinked([links for _, _, _, links in every], hosts, size)
if why is not None:
return None, why
size, why = _agreed_node_size([size for size, _, _ in every], world_size)
split = None if size is None else _split_host([host for _, _, host in every], size)
return None, why, True

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Multi-host test now aborts. On two Eos hosts, check_node_size() deliberately makes hier_output_dist_lsa_size return world_size so it can test the operator's refusal of a wrong team size. This new check rejects that simulated node because its GPUs span hosts without shared NVLink. HierDist.setup() then raises NVLinkCheckError, but the test expects False and a warning and does not catch the exception. The run stops before the training cases. Update that test alongside this change, keeping its intended operator check separate from the new connectivity check.

shijieliu added a commit to shijieliu/recsys-examples that referenced this pull request Nov 13, 2026
…of the team, across nodes too

check_node_size had every rank read a node that is not NCCL's team, to see
the op's own communicator refuse it (its LSA check): on one node half of
the team, across nodes every rank. On two Eos nodes the latter is a node of
16 GPUs across two hosts that only IB joins, which no run can have; since
NVIDIA#553 node_size refuses it first (NVLinkCheckError), and the check failed.
The previous commit took that refusal; this one drops it and reads half
of the team across nodes too, inside the team's NVLink domain, whose nodes
then talk over GIN: the op's LSA check refuses it, as the check means, or
NCCL refuses its GIN first (the warning then says why).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aleliu <[email protected]>
shijieliu added a commit to shijieliu/recsys-examples that referenced this pull request Nov 13, 2026
check_node_size had every rank read a node size that NCCL never gives
(half of the team on one node, every rank across nodes) and expected the
op's own LSA check to refuse that node. No run has such a node: node_size
and the op read the same team from NCCL. Across Eos nodes it was a node of
16 GPUs over IB, which since NVIDIA#553 node_size refuses first, and
eos-hier-2nodes failed on it. The check goes, with its words in the
docstrings and the design doc's section 18. The previous two commits'
attempts to keep it are undone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aleliu <[email protected]>
shijieliu added a commit that referenced this pull request Nov 14, 2026
…am (#554)

* [FIX] DynamicEmb: test_hier_dist takes the NVLink check's refusal of a node across Eos hosts

Across nodes, check_node_size has every rank read a node of all the ranks,
which the op's own communicator should refuse (its LSA check). Since #553,
node_size refuses such a node first when NVLink does not join its hosts, as
on Eos (two hosts over IB), and a sharding on "hierarchical" raises
NVLinkCheckError. The check took no exception, so test_hier_dist.py failed
on two Eos nodes (main's CI, eos-hier-2nodes). It now counts that refusal
too. GB300's trays share an NVLink clique: there the op's LSA check refuses
the node, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aleliu <[email protected]>

* [FIX] DynamicEmb: test_hier_dist's node that is not the team is half of the team, across nodes too

check_node_size had every rank read a node that is not NCCL's team, to see
the op's own communicator refuse it (its LSA check): on one node half of
the team, across nodes every rank. On two Eos nodes the latter is a node of
16 GPUs across two hosts that only IB joins, which no run can have; since
#553 node_size refuses it first (NVLinkCheckError), and the check failed.
The previous commit took that refusal; this one drops it and reads half
of the team across nodes too, inside the team's NVLink domain, whose nodes
then talk over GIN: the op's LSA check refuses it, as the check means, or
NCCL refuses its GIN first (the warning then says why).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aleliu <[email protected]>

* [FIX] DynamicEmb: test_hier_dist checks no node that is not NCCL's team

check_node_size had every rank read a node size that NCCL never gives
(half of the team on one node, every rank across nodes) and expected the
op's own LSA check to refuse that node. No run has such a node: node_size
and the op read the same team from NCCL. Across Eos nodes it was a node of
16 GPUs over IB, which since #553 node_size refuses first, and
eos-hier-2nodes failed on it. The check goes, with its words in the
docstrings and the design doc's section 18. The previous two commits'
attempts to keep it are undone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aleliu <[email protected]>

---------

Signed-off-by: aleliu <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
shijieliu added a commit to shijieliu/recsys-examples that referenced this pull request Nov 16, 2026
Brings in main 4466f9d: NVIDIA#528 (hierarchical dist), NVIDIA#550, NVIDIA#553, NVIDIA#555, NVIDIA#478
(exportable embedding collections with NVE layers), NVIDIA#554 and NVIDIA#556.

Conflicts:
- corelib/dynamicemb/CMakeLists.txt: main (NVIDIA#478) adds the RPATH, NVE_ROOT
  and DYNAMICEMB_PYTHON_MODULE_DIR lines above the C++ standard; kept them,
  with this branch's C++20 (PyTorch 2.14's headers need it).
- corelib/dynamicemb/setup.py: main's file. It already has this branch's
  CUDA_HOME import and sm_103-aware default archs (from NVIDIA#528); the conflict
  was only main's new `import torch` and `Extension` imports.
- corelib/dynamicemb/README.md: main's new inference build section, after
  this branch's FBGEMM 1.9.0 / TorchRec 1.9.2 lines.

docker/Dockerfile merged cleanly: NVIDIA#478's build stage rebuilds the default
NVE from the submodule with the same pip command and settings as the devel
stage, and builds torch_binding_build through the CMakeLists above.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aleliu <[email protected]>
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.

1 participant