Keep empty gradient-norm ranks in collective reductions #8918
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.45) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 431 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.363
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8918"
general
weight: 0.35
Levius-Fubuki
Fixes #8912.
get_global_norm_of_tensorsfails when a rank has no local norm inputs, leaving peers in a collective. Materialize iterable inputs once and use a device-local FP32 zero for empty positive p-norm and infinity-norm contributions. Keep the existing model/expert/pipeline group choices and collective order. Nonempty results retain their input-device placement.Validation: 2 x NVIDIA GeForce RTX3090 24GB, driver580.105.08, torch2.12.1+cu130, CUDA13.0, NCCL2.29.7, Python3.12.3. On upstream bf222a2a, a two-rank NCCL reproduction fails with
stack expects a non-empty TensorListon the empty rank; a nonempty generator regression fails for the same reason. With the fix:Coverage includes L1/L2/L3/infinity, one/all/no empty ranks, real model/expert groups, generators, output dtype/device, and a public-engine BF16 ZeRO1 TP2/DP1 clipped-SGD update with an empty norm rank. Changed-file pre-commit checks pass. The committed-diff CI selector identifies 87 impacted v1 test files; those broader tests have not all been run locally.
Duplicate check: no open PR found for #8912 or this empty-input fix. Existing #8478/#8635 address norm accounting rather than empty collective participants. Sibling flattened/ZeRO norm helpers were inspected and are unchanged. No production convergence or throughput claim; other accelerators, full folded-MoE models, offload, and combined pipeline/expert topologies are unvalidated.
AI assistance (OpenAI Codex) was used for investigation, implementation and device tests. The human submitter confirmed manual diff review and test-result verification and authorized submission. Device tests above were executed on the requested server with Codex; no additional human test execution is asserted.
Review follow-up (3db49c4a): extracted the local norm contribution helper and shared collective dispatch, retaining group selection/order and finite-p versus infinity semantics. On Apple M3/macOS ARM64, Python 3.12.13, torch 2.14.1, CPU/Gloo, the complete
tests/unit/runtime/test_runtime_utils.pysuite reports 27 passed before and after refactoring, including real two-process reductions and a BF16 clipped engine update. Changed-file pre-commit, syntax and diff checks pass. The GPU results above were obtained on the original PR revision9ed909a4; CUDA/NCCL tests were not rerun for this follow-up because the server is offline.Published follow-up on 2026-10-30 (
5cffa02f): handle zero-element tensors inside a nonempty iterable for infinity norms. Zero-element infinity contributions are skipped, and a device-local FP32 zero is used when no contributions remain; collective group selection/order and finite-p behavior are unchanged. Expanded existing distributed and iterable tests cover one/all zero-element ranks, mixed tensors, and generators. On Apple M3/macOS 15.1 ARM64, Python 3.12.13, torch 2.14.1, CPU/Gloo, the new zero-element iterable regression fails on prior head3db49c4awith the reported max() error; the complete updated runtime-utils file reports 38 passed after the fix. All applicable changed-file pre-commit checks pass. These checks were executed with Codex; no new CUDA/NCCL validation is claimed. The submitting human confirmed reviewing the final diff and running the relevant tests, and authorized DCO sign-off and publication.