Repository navigation
[FIX] CI follow-ups to #478: TP layer norm on an empty batch; FlexKV without MPS - #556
Merged
Merged
Conversation
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]>
Contributor
[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
SummaryThis PR fixes empty-batch reshaping in HSTU layer normalization and makes FlexKV apply the requested MPS setting to its cached configuration.
Reviews (1) · Last reviewed commit: "[FIX] KVCache: FlexKV starts no MPS daem..." · Reviewed by Greptile |
This was referenced Nov 15, 2026
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]>
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.
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 batchpretrain_gr_ranking.pywithkuairand_1k_ranking_tp2.ginfails at its first eval, on ranks 2 and 3, attp_layer_norm.py:131:cannot reshape tensor of 0 elements into shape [0, -1]. The CI has failed this way since at least October.HSTUSequenceDatasetpads a rank's share of the last global batch with empty samples.TPLayerNormMulDropoutthen callsu.view(T, -1), and-1cannot be inferred from 0 elements.u.flatten(1)gives[0, H*D].pytorch_norm_mul_dropout, the unfused path, had the same reshape and gets the same fix.2. A100 1-GPU jobs lose CUDA: FlexKV starts an MPS daemon nobody asked for
inference_test_nve_2605_1gpu: Inductor's autotune subprocess saysCould not find an active GPU backend, then the C++ demo saysCUDA is required for this demo;unit_test_1gpu_a100: a new container reportsNo CUDA-capable device is detected (error 100);inference_test_1gpu: FlexKV's spawned worker reportsCUDA is not available for FBGEMM HSTU.FlexKVStoragetakesenable_mps=False, and every caller passes 0.FLEXKV_ENABLE_MPSin_init_client, but FlexKV reads the variable intoGLOBAL_CONFIG_FROM_ENVwhenflexkv.common.configis first imported. That import happens in this module's own imports, so the variable comes too late.KVManagerrannvidia-cuda-mps-control -din every FlexKV run.inference_test_1gpustarted FlexKV at 06:03:55 on Nov 13;nve_2605andunit_test_1gpu_a100lost CUDA around 06:04;nve_2605died around 05:35;An instance of this daemon is already running)._init_clientalso setsGLOBAL_CONFIG_FROM_ENV.enable_mps, as it already does forenable_layerwise_transfer.3 and 4. The fixes in the CI scripts (distributed-recommender!145)
unit_test_4gpuandunit_test_tp_4gpu.Failed to bind NVLink SHARP (NVLS) Multicast memory ... CUDA error 2 'out of memory'.NCCL_NVLS_ENABLE=0, as NCCL's own error message suggests.run-cw-dfw-e2e-benchmark._get_recaton garbagebatch_size_per_rank. That's 6 of 6 runs, on different node pairs.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_test_1gpu,inference_test_nve_2605_1gpuandinference_unit_test_1gpupassed. Both C++ demos passed, and the logs show no MPS daemon and no CUDA loss.run-cw-dfw-e2e-benchmark(NCCL 2.30.7, PXN off): 1000 iterations, max 5551 TFLOPS (the floor is 3900), no_get_recaterror.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.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 LustreFile existserror), and the B200 jobs.dynamicemb_test_fwd_bwd_8gpusfailed twice on infrastructure. This PR doesn't touch DynamicEmb.nvml error: gpu requires reset.test_table_dump_load.pyerrored in their first 8-rank barrier, because NCCL could not bind NVLS memory (CUDA error 401).dynamicemb_test.sh). That change was added after this pipeline started, so the pipeline did not run it.🤖 Generated with Claude Code