Skip to content

Commit c7e4801

Browse files
mikethegoblinleoda1MC952-arch
authored
[UIL&PAL] FlagCX P2P Engine optimization (#478)
--------- Co-authored-by: leoda1 <liud33787@gmail.com> Co-authored-by: MC952-arch <MC952-arch@qq.com>
1 parent 4d50508 commit c7e4801

9 files changed

Lines changed: 2676 additions & 524 deletions

File tree

.github/workflows/unittest-p2p.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "Unit Tests: p2p"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
unittest-p2p:
13+
runs-on: [self-hosted, cx-build]
14+
container:
15+
image: localhost:5000/flagscale:cuda12.8.1-cudnn9.7.1-python3.12-torch2.7.0-time2507111538
16+
options: --gpus all --privileged --ipc=host --ulimit memlock=-1 --ulimit stack=67108864
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v6
20+
with:
21+
repository: ${{ github.event.pull_request.head.repo.full_name }}
22+
ref: ${{ github.event.pull_request.head.ref }}
23+
ssh-strict: true
24+
ssh-user: git
25+
persist-credentials: true
26+
clean: true
27+
sparse-checkout-cone-mode: true
28+
fetch-tags: false
29+
show-progress: true
30+
lfs: false
31+
submodules: true
32+
set-safe-directory: true
33+
34+
- name: Build Google Test
35+
run: |
36+
cd /__w/FlagCX/FlagCX/third-party/googletest
37+
mkdir -p build
38+
cd build
39+
cmake ..
40+
make -j$(nproc)
41+
42+
- name: Build FlagCX
43+
run: |
44+
cd /__w/FlagCX/FlagCX
45+
export MPI_HOME=/usr/local/mpi
46+
make -j$(nproc) USE_NVIDIA=1
47+
48+
- name: Build p2p unit tests
49+
run: |
50+
cd /__w/FlagCX/FlagCX/test/unittest/p2p
51+
export MPI_HOME=/usr/local/mpi
52+
make -j$(nproc)
53+
54+
- name: Run p2p unit tests (requires IB hardware)
55+
run: |
56+
cd /__w/FlagCX/FlagCX/test/unittest/p2p
57+
export MPI_HOME=/usr/local/mpi
58+
export LD_LIBRARY_PATH=/__w/FlagCX/FlagCX/build/lib:$LD_LIBRARY_PATH
59+
make run-unit

flagcx/adaptor/include/flagcx_net_adaptor.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ typedef enum {
2525
// regMr, regMrDmaBuf, deregMr, isend, irecv, iflush, test,
2626
// iput, iget, iputSignal, getDevFromName
2727
// v2 — adds iputBatch (optional one-sided batch WRITE)
28+
// latest — adds optional batch helpers for one-sided transfers
2829

2930
struct flagcxNetAdaptor_v1 {
3031
// Basic functions
@@ -135,6 +136,17 @@ struct flagcxNetAdaptor_latest {
135136
const size_t *sizes, int srcRank, int dstRank,
136137
void **srcHandles, void **dstHandles,
137138
void **requests, int *posted);
139+
// Optional batch completion test — polls CQ once for multiple requests.
140+
// If NULL, caller falls back to per-request test().
141+
flagcxResult_t (*testBatch)(void **requests, int nRequests, int *doneFlags,
142+
int *doneCount);
143+
// Optional one-side batch READ. Success returns one logical request for the
144+
// full batch.
145+
flagcxResult_t (*igetBatch)(void *sendComm, int count,
146+
const uint64_t *srcOffs, const uint64_t *dstOffs,
147+
const size_t *sizes, int srcRank, int dstRank,
148+
void *const *srcHandles, void *const *dstHandles,
149+
void **request);
138150
};
139151

140152
#define flagcxNetAdaptor flagcxNetAdaptor_latest

0 commit comments

Comments
 (0)