Skip to content

[distributed] Add a manual collective-order fault probe - #5658

Closed
tranle-fw wants to merge 3 commits into
pytorch:mainfrom
tranle-fw:repro-cp-fsdp-collective-ordering
Closed

tranle-fw wants to merge 3 commits into
pytorch:mainfrom
tranle-fw:repro-cp-fsdp-collective-ordering

Conversation

@tranle-fw

@tranle-fw tranle-fw commented Oct 28, 2026 •

Copy link
Copy Markdown

Superseded by #5663, which combines the FSDP communicator fix with this tested repro and evidence under tranle-fw.

Superseded by zpcore/torchtitan#1, which targets the branch behind pytorch/torchtitan#5645 and carries the same tested script and sanitized evidence.

  • Adds an 82-line manual collective-order reproducer for [distributed] Isolate FSDP from CP's default-group reuse to prevent a deadlock #5645: matching warmup, then rank 0 submits A2A→AG while ranks 1–3 submit AG→A2A. --separate-group gives AG its own communicator.
  • Fresh run of the unchanged script: shared PG 0 / sequence 3 times out (rank 0 A2A versus peers AG); separate communicators pass on all four ranks with exact outputs, exit 0. Sanitized evidence below.
  • This is an intentional host-order fault diagnostic. Separate-group completion is measured here, not a general reversed-order guarantee (NVIDIA ordering contract). Kept in draft for review.
Reproduction commands and measured setup

Exact tested source: 3803b11c, fault at line 56. Both runs used the same four B300 GPUs and PyTorch 2.13.0a0+8145d630e8.nv26.06, CUDA 13.3, NCCL 2.30.5.

Run each case in a separate process/container with an external deadline. Equivalent local invocations with the recorded communication settings:

export NCCL_LAUNCH_ORDER_IMPLICIT=1
export NCCL_CUMEM_ENABLE=0 NCCL_CUMEM_HOST_ENABLE=0 NCCL_NVLS_ENABLE=0
export NCCL_SOCKET_IFNAME=lo NCCL_DEBUG=WARN TORCH_NCCL_DUMP_ON_TIMEOUT=0

timeout --signal=KILL 150s torchrun --standalone --nproc-per-node=4 scripts/repro_collective_order.py
timeout --signal=KILL 150s torchrun --standalone --nproc-per-node=4 scripts/repro_collective_order.py --separate-group

The measured runs used a container deadline and a CUDA-readiness gate before process-group creation; neither changes the script's fault phase. No GPU delay is injected. Source SHA256: fb0abc0ec4a74a099a8f89125bf71e270cd9092253191f4c7e62aea79f6e88be.

Fresh run of the exact draft: sanitized forced-order logs

Four CUDA ranks; PyTorch 2.13.0a0, CUDA 13.3, NCCL 2.30.5; NCCL_LAUNCH_ORDER_IMPLICIT=1 in both runs. After matching AG→A2A warmup, rank 0 deliberately submits A2A→AG while peers submit AG→A2A. This is a host-order negative control, not GPU-only skew or a natural FSDP prefetch reproduction. Host/process identifiers, timestamps, paths and addresses are omitted; retained lines/payloads below are unchanged.

Shared group: all ranks warm up and both asynchronous calls return on every rank, then collective sequence 3 times out.

rank=0 WARMED
rank=0 warmup=False submitted=a2a
rank=0 warmup=False submitted=ag
rank=2 WARMED
rank=3 WARMED
rank=2 warmup=False submitted=ag
rank=3 warmup=False submitted=ag
rank=2 warmup=False submitted=a2a
rank=3 warmup=False submitted=a2a
rank=1 WARMED
rank=1 warmup=False submitted=ag
rank=1 warmup=False submitted=a2a
[Rank 3] Watchdog caught collective operation timeout: WorkNCCL(SeqNum=3, OpType=_ALLGATHER_BASE, NumelIn=1048576, NumelOut=4194304, Timeout(ms)=30000)
[Rank 2] Watchdog caught collective operation timeout: WorkNCCL(SeqNum=3, OpType=_ALLGATHER_BASE, NumelIn=1048576, NumelOut=4194304, Timeout(ms)=30000)
[Rank 0] Watchdog caught collective operation timeout: WorkNCCL(SeqNum=3, OpType=ALLTOALL_BASE, NumelIn=1048576, NumelOut=1048576, Timeout(ms)=30000)
[Rank 1] Watchdog caught collective operation timeout: WorkNCCL(SeqNum=3, OpType=_ALLGATHER_BASE, NumelIn=1048576, NumelOut=4194304, Timeout(ms)=30000)

Dedicated all-gather group: the same opposite host order completes. PASS is printed after CUDA synchronization and exact checks of both outputs.

rank=2 PASS
rank=0 PASS
rank=1 PASS
rank=3 PASS

The shared run recorded the 30-second watchdog, then required its external 150-second container deadline (exit 137). The dedicated run exited 0 in 16.090 seconds. Dedicated completion is an empirical result of this test, not a general guarantee for reversed cross-communicator order.

@meta-cla

meta-cla Bot commented Oct 28, 2026

Copy link
Copy Markdown

Hi @tranle-fw!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@tranle-fw tranle-fw changed the title [distributed] Add a minimal FSDP2/CP communicator example [distributed] Add a minimal collective-order fault reproducer Oct 28, 2026
@tranle-fw tranle-fw changed the title [distributed] Add a minimal collective-order fault reproducer [distributed] Add a manual collective-order fault probe Oct 28, 2026
@tranle-fw tranle-fw closed this Oct 28, 2026
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