Repository navigation
Commit 00294d8
committed
[TRTLLM-16622][perf] DeepSeek-V4.1: mHC all-reduce boundaries with the attention O-B in the boundary launch
At attention TP the decode mHC boundaries all-reduce the sublayer's partial output in their own
launch (one-shot Lamport protocol). On SM100/SM103, every change bitwise:
- ObAllReduceBoundaryKernel runs the attention's small-M MXFP8 O-B projection, its all-reduce and
the FFN-entry boundary as two roles of one grid: O-B CTAs compute 8-column tiles as the small-M
GEMM does and push them into every rank's slots; token CTAs poll, sum in rank order and finish
the boundary. It engages for up to 16 rows when the FFN boundary is split and all-reduces
in-kernel and the O-B shard tiles the grid (attention TP8); the decoder layer asks the attention
for its O-B input through defer_ob_to_boundary, and defer_ob_projection builds the ObUnprojected.
- The CTA counted last advances the Lamport state (a hand-over warp in the cluster form of the
all-reduce boundary), so no CTA spins on the arrival counter after its work.
- A rank takes its own slot from the words it pushed instead of waiting for their multicast copy.
- The 4-CTA cluster form (up to 12 rows) exchanges RMSNorm partials with st.async on an mbarrier;
the MoE-finalize rows load right after the routing.
- Behind a captured CuTe FC2 the MNNVL MoE boundary reads its routing and clears the previous
buffer before its dependency wait. The MoE boundary that enters a layer whose O-B is deferred
prefetches that O-B weight into L2.
GB300, attention TP8 batch-1 decode with DSpark k=5, per decode step: last-CTA hand-over in the
O-B boundary -6..-10 us; routing before the wait, own slot and hand-over warp -16 us together
(FC2 end -> MoE boundary end -0.38 / -0.43 us per layer); the O-B weight prefetch together with the
CSA2 O-A releasing the deferred boundary after its wait about -29 us. The fused O-B launch and the
mbarrier exchange are not measured separately (the exchange with the early MoE rows: 3.688 ->
3.684 ms per step at attention TP4 with 6 rows, within the run-to-run spread).
Test: test_mhc_ob_boundary_matches_ob_then_boundary (1, 6 and 16 rows, with and without the NVFP4
copy, MNNVL; 50 graph replays between a MoE-finalize boundary and a library all-reduce on one
workspace) equals the O-B GEMM then the boundary byte for byte;
test_mhc_moe_boundary_behind_lowm_fc2 (2 GPUs, MNNVL) replays captured layers of attention
boundary, FC1-only MoE, CuTe FC2 and MoE boundary (with the O-B prefetch) with the eager bits;
test_mhc_allreduce_boundary_matches_allreduce_then_boundary also covers the 6-row MoE input.
Signed-off-by: ziyixiong-nv <219238287+ziyixiong-nv@users.noreply.github.com>1 parent 9ae3494 commit 00294d8
8 files changed
Lines changed: 1759 additions & 112 deletions
File tree
- tensorrt_llm/_torch
- kernels/blackwell/mhc
- models
- modules/mhc
- tests
- integration
- defs
- test_lists/test-db
- unittest/_torch/multi_gpu
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
1065 | 1066 | | |
1066 | 1067 | | |
1067 | 1068 | | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
1068 | 1079 | | |
1069 | 1080 | | |
1070 | 1081 | | |
| |||
1184 | 1195 | | |
1185 | 1196 | | |
1186 | 1197 | | |
| 1198 | + | |
| 1199 | + | |
1187 | 1200 | | |
1188 | 1201 | | |
1189 | 1202 | | |
| |||
1209 | 1222 | | |
1210 | 1223 | | |
1211 | 1224 | | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1212 | 1229 | | |
1213 | 1230 | | |
1214 | 1231 | | |
| |||
1246 | 1263 | | |
1247 | 1264 | | |
1248 | 1265 | | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
1262 | 1283 | | |
1263 | 1284 | | |
1264 | 1285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
812 | 812 | | |
813 | 813 | | |
814 | 814 | | |
| 815 | + | |
815 | 816 | | |
816 | 817 | | |
817 | 818 | | |
| |||
830 | 831 | | |
831 | 832 | | |
832 | 833 | | |
833 | | - | |
| 834 | + | |
| 835 | + | |
834 | 836 | | |
835 | 837 | | |
836 | 838 | | |
| |||
873 | 875 | | |
874 | 876 | | |
875 | 877 | | |
| 878 | + | |
876 | 879 | | |
877 | 880 | | |
878 | 881 | | |
| |||
0 commit comments