Repository navigation
Conversation
… enabled
`use_pg_for_symm_mem_rendezvous` moved the RendezvousRequest and block handle
exchanges off the TCPStore, since the store gets overloaded during rendezvous at
large rank counts, but multicast setup was left behind: the multicast handle
exchange, the per-rank success flag, and the barrier after peer handles are
imported all still hit the store. This routes the three of them through the
process group when the option is set. The multicast handle uses a real
broadcast (`pg_broadcast`, new alongside `pg_all_gather`) rather than the store
path's allgather-and-keep-element-0, which is what the existing
`TODO implement storeExchange.broadcast` worked around; rank 0 is the only
producer, so an allgather would just waste bandwidth. The POSIX-fd path is
unchanged, exchanging the multicast fd over `ipc_channel` as before.
The barrier moves too. There is one TCPStore per job, shared by every rank and
by all the symmetric memory groups rendezvousing against it, so what overloads
it is the aggregate request rate rather than any single exchange; `Store::barrier`
is an add plus a wait from every rank, which is no better in that respect than
the allgathers it sits between. The success flag is carried as `uint8_t` because
`pg_all_gather` memcpys into its result vector and `std::vector<bool>` packs
bits, leaving no usable `data()` to copy into.
`test_rendezvous_via_pg_allgather` asserted an exact allgather count, so it now
derives the expected range from whether the handle got a multicast pointer.
Test Plan:
On 2x GB200 (NVLink fabric handles, multicast supported):
```
python test/distributed/test_symmetric_memory.py -v
```
134 tests, 1 pre-existing failure (`LoweringTest.test_custom_op_symm_mem_realization`,
an `alloc_id` size mismatch that also reproduces without this change and passes
in isolation). The NCCL flight recorder around a PG rendezvous confirms nothing
is left on the store, and `multimem_all_gather_out` over the resulting pointer
confirms the PG-exchanged multicast handle works:
```
nccl ops: ['nccl:_all_gather_base', # RendezvousRequest
'nccl:_all_gather_base', # block handles
'nccl:all_reduce_barrier', # post-import barrier
'nccl:broadcast', # multicast handle
'nccl:_all_gather_base'] # multicast success flag
```
This PR was authored with the assistance of an AI coding agent (Claude Code).
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/192623
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 96987ba with merge base 061ace3 ( CRCR (non-blocking) - The following CRCR downstream CI job failed but is non-blocking:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| if (work != nullptr) { | ||
| work->wait(); | ||
| } | ||
| } |
There was a problem hiding this comment.
claude: Tell me why we have to new add new functions for these
|
@claude Answer claude questions. Also let's argue why the specific PGOptions in the new functions are correct, as well as the wait/cpu strategy. |
|
Claude finished @ezyang's task in 9m 59s —— View job Answered both inline questions and laid out the reasoning for the Details1.
|
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
pytorch#192623) … enabled `use_pg_for_symm_mem_rendezvous` moved the RendezvousRequest and block handle exchanges off the TCPStore, since the store gets overloaded during rendezvous at large rank counts, but multicast setup was left behind: the multicast handle exchange, the per-rank success flag, and the barrier after peer handles are imported hit the store. This routes tthem through the process group when the option is set. The multicast handle uses a real broadcast (`pg_broadcast`) rather than the store path's allgather-and-keep-element-0. The POSIX-fd path is unchanged, exchanging the multicast fd over `ipc_channel` as before. The barrier moves too as for large jobs the aggregate request rate from all groups is problematic rather than any single exchange; The success flag is carried as `uint8_t` because `pg_all_gather` memcpys into its result vector and `std::vector<bool>` packs bits, leaving no usable `data()` to copy into. `test_rendezvous_via_pg_allgather` asserted an exact allgather count, so it now derives the expected range from whether the handle got a multicast pointer. Test Plan: On 2x GB200 (NVLink fabric handles, multicast supported): ``` python test/distributed/test_symmetric_memory.py -v ``` 134 tests, 1 pre-existing failure (`LoweringTest.test_custom_op_symm_mem_realization`, an `alloc_id` size mismatch that also reproduces without this change and passes in isolation). The NCCL flight recorder around a PG rendezvous confirms nothing is left on the store, and `multimem_all_gather_out` over the resulting pointer confirms the PG-exchanged multicast handle works: ``` nccl ops: ['nccl:_all_gather_base', # RendezvousRequest 'nccl:_all_gather_base', # block handles 'nccl:all_reduce_barrier', # post-import barrier 'nccl:broadcast', # multicast handle 'nccl:_all_gather_base'] # multicast success flag ``` This PR was authored with the assistance of an AI coding agent (Claude Code). Pull Request resolved: pytorch#192623 Approved by: https://github.com/ezyang
… enabled
use_pg_for_symm_mem_rendezvousmoved the RendezvousRequest and block handle exchanges off the TCPStore, since the store gets overloaded during rendezvous at large rank counts, but multicast setup was left behind: the multicast handle exchange, the per-rank success flag, and the barrier after peer handles are imported hit the store. This routes tthem through the process group when the option is set. The multicast handle uses a real broadcast (pg_broadcast) rather than the store path's allgather-and-keep-element-0. The POSIX-fd path is unchanged, exchanging the multicast fd overipc_channelas before.The barrier moves too as for large jobs the aggregate request rate from all groups is problematic rather than any single exchange; The success flag is carried as
uint8_tbecausepg_all_gathermemcpys into its result vector andstd::vector<bool>packs bits, leaving no usabledata()to copy into.test_rendezvous_via_pg_allgatherasserted an exact allgather count, so it now derives the expected range from whether the handle got a multicast pointer.Test Plan:
On 2x GB200 (NVLink fabric handles, multicast supported):
134 tests, 1 pre-existing failure (
LoweringTest.test_custom_op_symm_mem_realization, analloc_idsize mismatch that also reproduces without this change and passes in isolation). The NCCL flight recorder around a PG rendezvous confirms nothing is left on the store, andmultimem_all_gather_outover the resulting pointer confirms the PG-exchanged multicast handle works:This PR was authored with the assistance of an AI coding agent (Claude Code).