Repository navigation
fix(data-plane): preserve tensor layouts and avoid int16 widening - #4263
ZhiyuLi-Nvidia merged 2 commits into
Conversation
|
Thanks @Alvorecer721 for the fix! LGTM! Just several nit questions.
|
c4871a0 to
afc9d6c
Compare
There was a problem hiding this comment.
LGTM. Verified old vs new logic on 2× GB300 / NCCL 2.30.7:
- Correct: int8 / int16 / int32 (incl.
-1, min/max), CPU + CUDA source, contiguous + permuted. - Fixes a hang: old path with a non-contiguous CUDA tensor raises
Tensors must be contiguouson the leader while followers hang. - int16, 384 MiB: 2.3 → 0.8 ms (CUDA source); peak extra GPU memory ~1.5 GiB → ≤384 MiB.
|
/ok to test afc9d6c |
afc9d6c to
b1870b4
Compare
|
/ok to test b1870b4 |
Stage ordinary tensors in contiguous logical order without replacing the source tensor. Restore receiver device types and release temporary staging between fields. Add real Gloo/NCCL regressions for strided, scalar and empty tensors from either sender rank. Signed-off-by: Alvorecer721 <[email protected]>
Send ordinary and packed int16 payloads through uint8 views of their existing storage instead of widening to int32. Preserve packed metadata and check the complete signed int16 domain and exact two-byte payload size on Gloo and NCCL. Signed-off-by: Alvorecer721 <[email protected]>
b1870b4 to
ba7f315
Compare
|
/ok to test ba7f315 |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
What does this PR do ?
Preserves noncontiguous tensor values in replica leader broadcasts and eliminates int16 widening buffers.
The broadcast descriptor carries shape/dtype/device, while receiving ranks allocate contiguous storage. Sending a transposed tensor without normalizing its layout therefore changes its logical values with Gloo:
[[0, 3], [1, 4], [2, 5]]arrives as[[0, 1], [2, 3], [4, 5]]. NCCL also requires contiguous input. The local data plane can preserve tensor views, so this is not guaranteed by the caller.Two separate signed-off commits:
.contiguous()because.to()can return its input unchanged when dtype and device already match.Packed metadata, segment deduplication, preprocessing settings, and per-field staging remain unchanged. The patch changes only the broadcast helper and its tests; there are no dependency or configuration changes.
Issues
Fixes #4262
Usage
Applies automatically to replica leader broadcasts. To run the focused tests in a configured upstream environment:
uv run --group test pytest tests/unit/data_plane/test_leader_broadcast.py -qCPU tests use two Gloo ranks; NCCL coverage requires two CUDA devices.
Before your PR is "Ready for review"
Pre checks:
Additional Information
Validation performed
tests/unit/data_plane/test_leader_broadcast.pypass through normal package imports, including all five NCCL cases and the mixin-default test. No exclusions or skips in this file. Python 3.13.14, Ray 2.56.1, Transformers 5.12.1, TransferQueue 0.1.9, Lens 0.2.0+b0f977d, Torch 2.11.0+cu130, NCCL 2.28.9. The earlier isolated results below are retained for context.tests/functional/sft_v2_energon.sh policy.megatron_cfg.tensor_model_parallel_size=2, using Qwen2.5-VL-3B, the local data plane, two GH200 GPUs, and three optimizer steps. Losses were 6.2562, 5.8304, and 7.5371; checkpoint saving and the script's finite-loss check passed. This is training integration coverage, not a convergence or numerical-parity claim.1f8873bb, MCore6a366090, TE 2.18.0) inside the v0.7.0 base container. Its first attempt failed because cuDNN loaded duplicate graph libraries from the Python environment and base container. Session-local library aliases made both filename forms resolve to the same locked cuDNN installation; a standalone convolution reproducer and the unchanged functional test then passed. No PR source or dependency pins were changed.torchaudio; three vLLM generation cases fail with cuBLAS initialization errors; two telemetry tests fail on metric-registration order; and three Llama-2 FLOPs cases receive Hugging Face HTTP 403. There are 46 recorded runtime skips, plus module-level collection skips/backend exclusions; 11 data-plane cases require unavailable mlx5 RDMA. No unrelated production source was changed to address these.No module named megatron) and blocked client. That exact case and the complete data-plane group pass in fresh processes; the interaction remains unresolved. A later vLLM generation attempt was interrupted cleanly after a worker initialization error left its controlling test blocked. Its unfinished generation cases remain unqualified; the other model files passed 539 additional cases in a fresh continuation. Test selections and earlier failures are retained. A cold OpenMathInstruct-2 timeout passed on retry.PackedTensor/BatchedDataDictclass source with isolated imports. Test bodies are unchanged; Gloo/NCCL collectives are real. One unrelated default-mixin-method test was excluded. This validates helper behavior, not full-package imports, training, or upstream CI.Measured allocation benefit
For a contiguous 64 MiB int16 payload sourced on CPU, three repeated two-rank NCCL measurements reduce peak extra PyTorch CUDA allocation from 256 MiB to 64 MiB on both sender and receiver. Wire payload drops from 128 MiB to 64 MiB. Every received value is checked exactly.
These measurements exclude preexisting input storage, allocator-reserved memory, and NCCL allocations outside PyTorch. They establish a helper-level allocation reduction, not total training-memory or throughput gains.
CI request
This PR is ready for maintainer review. The complete local matrix and upstream CI are not yet passing; the package and training checks above are the current evidence. Could a maintainer assign the appropriate CI tier (suggested
CI:L1because this changes training-input transport) and authorize testing ofc4871a09ed95d758f51e88e0f13cce0be95783dcwith/ok to test <full-sha>after review? I do not have permission to set upstream labels or authorize external-fork CI.