← Back to Pull requests

Keep empty gradient-norm ranks in collective reductions #8918

Closed
unknown closed this pull request without merging on Nov 25, 2026 00:52 UTC
View on GitHub
unknown unknown commented on Oct 27, 2026 01:31 UTC
Author

Fixes #8912.

get_global_norm_of_tensors fails 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 TensorList on the empty rank; a nonempty generator regression fails for the same reason. With the fix:

python -m pytest --forked tests/unit/runtime/test_runtime_utils.py --torch_ver=2.12.1+cu130 --cuda_ver=13.0 -q
27 passed

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.py suite 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 revision 9ed909a4; 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 head 3db49c4a with 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.

Diff: 431 lines (+323 / -108) across 5 files Reviewer: Levius-Fubuki Review duration: 41721m
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
0.45
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 45.2% (MEDIUM) · Higher = larger blast radius
45.2%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 19.5% · Safe to merge
19.5%