enable window AGP via ncclx (#2018)#2018
Open
tianfengfrank wants to merge 4 commits intometa-pytorch:mainfrom
Open
enable window AGP via ncclx (#2018)#2018tianfengfrank wants to merge 4 commits intometa-pytorch:mainfrom
tianfengfrank wants to merge 4 commits intometa-pytorch:mainfrom
Conversation
… core funcs and add Buffer abstraction layer
Summary:
## Motivation
AllGatherP's utility functions (`nvlCeBcast`, `copyToSelf`) are currently tightly coupled to `PersistArgs` — they take `PersistArgs&` and extract fields internally. This prevents reuse from any other context that has remote buffer metadata but not a `PersistArgs` struct.
This diff decouples these utilities by replacing the `PersistArgs&` parameter with explicit, individually-passed arguments. This is a pure refactoring with zero logic or behavior change.
## What Changed
**`CommUtils.h`:**
- `nvlCeBcast(... PersistArgs& pArgs ...)` →
`nvlCeBcast(... const vector<void*>& remoteRecvBuffs, const vector<RemoteAccessKey>& remoteAccessKeys ...)`
- `copyToSelf(... PersistArgs& pArgs ...)` →
`copyToSelf(... void* recvbuff ...)`
**`DirectImpl.cc` / `PipelineImpl.cc`:**
- Updated all call sites to pass `pArgs.remoteRecvBuffs`, `pArgs.remoteAccessKeys`, `pArgs.recvbuff` explicitly.
## Before → After (call site)
```
Before: nvlCeBcast(comm, sendBuff, sendSize, offset, pArgs, stream);
After: nvlCeBcast(comm, sendBuff, sendSize, offset,
pArgs.remoteRecvBuffs, pArgs.remoteAccessKeys,
stream);
Before: copyToSelf(comm, sendBuff, sendSize, pArgs, stream);
After: copyToSelf(comm, sendBuff, sendSize, pArgs.recvbuff, stream);
```
## Why This Enables Window-Based Reuse (Follow-up)
```
┌──────────────────────────────────────────────────┐
│ Reusable Utility Functions │
│ │
│ nvlCeBcast(remoteRecvBuffs[], accessKeys[]) │
│ copyToSelf(recvbuff) │
└────────────────┬────────────────┬────────────────┘
│ │
┌─────────┴──┐ ┌──────┴────────┐
│ Legacy AGP │ │ Window Path │
│ (existing) │ │ (follow-up) │
├────────────┤ ├───────────────┤
│ Passes: │ │ Passes: │
│ pArgs. │ │ win-> │
│ remoteRecv │ │ remWinInfo │
│ Buffs │ │ [peer]. │
│ pArgs. │ │ dataAddr │
│ remoteAccess│ │ win-> │
│ Keys │ │ remWinInfo │
│ │ │ [peer]. │
│ pArgs. │ │ dataRkey │
│ recvbuff │ │ win-> │
│ │ │ winDataPtr │
└─────────────┘ └───────────────┘
```
The follow-up diff will add a window-based execution path that calls
these same utility functions with `win->remWinInfo` data, enabling:
- Regular AG → persistent AGP conversion in graph capture mode
- SM-free CE-based allgather reusable via window API
- No duplication of the core CE broadcast and copy logic
```
┌──────────────┐ ┌──────────────┐
│ PersistArgs │ │ CtranWin │
│ (legacy) │ │ (Phase 3) │
└──────┬───────┘ └──────┬───────┘
│ │
populate Buffer populate Buffer
│ │
┌──────▼─────────────────────▼──────┐
│ Buffer (view) │
│ recvbuff, recvHdl, │
│ *remoteRecvBuffs, *remoteAccessKeys│
└──────────────┬─────────────────────┘
│
┌────────────────────┼─────────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌──────────────────┐ ┌───────────────┐
│ copyToSelf() │ │ nvlCeBcast() │ │ GPE submit() │
│ (CE → self) │ │ (CE → NVL peers)│ │ (IB put/ring) │
└─────────────────┘ └──────────────────┘ └───────────────┘
Phase 1 Phase 1 Phase 2
parameterized parameterized parameterized
```
Differential Revision: D99514784
Contributor
|
@tianfengfrank has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100036330. |
Summary: Pull Request resolved: meta-pytorch#2002 Differential Revision: D100051366
Differential Revision: D99771595
Summary: Pull Request resolved: meta-pytorch#2018 Pull Request resolved: meta-pytorch#2003 - Expose window based AGP via ncclx - add UT for testing Differential Revision: D100036330
e1b16c4 to
250a333
Compare
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.
Summary:
Differential Revision: D100036330