[Feat] Route FSDP weight all-gather through copy-engine symmetric memory - #65
Open
wtr0504 wants to merge 8 commits into
Open
[Feat] Route FSDP weight all-gather through copy-engine symmetric memory#65wtr0504 wants to merge 8 commits into
wtr0504 wants to merge 8 commits into
Conversation
…hey run on hosts without an initialized NVLink fabric
jiahy0825
reviewed
Aug 31, 2026
Collaborator
There was a problem hiding this comment.
Rewrite this file as a custom pass like magi_compiler/passes/full_graph/replace_sage_atten.py
| _TO_EMPTY_LAMBDA = "Module.to_empty.<locals>.<lambda>" | ||
|
|
||
|
|
||
| class SymmArena: |
Collaborator
There was a problem hiding this comment.
The word arena is weird in this pr, you can use SymmBuffer directly. Replace all arena with a better name
Collaborator
There was a problem hiding this comment.
It makes no sense to apply a patch when we use ce-ag. I think it's better to replace all weights with SymmBuffer after capturing the whole graph.
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.

🗂️ PR Category
📝 Description
Add a copy-engine (CE) transport for SimpleFSDP weight all-gather, as an alternative to NCCL ring kernels.
Today
enable_fullgraph_overlaphides weight gathers under upstream compute, but those gathers still occupy SMs and contend with the compute that is supposed to hide them. Withfsdp_config.transport="copy_engine":torch.distributed._symmetric_memoryarena at model build (to_emptyinterception on the decorated class). One window per(dtype, process group)so dense FSDP and MoE edp meshes do not share a rendezvous.all_gather_into_tensor/_coalescednodes whose input is an arena shard (to_local(placeholder|get_attr)) tomagi::symm_all_gather/magi::symm_all_gather_coalesced. Cast/pad gathers stay on NCCL, so mixed graphs are legal.cudaMemcpyBatchAsync) into a fresh dest — zero SM occupancy, no per-step cross-rank barrier. Weights are static in inference, so the NCCL barrier is wasted work.FallbackKernel, so the pass now treatsmagi::symm_all_gather*as collectives (_issues_transfer) instead of counting them as compute.wait(launch()). Timing the launch alone measures CPU issue (~3 µs) and misses the side-stream copies, which undersizes the overlap window by an order of magnitude.Default remains
transport="nccl". CE requires NVLink within the FSDP mesh dim and static weights (inference).Config
fsdp_config.transport"nccl""nccl": SM ring kernels."copy_engine": symmetric-memory peer copies.