-
Notifications
You must be signed in to change notification settings - Fork 62
[UIL] Add scalar IR API, on-device net construction, and per-peer staging fix #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e5e538a
device-ir: rename APIs (C/S suffix), add docs, add scalar IR tests
MC952-arch 1bbf457
fix(device-ir): pre-allocate net contexts in DevComm, expand scalar I…
MC952-arch 20d2f65
refactor: construct flagcxDevNet on-device via kernel launch
MC952-arch 8ae3ce4
fix: address review findings for device IR refactor
MC952-arch f8ed648
fix(device-ir): address review findings — stream sync, ODR fix, test …
MC952-arch 55b36b1
refactor(device-ir): revert C-suffix on wrapper APIs, keep S-suffix f…
MC952-arch 6a9e616
fix(device-ir): address review findings for scalar IR API
MC952-arch ed74831
fix critical issues
MC952-arch ae97e6a
fix(barrier): prevent epoch corruption in split ArriveS/WaitS scalar …
MC952-arch 0c24a03
refactor(device-api): move epochShadow from Comm trait to wrapper level
MC952-arch 40814db
Fix device_api issue
MC952-arch 32dcb2a
feat(ir): add epoch shadow for scalar split barriers (SessionInitS)
MC952-arch aaf2435
fix(barrier): use acquire/release ordering for epoch shadow loads/stores
MC952-arch 7c028ee
Add debug logs
MC952-arch 9344a4f
fix(putValue): use per-peer staging slots to prevent RDMA data races
MC952-arch 812b480
ci: update device_api workflow to run intra/inter-node tests separately
MC952-arch 74e677e
Remove debug log prints added during device IR development
MC952-arch 1642260
Revert Release/Acquire reverted to Relaxed in flagcx_device_scalar_ir…
MC952-arch d0c40ff
Remove shadow epoch buffer from S-path barriers
MC952-arch ffd1fd9
fix(device-ir): remove dead epoch accessors, fix sync and guard issues
MC952-arch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,68 +1,124 @@ | ||
| flagcxCoopAnyInitBlock | ||
| flagcxCoopAnyInitLanes | ||
| flagcxCoopAnyInitThread | ||
| flagcxCoopAnyInitTileSpan | ||
| flagcxCoopAnyInitWarp | ||
| flagcxCoopAnyInitBlockC | ||
| flagcxCoopAnyInitLanesC | ||
| flagcxCoopAnyInitThreadC | ||
| flagcxCoopAnyInitTileSpanC | ||
| flagcxCoopAnyInitWarpC | ||
| flagcxCoopSizeC | ||
| flagcxCoopSizeExS | ||
| flagcxCoopSizeS | ||
| flagcxCoopSyncC | ||
| flagcxCoopSyncExS | ||
| flagcxCoopSyncS | ||
| flagcxCoopThreadRankC | ||
| flagcxCoopThreadRankExS | ||
| flagcxCoopThreadRankS | ||
| flagcxDataTypeSizeDevice | ||
| flagcxDevCommGetIntraRank | ||
| flagcxDevCommGetIntraSize | ||
| flagcxDevCommGetRank | ||
| flagcxDevCommGetSize | ||
| flagcxDevNetFlush | ||
| flagcxDevNetGet | ||
| flagcxDevNetFlushC | ||
| flagcxDevNetFlushS | ||
| flagcxDevNetGetC | ||
| flagcxDevNetGetFromCommS | ||
| flagcxDevNetGetS | ||
| flagcxDevNetIncreaseSignalShadow | ||
| flagcxDevNetInitC | ||
| flagcxDevNetPut | ||
| flagcxDevNetPutValue | ||
| flagcxDevNetPutValue_RCtrInc | ||
| flagcxDevNetPutValue_RSigAdd | ||
| flagcxDevNetPutValue_RSigInc | ||
| flagcxDevNetPut_LCtrInc | ||
| flagcxDevNetPut_LSigAdd | ||
| flagcxDevNetPut_LSigInc | ||
| flagcxDevNetPut_RCtrInc | ||
| flagcxDevNetPut_RCtrInc_LCtrInc | ||
| flagcxDevNetPut_RCtrInc_LSigAdd | ||
| flagcxDevNetPut_RCtrInc_LSigInc | ||
| flagcxDevNetPut_RSigAdd | ||
| flagcxDevNetPut_RSigAdd_LCtrInc | ||
| flagcxDevNetPut_RSigAdd_LSigAdd | ||
| flagcxDevNetPut_RSigAdd_LSigInc | ||
| flagcxDevNetPut_RSigInc | ||
| flagcxDevNetPut_RSigInc_LCtrInc | ||
| flagcxDevNetPut_RSigInc_LSigAdd | ||
| flagcxDevNetPut_RSigInc_LSigInc | ||
| flagcxDevNetReadCounter | ||
| flagcxDevNetReadSignal | ||
| flagcxDevNetRecv | ||
| flagcxDevNetPutC | ||
| flagcxDevNetPutS | ||
| flagcxDevNetPutS_LCtrInc | ||
| flagcxDevNetPutS_LSigAdd | ||
| flagcxDevNetPutS_LSigInc | ||
| flagcxDevNetPutS_RCtrInc | ||
| flagcxDevNetPutS_RCtrInc_LCtrInc | ||
| flagcxDevNetPutS_RCtrInc_LSigAdd | ||
| flagcxDevNetPutS_RCtrInc_LSigInc | ||
| flagcxDevNetPutS_RSigAdd | ||
| flagcxDevNetPutS_RSigAdd_LCtrInc | ||
| flagcxDevNetPutS_RSigAdd_LSigAdd | ||
| flagcxDevNetPutS_RSigAdd_LSigInc | ||
| flagcxDevNetPutS_RSigInc | ||
| flagcxDevNetPutS_RSigInc_LCtrInc | ||
| flagcxDevNetPutS_RSigInc_LSigAdd | ||
| flagcxDevNetPutS_RSigInc_LSigInc | ||
| flagcxDevNetPutValueC | ||
| flagcxDevNetPutValueS | ||
| flagcxDevNetPutValueS_RCtrInc | ||
| flagcxDevNetPutValueS_RSigAdd | ||
| flagcxDevNetPutValueS_RSigInc | ||
| flagcxDevNetPutValue_RCtrIncC | ||
| flagcxDevNetPutValue_RSigAddC | ||
| flagcxDevNetPutValue_RSigIncC | ||
| flagcxDevNetPut_LCtrIncC | ||
| flagcxDevNetPut_LSigAddC | ||
| flagcxDevNetPut_LSigIncC | ||
| flagcxDevNetPut_RCtrIncC | ||
| flagcxDevNetPut_RCtrInc_LCtrIncC | ||
| flagcxDevNetPut_RCtrInc_LSigAddC | ||
| flagcxDevNetPut_RCtrInc_LSigIncC | ||
| flagcxDevNetPut_RSigAddC | ||
| flagcxDevNetPut_RSigAdd_LCtrIncC | ||
| flagcxDevNetPut_RSigAdd_LSigAddC | ||
| flagcxDevNetPut_RSigAdd_LSigIncC | ||
| flagcxDevNetPut_RSigIncC | ||
| flagcxDevNetPut_RSigInc_LCtrIncC | ||
| flagcxDevNetPut_RSigInc_LSigAddC | ||
| flagcxDevNetPut_RSigInc_LSigIncC | ||
| flagcxDevNetReadCounterC | ||
| flagcxDevNetReadCounterS | ||
| flagcxDevNetReadSignalC | ||
| flagcxDevNetReadSignalS | ||
| flagcxDevNetRecvC | ||
| flagcxDevNetRecvS | ||
| flagcxDevNetResetCounter | ||
| flagcxDevNetResetSignal | ||
| flagcxDevNetSend | ||
| flagcxDevNetSignalCtrInc | ||
| flagcxDevNetSignalSigAdd | ||
| flagcxDevNetSignalSigInc | ||
| flagcxDevNetTerm | ||
| flagcxDevNetWait | ||
| flagcxDevNetWaitCounter | ||
| flagcxDevNetWaitSignal | ||
| flagcxDevNetWaitSignalMeetShadow | ||
| flagcxDevNetSendC | ||
| flagcxDevNetSendS | ||
| flagcxDevNetSignalCtrIncC | ||
| flagcxDevNetSignalCtrIncS | ||
| flagcxDevNetSignalSigAddC | ||
| flagcxDevNetSignalSigAddS | ||
| flagcxDevNetSignalSigIncC | ||
| flagcxDevNetSignalSigIncS | ||
| flagcxDevNetTermC | ||
| flagcxDevNetTermS | ||
| flagcxDevNetWaitC | ||
| flagcxDevNetWaitCounterC | ||
| flagcxDevNetWaitCounterS | ||
| flagcxDevNetWaitS | ||
| flagcxDevNetWaitSignalC | ||
| flagcxDevNetWaitSignalMeetShadowC | ||
| flagcxDevNetWaitSignalMeetShadowS | ||
| flagcxDevNetWaitSignalS | ||
| flagcxGetIntraPointerC | ||
| flagcxGetIntraPointerS | ||
| flagcxGetLocalPointerC | ||
| flagcxGetLocalPointerS | ||
| flagcxGetMulticastPointerC | ||
| flagcxGetMulticastPointerS | ||
| flagcxGetPeerPointerC | ||
| flagcxGetTeamInter | ||
| flagcxGetTeamIntra | ||
| flagcxGetTeamWorld | ||
| flagcxInterBarrierSessionInit | ||
| flagcxInterBarrierSessionSync | ||
| flagcxIntraBarrierSessionArrive | ||
| flagcxIntraBarrierSessionInit | ||
| flagcxIntraBarrierSessionSync | ||
| flagcxIntraBarrierSessionWait | ||
| flagcxGetPeerPointerS | ||
| flagcxGetTeamInterC | ||
| flagcxGetTeamIntraC | ||
| flagcxGetTeamWorldC | ||
| flagcxInterBarrierArriveS | ||
| flagcxInterBarrierSessionInitC | ||
| flagcxInterBarrierSessionSyncC | ||
| flagcxInterBarrierSyncS | ||
| flagcxInterBarrierWaitS | ||
| flagcxIntraBarrierArriveS | ||
| flagcxIntraBarrierSessionArriveC | ||
| flagcxIntraBarrierSessionInitC | ||
| flagcxIntraBarrierSessionSyncC | ||
| flagcxIntraBarrierSessionWaitC | ||
| flagcxIntraBarrierSyncS | ||
| flagcxIntraBarrierWaitS | ||
| flagcxTeamRankToIntraC | ||
| flagcxTeamRankToIntraS | ||
| flagcxTeamRankToWorldC | ||
| flagcxWorldBarrierSessionInit | ||
| flagcxWorldBarrierSessionSync | ||
| flagcxTeamRankToWorldS | ||
| flagcxWorldBarrierArriveS | ||
| flagcxWorldBarrierSessionInitC | ||
| flagcxWorldBarrierSessionSyncC | ||
| flagcxWorldBarrierSyncS | ||
| flagcxWorldBarrierWaitS | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /************************************************************************* | ||
| * Copyright (c) 2026 BAAI. All rights reserved. | ||
| * | ||
| * FlagCX Device API Enums — Scalar enum types for IR/Triton integration. | ||
| * | ||
| * These enums encode cooperative group kind and team kind as plain | ||
| * integers, enabling LLVM IR callers (e.g. Triton) to express these | ||
| * concepts without instantiating C++ structs. | ||
| * | ||
| * Safe to include from: CUDA device code, host code, LLVM bitcode builds. | ||
| ************************************************************************/ | ||
|
|
||
| #ifndef FLAGCX_DEVICE_ENUMS_H_ | ||
| #define FLAGCX_DEVICE_ENUMS_H_ | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| /* ================================================================ | ||
| * Cooperative Group Kind | ||
| * | ||
| * Identifies the cooperation scope for collective device operations. | ||
| * Used by the scalar IR API in place of struct-based cooperative groups. | ||
| * ================================================================ */ | ||
| typedef enum { | ||
| FLAGCX_COOP_THREAD = 0, /* Single thread (no cooperation) */ | ||
| FLAGCX_COOP_WARP = 1, /* Full warp (FLAGCX_SIMT_WIDTH threads) */ | ||
| FLAGCX_COOP_BLOCK = 2, /* Entire CTA */ | ||
| FLAGCX_COOP_TILE_SPAN = 3, /* Consecutive tile span (needs t0, nTiles, id) */ | ||
| FLAGCX_COOP_LANES = 4, /* Arbitrary lane bitmask */ | ||
| } flagcxCoopKind_t; | ||
|
|
||
| /* ================================================================ | ||
| * Team Kind | ||
| * | ||
| * Identifies the team scope within a communicator. | ||
| * Used by the scalar IR API in place of struct-based teams. | ||
| * ================================================================ */ | ||
| typedef enum { | ||
| FLAGCX_TEAM_INTRA = 0, /* Intra-node ranks */ | ||
| FLAGCX_TEAM_INTER = 1, /* Inter-node representatives */ | ||
| FLAGCX_TEAM_WORLD = 2, /* All ranks */ | ||
| } flagcxTeamKind_t; | ||
|
|
||
| #endif /* FLAGCX_DEVICE_ENUMS_H_ */ |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /************************************************************************* | ||
| * Copyright (c) 2026 BAAI. All rights reserved. | ||
| * | ||
| * Host-callable helpers that require device-compiler visibility of | ||
| * device-only types (e.g. flagcxDevNet). Compiled by nvcc/hipcc, | ||
| * linked into libflagcx.so, called from flagcx_device.cc via extern "C". | ||
| ************************************************************************/ | ||
|
|
||
| #include "device_api/flagcx_device_core.h" | ||
| #include <new> | ||
|
|
||
| extern "C" size_t flagcxDevNetSizeOf() { return sizeof(flagcxDevNet); } | ||
|
|
||
| extern "C" void flagcxDevNetConstructArray(void *dst, const void *comm, | ||
| int count) { | ||
| const flagcxDevComm *devComm = (const flagcxDevComm *)comm; | ||
| flagcxDevNet *nets = (flagcxDevNet *)dst; | ||
| for (int i = 0; i < count; i++) { | ||
| ::new (&nets[i]) flagcxDevNet(*devComm, i); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.