Skip to content

[HIP] perf(custom_ar): one gfx1250 Lamport two-shot replaces the LL two-shot, on every transport - #7937

Merged
zufayu merged 12 commits into
mainfrom
zejun/gfx1250-ar-2s-lamport
Nov 27, 2026
Merged

zufayu merged 12 commits into
mainfrom
zejun/gfx1250-ar-2s-lamport

Conversation

@zejunchen-zejun

@zejunchen-zejun zejunchen-zejun commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On gfx1250, plain all-reduce has one two-shot now: main's Lamport lamport_ar_2shot_gfx1250, extended with an fp32 codec and a split layout. It replaces #7432's LL two-shot ar_2s_ll_gfx1250. The Lamport inbox is now built on every transport, so its kernels also run over symm_mem (TP8 across trays) and VMM.

  • Kernel: lamport_ar_2shot_gfx1250<T, ngpus, BLOCK, ROLES>.
    • Codec. 2-byte dtypes keep the 16-bit sentinel of the other Lamport ops; fp32 gets a 32-bit one.
    • Layout. ROLES = 1 is main's fused layout: one lane takes all three steps of a pack. 2 or 3 is the split layout: send, reduce and gather in wave groups, one block a CU.
    • Any size. A chunk is ceil(packs / ngpus) packs with p < packs guards, so any input of whole 16-byte packs runs.
  • Removed:
  • Routes: by size, per world size and dtype, from MI455X measurements (table below). TP8 takes the Lamport kernels for the first time; fp32 takes the two-shot wherever it beats the LL one-shot.
  • Result against main, production route, CUDA graph, slowest rank:
    • TP8, two trays, symm_mem: bf16 is 1.24–2.14× from 256 KiB to 8 MiB and fp32 1.18–2.13×. From 12 to 32 MiB, where main took RCCL, both are 1.31–1.46×. Kimi-K3's [545, 3584] goes 23.8 → 14.8 µs and [545, 7168] 43.5 → 20.3 µs.
    • TP4, one tray: over symm_mem, bf16 is 1.37–2.06× from 256 KiB to 16 MiB; main had no Lamport there. Over IPC, bf16 is level up to 4 MiB and 1.35–1.51× at 5–8 MiB (split). fp32 is 1.01–2.05× up to 4 MiB and 1.38–2.87× above, where main took RCCL.
    • TP2, one tray: bf16 is unchanged (the one-shot). fp32 is 1.16–1.52× from 1.5 to 8 MiB, and 3.6–6.3× from 12 to 32 MiB, where main took RCCL.

Motivation

  • One protocol, three kernels. [HIP] perf(custom_ar): gfx1250 LL two-shot all-reduce for 1 MiB+ messages #7432's LL two-shot and this PR's earlier ar_2s_lamport_gfx1250 repeated main's Lamport two-shot: the same sentinel, (round + 2) % 3 re-arm, per-wave round counter and rank-order fp32 sum. They differed only in launch shape and in where their inbox lived. The earlier kernel's inbox sat in the uncached meta buffer, which cost 1–4 µs a call in a tray. Review asked for one kernel: main's, with the 32-bit codec and a layout parameter.
  • Lamport off on most transports. On main, the Lamport all-reduce runs only over IPC at TP2 and TP4, for fp16 and bf16. Everything else takes the LL kernels or RCCL:
    • TP8 across trays, over symm_mem, the Kimi-K3 server's transport;
    • TP4 over symm_mem or VMM;
    • fp32 at any world size.

Changes

Kernel and host side (csrc/include/custom_all_reduce_gfx1250.cuh, csrc/kernels/custom_all_reduce_gfx1250.cu, .h, pybind)

  • LamportArCodec<T>.
    • fp16/bf16: a 0xffff half-word is sent as 0x7fff (the other Lamport ops' codec).
    • fp32: a word with all bits set is sent as 0x7fffffff. A 16-bit sentinel would not work there, because an fp32 value's low half-word can be 0xffff.
    • Both forms are NaN, and every rank writes the same bits.
  • lamport_ar_2shot_gfx1250<T, ngpus, BLOCK, ROLES>, main's kernel with:
    • the codec;
    • ROLES (1 fused, 2 or 3 split);
    • ragged chunks: part = ceil(packs / ngpus), with p < packs guards on every load and store. Lanes past the message only re-arm.
    • Inbox: the reduce-scatter takes one round of the shared inbox, like every Lamport op. The all-gather keeps its own inbox, re-armed as it is read.
    • The send step loads all of a lane's packs before its first remote store. Main's loop alternated a load and a store per peer, and a wave's load issued after its own remote store waits for that store. On the same fused launch this gives 1.10–1.23× main at TP4 from 12 to 32 MiB, and it keeps TP8 ahead of RCCL past 8 MiB.
  • run_2shot(…, split).
    • Fused: add_threads(part) lanes a block (64, 256 or 512).
    • Split: W lanes a role, W = min(512, roundup32(ceil(part / CUs))), on ceil(part / W) blocks, so a CU runs at most one block. Three wave groups while W ≤ 320, two above. The reduce and gather pollers first sleep delay × s_sleep(16): 4 up to W = 64, else 8.
  • allreduce_lamport(…, two_shot, split). Dispatches fp32 to the two-shot only; the one-shot stays 2-byte.
  • Removed.
    • ar_2s_ll_gfx1250, its peer and block-flag tables, use_2s_ll / allreduce_2s_ll and its dispatch.
    • Meta buffer per rank: TP4 144.3 → 80.3 MiB, TP8 208.3 → 144.3 MiB; TP2 is unchanged at 48.3.

Python (aiter/dist/device_communicators/custom_all_reduce.py, aiter/ops/custom_all_reduce.py)

  • _init_lamport_ar_rms runs on every transport. _alloc_lamport_inbox builds the inbox:
    • IPC: as before, cached;
    • symm_mem: symm_mem.empty and a rendezvous. If the peers cannot be mapped, every rank turns the Lamport ops off.
    • VMM: VMMBuffer and vmm_exchange.
  • _LAMPORT_AR_MAX_BYTES {2: 16, 4: 8, 8: 4} MiB: plain all-reduce's own cap, a sender's slot of the inbox, apart from the AR + RMSNorm cap.
    • The two-shot takes up to world_size × it, 32 MiB at TP2, TP4 and TP8.
    • Past 8 MiB at TP8, the fused launch runs more blocks than CUs and slows. It stays ahead of RCCL: 20.8 vs 41.4 µs at 8 MiB, 33.5 vs 43.2 at 10 MiB, 66.0 vs 96.6 at 32 MiB.
    • The inbox is sized by the larger of the two caps: 152 MiB a rank at each of these.
    • AR + RMSNorm, AR + add and all-gather keep _LAMPORT_AR_RMS_MAX_BYTES, still off at TP8 by default.
    • AITER_CUSTOM_AR_LAMPORT_RMS_MAX_SIZE overrides both caps, as it did; 0 turns every Lamport op off.
  • select_lamport_ar(inp) returns (two_shot, split) or None, from shapes, dtype and the cap only, so every rank picks the same kernel. Its tables:
    • _LAMPORT_AR_1SHOT_MAX_BYTES gains TP8;
    • new: _LAMPORT_AR_FP32_LL_MAX_BYTES and _LAMPORT_AR_SPLIT_BYTES.
  • _GFX1250_PLAIN_AR_MAX_SIZE[8]: 8 → 4 MiB. Without the LL two-shot, the meta-buffer path past 4 MiB is the pull, far behind RCCL. Sizes the Lamport all-reduce takes are not capped by it.
  • Gone: _LAMPORT_AR_SKIP_WORLD_SIZES, and the post-init barrier this PR had added for the meta-buffer two-shot. The Lamport init keeps its barrier after arming the inbox.

Routes, gfx1250 plain all-reduce, defaults

TP2 TP4 TP8
fp16 / bf16 one-shot to 9 MiB, fused to 32 MiB one-shot to 1.25 MiB, fused to 4 MiB, split to 8 MiB, fused to 32 MiB one-shot to 768 KiB, split to 4 MiB, fused to 32 MiB
fp32 LL one-shot to 1 MiB, fused to 2 MiB, split to 4 MiB, fused to 32 MiB fused to 4 MiB, split to 8 MiB, fused to 32 MiB split to 4 MiB, fused to 32 MiB
main, fp16 / bf16 one-shot to 9 MiB, L2 to 32 MiB (IPC) IPC: one-shot to 1.25 MiB, L2 to 32 MiB; symm_mem / VMM: LL below 1 MiB, LL two-shot to 4 MiB LL below 512 KiB, LL two-shot to 8 MiB
main, fp32 LL to 4 MiB LL below 1 MiB, LL two-shot to 4 MiB LL below 512 KiB, LL two-shot to 8 MiB

Main takes RCCL past its last range.

Past those ranges (world_size × the cap): RCCL. With every Lamport op off: the LL one-shot up to 4 MiB, RCCL above.

Memory a rank

TP2 IPC TP4 IPC TP4 symm_mem / VMM TP8 symm_mem
main: meta + Lamport inbox 48.3 + 152 MiB 144.3 + 152 MiB 144.3 MiB 208.3 MiB
this PR 48.3 + 152 MiB 80.3 + 152 MiB 80.3 + 152 MiB 144.3 + 152 MiB

Performance

MI455X, ROCm 10.1, rocm/fw-bringup:gfx1250-atom-k3-20261119, RCCL 2.30.4.

  • Setups: TP2 and TP4 in one tray; TP8 across two trays of one UALink vpod (4 + 4), over symm_mem.
  • TP8 was timed on the head 6c25a7f46. TP2 and TP4 were timed on ca3a7e0ad. Their routes and kernels have not changed since: the later commits change only the TP8 tables and merge main, which touches none of these files.
  • Measurement: µs per call on the slowest rank. Each case is 50 calls captured in one CUDA graph; the time is the median of 20 replays.
  • Rounds: two rounds per tree, alternating trees; each number is the mean of the rounds. Round-to-round spread: median 0.4%, max 12.9%.
  • Correctness: every case is first checked bit for bit against the rank-order fp32 sum rounded once. Every custom kernel matched in every case.
  • main is afc300d7f. prod is tensor_model_parallel_all_reduce with the server's RCCL settings (RCCL_DDA_LL_ONESHOT_THRESHOLD=2097152, RCCL_DDA_LL_TWOSHOT_THRESHOLD=134217728).
  • Routes: L2 is main's Lamport two-shot; fused and split are this PR's two layouts of it.
  • ★ marks Kimi-K3's c128 decode all-reduces: [545, 3584] and [545, 7168] bf16.

TP8, two trays, symm_mem: main → this PR

size bf16 main bf16 PR × fp32 main fp32 PR × RCCL bf16 main route PR route
256 KiB 12.7 7.4 1.73 14.4 10.1 1.43 13.7 LL / LL 1-shot / split
512 KiB 12.2 8.6 1.43 12.2 10.4 1.18 16.1 LL 2-shot / LL 2-shot 1-shot / split
768 KiB 12.7 9.9 1.28 12.6 10.6 1.19 18.2 LL 2-shot / LL 2-shot 1-shot / split
1 MiB 13.0 10.5 1.24 13.0 10.7 1.22 20.5 LL 2-shot / LL 2-shot split / split
1.25 MiB 15.7 11.3 1.39 15.8 11.5 1.37 27.2 LL 2-shot / LL 2-shot split / split
1.5 MiB 16.3 11.4 1.43 16.4 11.8 1.38 28.5 LL 2-shot / LL 2-shot split / split
2 MiB 17.7 12.2 1.45 17.9 12.3 1.46 32.5 LL 2-shot / LL 2-shot split / split
3 MiB 23.3 16.3 1.43 23.1 16.8 1.38 35.7 LL 2-shot / LL 2-shot split / split
3.73 MiB ★ 23.8 14.8 1.61 23.8 14.9 1.59 38.9 LL 2-shot / LL 2-shot split / split
4 MiB 24.0 14.4 1.66 24.2 14.7 1.65 38.6 LL 2-shot / LL 2-shot split / split
5 MiB 29.1 17.0 1.71 29.1 17.2 1.69 37.4 LL 2-shot / LL 2-shot fused / fused
6 MiB 32.7 18.2 1.80 32.6 18.2 1.79 38.3 LL 2-shot / LL 2-shot fused / fused
7.45 MiB ★ 43.5 20.3 2.14 43.3 20.3 2.13 40.2 LL 2-shot / LL 2-shot fused / fused
8 MiB 43.4 20.8 2.09 44.0 20.8 2.11 40.6 LL 2-shot / LL 2-shot fused / fused
12 MiB 47.4 35.5 1.34 47.2 35.4 1.33 46.8 RCCL / RCCL fused / fused
16 MiB 52.8 40.1 1.32 52.7 40.1 1.31 54.3 RCCL / RCCL fused / fused
32 MiB 95.5 65.7 1.45 95.5 65.5 1.46 97.0 RCCL / RCCL fused / fused

TP4, one tray, IPC: main → this PR

size bf16 main bf16 PR × fp32 main fp32 PR × RCCL bf16 main route PR route
256 KiB 5.4 5.3 1.01 8.8 8.5 1.04 8.3 1-shot / LL 1-shot / fused
512 KiB 5.9 5.9 1.00 10.1 8.6 1.18 9.4 1-shot / LL 1-shot / fused
1 MiB 7.0 7.0 1.00 15.3 8.9 1.72 11.4 1-shot / LL 2-shot 1-shot / fused
1.5 MiB 9.5 9.3 1.02 16.3 9.3 1.76 16.2 L2 / LL 2-shot fused / fused
2 MiB 9.9 9.8 1.01 18.1 9.8 1.85 17.0 L2 / LL 2-shot fused / fused
3 MiB 10.7 10.6 1.01 19.6 10.6 1.85 21.8 L2 / LL 2-shot fused / fused
3.73 MiB ★ 11.4 11.2 1.02 22.4 11.2 2.01 22.5 L2 / LL 2-shot fused / fused
4 MiB 11.7 11.4 1.02 22.8 11.4 2.00 22.9 L2 / LL 2-shot fused / fused
5 MiB 22.9 15.2 1.51 24.1 15.3 1.58 24.0 L2 / RCCL split / split
6 MiB 23.6 16.5 1.43 25.1 16.6 1.51 25.0 L2 / RCCL split / split
7.45 MiB ★ 24.6 18.2 1.35 26.8 18.4 1.46 26.7 L2 / RCCL split / split
8 MiB 25.0 17.8 1.40 27.4 18.0 1.53 27.4 L2 / RCCL split / split
12 MiB 29.1 23.7 1.23 39.1 23.9 1.64 39.8 L2 / RCCL fused / fused
16 MiB 35.8 30.0 1.19 44.3 30.2 1.47 45.1 L2 / RCCL fused / fused
32 MiB 59.5 53.9 1.10 153 53.3 2.87 158 L2 / RCCL fused / fused

TP4, one tray, symm_mem: main → this PR

size bf16 main bf16 PR × fp32 main fp32 PR × RCCL bf16 main route PR route
256 KiB 7.5 5.3 1.40 8.6 8.5 1.01 8.4 LL / LL 1-shot / fused
512 KiB 8.7 5.9 1.47 9.8 8.6 1.13 9.4 LL / LL 1-shot / fused
1 MiB 11.1 7.0 1.58 11.0 8.9 1.24 11.5 LL 2-shot / LL 2-shot 1-shot / fused
1.5 MiB 12.7 9.3 1.37 12.7 9.3 1.36 16.3 LL 2-shot / LL 2-shot fused / fused
2 MiB 14.1 9.8 1.44 14.1 9.8 1.43 17.1 LL 2-shot / LL 2-shot fused / fused
3 MiB 16.9 10.6 1.59 16.9 10.7 1.58 21.7 LL 2-shot / LL 2-shot fused / fused
3.73 MiB ★ 23.1 11.2 2.06 23.1 11.2 2.05 22.5 LL 2-shot / LL 2-shot fused / fused
4 MiB 23.3 11.5 2.03 23.3 11.5 2.03 22.9 LL 2-shot / LL 2-shot fused / fused
5 MiB 24.2 15.2 1.59 24.1 15.4 1.57 24.0 RCCL / RCCL split / split
6 MiB 25.2 16.9 1.49 25.1 17.0 1.48 25.0 RCCL / RCCL split / split
7.45 MiB ★ 26.7 19.5 1.37 26.7 19.3 1.38 26.7 RCCL / RCCL split / split
8 MiB 27.5 17.5 1.58 27.4 17.8 1.54 27.4 RCCL / RCCL split / split
12 MiB 39.3 24.7 1.59 39.2 25.0 1.57 39.8 RCCL / RCCL fused / fused
16 MiB 44.1 31.0 1.42 44.1 31.0 1.42 45.2 RCCL / RCCL fused / fused
32 MiB 153 55.1 2.78 153 54.8 2.80 160 RCCL / RCCL fused / fused

TP2, one tray, IPC: main → this PR

size bf16 main bf16 PR × fp32 main fp32 PR × RCCL bf16 main route PR route
256 KiB 4.9 4.9 1.00 6.8 6.8 1.00 6.9 1-shot / LL 1-shot / LL
512 KiB 5.0 5.0 1.00 7.1 7.1 1.00 7.1 1-shot / LL 1-shot / LL
1 MiB 5.2 5.2 1.00 8.0 8.0 1.00 7.8 1-shot / LL 1-shot / LL
1.5 MiB 7.2 7.2 1.00 11.9 8.0 1.48 12.2 1-shot / LL 1-shot / fused
2 MiB 7.7 7.7 1.01 12.4 8.2 1.51 12.6 1-shot / LL 1-shot / fused
3 MiB 8.7 8.8 0.99 17.4 11.9 1.46 15.6 1-shot / LL 1-shot / split
3.73 MiB ★ 10.5 10.7 0.99 17.4 12.2 1.43 16.2 1-shot / LL 1-shot / split
4 MiB 10.7 10.8 0.99 18.6 12.2 1.52 16.5 1-shot / LL 1-shot / split
5 MiB 13.3 13.2 1.01 20.6 14.6 1.41 23.6 1-shot / RCCL 1-shot / fused
6 MiB 13.8 13.8 1.00 21.2 15.7 1.35 24.2 1-shot / RCCL 1-shot / fused
7.45 MiB ★ 15.3 15.3 1.00 21.9 18.8 1.16 24.7 1-shot / RCCL 1-shot / fused
8 MiB 15.6 15.6 1.00 22.1 19.0 1.16 24.9 1-shot / RCCL 1-shot / fused
12 MiB 23.5 22.7 1.03 141 22.5 6.27 146 L2 / RCCL fused / fused
16 MiB 27.1 27.2 1.00 142 26.7 5.33 148 L2 / RCCL fused / fused
32 MiB 51.7 50.5 1.02 175 49.3 3.54 181 L2 / RCCL fused / fused
This PR's kernels side by side (bf16 and fp32): the 1-shot / fused / split / LL crossovers behind the routes

TP8, two trays, symm_mem, bf16

size 1-shot fused split LL / pull RCCL PR route
256 KiB 7.4 9.8 9.8 12.8 13.7 1-shot
512 KiB 8.6 13.5 10.0 15.1 16.1 1-shot
768 KiB 9.9 14.1 10.3 16.8 18.2 1-shot
1 MiB 11.1 14.0 10.5 18.7 20.5 split
1.25 MiB 17.2 14.2 11.3 24.6 27.2 split
1.5 MiB 17.8 14.1 11.4 27.6 28.5 split
2 MiB 19.8 15.2 12.2 31.3 32.5 split
3 MiB 28.7 15.6 16.8 51.7 35.7 split
3.73 MiB ★ 32.8 16.1 14.7 49.1 38.9 split
4 MiB 33.7 16.4 14.4 58.5 38.6 split
5 MiB – 17.0 19.5 152 37.4 fused
6 MiB – 18.3 23.5 173 38.3 fused
7.45 MiB ★ – 20.3 24.0 219 40.2 fused
8 MiB – 20.8 24.3 238 40.6 fused
12 MiB – 35.5 36.5 333 46.8 fused
16 MiB – 40.2 42.4 406 54.3 fused
32 MiB – 65.7 76.4 693 97.0 fused

TP8, two trays, symm_mem, fp32

size 1-shot fused split LL / pull RCCL PR route
256 KiB – 10.1 10.1 14.6 13.7 split
512 KiB – 13.5 10.4 16.6 16.1 split
768 KiB – 13.9 10.6 18.9 18.2 split
1 MiB – 14.1 10.7 21.2 20.4 split
1.25 MiB – 14.2 11.5 28.0 27.1 split
1.5 MiB – 14.5 11.8 31.9 28.5 split
2 MiB – 15.2 12.3 36.4 32.4 split
3 MiB – 15.3 16.8 59.5 35.7 split
3.73 MiB ★ – 16.1 14.9 59.3 38.8 split
4 MiB – 16.1 14.7 67.4 38.5 split
5 MiB – 17.2 19.5 158 37.4 fused
6 MiB – 18.3 23.1 171 38.4 fused
7.45 MiB ★ – 20.3 24.3 216 40.1 fused
8 MiB – 20.9 24.9 236 40.6 fused
12 MiB – 35.4 37.5 329 46.6 fused
16 MiB – 40.1 44.1 413 54.4 fused
32 MiB – 65.3 89.4 714 96.6 fused

TP4, one tray, IPC, bf16

size 1-shot fused split LL / pull RCCL PR route
256 KiB 5.3 8.5 8.7 7.5 8.3 1-shot
512 KiB 5.9 8.6 8.9 8.6 9.4 1-shot
1 MiB 7.0 8.9 9.3 12.8 11.4 1-shot
1.5 MiB 9.5 9.3 10.7 17.1 16.2 fused
2 MiB 10.8 9.7 10.9 19.2 17.0 fused
3 MiB 13.7 10.6 12.5 28.6 21.8 fused
3.73 MiB ★ 17.5 11.2 13.5 29.6 22.5 fused
4 MiB 17.9 11.4 13.7 31.5 22.9 fused
5 MiB 21.9 16.3 15.2 66.9 24.0 split
6 MiB 23.1 17.2 16.5 72.1 25.0 split
7.45 MiB ★ 30.1 18.8 18.4 83.1 26.7 split
8 MiB 30.8 19.5 17.6 90.9 27.4 split
12 MiB – 23.7 32.3 122 39.8 fused
16 MiB – 30.0 33.9 146 45.1 fused
32 MiB – 53.9 66.1 274 158 fused

TP4, one tray, IPC, fp32

size 1-shot fused split LL / pull RCCL PR route
256 KiB – 8.5 8.9 8.8 8.3 fused
512 KiB – 8.6 9.1 10.1 9.4 fused
1 MiB – 8.9 9.4 12.2 11.5 fused
1.5 MiB – 9.3 10.8 18.4 16.2 fused
2 MiB – 9.8 11.0 20.2 17.0 fused
3 MiB – 10.6 12.7 32.3 21.5 fused
3.73 MiB ★ – 11.2 13.7 33.4 22.3 fused
4 MiB – 11.4 13.9 35.2 22.6 fused
5 MiB – 16.4 15.2 60.0 23.9 split
6 MiB – 17.3 16.6 63.9 24.9 split
7.45 MiB ★ – 18.9 18.4 75.0 26.6 split
8 MiB – 19.5 17.9 77.9 27.2 split
12 MiB – 23.9 32.2 102 39.8 fused
16 MiB – 30.1 34.0 150 45.1 fused
32 MiB – 53.4 64.9 256 159 fused

TP4, one tray, symm_mem, bf16

size 1-shot fused split LL / pull RCCL PR route
256 KiB 5.4 8.6 8.8 7.5 8.4 1-shot
512 KiB 5.9 8.7 8.9 8.7 9.4 1-shot
1 MiB 7.0 8.9 9.3 11.6 11.5 1-shot
1.5 MiB 10.2 9.3 10.8 16.5 16.3 fused
2 MiB 11.4 9.8 10.9 18.2 17.1 fused
3 MiB 13.8 10.6 12.5 25.4 21.7 fused
3.73 MiB ★ 17.5 11.2 13.4 25.9 22.5 fused
4 MiB 18.0 11.5 13.6 29.0 22.9 fused
5 MiB 22.2 17.6 15.2 68.7 24.0 split
6 MiB 23.9 18.6 16.9 75.9 25.0 split
7.45 MiB ★ 30.2 19.6 19.5 90.9 26.7 split
8 MiB 31.0 20.0 17.4 97.5 27.4 split
12 MiB – 24.7 33.3 134 39.8 fused
16 MiB – 31.0 34.7 162 45.2 fused
32 MiB – 55.1 68.6 287 160 fused

TP4, one tray, symm_mem, fp32

size 1-shot fused split LL / pull RCCL PR route
256 KiB – 8.5 8.8 8.7 8.3 fused
512 KiB – 8.6 9.1 9.7 9.3 fused
1 MiB – 8.9 9.3 12.0 11.4 fused
1.5 MiB – 9.3 10.8 17.7 16.2 fused
2 MiB – 9.9 11.0 19.5 17.1 fused
3 MiB – 10.7 12.7 30.3 21.7 fused
3.73 MiB ★ – 11.2 13.7 30.4 22.4 fused
4 MiB – 11.4 13.9 33.5 22.8 fused
5 MiB – 17.6 15.4 63.0 23.9 split
6 MiB – 18.1 17.0 66.1 24.9 split
7.45 MiB ★ – 19.5 19.3 79.3 26.6 split
8 MiB – 19.8 17.8 86.3 27.3 split
12 MiB – 25.0 33.0 106 39.8 fused
16 MiB – 30.9 35.1 149 45.2 fused
32 MiB – 54.8 66.8 271 159 fused

TP2, one tray, IPC, bf16

size 1-shot fused split LL / pull RCCL PR route
256 KiB 4.9 7.6 8.1 6.5 6.9 1-shot
512 KiB 5.0 7.7 8.3 6.8 7.1 1-shot
1 MiB 5.2 7.9 10.3 8.0 7.8 1-shot
1.5 MiB 7.4 8.1 10.6 11.1 12.2 1-shot
2 MiB 7.7 8.3 10.8 11.7 12.6 1-shot
3 MiB 8.8 13.3 11.9 16.4 15.6 1-shot
3.73 MiB ★ 10.7 13.6 12.3 16.7 16.2 1-shot
4 MiB 10.9 13.7 12.3 17.4 16.5 1-shot
5 MiB 13.2 14.8 18.1 32.6 23.6 1-shot
6 MiB 13.9 15.5 18.8 33.1 24.2 1-shot
7.45 MiB ★ 15.3 18.7 19.6 35.4 24.7 1-shot
8 MiB 15.6 19.0 19.7 35.0 24.9 1-shot
12 MiB 23.9 22.8 33.7 43.4 146 fused
16 MiB 28.5 27.1 38.6 53.0 148 fused
32 MiB – 50.5 74.5 98.5 181 fused

TP2, one tray, IPC, fp32

size 1-shot fused split LL / pull RCCL PR route
256 KiB – 7.5 8.1 6.8 6.8 LL
512 KiB – 7.7 8.3 7.1 7.0 LL
1 MiB – 7.9 10.2 8.1 7.7 LL
1.5 MiB – 8.0 10.6 11.8 11.9 fused
2 MiB – 8.2 10.8 12.3 12.2 fused
3 MiB – 13.2 11.9 17.0 15.6 split
3.73 MiB ★ – 13.6 12.2 17.4 16.2 split
4 MiB – 13.7 12.2 18.5 16.4 split
5 MiB – 14.7 18.0 28.1 20.8 fused
6 MiB – 15.6 18.6 28.9 21.3 fused
7.45 MiB ★ – 18.7 19.5 30.0 21.9 fused
8 MiB – 19.0 19.6 30.1 22.1 fused
12 MiB – 22.5 33.8 34.2 146 fused
16 MiB – 26.7 38.2 37.0 148 fused
32 MiB – 49.3 73.2 52.9 181 fused

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

The kernel changes are gfx1250 only. On gfx9, the Python changes leave the Lamport caps at 0 and select_lamport_ar returns None, as before; symm_mem and VMM init are gfx1250 only.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

The routes and their measurements are in the comments of the tables they set (custom_all_reduce.py) and of run_2shot (.cuh).

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None for users. Internal signatures:

  • allreduce_lamport_gfx1250 gains split=False and takes fp32 with two_shot=True.
  • CustomAllreduce.select_lamport_ar returns (two_shot, split) or None instead of a bool.

PR Self-Review

Reviewed revision

6c25a7f46

Behavior and intent

On gfx1250, plain all-reduce routes by size to one Lamport kernel family on every transport.

  • The Lamport one-shot (fp16/bf16), or main's Lamport two-shot in its fused or split layout.
  • fp32 runs the two-shot through a 32-bit sentinel codec.
  • The LL two-shot is removed; it carried half as much payload a 16-byte line.
  • TP8 across trays and TP4 over symm_mem or VMM now get the Lamport kernels.
  • Every rank still gets the bits of the fp32 sum in rank order, rounded once, NaNs included.

Validation and unverified scope

All on MI455X, at the head 6c25a7f46.

  • op_tests/multigpu_tests/test_custom_allreduce.py --regression passed:
    • TP2 over IPC;
    • TP4 over IPC, symm_mem (--transport symm) and VMM (AITER_CUSTOM_AR_FORCE_VMM=1).
    • Each run covers: tail, LL mixed sizes, two-shot mixed sizes (ragged sizes included), LL in place, two-shot sentinel payload, plain cutoff.
  • TP8 across two trays over symm_mem (per-rank functions under torchrun, 4 + 4): --regression passed, with the same checks.
  • Other tests passed:
    • gfx1250_poc/test_gfx1250_lamport_allreduce.py at TP2 and TP4, bf16 and fp32: routes as restated, every kernel bit-exact, 99-call mixed sequences;
    • test_fused_ar_rms_lamport.py, test_ar_add_lamport.py and test_ag_lamport.py at TP2 and TP4;
    • pytest test_custom_allreduce_size_env.py: 17 passed.
    • The PoC's restated routes agree with select_lamport_ar on CPU for TP2, TP4 and TP8 defaults: 27 sizes × bf16 and fp32, 162 cases.
  • Benchmark: the tables above, every timed case bit-exact.
  • Known gap: TP8 at 2.5–3 MiB, where the split launches W = 96. It trails the previous head's split there (16.3 vs 13.9 µs at 3 MiB, bf16) and varies between runs (14.5 to 16.8). It is still 1.4× main. This is a follow-up.
  • Not run, and why:
    • TP8 over IPC: hipIpc does not cross these 4-GPU trays.
    • TP8 over VMM and TP6: not run.
    • The PoC at TP8.
    • MI250X / MI300X: gfx1250 only.
    • No end-to-end serving run.

PR-specific question

What selects the changed path:

  • Arch: gfx1250 only. CustomAllreduce builds the Lamport inbox only there, and symm_mem and VMM are gfx1250 only.
  • Input: select_lamport_ar → should_lamport_ar(two_shot=True) requires:
    • the inbox built (cap > 0);
    • fp16, bf16 or fp32;
    • contiguous;
    • bytes % 16 == 0 and 0 < bytes <= world_size × cap.
  • Kernel: then _LAMPORT_AR_1SHOT_MAX_BYTES, _LAMPORT_AR_FP32_LL_MAX_BYTES and _LAMPORT_AR_SPLIT_BYTES pick it.
  • Same on every rank: shapes, dtype and cap decide, never addresses, so no rank waits on a peer that took another path.

What keeps unsupported inputs out, in C++:

  • ar_packs throws on a partial pack or past the inbox's world_size × slot packs.
  • allreduce_lamport throws before init_lamport_ar_rms, and on a one-shot of a 4-byte dtype.
  • The .cu wrapper takes fp16, bf16 and fp32 only, with a contiguous output of the input's dtype and size.
  • A ragged last chunk is handled by the p < packs guards; lanes past it only re-arm.

Changed op tests

  • op_tests/multigpu_tests/test_custom_allreduce.py:
    • _AR2S_GFX1250_MIXED_SIZES gains two ragged fp32 sizes. 655 364 and 1 597 444 have numel 4 mod 8, so no world size cuts them into whole packs a chunk. They fall in the ranges where TP8 splits and fuses, and the list runs at TP2, TP4 and TP8. Without them, nothing fails if the chunk grain goes back to 16 × ngpus.
    • The two-shot sentinel test also runs at TP2, which now takes the two-shot.
    • Comments follow the routes.
  • op_tests/multigpu_tests/test_custom_allreduce_size_env.py: CPU tests of the size gates.
    • test_gfx1250_lamport_ar_route pins select_lamport_ar at every route boundary: per world size, dtype and layout, and at an unmeasured world size.
    • The TP8 asserts of the skip list are gone, and the TP8 plain cutoff is 4 MiB.
    • No other test checks these boundaries.
  • op_tests/multigpu_tests/gfx1250_poc/test_gfx1250_lamport_allreduce.py: the PoC restates the routing rules independently and checks every rank's kernel against them.
    • It gains the split candidate and fp32 two-shots in the mixed sequence, which share the inbox with AR + add, AR + RMSNorm and all-gather.
    • It drops LAMPORT_AR_SKIP_TP.
    • It is the only test that interleaves every Lamport op on one inbox.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7937 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added the HIP label Nov 19, 2026
@aiter-bot

aiter-bot commented Nov 19, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 5cbc96084809 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (6)

Post TP4 before/after numbers and a TP4 --regression run at head. The TP4 table was "measured earlier, one round each". Its weakest rows are 2–4 MiB (0.98x at [320,3584] 2.29 MB, then 1.02–1.04x), which sit right after the 3x128 → 2x256 switch (custom_all_reduce_gfx1250.cuh:2531-2545). Please post ≥2 alternating rounds at head covering 1.7–4 MiB, the 2 MiB switch, and TP4 4–8 MiB (2x512). The PR's own comment moves TP4 4.59 MB from 22.2 µs (base) to 26.8 µs (custom_all_reduce.py:254-256). Also add one TP8 point in 0.5–0.92 MB, the new floor window with the s_sleep delay.

Reuse the existing Lamport helpers instead of copying them. These are identical to existing helpers apart from their names:

  • ar2s_u32x4 / ar2s_store / ar2s_load (.cuh:511-529) match lamport_u32x4 / lamport_store_b128 / lamport_load_b128 (:1320-1338).
  • kAr2sBuffers (:239) matches kLamportBuffers (:1251).
  • The literal 32 (:580-584, :702-704, :2471) should be kLamportWave (:1252).
  • ensure_2s_tables_ (:2464-2476) repeats the init steps of init_lamport_ar_rms (:2599-2607).
  • The protocol comment (:470-481) restates :1235-1242.

Move kLamportBuffers / kLamportWave above :236, because ar2sScratchBytes uses them. Move the three helpers below the AITER_GFX1250_HAVE_B128 / llx_v4u_gptr block (~:300), then call them from both kernels. Only kAr2sSentinel, ar2s_canonical and ar2s_pending need to be new, since the 32-bit sentinel is required.

Make the test inputs actually catch a stale line in the two-shot inbox. At test_custom_allreduce.py:393-406 the inputs cycle through 3 values (x, -x, 2x), and the kernel rotates through 3 inbox buffers, so a stale line from 3 calls earlier carries exactly the expected bits. In a CPU model of the real size lists, the test cannot detect a missing re-arm in the pack groups that only the 7.81 MB call reaches: 1575 of 3815 at TP4 and 788 of 1908 at TP8. Use 4 exact variants (x, -x, 2x, -2x); the model then shows 0 undetected groups. Fix the "one or two rounds back" comment too.

Nits (required here, small)

  1. NaN bits differ across ranks. The owner writes raw r to its own chunk while peers get rc (.cuh:659-664). Write rc there, as lamport_ar_rmsnorm_gfx1250 already canonicalises its local operand (:1381-1383). No test feeds a 0xffffffff payload word, so add one: set one fp32 word to bits 0xffffffff in one rank's input, then assert there is no hang, NaN appears at that position, and the bits are identical on every rank.
  2. Fix comments that are wrong or not backed by posted data.
    • test_custom_allreduce.py:304-319: the real shapes are TP8 3x64/3x128/2x256 and TP4 3x128/2x256/2x512. 7.81 MB ends in a partial group at TP8 only. At TP2/TP6 all five sizes take the one-shot LL.
    • The perf numbers at .cuh:215-219, .cuh:2526-2530 and custom_all_reduce.py:254-257 do not match the posted table (e.g. 26.6/43.5 vs 25.9/42.8). The TP4 8.39 MB figure (29.0 vs RCCL 29.7) is not in it at all.
  3. Correct the PR body. "Routing and size cutoffs unchanged" is wrong: use_2s now requires bytes % (16*ws) (.cuh:2399-2402), so for TP8 bf16 with numel ≡ 32 mod 64 above 4 MiB the call falls back to the naive pull. Please confirm no shipped TP8 shape hits this.

Questions

  • 16-byte sendbuff/recvbuff access has no data_ptr % 16 check, unlike the sibling lamport_ar_add path (custom_all_reduce.py:2408). Is that acceptable? Any guard must be rank-uniform.
  • Is the symm_mem meta base 2 MiB aligned, as .cuh:252-256 claims?

Reviewed at 7025b9d (deep; 3 hunters + 2 C1 verifiers + 1 C2, plus 2 extra votes from a parallel pass). Already fixed: n/a (first review).

Copilot AI balanced review requested due to automatic review settings November 19, 2026 14:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@zejunchen-zejun

Copy link
Copy Markdown
Contributor Author

Thanks @valarLip. 2fd780074 takes the code and test items. The GPU items need trays, which I don't have today:
the TP4 table, the TP8 0.5–0.92 MB point, and --regression at this head. I'll post them here when the runs are done.
The description is updated: the routing change, the pending runs, and the self-review section.

Action required

1. TP4 before/after, TP4 --regression, and a TP8 point in 0.5–0.92 MB: pending.

  • TP4 in one tray: [HIP] perf(custom_ar): gfx1250 LL two-shot all-reduce for 1 MiB+ messages #7432 and this head, in at least two alternating rounds.
    • 1.7–4 MiB, around the 3 × 128 → 2 × 256 switch at 2 MiB: [240, 3584], [128, 7168], [160, 7168], [320, 3584],
      [448, 3584], [545, 3584], [585, 3584].
    • 4–8.4 MB, the 2 × 512 range: [320, 7168], [384, 7168], [448, 7168], [545, 7168], [585, 7168].
  • TP4 --regression: with the IPC transport and with --transport symm.
  • TP8: [40, 7168] (0.57 MB) and [56, 7168] (0.80 MB), where W = 64 and the pollers sleep first.

You're right that the comment showed TP4 4.59 MB at 22.2 µs before and 26.8 µs after. By default, TP4 plain all-reduce
above 4 MiB goes to RCCL. Whether the 2 × 512 range is behind #7432 is what this table will show, and I'll act on it
then.

2. The Lamport helpers are reused.

  • kLamportBuffers / kLamportWave now sit above the two-shot's inbox, which sizes itself with them.
  • lamport_u32x4 / lamport_store_b128 / lamport_load_b128 now sit below the AITER_GFX1250_HAVE_B128 /
    llx_v4u_gptr block, and both kernels call them.
  • kAr2sBuffers and the ar2s_* copies are gone. The two-shot keeps only kAr2sSentinel, ar2s_canonical and
    ar2s_pending, for the 32-bit sentinel.
  • The literal 32s are now kLamportWave.
  • ensure_2s_tables_ and init_lamport_ar_rms arm their inboxes with one helper, arm_lamport_inbox_. It fills the
    rank's inbox with the sentinel, zeroes packs / kLamportWave round counters, and syncs.
  • The two-shot's protocol comment now points to lamport_ar_rmsnorm_gfx1250's. It keeps only what differs: two
    phases, and lanes that only re-arm.

3. The test inputs now catch a stale line.

  • The rounds cycle x, −x, 2x and −2x, and the "one or two rounds back" comment is fixed.
  • A CPU model of the real size lists reproduces your counts with three variants: TP4 1575 of 3815 waves, TP8 788 of
    1908.
  • It also finds the same gap in the in-place list, where only the 3.91 MB call reaches some waves: TP4 116 of 1908,
    TP8 58 of 954.
  • With four variants, both lists show 0 undetected waves at both world sizes.

Nits

  1. NaN bits.
    • The reduce role now writes its own chunk with the canonical word it sends, so every rank gets the same bits.
    • New test_allreduce_2s_gfx1250_sentinel_payload, in --regression at TP4 and TP8, fp32, 1.15 MB (three wave
      groups) and 4.59 MB (two).
    • Rank 0's input has bits 0xffffffff in its own chunk (the owner's sum) and in rank 1's (a pushed contribution).
    • It asserts that nothing hangs (30 s deadline), that both positions are NaN, that every other element is exact, and
      that every rank's output bits are identical.
  2. Comments.
    • test_custom_allreduce.py now gives the real shapes: TP8 3 × 64 / 3 × 128 / 2 × 256, TP4 3 × 128 / 2 × 256 /
      2 × 512.
    • Partial waves: 3.91 MB at both world sizes, 7.81 MB at TP8 only. At TP2/TP6, all five in-place sizes take the
      one-shot LL.
    • The perf numbers at .cuh:215-219, .cuh:2526-2530 and custom_all_reduce.py:254-257 are now the posted TP8
      table's (25.9 vs 42.8 at 8.26 MB, and so on).
    • The TP4 4.59 and 8.39 MB figures are out until the new TP4 table is posted. Until then, the TP4 line of
      ar2sMaxBytes keeps main's [HIP] perf(custom_ar): gfx1250 LL two-shot all-reduce for 1 MiB+ messages #7432 numbers.
    • The inbox's 33.2 vs 26.1 µs is now in the description too.
  3. PR body corrected.
    • "Routing and size cutoffs unchanged" is gone. The two-shot needs bytes % (16 × world_size) == 0, so a TP8 bf16
      all-reduce above 4 MiB whose numel is 32 mod 64 now takes the pull kernel.
    • No shipped TP8 shape hits this. Every all-reduce ATOM issues is whole rows of a hidden size or a MoE latent, and
      those are multiples of 64 elements. Kimi-K3's are [T, 7168] and [T, 3584].

Questions

16-byte access without a data_ptr % 16 check. This keeps an assumption the gfx1250 path already makes:

  • ar_gfx1250_naive_unroll4, the pull kernel past the LL range, reads every peer's input and writes out in 16-byte
    packs with no pointer check.
  • _fits_custom_size checks only bytes % 16, and the LL kernels read in in 8-byte packets.
  • The plain all-reduce's tensors are allocator-aligned: a contiguous activation, and empty_like.

So I added no guard. If you want one, a rank-uniform form would test storage_offset() * element_size() % 16 in
should_custom_plain_ar. That depends only on view metadata, which every rank computes the same way, since the
caching allocator's bases are 512-byte aligned. data_ptr() itself isn't guaranteed to be uniform.

Is the symm_mem meta base 2 MiB aligned? No API guarantees it, so the comment no longer claims it.

  • It now says the inbox is 2 MiB-aligned within the meta buffer, and in memory wherever the buffer's base is.
  • The meta buffer is an allocation of its own on every transport:
    • IPC: allocate_meta_buffer, i.e. hipExtMallocWithFlags;
    • VMM: VMMBuffer reserves its VA at the recommended allocation granularity;
    • symm_mem: mori's torch backend reserves each allocation the same way (src/allocator/symm_backend.cpp).
  • A base off a boundary costs time, the 6.7 µs at TP8 7.81 MB, not correctness.
  • With the runs above, I'll print meta_ptr % 2 MiB and the granularity for each transport.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (7)

1. Rebase onto main and keep one Lamport two-shot. Main gained lamport_ar_2shot_gfx1250 (#7927, main .cuh ~1889-2057) after this branch was cut. It is the same protocol as the rewritten ar_2s_lamport_gfx1250 (.cuh:565-715): reduce-scatter + all-gather pushed as 16 B lines, kLamportBuffers rotation re-arming (round+2)%3, a counter per kLamportWave wave, rank-order fp32 sum. What differs is the 32-bit sentinel (fp32), the meta-buffer inbox (every transport), TP8 by default, and the launch shape. Please merge them into one kernel and delete the other:

  • extend #7927's kernel with a 32-bit codec (LamportAgEscape already shows the pattern), plus your launch shape and a TP8 cap; or
  • route select_lamport_ar's two-shot to yours, adding the short-chunk and unaligned-copy support.

Pick the direction from a TP4 IPC bf16 A/B over 1.25-8 MiB. When you rebase, the one conflict (init_lamport_ar_rms) must keep main's 2x cluster_partials, the escape-inbox 0 fill and the two-shot AG inbox 0xff fill. Taking this side writes out of bounds in the FP8 amax pass. Pointing arm_lamport_inbox_ at the whole pool arms the escape inbox with 0xff.

2. Post build, --regression and perf numbers on the rebased head. No CI lane builds or runs gfx1250: multi-GPU CI is MI350X, the 2s tests return at _is_gfx1250, and the branch conflicts, so no PR CI ran. Your list of unverified items at 2fd7800 is still open: build, --regression TP4/TP8 (IPC + symm_mem), TP8 0.5-0.92 MB.

  • TP4 IPC fp16/bf16 now goes to #7927's kernel, which also lifts the 4 MiB cutoff. Your TP4 table no longer describes it, so drop our r47 TP4 4-8 MiB / 2x512 ask.
  • Instead post TP4 fp32 or VMM/symm_mem at 1-4 MiB vs base, plus the item 1 A/B.

3. Fix text that is wrong on main. .cuh:216-221 ("plain all-reduce stops at 4 MiB by default") is false for TP4 IPC fp16/bf16. custom_all_reduce.py:255 ("TP4 … the two-shot leads at 4.19 MB") now means #7927's kernel, and the line dropped "RCCL from 5.73 MB", the only stated reason for the TP4 cutoff. .cuh:235-237 and :502 name only lamport_ar_rmsnorm as user/twin.

4. Update gfx1250_poc/test_gfx1250_lamport_allreduce.py (on main) for the rename. :158 matches "ar_2s_ll_gfx1250", so ar_2s_lamport_gfx1250 counts as no kernel and "route ok" is False for every TP4 two-shot case (m=128-512, default args); :137 still uses % (8 * tp). Use "ar_2s_lamport_gfx1250" and 16 * tp, and rename the LL2S_* constants and docstrings.

Nits (required here, small; missed in r47)

  1. .cuh:261 "264 KiB past a boundary": Signal is 264192 B = 258 KiB. Same in the PR body.
  2. The 7025b9d message says "same routing (use_2s; … unchanged)", but use_2s now needs bytes % (16*ws). Fix the squash message.
  3. custom_all_reduce.py _init_ipc comment (~:1925): meta is not "Signal (~34 KB) + LL staging scratch". Point to the .cuh layout comment.

Reviewed at 2fd7800 (deep; 3 hunters + C2 + 5 C1 verifiers). Already fixed: Lamport helper reuse, 4 test variants, owner NaN bits + sentinel test, test-shape/perf comments, PR-body routing note.

@zejunchen-zejun
zejunchen-zejun force-pushed the zejun/gfx1250-ar-2s-lamport branch from 2fd7800 to e2127e7 Compare November 20, 2026 04:00
Copilot AI balanced review requested due to automatic review settings November 20, 2026 04:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@zejunchen-zejun

Copy link
Copy Markdown
Contributor Author

Thanks @valarLip. The branch is rebased onto main as one commit, e2127e7ec, with the message corrected. The GPU items
are still waiting for trays.

1. One Lamport two-shot: I'll keep this kernel, unless the A/B says otherwise.

  • Its meta-buffer inbox runs on every transport, TP8 across trays included, and it takes every dtype.
  • The plan:
    • add short chunks and the unaligned copy;
    • route select_lamport_ar's two-shot to it;
    • delete lamport_ar_2shot_gfx1250.
  • The TP4 IPC bf16 A/B of the two over 1.25–8 MiB comes first, as you suggest, once trays are free.
  • @TennyWang1223, does this direction work for you?
  • Until then the two run side by side. TP4 fp16/bf16 on IPC goes to [HIP] fea: impl gfx1250 lamport allreduce #7927's kernel (select_lamport_ar), and the
    rest of the range comes here.

The conflict (init_lamport_ar_rms) keeps main's side:

  • cluster_partials stays at 2×.
  • The escape inbox is filled with 0.
  • [HIP] fea: impl gfx1250 lamport allreduce #7927's all-gather inbox is filled with 0xff.
  • arm_lamport_inbox_ arms only the shared inbox (lamport_ar_rms_buffer_bytes) and its round counters, with one
    sync after all three regions.

2. Build, --regression and numbers on the rebased head: pending trays. I'll post:

  • the build;
  • --regression at TP4 and TP8, IPC and symm_mem;
  • TP4 fp32 and VMM / symm_mem at 1–4 MiB against base;
  • TP8 at 0.5–0.92 MB;
  • the A/B from item 1.

The TP4 IPC bf16 table is out of the description, and the 4–8 MiB / 2 × 512 ask is dropped, as you said.

3. Text fixed for main

  • .cuh ar2sMaxBytes: plain all-reduce stops at 4 MiB by default, except fp16/bf16 on IPC. The Lamport kernels take
    those past 4 MiB too (select_lamport_ar).
  • custom_all_reduce.py: the TP4 line gives the cutoff's reason again. RCCL overtook the LL two-shot this kernel
    replaced from 5.73 MB (25.8 vs 26.2).
  • .cuh Lamport constants: the comment names every Lamport kernel on the AR + RMSNorm pool, beside this one.
  • The two-shot's protocol comment says lamport_ar_2shot_gfx1250 is the same two-shot on that pool, for 2-byte dtypes
    on IPC.

4. gfx1250_poc/test_gfx1250_lamport_allreduce.py: it now matches ar_2s_lamport_gfx1250 (route ar2s) and
16 * tp. The constants are now AR2S_MIN_BYTES / AR2S_MAX_BYTES, and the docstrings follow.

Nits

  1. 258 KiB (the Signal struct's 264192 B), in the .cuh and in the description.
  2. The commit message (now one commit) says that use_2s needs bytes % (16 × world_size), and what that sends to the
    pull kernel.
  3. _init_ipc now points to the .cuh layout: Signal, LL scratch, the AR + RMSNorm shard, the two-shot inbox.

On the earlier meta base question:

  • The IPC meta is an uncached, coarse-grained allocation, and 2 MB-aligned at these sizes. The _init_ipc comment
    documents that regime.
  • VMM and mori's symm_mem reserve at the allocation granularity.
  • I'll print meta_ptr % 2 MiB for each transport with the runs.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (6)

1. Keep one Lamport two-shot (r49 item 1, still open). ar_2s_lamport_gfx1250 (.cuh:541-721) and lamport_ar_2shot_gfx1250 (.cuh:1993-2161) now run the same protocol: 16 B payload lines, kLamportBuffers rotation, per-kLamportWave rounds, (round+2)%3 re-arm, rank-order fp32 sum, p0..p7 inboxes. Before this PR the meta-buffer two-shot was an LL kernel, so this diff creates the duplicate. The differences are parameters. The 32-bit codec also covers 2-byte dtypes, and #7927's ragged chunks are its p < packs guards. kAr2sSentinel also restates LamportAgEscape::kOnes. Merge them and delete one in this PR, not after an A/B. Merging also fixes item 2.

2. Take ragged chunks instead of tightening use_2s to bytes % (16*ws) (.cuh:3276-3280). Sizes that are a multiple of 8·ws but not 16·ws leave the two-shot on the default path:

  • TP8 4–8 MiB go to the naive pull (py:258 cites the pull at 405 µs at 14.68 MB).
  • TP8 0.5–4 MiB and TP4 1–4 MiB (fp32; fp16/bf16 off IPC) go to the LL one-shot.
  • No shipped hidden size hits this; only hidden ≡ 32 mod 64 with odd T does.

Use part = ceil(packs/ngpus) plus p < packs, as lamport_ar_2shot_gfx1250 does (.cuh:2052-2064). Do not re-add an 8-byte LL fallback kernel. Either way, the PR body and squash message must list every routing change, not "one case".

3. Post build, --regression (TP4/TP8, IPC + symm_mem) and perf on this head (r49 item 2, still open). No CI lane builds or runs gfx1250, and the tests return early off gfx1250. The PR body still says "pending at 2fd7800".

4. Fix the PR body.

  • "264 KiB" should be 258 KiB (r49 Nit 1: only the .cuh was fixed).
  • "Reviewed revision / Pending at 2fd7800" is stale.
  • The TP4 IPC table is still there, though you said you removed it.
  • "Above 4 MiB TP4 plain AR goes to RCCL" is false for fp16/bf16 on IPC (select_lamport_ar).
  • "Changed op tests" omits the gfx1250_poc file (aiter-bot FAIL).

5. Fix code text the PR made wrong.

  • .cuh:543-544: lamport_ar_add_gfx1250 does not exist; point to lamport_ar_1shot_gfx1250.
  • .cuh:4054-4057: the comment above if(use_2s(...)) describes only the LL flag-in-data lane.
  • .cu:113-114 and py:260: the two-shot is not one of "the LL kernels".
  • .cuh:331-332: the line helpers are also used by 1shot / 2shot / ag.
  • py:1990: "tens of MiB" is 48–194 MiB.
  • .cuh:265-266 and the PR body: "6.7 us longer (33.2 vs 26.1 us)" does not add up, since 33.2 − 26.1 = 7.1.

6. Fix the test text.

  • test_custom_allreduce.py:507-508: where three sizes reach a wave, the line 3 rounds back is the same size one iteration earlier, not "another size's line".
  • :880-882: the --regression help omits the two-shot mixed test and the new sentinel test.
  • :422/:600/:923: LL2S/ll2s names remain, while the poc file was renamed.

Reviewed at e2127e7 (deep; hunters H1–H3 + B3 + C2, 2 C1 verifiers, Stage D). CPU checks found no protocol, layout or arming bug: an inbox-protocol model, launch-bounds replay, meta layout per TP, and the init_lamport_ar_rms merge. Already fixed: helper reuse, 4 input variants, owner NaN bits + sentinel test, poc rename, r49 text items 3a–d, _init_ipc comment, squash message (use_2s grain).

Copilot AI balanced review requested due to automatic review settings November 20, 2026 06:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 20, 2026 08:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

zejunchen-zejun and others added 3 commits November 20, 2026 08:54
…ort lines

ar_2s_ll_gfx1250 sent LL lines, 8 bytes of payload and two epoch flags in 16
bytes, so a TP8 two-shot put 3.5 x the message on the fabric. Its
replacement, ar_2s_lamport_gfx1250, sends the payload alone. The receiver's
inbox holds a sentinel (all bits set) in every 32-bit word where nothing is
pending. A payload word equal to it is sent as 0x7fffffff (a NaN in fp32 and
NaNs in fp16 / bf16, as the sentinel is), and the reducing rank writes its own
chunk with the same bits. Inbox rounds work as in the other Lamport kernels:
three buffers, a rank-local round counter a wave of packs, the previous
round's buffer re-armed, so CUDA graphs replay as is. It reuses their
constants, line helpers and inbox arming. The reduce-scatter + all-gather,
the in-place read and the rank-order fp32 sum rounded once (bit-identical on
every rank) are unchanged.

Routing: the size range is the same (ar2sMinBytes to ar2sMaxBytes), but
use_2s now needs whole 16-byte packs a chunk, bytes % (16 x world_size)
(8 before). So a TP8 bf16 all-reduce above 4 MiB whose numel is 32 mod 64
takes the pull kernel instead; no shipped TP8 shape is one. At TP4, fp16 /
bf16 on the IPC transport go to the Lamport kernels on the AR + RMSNorm pool
first (select_lamport_ar), as on main.

Launch: at most one block a CU, since a CU running two finishes last (TP8,
7.81 MB: 273 blocks of 2 x 224 threads 45.5 us, 239 of 2 x 256 26.2 us). W
threads a role, the smallest of 64, 128, 256 and 512 that covers a chunk in
cu_count blocks; three wave groups (send, reduce, gather) up to W = 128, two
above. The pollers first sleep through the time before anything can land.

The inbox (48 MiB a rank at TP4 and TP8) starts on a 2 MiB boundary of the
meta buffer. Started where the shard ends, 258 KiB past one, the TP8 call
took 6.7 us longer at 7.81 MB. The meta buffer still shrinks by 15 MB a rank
(TP8 218.4 -> 203.4 MB, TP4 151.3 -> 136.3 MB). CustomAllreduce barriers
after init_custom_ar so that every rank's sentinel fill lands before any
push.

MI455X, TP8 across two trays (symm_mem), bf16 in a CUDA graph, us an
all-reduce, #7432's two-shot -> this one (RCCL): 0.92 MB 13.9 -> 12.6 (20.3),
2.75 MB 20.7 -> 15.5 (40.1), 3.91 MB 25.2 -> 17.9 (39.4), 5.50 MB 29.6 -> 23.5
(39.5), 7.81 MB 38.3 -> 25.4 (42.5), 8.26 MB 39.0 -> 25.9 (42.8). Kimi-K3's
c128 decode all-reduces are [545, 3584] (3.91 MB) and [545, 7168] (7.81 MB).

Tests:
- test_custom_allreduce.py: the two-shot mixed-size and in-place lists add
  sizes whose chunks end in a partial wave of packs. Their regressions cycle
  four exact input variants, so a stale line in any of the three buffers is
  caught. test_allreduce_2s_gfx1250_sentinel_payload feeds a payload word with
  the sentinel's bits.
- gfx1250_poc/test_gfx1250_lamport_allreduce.py names the renamed kernel and
  its 16 x tp divisor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
valarLip's review 5988279188 of e2127e7, items 5 and 6:

- The two-shot's comments point to lamport_ar_1shot_gfx1250 (there is no
  lamport_ar_add_gfx1250 on main). The line helpers serve every Lamport
  kernel.
- The allreduce() comment covers the two-shot as well as the LL one-shot.
- ll_ar_max_bytes and the plain cutoff no longer count the two-shot among
  "the LL kernels".
- The meta size is 48 to 194 MiB.
- The inbox offset cost 7.1 us (33.2 vs 26.1 us, the prototype that changed
  only the offset).
- Tests:
  - the vary_inputs comment says what a pack that three sizes reach reads;
  - the --regression help lists the two-shot mixed sizes and the sentinel
    payload;
  - ll2s / LL2S names become 2s / AR2S.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ernels

At TP8 plain all-reduce never takes the Lamport all-reduce
(lamport_ar_1shot/2shot_gfx1250), even when
AITER_CUSTOM_AR_LAMPORT_RMS_MAX_SIZE sets a Lamport cap there. It keeps
the meta-buffer kernels, ar_2s_lamport_gfx1250 in its range, which is
measured across two trays; the Lamport all-reduce is measured at TP2 and
TP4 only. select_lamport_ar returns None at the world sizes in
_LAMPORT_AR_SKIP_WORLD_SIZES. TP2 and TP4 route as before.

test_custom_allreduce_size_env.py checks the TP8 gate (it fails without
it); the gfx1250 PoC test restates it in expect_route.

Signed-off-by: TennyWang1223 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zejunchen-zejun
zejunchen-zejun force-pushed the zejun/gfx1250-ar-2s-lamport branch from 941dd41 to 741e953 Compare November 20, 2026 08:54
Copilot AI balanced review requested due to automatic review settings November 20, 2026 08:54
TP8 across two MI455X trays over symm_mem, this head's kernels, CUDA graph,
bf16 unless noted:
- The one-shot stops at 768 KiB. The split two-shot overtakes it past there:
  9.9 vs 10.3 us at 768 KiB, 11.1 vs 10.5 at 1 MiB.
- fp32 takes the split from the smallest size up to 4 MiB. Against the fused
  layout: 9.0 vs 9.6 us at 16 KiB, 10.1 vs 10.7 at 256 KiB, 10.8 vs 15.5 at
  1 MiB.
- The cap goes back to 4 MiB a sender, so the two-shot runs to 32 MiB. Past
  8 MiB the fused layout stays ahead of RCCL: 33.5 vs 43.2 us at 10 MiB, 66.0
  vs 96.6 at 32 MiB. Its send loop issues every load before its first remote
  store; main's two-shot, which set the 8 MiB cap, did not.
- The code comments quote these numbers in place of the ones taken on the
  kernels before the merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 22, 2026 12:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@zejunchen-zejun

Copy link
Copy Markdown
Contributor Author

@valarLip Thanks for the review. The seven items are addressed in two commits:

  • ca3a7e0ad;
  • 6c25a7f46, which sets the TP8 routes from this head's own TP8 timings.

03d6565fe between them only merges main, which touches none of this PR's files. Everything below ran on the head 6c25a7f46, and the PR body is rewritten for it. Item by item:

1. One Lamport two-shot. Done as you described: main's lamport_ar_2shot_gfx1250 is the base, now <T, ngpus, BLOCK, ROLES>.

  • Codec. A 32-bit codec, LamportArCodec<T>: fp32 sends an all-ones word as 0x7fffffff; 2-byte dtypes keep the 16-bit sentinel.
  • Layout. ROLES = 1 is main's fused loop. 2 or 3 is the split wave groups from the earlier kernel, with the pre-poll sleep.
  • Deleted. ar_2s_lamport_gfx1250 and its 48 MiB inbox, and [HIP] perf(custom_ar): gfx1250 LL two-shot all-reduce for 1 MiB+ messages #7432's ar_2s_ll_gfx1250 with its peer and flag tables. The meta-buffer path has no two-shot left, so the meta buffer is 64 MiB a rank smaller at TP4 and TP8 (144.3 → 80.3 and 208.3 → 144.3 MiB).
  • Inbox. The reduce-scatter takes one round of the shared Lamport inbox, as every Lamport op does. The all-gather has its own inbox with no rounds, re-armed as it is read (lamport_two_shot_offset).

2. Ragged chunks.

  • Kernel. part = ceil(packs / ngpus), with p < packs guards in send, reduce and gather; lanes past the message only re-arm. There is no bytes % (16 × ngpus) condition left.
  • Test. _AR2S_GFX1250_MIXED_SIZES gains 655_364 and 1_597_444 fp32 elements (2.62 and 6.39 MB).
    • Both have numel ≡ 4 mod 8, so bytes ≡ 16 mod 32: ragged at every world size, not only TP8. They are fp32 because the test checks the rank-order sum.
    • At TP8 they fall in 0.5–4 MiB and 4–8 MiB as you asked: one split, one fused. At TP4 they are fused and split, and at TP2 split and fused.
    • Their last wave is partial everywhere.
    • 200 rounds of the list pass at TP2, TP4 and TP8.

3. _LAMPORT_AR_SKIP_WORLD_SIZES is dropped.

  • Removed: 741e953 is reverted, along with the TP8 asserts in size_env and LAMPORT_AR_SKIP_TP in the PoC. The check you measured at +18 ns is gone.
  • TP8 routes by size, measured on symm_mem, the transport TP8 takes here (two 4-GPU trays):
    • fp16/bf16: the one-shot to 768 KiB (_LAMPORT_AR_1SHOT_MAX_BYTES[8]), the split to 4 MiB, the fused layout to 32 MiB;
    • fp32: the split from the smallest size to 4 MiB (_LAMPORT_AR_SPLIT_BYTES[8] is (0, 4 MiB]), the fused layout to 32 MiB;
    • the cap: _LAMPORT_AR_MAX_BYTES[8] is 4 MiB a sender, so the two-shot runs to 32 MiB. Past 8 MiB the fused layout runs more blocks than CUs and slows, but it stays ahead of RCCL: 33.5 vs 43.2 µs at 10 MiB, 66.0 vs 96.6 at 32 MiB. On main's two-shot, whose send loop this PR reorders, 10 MiB took 45.9 µs against RCCL's 43.0.
    • Timed on this head (table in the PR body): 1.24–2.14× main's route from 256 KiB to 8 MiB, and 1.31–1.46× from 12 to 32 MiB, where main took RCCL.
    • Against the previous head it is level or ahead everywhere except 2.5–3 MiB; see the end.
  • What makes it reachable:
    • The Lamport inbox is built on every transport, not only in _init_ipc: symm_mem and VMM build it too.
    • Plain all-reduce has its own cap, _LAMPORT_AR_MAX_BYTES {2: 16, 4: 8, 8: 4} MiB, next to the RMSNorm cap.
    • AR + RMSNorm, AR + add and AG keep _LAMPORT_AR_RMS_MAX_BYTES, still off at TP8 by default.
  • fp32 routes by measurement too: the LL one-shot only at TP2 up to 1 MiB, the two-shot everywhere else. The two-shot is level with or ahead of the LL one-shot from 16 KiB up at TP4 and TP8 (tables below).

4. One block a CU.

  • Split launch: W = min(512, roundup32(ceil(part / CUs))), three roles while W ≤ 320, two above, on ceil(part / W) blocks.
  • Fused launch: keeps main's add_threads(part).
  • Stale numbers are gone with the code they described: .cuh "7.81 MB 25.4" and "no other width ahead", py "25.9 vs 42.8", and 6.7 vs 7.1 µs.
  • At TP8 5 MiB the route is now the fused layout. It takes 17.0 µs there, against 29.1 for main's route (the LL two-shot) and 30.3 for the previous head's 2 × 256 split launch. The split at one block a CU (3 × 160 lanes) takes 19.5, so TP8 stays fused above 4 MiB.

5. --regression, all on the head 6c25a7f46:

transport TP2 TP4 TP8 (two trays, torchrun 4 + 4)
IPC pass pass not possible: hipIpc does not cross trays
symm_mem – pass pass
VMM (AITER_CUSTOM_AR_FORCE_VMM=1) – pass not run

Each run: tail, LL mixed sizes, two-shot mixed sizes (the ragged ones included), LL in place, two-shot sentinel payload (now at TP2 too), plain cutoff.

Also at this head:

  • the PoC at TP2 and TP4, bf16 and fp32: every route as restated, every kernel bit-exact, 99-call mixed sequences with 0 bit difference;
  • test_fused_ar_rms_lamport.py, test_ar_add_lamport.py and test_ag_lamport.py at TP2 and TP4;
  • size_env: 17 passed;
  • the PoC's restated routes agree with select_lamport_ar on CPU, 162 cases at the TP2, TP4 and TP8 defaults.

6. Text.

  • "LL kernels" now reads "LL one-shot" or "meta-buffer kernels" at py:571, py:2370-2371 and size_env, plus one more site in the mixed-size test's comment.
  • The two-bank comment now reads: d = 2 for the LL one-shot's two banks. Where k sizes reach a pack, the stale line is the same size's from d / k rounds back when k divides d (k = 1, 2), and another size's otherwise (k = 3).

7. PR body and squash text are rewritten for this head:

  • the design, the routes and the memory a rank;
  • main → PR tables at TP2, TP4 (IPC and symm_mem) and TP8;
  • every changed op test, the PoC and size_env included.

Still open: TP8 at 2.5–3 MiB.

  • The split launches W = 96 there, and it is the one band where this head trails the previous one: 16.3 vs 13.9 µs at 3 MiB (bf16).
  • It moves between runs: 14.5 µs in the first two rounds, 16.5–16.8 in every round since. That is not the slot size; a 1 MiB slot times the same.
  • Its neighbours are steady: W = 64 at 2 MiB takes 12.3 µs, and W = 128 at 3.5–4 MiB takes 14.3–14.6.
  • It is still 1.4× main there. I'll look into it as a follow-up; one candidate is rounding W to a multiple of 64.
Previous head (741e953) → this head, production route, µs (MI455X, CUDA graph, slowest rank, mean of two alternating rounds)

TP8, two trays, symm_mem

size bf16 old bf16 PR × fp32 old fp32 PR × RCCL bf16 old route PR route
256 KiB 12.7 7.4 1.72 14.5 10.1 1.44 13.7 LL / LL 1-shot / split
512 KiB 10.9 8.6 1.28 10.8 10.4 1.04 16.1 old 2-shot / old 2-shot 1-shot / split
768 KiB 11.2 9.9 1.13 11.0 10.6 1.04 18.2 old 2-shot / old 2-shot 1-shot / split
1 MiB 11.4 10.5 1.09 11.3 10.7 1.06 20.5 old 2-shot / old 2-shot split / split
1.25 MiB 11.8 11.3 1.05 11.7 11.5 1.01 27.2 old 2-shot / old 2-shot split / split
1.5 MiB 11.7 11.4 1.03 11.9 11.8 1.01 28.5 old 2-shot / old 2-shot split / split
2 MiB 12.2 12.2 1.00 12.1 12.3 0.99 32.5 old 2-shot / old 2-shot split / split
3 MiB 13.9 16.3 0.85 13.7 16.8 0.82 35.7 old 2-shot / old 2-shot split / split
3.73 MiB ★ 15.0 14.8 1.01 14.8 14.9 0.99 38.9 old 2-shot / old 2-shot split / split
4 MiB 14.9 14.4 1.03 14.8 14.7 1.01 38.6 old 2-shot / old 2-shot split / split
5 MiB 30.3 17.0 1.78 30.5 17.2 1.78 37.4 old 2-shot / old 2-shot fused / fused
6 MiB 30.7 18.2 1.69 30.9 18.2 1.69 38.3 old 2-shot / old 2-shot fused / fused
7.45 MiB ★ 31.7 20.3 1.56 31.9 20.3 1.57 40.2 old 2-shot / old 2-shot fused / fused
8 MiB 32.0 20.8 1.54 32.1 20.8 1.54 40.6 old 2-shot / old 2-shot fused / fused
12 MiB 46.9 35.5 1.32 47.2 35.4 1.33 46.8 RCCL / RCCL fused / fused
16 MiB 52.7 40.1 1.31 52.7 40.1 1.32 54.3 RCCL / RCCL fused / fused
32 MiB 95.9 65.7 1.46 95.8 65.5 1.46 97.0 RCCL / RCCL fused / fused

TP4, one tray, IPC

size bf16 old bf16 PR × fp32 old fp32 PR × RCCL bf16 old route PR route
256 KiB 5.3 5.3 1.00 8.8 8.5 1.04 8.3 1-shot / LL 1-shot / fused
512 KiB 5.9 5.9 1.00 10.1 8.6 1.18 9.4 1-shot / LL 1-shot / fused
1 MiB 7.0 7.0 1.00 13.6 8.9 1.53 11.4 1-shot / old 2-shot 1-shot / fused
1.5 MiB 9.4 9.3 1.01 11.8 9.3 1.28 16.2 L2 / old 2-shot fused / fused
2 MiB 9.8 9.8 1.00 13.3 9.8 1.35 17.0 L2 / old 2-shot fused / fused
3 MiB 10.7 10.6 1.01 16.3 10.6 1.54 21.8 L2 / old 2-shot fused / fused
3.73 MiB ★ 11.4 11.2 1.02 17.4 11.2 1.55 22.5 L2 / old 2-shot fused / fused
4 MiB 11.7 11.4 1.02 17.6 11.4 1.55 22.9 L2 / old 2-shot fused / fused
5 MiB 22.3 15.2 1.47 24.1 15.3 1.58 24.0 L2 / RCCL split / split
6 MiB 23.1 16.5 1.40 25.1 16.6 1.51 25.0 L2 / RCCL split / split
7.45 MiB ★ 24.2 18.2 1.33 26.8 18.4 1.46 26.7 L2 / RCCL split / split
8 MiB 24.5 17.8 1.38 27.4 18.0 1.53 27.4 L2 / RCCL split / split
12 MiB 29.7 23.7 1.25 39.2 23.9 1.64 39.8 L2 / RCCL fused / fused
16 MiB 35.9 30.0 1.19 44.1 30.2 1.46 45.1 L2 / RCCL fused / fused
32 MiB 59.9 53.9 1.11 153 53.3 2.87 158 L2 / RCCL fused / fused

TP4, one tray, symm_mem

size bf16 old bf16 PR × fp32 old fp32 PR × RCCL bf16 old route PR route
256 KiB 7.5 5.3 1.40 8.6 8.5 1.01 8.4 LL / LL 1-shot / fused
512 KiB 8.7 5.9 1.46 9.8 8.6 1.14 9.4 LL / LL 1-shot / fused
1 MiB 9.3 7.0 1.34 9.2 8.9 1.03 11.5 old 2-shot / old 2-shot 1-shot / fused
1.5 MiB 10.9 9.3 1.18 10.9 9.3 1.17 16.3 old 2-shot / old 2-shot fused / fused
2 MiB 11.0 9.8 1.13 11.0 9.8 1.11 17.1 old 2-shot / old 2-shot fused / fused
3 MiB 13.0 10.6 1.22 12.9 10.7 1.21 21.7 old 2-shot / old 2-shot fused / fused
3.73 MiB ★ 14.2 11.2 1.27 14.1 11.2 1.25 22.5 old 2-shot / old 2-shot fused / fused
4 MiB 13.7 11.5 1.19 13.7 11.5 1.19 22.9 old 2-shot / old 2-shot fused / fused
5 MiB 24.2 15.2 1.59 24.1 15.4 1.56 24.0 RCCL / RCCL split / split
6 MiB 25.1 16.9 1.49 25.1 17.0 1.48 25.0 RCCL / RCCL split / split
7.45 MiB ★ 26.8 19.5 1.37 26.8 19.3 1.38 26.7 RCCL / RCCL split / split
8 MiB 27.5 17.5 1.58 27.5 17.8 1.54 27.4 RCCL / RCCL split / split
12 MiB 39.4 24.7 1.60 39.2 25.0 1.57 39.8 RCCL / RCCL fused / fused
16 MiB 44.2 31.0 1.42 44.3 31.0 1.43 45.2 RCCL / RCCL fused / fused
32 MiB 155 55.1 2.81 155 54.8 2.82 160 RCCL / RCCL fused / fused

TP2, one tray, IPC

size bf16 old bf16 PR × fp32 old fp32 PR × RCCL bf16 old route PR route
256 KiB 4.9 4.9 1.01 6.9 6.8 1.02 6.9 1-shot / LL 1-shot / LL
512 KiB 5.0 5.0 1.00 7.2 7.1 1.01 7.1 1-shot / LL 1-shot / LL
1 MiB 5.3 5.2 1.00 8.0 8.0 1.00 7.8 1-shot / LL 1-shot / LL
1.5 MiB 7.2 7.2 1.00 11.9 8.0 1.49 12.2 1-shot / LL 1-shot / fused
2 MiB 7.7 7.7 1.00 12.6 8.2 1.53 12.6 1-shot / LL 1-shot / fused
3 MiB 8.7 8.8 0.99 17.5 11.9 1.47 15.6 1-shot / LL 1-shot / split
3.73 MiB ★ 10.5 10.7 0.99 17.5 12.2 1.43 16.2 1-shot / LL 1-shot / split
4 MiB 10.7 10.8 0.99 18.5 12.2 1.51 16.5 1-shot / LL 1-shot / split
5 MiB 13.3 13.2 1.01 20.5 14.6 1.40 23.6 1-shot / RCCL 1-shot / fused
6 MiB 13.9 13.8 1.00 21.1 15.7 1.35 24.2 1-shot / RCCL 1-shot / fused
7.45 MiB ★ 15.3 15.3 1.00 21.8 18.8 1.16 24.7 1-shot / RCCL 1-shot / fused
8 MiB 15.7 15.6 1.00 22.1 19.0 1.16 24.9 1-shot / RCCL 1-shot / fused
12 MiB 23.4 22.7 1.03 141 22.5 6.26 146 L2 / RCCL fused / fused
16 MiB 27.0 27.2 0.99 143 26.7 5.36 148 L2 / RCCL fused / fused
32 MiB 52.4 50.5 1.04 175 49.3 3.56 181 L2 / RCCL fused / fused
fp32 at small sizes: LL one-shot vs the two-shot (what sets _LAMPORT_AR_FP32_LL_MAX_BYTES)

TP8, two trays, symm_mem

size LL one-shot two-shot fused split RCCL two-shot / LL route (this head)
16 KiB 11.1 9.6 9.0 11.5 0.86 fused
32 KiB 11.0 9.9 9.3 11.8 0.90 fused
64 KiB 11.7 10.1 9.5 12.1 0.87 fused
128 KiB 13.5 10.1 9.8 12.7 0.75 fused
192 KiB 14.0 10.4 10.0 13.2 0.74 fused
256 KiB 14.6 10.7 10.1 13.8 0.73 fused
384 KiB 15.5 14.4 10.3 14.8 0.93 split
512 KiB 16.5 14.4 10.4 16.1 0.87 split
768 KiB 18.9 14.6 10.6 18.1 0.77 split
1 MiB 21.2 15.5 10.8 20.4 0.73 split
1.25 MiB 28.0 15.0 11.9 27.2 0.53 split
1.5 MiB 32.0 15.0 12.2 28.5 0.47 split
2 MiB 36.4 15.9 12.6 32.4 0.44 split

TP4, one tray, IPC

size LL one-shot two-shot fused split RCCL two-shot / LL route (this head)
16 KiB 7.5 7.3 7.8 7.2 0.98 fused
32 KiB 7.7 7.5 8.1 7.5 0.98 fused
64 KiB 7.9 7.7 8.3 7.6 0.98 fused
128 KiB 8.2 7.9 8.5 7.8 0.97 fused
192 KiB 8.5 8.4 8.7 8.1 0.98 fused
256 KiB 8.9 8.4 8.8 8.3 0.95 fused
384 KiB 9.6 8.5 8.9 8.9 0.89 fused
512 KiB 10.1 8.6 9.0 9.4 0.84 fused
768 KiB 11.2 8.7 9.1 10.4 0.78 fused
1 MiB 12.2 8.9 9.3 11.5 0.72 fused
1.25 MiB 17.4 9.0 10.7 15.7 0.52 fused
1.5 MiB 18.2 9.2 10.7 16.3 0.51 fused
2 MiB 20.1 9.7 10.9 17.1 0.49 fused

TP4, one tray, symm_mem

size LL one-shot two-shot fused split RCCL two-shot / LL route (this head)
16 KiB 7.5 7.3 7.8 7.2 0.98 fused
32 KiB 7.6 7.6 8.1 7.4 1.00 fused
64 KiB 7.8 7.8 8.4 7.6 1.00 fused
128 KiB 8.0 8.0 8.6 7.8 1.00 fused
192 KiB 8.3 8.5 8.7 8.0 1.02 fused
256 KiB 8.7 8.6 8.8 8.3 0.98 fused
384 KiB 9.2 8.6 8.9 8.8 0.94 fused
512 KiB 9.7 8.6 9.0 9.3 0.88 fused
768 KiB 10.9 8.7 9.1 10.3 0.80 fused
1 MiB 11.9 8.9 9.3 11.4 0.75 fused
1.25 MiB 16.2 9.1 10.8 15.7 0.56 fused
1.5 MiB 17.7 9.3 10.9 16.2 0.52 fused
2 MiB 19.4 9.8 11.0 17.0 0.51 fused

TP2, one tray, IPC

size LL one-shot two-shot fused split RCCL two-shot / LL route (this head)
16 KiB 6.2 6.9 7.4 6.4 1.11 LL
32 KiB 6.3 7.0 7.6 6.6 1.11 LL
64 KiB 6.5 7.2 7.7 6.6 1.12 LL
128 KiB 6.6 7.4 8.0 6.7 1.12 LL
192 KiB 6.7 7.5 8.1 6.8 1.12 LL
256 KiB 6.8 7.6 8.2 6.9 1.12 LL
384 KiB 6.9 7.6 8.2 7.0 1.11 LL
512 KiB 7.1 7.7 8.3 7.1 1.09 LL
768 KiB 7.6 7.8 10.2 7.4 1.02 LL
1 MiB 8.0 7.9 10.3 7.7 0.98 LL
1.25 MiB 11.6 8.0 10.5 11.7 0.69 fused
1.5 MiB 11.9 8.1 10.6 11.9 0.68 fused
2 MiB 12.6 8.2 10.8 12.2 0.65 fused

@zufayu

zufayu commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@TennyWang1223 @valarLip Could you please take a look at current head 6c25a7f4? The author reports that it addresses the prior seven review items, and all required CI is green.

Tenny, could you give it the primary communications review? valarLip, could you re-review and update the existing CHANGES_REQUESTED if satisfied? One point worth confirming is whether the companion Lamport ops—AR+RMSNorm, AR+add, and all-gather—were also validated on TP4 symm_mem/VMM, since this head enables their shared inbox on those transports.

One conflict: the _init_ipc meta-size comment in
aiter/dist/device_communicators/custom_all_reduce.py. The old-arch line is
main's (#5918 put the LL scratch in meta_size()); the gfx1250 lines are this
PR's.
Copilot AI balanced review requested due to automatic review settings November 24, 2026 08:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 02:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 26, 2026 02:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 26, 2026 06:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

TennyWang1223
TennyWang1223 previously approved these changes Nov 27, 2026
@zufayu

zufayu commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

conflict

Conflicts with #8559 (gfx1250 Lamport AR + RMSNorm split sends):
- lamport_ar_2shot_gfx1250 keeps this branch's kernel. #8559 made the
  round counters [2][slot / 32] (tx, rx) and has every Lamport kernel
  advance both, as a split lamport_ar_rmsnorm_gfx1250 reads the rx
  counters; both branches of this kernel now do (advance_round).
- LamportArRms keeps num_cus, which #8559 dropped with the cluster
  path: run_2shot's split layout (a block a CU) reads it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 06:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@zufayu
zufayu merged commit 1180f77 into main Nov 27, 2026
66 of 67 checks passed
@zufayu
zufayu deleted the zejun/gfx1250-ar-2s-lamport branch November 27, 2026 10:09
gbyu-amd added a commit that referenced this pull request Dec 3, 2026
#8012 @ c3b4113, head 2026-11-16T06:45:00Z)

Applied as the PR diff onto the rebased 1116 tree; PR state: draft. Conflicts resolved by keeping both sides (both PRs add different opt-in routes next to each other): communicator_cuda.py (#8015 Lamport one-shot check, then this PR's INT4 two-shot check), custom_all_reduce.py (constants, both symm_mem inits, both init methods), custom_all_reduce_gfx1250.h / pybind (main's #7927 allreduce_lamport and fused AR+RMS+quant declarations kept next to this PR's q4 declarations).

(cherry picked from commit 1bb791e)

Rebase onto main 12-03: #8015 (one-shot + symm_mem inbox) is not carried: main's #7937 final builds the Lamport inbox on every transport and routes plain all-reduce itself (should_lamport_ar(inp, two_shot)). So _LAMPORT_AR_MAX_SIZE / _init_lamport_symm / should_lamport_ar / lamport_all_reduce and the communicator's one-shot branch from #8015 are left out; the symm_mem init calls main's _init_lamport_ar_rms, then this PR's _init_lamport_q4_2s(symm=True). pybind keeps main's allreduce_lamport(split=False) next to the q4 bindings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants