Skip to content

[Fix] diffusion: Keep the N-rank IPC all-to-all's flags and staging out of expandable segments - #45948

Merged
mickqian merged 1 commit into
mainfrom
mick/diffusion-ipc-a2a-multi-shareable
Oct 23, 2026
Merged

mickqian merged 1 commit into
mainfrom
mick/diffusion-ipc-a2a-multi-shareable

Conversation

@mickqian

@mickqian mickqian commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

#43584 moved the 2-rank IPC all-to-all's exported buffers and the N-rank _PipelinePool onto ipc_shareable_zeros, but the N-rank transport's signal flags, timeout flag and exchange staging (from #43164) stayed plain torch.zeros. Under PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True those can land in expandable segments, whose IPC import calls pidfd_getfd. Containers without ptrace rights deny that syscall with EPERM.

Seen on a RunPod 4xB300 container (2026-10-22): every sequence-parallel server with more than two ranks logged IPC all-to-all (multi-rank) unavailable (pidfd_getfd: Operation not permitted); using NCCL (24 warnings across 6 runs: Wan2.2-A14B, Cosmos3, MiniMax-H3 4-GPU), so the copy-engine all-to-all and the head-grouped pipelined attention never ran.

It can also hang. Whether a plain torch.zeros buffer lands in an expandable block depends on each rank's allocator history, so one rank can import its peer's flags while the other fails. Init then deadlocks: one rank waits in _share(timed_out)'s all_gather_object, the other in the all-reduce where ranks agree on the outcome, until the NCCL watchdog aborts both (~10 min). On RunPod all four ranks happened to fail alike, which is why only the fallback was visible.

Modifications

  • ipc_a2a_multi.py: the signal flags, timeout flag and staging buffers come from ipc_shareable_zeros, like every other exported buffer. If sharing the flags still fails, the init error now says so.
  • ipc_a2a.py: one docstring line on why ipc_shareable_zeros matters (pidfd_getfd).
  • The NCCL fallback for hosts that genuinely cannot do CUDA IPC is unchanged.

Tests:

  • test/unit/test_ipc_a2a_lifecycle.py (CPU, mocked): every buffer the N-rank path exports must come from ipc_shareable_zeros. On main the flags, timeout flag and staging fail it.
  • single_test_file/test_ipc_a2a_multi_gpu.py: reruns the 2-rank multi-rank worker with expandable_segments:True under a seccomp filter that makes pidfd_getfd fail with EPERM.

Accuracy Tests

No numerical change: the same buffers, allocated outside expandable segments.

On 2xH200 with pidfd_getfd blocked by seccomp (reproduces the RunPod warning exactly):

main this PR
multi-rank worker, expandable segments on, syscall allowed passes, 3 pidfd_getfd calls passes, 0 calls
pipelined-attention test, syscall blocked RunPod warning on both ranks, FAIL PASS, 0 calls
new 2-GPU test, syscall blocked deadlock (713 s, watchdog) PASS (~36 s)
2-rank IPC test, syscall blocked PASS, 0 calls PASS, 0 calls

Speed Tests and Profiling

Restores the IPC all-to-all on such hosts; the multi-rank GPU test file runs in ~48 s on H200, unchanged. Follow-up (not in this PR): runtime/distributed/ipc_cuda.py (scheduler↔client CUDA IPC) has the same exposure on the import side.

Checklist

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ✅ Run #39892502150
Latest PR Test (Extra): ❌ Run #39892501681
Latest PR Test (AMD ROCm 10): ⏳ Run #39892501676

…ut of expandable segments

#43584 moved the 2-rank transport's exported buffers and the N-rank
pipeline pool onto ipc_shareable_zeros, but the N-rank transport's signal
flags, timeout flag and exchange staging stayed plain torch.zeros. Under
expandable_segments:True those export expandable-segment handles, and
importing one calls pidfd_getfd, which containers without ptrace rights
deny with EPERM. Every multi-rank SP group then fell back to NCCL; when
the ranks' allocator histories differ, one rank's flags can land in a
non-expandable block while its peer's do not, and init deadlocks instead.

Allocate every exported buffer with ipc_shareable_zeros, and name the
signal flags in the init error if sharing them still fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mickqian

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant