Skip to content

[FIX] CI follow-ups to #478: TP layer norm on an empty batch; FlexKV without MPS - #556

Merged
shijieliu merged 2 commits into
NVIDIA:mainfrom
shijieliu:fix/ci-478-followups
Nov 15, 2026
Merged

shijieliu merged 2 commits into
NVIDIA:mainfrom
shijieliu:fix/ci-478-followups

Conversation

@shijieliu

@shijieliu shijieliu commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes the code side of four CI failures that #478's run hit (pipeline #81873751). All four failed the same way on main without #478 (pipeline #81873480). #478 is merged, so this PR targets main.

The two fixes that belong in the CI scripts (NVLS and PXN) are in distributed-recommender!145.

1. unit_test_tp_4gpu: the TP layer norm fails on a rank's empty batch

  • Error. pretrain_gr_ranking.py with kuairand_1k_ranking_tp2.gin fails at its first eval, on ranks 2 and 3, at tp_layer_norm.py:131: cannot reshape tensor of 0 elements into shape [0, -1]. The CI has failed this way since at least October.
  • Cause.
    • HSTUSequenceDataset pads a rank's share of the last global batch with empty samples.
    • When the eval set doesn't fill that batch, a DP rank gets no sample at all, and its TP ranks run the model on T = 0 tokens.
    • TPLayerNormMulDropout then calls u.view(T, -1), and -1 cannot be inferred from 0 elements.
  • Fix. u.flatten(1) gives [0, H*D]. pytorch_norm_mul_dropout, the unfused path, had the same reshape and gets the same fix.
  • The fused Triton op already returns early when N == 0, and the TP all-gather and split work on empty tensors.

2. A100 1-GPU jobs lose CUDA: FlexKV starts an MPS daemon nobody asked for

  • Errors. Different jobs on the shared DGX A100 hosts fail when they start a new CUDA process:
    • inference_test_nve_2605_1gpu: Inductor's autotune subprocess says Could not find an active GPU backend, then the C++ demo says CUDA is required for this demo;
    • unit_test_1gpu_a100: a new container reports No CUDA-capable device is detected (error 100);
    • inference_test_1gpu: FlexKV's spawned worker reports CUDA is not available for FBGEMM HSTU.
  • Cause.
    • FlexKVStorage takes enable_mps=False, and every caller passes 0.
    • It sets FLEXKV_ENABLE_MPS in _init_client, but FlexKV reads the variable into GLOBAL_CONFIG_FROM_ENV when flexkv.common.config is first imported. That import happens in this module's own imports, so the variable comes too late.
    • FlexKV's default is 1, so KVManager ran nvidia-cuda-mps-control -d in every FlexKV run.
  • Evidence. The CUDA losses follow FlexKV starts on the same host within seconds:
    • on luna-prod-78-80gb, inference_test_1gpu started FlexKV at 06:03:55 on Nov 13; nve_2605 and unit_test_1gpu_a100 lost CUDA around 06:04;
    • on ro-prod-01-80gb, FlexKV started at 05:34:36 and nve_2605 died around 05:35;
    • once, a fresh FlexKV container found another job's daemon (An instance of this daemon is already running).
  • Not the hardware. The same NVE 26.05 export passed on luna on Nov 3 and 4.
  • Fix. _init_client also sets GLOBAL_CONFIG_FROM_ENV.enable_mps, as it already does for enable_layerwise_transfer.

3 and 4. The fixes in the CI scripts (distributed-recommender!145)

  • unit_test_4gpu and unit_test_tp_4gpu.
    • On the shared H100 hosts (viking), NCCL fails to bind NVLS multicast memory on the job's 4 GPUs: Failed to bind NVLink SHARP (NVLS) Multicast memory ... CUDA error 2 'out of memory'.
    • This happened in all five runs on Nov 13.
    • The tests don't need NVLS, so their containers set NCCL_NVLS_ENABLE=0, as NCCL's own error message suggests.
  • run-cw-dfw-e2e-benchmark.
    • With NCCL 2.30.7 (the 26.07 image), every run since Nov 2 fails in TorchRec's _get_recat on garbage batch_size_per_rank. That's 6 of 6 runs, on different node pairs.
    • It is always local rank 6 that gets the garbage. It comes from every rank of the other node except its same-rail peer, i.e. from the ranks whose data PXN relays.
    • The one run on 26.09's NCCL 2.31.2 passed.
    • The benchmark now sets NCCL_PXN_DISABLE=1. The 26.09 image ([BUILD] NGC PyTorch 26.09 base image, and DynamicEmb for GB300 (sm_103) #549) would make this unnecessary.

CI

Pipeline #82135760 ran this branch with !145's scripts, plus a temporary diagnostic for the CoreWeave job. Every job passed except dynamicemb_test_fwd_bwd_8gpus, which failed on infrastructure (below).

  • unit_test_tp_4gpu: the TP2 pretraining (kuairand_1k_ranking_tp2.gin) ran all 550 iterations with 55 evals, with no reshape error.
  • Inference jobs:
    • inference_test_1gpu, inference_test_nve_2605_1gpu and inference_unit_test_1gpu passed. Both C++ demos passed, and the logs show no MPS daemon and no CUDA loss.
    • These jobs ran on PCIe A100 hosts this time, not on the shared DGX hosts where the interference showed.
  • run-cw-dfw-e2e-benchmark (NCCL 2.30.7, PXN off): 1000 iterations, max 5551 TFLOPS (the floor is 3900), no _get_recat error.
    • The diagnostic ran the splits all-to-all alone, 300 times each with PXN on and off, and found no bad values either way.
    • So the corruption only appears inside the benchmark. The PXN diagnosis rests on the rank pattern and on this run passing.
  • unit_test_4gpu: passed. Both 4-GPU jobs ran on hosts without NVSwitch (A100 PCIe and H100 NVL), so this run did not exercise NVLS-off.
  • Also passed: pre_check, unit_test_1gpu_a100, unit_test_1gpu_h100, L20_unit_test_1gpu, dynamicemb_test_load_dump_8gpus, the Eos and GB300 hier jobs (the GB300 two-tray job after one retry, for the runner's Lustre File exists error), and the B200 jobs.
  • dynamicemb_test_fwd_bwd_8gpus failed twice on infrastructure. This PR doesn't touch DynamicEmb.
    • The first attempt never started its container on genoa-cl-02: nvml error: gpu requires reset.
    • The retry ran on viking-dvt-151. There, all 1089 cases of test_table_dump_load.py errored in their first 8-rank barrier, because NCCL could not bind NVLS memory (CUDA error 401).
    • !145 now turns NVLS off for this job too (dynamicemb_test.sh). That change was added after this pipeline started, so the pipeline did not run it.

🤖 Generated with Claude Code

shijieliu and others added 2 commits November 14, 2026 01:30
HSTUSequenceDataset pads a rank's share of the last global batch with empty
samples, so when the eval set does not fill that batch a DP rank can get no
sample at all: its TP ranks run the model on T = 0 tokens, and
TPLayerNormMulDropout's u.view(T, -1) cannot infer -1 from 0 elements
("cannot reshape tensor of 0 elements into shape [0, -1]"). That failed
unit_test_tp_4gpu's pretraining (kuairand_1k_ranking_tp2.gin) at its first
eval, on rank 3. u.flatten(1) gives [0, H*D]. pytorch_norm_mul_dropout, the
unfused path, had the same reshape.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: aleliu <[email protected]>
FlexKVStorage takes enable_mps=False, and every caller passes 0, but FlexKV
reads FLEXKV_ENABLE_MPS (default 1) into GLOBAL_CONFIG_FROM_ENV when
flexkv.common.config is first imported, which this module's own imports do:
the variable set in _init_client came too late, and KVManager ran
nvidia-cuda-mps-control -d in every FlexKV run. On the CI's shared DGX A100
hosts that daemon broke CUDA for new processes of other jobs' containers on
the same host ("No CUDA-capable device is detected", "Could not find an
active GPU backend"), seconds after a FlexKV test started it (e.g.
inference_test_nve_2605_1gpu and unit_test_1gpu_a100 on luna-prod-78-80gb
on Nov 13), and once a FlexKV run found another job's daemon ("An instance
of this daemon is already running"). _init_client now sets enable_mps in
GLOBAL_CONFIG_FROM_ENV too, as it does for enable_layerwise_transfer.

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

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR affects HSTU layer runs and FlexKV startup on CUDA hosts.

The PR appears safe to merge, with a non-blocking request to test empty batches.

Findings

  1. P2 Empty batches lack regression coverage ▶

Summary

This PR fixes empty-batch reshaping in HSTU layer normalization and makes FlexKV apply the requested MPS setting to its cached configuration.

  • Tensor-parallel layer norm now accepts empty rank batches.
  • FlexKV starts its manager with the configured MPS setting.

Reviews (1) · Last reviewed commit: "[FIX] KVCache: FlexKV starts no MPS daem..." · Reviewed by Greptile

Comment thread examples/hstu/modules/tp_layer_norm.py Resolved
@shijieliu
shijieliu merged commit 4466f9d into NVIDIA:main Nov 15, 2026
1 check passed
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