Repository navigation
[Fix] diffusion: Keep the N-rank IPC all-to-all's flags and staging out of expandable segments - #45948
Merged
Conversation
…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
requested review from
AgainstEntropy,
BBuf,
HaiShaw,
kevin-mii,
niehen6174,
ping1jing2 and
yichiche
as code owners
October 23, 2026 02:58
Collaborator
Author
|
/tag-and-rerun-ci |
This was referenced Oct 23, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
#43584 moved the 2-rank IPC all-to-all's exported buffers and the N-rank
_PipelinePoolontoipc_shareable_zeros, but the N-rank transport's signal flags, timeout flag and exchange staging (from #43164) stayed plaintorch.zeros. UnderPYTORCH_CUDA_ALLOC_CONF=expandable_segments:Truethose can land in expandable segments, whose IPC import callspidfd_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.zerosbuffer 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)'sall_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 fromipc_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 whyipc_shareable_zerosmatters (pidfd_getfd).Tests:
test/unit/test_ipc_a2a_lifecycle.py(CPU, mocked): every buffer the N-rank path exports must come fromipc_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 withexpandable_segments:Trueunder a seccomp filter that makespidfd_getfdfail with EPERM.Accuracy Tests
No numerical change: the same buffers, allocated outside expandable segments.
On 2xH200 with
pidfd_getfdblocked by seccomp (reproduces the RunPod warning exactly):pidfd_getfdcallsSpeed 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