Skip to content

Commit df09f6f

Browse files
committed
kernel-proxy: per-context QPs for thread-isolated RDMA posting
1 parent 0d71a8c commit df09f6f

4 files changed

Lines changed: 224 additions & 196 deletions

File tree

flagcx/core/flagcx_hetero.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,8 @@ flagcxResult_t flagcxHeteroFlushRma(flagcxHeteroComm_t comm, int peer,
789789
return flagcxRemoteError;
790790
usleep(100);
791791
}
792-
// Check rmaError after wait: kernel proxy direct-post path advances doneSeqs
793-
// unconditionally (even on failure) to prevent flush hangs.
792+
// Final rmaError check: kernel proxy or network failures set rmaError;
793+
// catch errors that occurred after doneSeqs reached the target.
794794
if (__atomic_load_n(&proxy->rmaError, __ATOMIC_ACQUIRE))
795795
return flagcxRemoteError;
796796
return flagcxSuccess;
@@ -831,8 +831,8 @@ flagcxResult_t flagcxHeteroFlushAllRma(flagcxHeteroComm_t comm) {
831831
usleep(100);
832832
}
833833
}
834-
// Check rmaError after wait: kernel proxy direct-post path advances doneSeqs
835-
// unconditionally (even on failure) to prevent flush hangs.
834+
// Final rmaError check: kernel proxy or network failures set rmaError;
835+
// catch errors that occurred after doneSeqs reached the target.
836836
if (__atomic_load_n(&proxy->rmaError, __ATOMIC_ACQUIRE))
837837
return flagcxRemoteError;
838838
return flagcxSuccess;

flagcx/core/include/onesided.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,20 @@ struct flagcxOneSideHandleInfo {
2323
void *localMrHandle; // local rank's MR handle for deregMr
2424
void *localRecvComm; // recvComm used for MR registration (PD match)
2525
// Full-mesh IB connections (including self loopback, aligned with NCCL GIN)
26-
void **fullSendComms; // [nRanks] per-peer sendComm (NULL if not owner)
27-
void **fullRecvComms; // [nRanks] per-peer recvComm (NULL if not owner)
26+
void **fullSendComms; // [nRanks] per-peer sendComm — alias for
27+
// contextSendComms[0]
28+
void **fullRecvComms; // [nRanks] per-peer recvComm — alias for
29+
// contextRecvComms[0]
2830
int nRanks; // number of ranks (for cleanup iteration)
2931

32+
// Per-context QP arrays for thread isolation (NCCL GIN pattern).
33+
// Context 0 = RMA proxy; contexts 1..N = kernel proxy threads.
34+
// Each context has its own full-mesh of RC QPs so no QP is shared
35+
// across threads. All contexts share the same MR handles/rkeys (same PD).
36+
void ***contextSendComms; // [nContexts][nRanks]
37+
void ***contextRecvComms; // [nContexts][nRanks]
38+
int nContexts; // 1 + nKernelProxies
39+
3040
// Symmetric memory window for intra-node D2D bypass (CE path).
3141
// NULL if VMM not available or window not registered with
3242
// FLAGCX_WIN_COLL_SYMMETRIC.

0 commit comments

Comments
 (0)