Skip to content

Feat/pcie share - #104

Open
wtr0504 wants to merge 3 commits into
SandAI-org:mainfrom
wtr0504:feat/pcie_share
Open

wtr0504 wants to merge 3 commits into
SandAI-org:mainfrom
wtr0504:feat/pcie_share

Conversation

@wtr0504

@wtr0504 wtr0504 commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

🗂️ PR Category

  • ✨ New Feature
  • 🚀 Optimization (performance, memory, etc.)
  • 💥 Breaking Change
  • 🐛 Bug Fix
  • 🛠️ Development / Refactoring
  • 📚 Documentation
  • 🧹 Chore (Dependencies, CI/CD, Configuration, etc.)
  • 🧪 Testing

📝 Description

…ll-to-alls and H2D loads

Add transfer_link_sharing (auto/pcie/nvlink/off). Without NVLink, NCCL weight
all-gathers and graph all-to-alls are queued on the H2D load stream, and loads
are placed only on the compute time those collectives leave free. With NVLink,
collectives share one link stream of their own while loads overlap them freely.
'auto' picks the mode from NVML's NVLink state.
…d link and charge the overrun as exposure

With link sharing, collectives queued on the load stream used to be windows no
transfer could straddle, so a load longer than every gap before its wait could
only sit right in front of it, fully exposed. Now a transfer may start in a gap
and run into the next collective: on one stream that collective waits for it,
and only the part past the gap is exposed. The link is free again once that
collective is done, so the overrun does not cascade into the next transfer.

The backward planner scores each gap by the transfer's exposure there plus the
link it leaves idle, weighted by the link's load factor, so a busy link keeps a
load in the gap that barely hides it while an idle one hoists it back to a gap
that hides it whole. ScheduleResult reports the transfers that run into a window,
and the H2D reorder log prints how many and how much they expose.
…pileConfig.pairwise_all_to_all)

On PCIe without NVLink, NCCL's all-to-all runs every peer at once and the
transfers contend for the same links. With pairwise_all_to_all every
_c10d_functional.all_to_all_single in the graph is routed to
magi::link_pairwise_all_to_all_single, which runs world_size - 1 steps with one
peer in flight per rank: at step k rank r sends to r + k and receives from r - k.

The exchange queues on the stream transfer_link_sharing picks for collectives,
or, with link sharing off, on a stream of its own; the routing pass is then
installed even without FSDP or inserted loads. The profiling estimator replays
an all-to-all as the same pairwise exchange, so its cost matches what runs.

This branch has not been deployed

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

Labels

None yet

1 participant