Skip to content

[FlyDSL] FlyQuickAllReduce: reduce-scatter and all-gather modes for sequence parallelism - #7444

Open
eppaneamd wants to merge 21 commits into
mainfrom
eppaneamd/flydsl-quickreduce-sp-rs-ag
Open

eppaneamd wants to merge 21 commits into
mainfrom
eppaneamd/flydsl-quickreduce-sp-rs-ag

Conversation

@eppaneamd

@eppaneamd eppaneamd commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds reduce_scatter(inp, out), all_gather(inp, out) and compile_sp(full, shard) to FlyQuickAllReduce. reduce_scatter and all_gather each run one phase of the INT4 all-reduce on its own and leave row-contiguous shards, the layout sequence parallelism needs.

  • reduce_scatter: inp is this rank's bf16 [T, H] partial; out is its block [rank * T/W, (rank + 1) * T/W) of the sum.
  • all_gather: inp is this rank's [T/W, H] block; out is the [T, H] concatenation in rank order.
  • Same codec as the all-reduce (group-16 E5M2 scales, 1152 B per 2048 bf16), applied to every partial including the rank's own. A row's value therefore does not depend on which rank owns it, and the all-gather output is bitwise equal on every rank. The all-reduce adds a rank's own share exactly since [FlyDSL] [CI] One stage and two-stage ring all-reduce kernels for PCIe interconnects #5461; the reasoning is under Changes.
  • INT4 only: the mesh also takes INT5 and INT6 since [FlyDSL] QuickAllReduce INT5/INT6 and all-reduce cleanup #5555, but the single-phase modes stay INT4. The kernel builder refuses another codec, and the op test has an INT5 mesh case for it.
  • compile_sp(full, shard) is a collective preflight: every rank calls it with the same sizes before CUDA graph capture.
    • Each rank builds and loads both modes and checks that the persistent blocks can be co-resident. The ranks then vote through group (all_gather_object) on success, call kind and full size. Any failure or disagreement makes every rank raise and leaves the engine not ready.
    • It launches nothing. An eager first call on an engine that has not passed runs the same preflight. compile_sp and that first call are refused under CUDA graph capture.

Main (6efb333ad) was merged on 2026-11-11. #5555 renamed QuickAllReduceInt4 to FlyQuickAllReduce, quick_allreduce_int4.py to quick_allreduce.py (host) and kernels/comm/quick_allreduce_mesh.py (kernel), and moved the payload constants into allreduce_policy.py. Against main the PR is still the same five files.

Motivation

Why the existing INT4 kernels do not cover sequence parallelism:

  • The all-reduce kernel owns atoms/W atoms of every tile, so it cannot produce the row-contiguous shards sequence parallelism needs.
  • aiter's quick reduce-scatter (csrc/kernels/quick_reduce_scatter.cu) is HIP and requires four ranks.
  • There is no standalone INT4 all-gather.

What it is for: vllm-project/vllm#65628 uses these methods, through the router in #7819, for the sequence-parallel (SP) collectives of a TP2 model on MI355X. With bf16 RCCL collectives the SP layout was slower than the default layout in every end-to-end measurement made so far. The INT4 collectives are the candidate fix, and that PR reports the end-to-end results.

Changes

  • Kernel (kernels/comm/quick_allreduce_mesh.py)
    • A mode argument of the mesh kernel factory: MODE_AR (default, unchanged), MODE_RS and MODE_AG. The single-phase modes take super_tile=1, the 8-atom tile, INT4, divisor 1 and no fused norm.
    • Rank d owns a contiguous block of rows rather than a slice of every tile. The tile machinery is unchanged; only the HBM address of an atom moves (_sp_payload_io).
    • A single phase has no second-phase guard against inbox reuse, so both modes send through the all-gather slots and start each round with a payload-free ready flag. It is published after the tile's loads and awaited before the first payload store.
    • waves_per_eu is pinned as for the fused-norm builds, and the JIT symbol gets an _rs / _ag suffix.
  • Own share
    • Since [FlyDSL] [CI] One stage and two-stage ring all-reduce kernels for PCIe interconnects #5461 the all-reduce adds a rank's own share exactly from registers. The reduce-scatter quantizes it like every peer's packet (_own_packets) and accumulates in rank order. With the exact add, a row's value would depend on the rank that owns it.
    • The op test checks the owner independence bitwise, and a kernel mutant that adds the own share exactly fails it.
    • The all-gather decodes the rank's own block from the packet it sent, as the all-reduce does.
  • Host (quick_allreduce.py, allreduce_host_shared.py)
    • reduce_scatter, all_gather, compile_sp and the helpers _sp_engine, _sp_launcher, _check_sp_payload, _sp_preflight, _check_sp_residency, _run_sp.
    • check_tensors is split out of check_payload, whose behaviour and signature are unchanged (_launch_artifacts is imported from it for the residency check).
    • The class docstring has one paragraph of call rules for every method that takes stream; reduce_scatter and all_gather point to it. README: a paragraph on compile_sp and the serialized launch order, and a test line.
  • Constraints
    • World size 2 / 4 / 8; T % world_size == 0 (the host checks byte sizes only).
    • The full tensor is world_size times the shard, a non-empty whole number of 32 KiB tiles (T % 32 == 0 at hidden 2560), within the 4 GiB window, and the tensors do not overlap.
    • Every rank issues the same launches in the same order. Launches and graph replays on one communicator run in one serialized device order per rank: launches through the same engine (the single-phase modes, and the all-reduce sizes the ladder gives the same super_tile=1 engine) share its colors and inbox slots, so work on other streams needs an event dependency.
    • No fused RMSNorm epilogue; the mesh algorithm, the uncached inbox and a super_tile=1 engine at block 256 (the host raises otherwise). No min_bytes floor applies to these methods.
  • Co-residency: the single-phase kernels are persistent and spin on their peers' flags, so a launch deadlocks if a block waits in the queue while resident ones wait on it.
    • The preflight reads each build's own max_blocks_per_cu() and fails unless ceil(grid / CUs) fits. It does not clamp the grid (whether clamping is safe for the per-block colors is not verified; with the shipped grids the check does not fire on gfx950).
    • Static table, 116 compile-only builds (FlyDSL 0.4.1; both modes, every rank of TP2 / 4 / 8, gfx942 and gfx950, shipped and default-cap grids): VGPR 80-106, AGPR 0, no scratch, no spills, LDS 4608 / 6912 / 8064 B; implied waves per SIMD 4 / 5 / 5 against 1-4 blocks per CU needed.
    • Measured on gfx950: limits of 4 / 5 / 5-6 per CU at TP2 / 4 / 8 against needs of 2 / 4 / 2 at the shipped grids. gfx942 has the static numbers only.
  • All-reduce behaviour is unchanged. Compared before the merge of main, against untouched main 5eccc0c7b (FlyDSL 0.4.1; the kernel and allreduce_host_shared.py byte for byte):
    • ISA byte-identical on 68 builds (CPU, compile only): all-reduce at super_tile 1 and 8 (24), fused norm at hidden 4096 super_tile 1 and 8 (24), the latency build (12) and the wide tile at hidden 6144 (8), at world size 2 / 4 / 8, first and last rank, gfx950 and gfx942.
    • The upstream all-reduce op tests (test_flydsl_quick_allreduce_int4.py and ..._rmsnorm.py, TP2, GPU) gave the same result on main and on this tree: 487 non-timing table cells compared, 0 differences.
    • Not repeated on the merged tree (see Unverified). On the merged head main's test_flydsl_quick_allreduce.py --tp 2 passes.

Performance

µs per call (lower is better), bf16, hidden 2560, CUDA-graph replay, MI355X. The modes are new, so "Before" is RCCL. The INT4 modes are lossy. These timings predate the merge of main and were not repeated on the merged head.

Method:

  • Harness out-of-tree, not part of this PR; both columns are timed in one job on one stack, on one 8-GPU node (TP2 on two of its GPUs, TP4 on four, TP8 on eight), with one identity check for the whole job.
  • Timing: a graph of 50 calls replayed 4 times per round, 5 rounds after a warm-up round; median over rounds, maximum over ranks.
  • Stack: vllm/vllm-openai-rocm nightly dd4e40142a32 (amd-aiter 0.1.27, torch 2.13.0+rocm10.0.0, RCCL 2.30.4), FlyDSL 0.4.1 over the image's 0.4.0, aiter/ops/flydsl replaced by this tree's (301 files md5-checked). The kernel and allreduce_host_shared.py are 3c77ea12e's byte for byte; the host file is 30f37d948's up to one comment line, so the timings predate compile_sp.
  • TP8 "Before" is vLLM's PyNccl wrapper rather than torch.distributed. At 8 ranks both run the same meta::comms::dda*Ipc kernels, and in graph timing PyNccl is 0.975 to 1.000 (RS) and 0.986 to 0.995 (AG) of torch.distributed.
  • Numbers in brackets (fp8 wire, IPC, HIP INT4): the speedup this PR still brings over that variant, its time divided by the After time ((2.0x) means this PR is 2.0 times as fast). - means no number: HIP INT4 exists only for TP4 reduce-scatter, and aiter declines IPC at 16384 rows (the 80 MiB tensor is above its 64 MiB limit).
Hardware Workload Before (RCCL) After (PR) Speedup fp8 wire IPC HIP INT4
2x MI355X RS, 1024 rows 64.1 21.9 2.9x 45.9 (2.1x) 50.2 (2.3x) -
2x MI355X RS, 4096 rows 227.1 65.3 3.5x 138.3 (2.1x) 188.5 (2.9x) -
2x MI355X RS, 8192 rows 438.0 121.6 3.6x 245.9 (2.0x) 373.6 (3.1x) -
2x MI355X RS, 16384 rows 823.0 236.7 3.5x 465.4 (2.0x) - -
2x MI355X AG, 1024 rows 60.9 21.2 2.9x 42.9 (2.0x) 50.3 (2.4x) -
2x MI355X AG, 4096 rows 215.2 65.2 3.3x 130.7 (2.0x) 189.7 (2.9x) -
2x MI355X AG, 8192 rows 410.3 120.5 3.4x 243.4 (2.0x) 372.8 (3.1x) -
2x MI355X AG, 16384 rows 789.6 235.2 3.4x 461.4 (2.0x) - -
4x MI355X RS, 2048 rows 68.0 23.2 2.9x 51.5 (2.2x) 53.0 (2.3x) 49.6 (2.1x)
4x MI355X RS, 4096 rows 120.3 38.8 3.1x 86.4 (2.2x) 105.0 (2.7x) 88.9 (2.3x)
4x MI355X RS, 8192 rows 228.3 70.9 3.2x 152.7 (2.2x) 203.1 (2.9x) 168.9 (2.4x)
4x MI355X RS, 16384 rows 442.0 131.3 3.4x 283.6 (2.2x) - 280.9 (2.1x)
4x MI355X AG, 2048 rows 64.9 22.3 2.9x 47.7 (2.1x) 52.2 (2.3x) -
4x MI355X AG, 4096 rows 115.4 40.1 2.9x 77.2 (1.9x) 99.5 (2.5x) -
4x MI355X AG, 8192 rows 216.9 71.3 3.0x 136.1 (1.9x) 194.3 (2.7x) -
4x MI355X AG, 16384 rows 419.7 130.8 3.2x 251.4 (1.9x) - -
8x MI355X RS, 2048 rows 39.8 16.9 2.4x 38.9 (2.3x) 38.5 (2.3x) -
8x MI355X RS, 4096 rows 66.8 29.1 2.3x 57.7 (2.0x) 70.6 (2.4x) -
8x MI355X RS, 8192 rows 120.7 53.7 2.2x 100.4 (1.9x) 139.5 (2.6x) -
8x MI355X AG, 2048 rows 49.5 15.5 3.2x 48.5 (3.1x) 29.9 (1.9x) -
8x MI355X AG, 4096 rows 86.2 27.3 3.2x 61.6 (2.3x) 54.5 (2.0x) -
8x MI355X AG, 8192 rows 154.9 46.5 3.3x 91.0 (2.0x) 101.2 (2.2x) -

Columns (RS = reduce-scatter, AG = all-gather):

  • Before: RCCL reduce_scatter_tensor / all_gather_into_tensor through torch.distributed (TP8: PyNccl, above), bf16, exact. After: this PR (INT4). Speedup: Before divided by After (2.8x means 2.8 times as fast).
  • fp8 wire: a lossy alternative built from existing pieces, not in this PR.
    • Each bf16 row is quantized to fp8 (e4m3, one fp32 scale per 128 values) by a fused Triton kernel, the fp8 bytes go through RCCL (2,640 bytes per row on the wire instead of 5,120), and the receiver dequantizes. Reduce-scatter uses all_to_all_single and a dequantizing sum.
    • NMSE 6.6e-4. The kernels are in the harness. RCCL reductions on an fp8 dtype were not benchmarked.
  • IPC: aiter's own exact bf16 all-gather / reduce-scatter. Each rank exports its buffer as an IPC memory handle, the other ranks map it, and a kernel reads the peers' buffers directly instead of calling RCCL (an eager call first copies its input into the registered buffer). No quantization.
  • HIP INT4: aiter's existing INT4 reduce-scatter, qr_reduce_scatter, a HIP C++ kernel where this PR's are FlyDSL. It quantizes to 4-bit integers with a different codec (one fp16 scale per 32 values, NMSE 7.4e-3 against 6.5e-3 here), and exists for reduce-scatter on four ranks only.

Also measured:

  • Eager mode (200 calls per round, how an eager sequence-parallel call runs): the speedup over RCCL is 3.4x to 3.7x at TP2, 3.2x to 3.5x at TP4 and 2.3x to 3.3x at TP8 (against PyNccl). FlyDSL's eager and graph times agree within 1.7 %.
  • All-reduce for comparison (8192 rows, µs): RS plus AG take 242.1 against the all-reduce's 233.5 (1.04x) at TP2, 142.2 against 128.2 (1.11x) at TP4, 100.3 against 79.2 (1.27x) at TP8 (the TP8 all-reduce runs super_tile=8 from 4096 rows).
  • Accuracy, normalized MSE against the exact fp32 sum on normal inputs, from the op test (8192 rows, maximum over ranks), RS / AG: TP2 6.50e-3 / 6.50e-3, TP4 6.50e-3 / 6.50e-3, TP8 6.51e-3 / 6.50e-3.
  • On Student-t(3) inputs (1,024 and 4,928 rows, TP2 also 16,384, both grid caps, maximum over ranks and sizes): TP2 1.13e-2 / 1.12e-2, TP4 1.13e-2 / 1.13e-2, TP8 1.13e-2 / 1.12e-2.

Testing

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

Documentation

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

Dependencies

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

This PR adds no requirement; the head merges main, which requires FlyDSL >= 0.5.0 (aiter/ops/flydsl/__init__.py).

Breaking Changes

None.

PR Self-Review

Reviewed revision

1748d5d5617933f88214f09f3aa2b82a30062db5

Behavior and intent

New methods only: no existing call, default or output changes (check_payload keeps its behaviour and signature, and the all-reduce ISA was byte-identical to main's before the merge, see Changes). Sequence-parallel layouts get INT4 collectives with row-contiguous shards, which the all-reduce kernel's per-tile ownership could not produce.

One behaviour differs from the all-reduce on purpose: the reduce-scatter quantizes the rank's own partial, where the all-reduce adds its own share exactly, so that a row's value does not depend on its owner. Taking the exact add instead is local to _own_packets and _reduce_scattered_sp; the owner-independence check would then no longer hold for reduce-scatter.

Validation and unverified scope

All runs on MI355X (gfx950), hidden 2560, bf16, in vllm/vllm-openai-rocm nightly dd4e40142a32 (amd-aiter 0.1.27, torch 2.13.0+rocm10.0.0, RCCL 2.30.4), with this tree's aiter/ops/flydsl and four aiter/dist files over the image's, md5-checked against the commit in every job. FlyDSL 0.4.1 (the requirements.txt pin) over the image's 0.4.0 for the pre-merge rows. FlyDSL 0.5.0 (PyPI wheel), a git archive snapshot and 8 to 13 md5-checked files per job for the others: the only runs under 0.5.0. 30f37d948, 3c77ea12e and 584df31bd are pre-merge; the head 0fd0532e2 is 584df31bd plus the merge of main 6efb333ad and an adaptation commit.

Tree What ran Result
30f37d948 op test python3 op_tests/multigpu_tests/test_flydsl_quick_reduce_scatter_all_gather.py --tp 2 4 8 -s 8192,2560 on 8 GPUs, from a copy outside the repo so that import aiter resolves to the overlay exit 0 in 199 s with a cold JIT cache: validity at TP2 / 4 / 8 at both grid caps, the extras, the timed sweep (source of the NMSE figures, not of the graph timings)
30f37d948 a driver calling the op test's functions, per world size 48 / 64 / 128 validity rows at TP2 / 4 / 8 (four fills, both grid caps, every rank): per-rank NMSE inside 3 % of an out-of-tree CPU model of the codec on every row; owner independence, bitwise-equal all-gather output, clean buffers and back-to-back launches all True; extras pass on every rank
3c77ea12e the op test per world size, fresh JIT cache each; the upstream test_flydsl_quick_allreduce_int4.py --tp 2 -a mesh exit 0: --tp 2 54 s, --tp 4 61 s, --tp 8 87 s (preflight pool included); the upstream test passes; TP2 and TP4 repeated on a second gfx950 node pass (62 s, 64 s), same correctness columns
584df31bd, 0.5.0 probe (on merge commit 5bbeb2589, whose kernel and host code are the head's); the op test, whole file, fresh cache max_blocks_per_cu() works in 36 of 36 builds, limits equal the 0.4.1 ones (TP2 4 against a need of 2, TP4 5 against 4, TP8 5 to 6 against 2), the residency check passes at every probed grid and raises one block per CU above the limit (36 of 36 each). Op test: TP2 rc 0 in 74 s, TP4 rc 0 in 62 s, correctness columns equal to the 0.4.1 runs digit for digit (rs NMSE 0.00650243 at TP2, 0.00650306 at TP4)
584df31bd, 0.5.0 one TP4 row alternately on 0.4.1 (tree 3c77ea12e) and 0.5.0 (the head), one lease rs 99.5 / 90.8 us against 91.4 / 91.8 us, ag 92.4 / 91.2 against 91.5 / 91.6 us, NMSE equal bit for bit
0fd0532e2 (head), 0.5.0 op test, whole file, fresh FlyDSL cache per world size; main's test_flydsl_quick_allreduce.py --tp 2 op test TP2 rc 0 in 99 s, TP4 rc 0 in 64 s; main's test rc 0 in 36 s (int4 codecs, SQNR 20.079 dB); no Traceback, Error, fail or skip line in any of the logs
head, mutant the builder's or codec != "int4" check removed from the overlay's quick_allreduce_mesh.py; op test --tp 2 rc 1 in 57 s: the INT5 mesh case in _check_unsupported_engines fails with a launch was reached

Timing note: in two earlier whole-file TP4 runs three of the four timed values (174.8, 174.7 and 225.6 us; the fourth was 96.0 us) were far above the 0.4.1 ones while another job of mine was running on the node. Four later runs with no other job of mine running gave 90.8 to 91.8 us, and two runs on the merged tree gave 90.9 to 91.3 us. The cause of the slow runs is not shown.

End-to-end accuracy through the INT4 hook of vllm-project/vllm#65628 (Qwen3.8-Flash-Next MXFP4, TP2, GSM8K 5-shot, 1,319 questions, strict match unless noted). The first three rows ran the first version of that hook (--enable-hc-sp-quick-reduce against --enable-hc-sp-aiter-ipc), whose flags no longer exist, on the host file of 30f37d948 (no collective preflight or residency check). The last row is the reworked PR, which reaches these kernels through #7819.

Run INT4 minus exact Remarks
One round, three arms at once: A default layout 95.53, B SP exact 96.66, C SP INT4 95.53 strict -1.14 points, flexible -0.99 Paired: 23 questions only B right against 8 only C right (sign test p = 0.011). C - A is 0.00. Outside the -1.0 point bound set before the run; no mechanism established. Needle (8k context) 40 of 40 per arm at 2,500, 5,000 and 7,500 tokens from the end
Repeat at the shipped 8 MiB gate, three new pairs (rule, bound and analysis fixed before the first run, one arm at a time, order alternated) strict -0.08 (95 % CI [-0.52, +0.36]), flexible +0.05 ([-0.39, +0.49]) No loss beyond the bound. With the earlier +0.83 pair (four pairs): +0.15 ([-0.25, +0.56]). The exact arm ranges over 95.60 to 96.82 in thirteen runs, so one pair cannot settle a one-point difference. INT4 runs on a minority of steps at this gate (104 of 6,243 steps above 2,048 tokens, 762 between 1,024 and 2,048)
Same, gate lowered to about 1 MiB (VLLM_ROCM_QUICK_REDUCE_MIN_SIZE_BYTES_MB=1, which also lowers the gate of the server's INT4 all-reduces): an upper bound, six pairs strict -0.51 (CI [-0.86, -0.15]), flexible -0.47 ([-0.82, -0.11]) Within the bound by the rule, but both intervals exclude zero (about half a point). The first three pairs were inconclusive (strict CI [-1.04, +0.03]); three more were added, registered before they started
vllm-project/vllm#65628 reworked, shipped gate, four rounds (5,276 paired questions); AITER side: the router's earlier commit bd54a9dee over an earlier head of this PR strict -0.34 ([-0.75, +0.07]), flexible -0.32 ([-0.72, +0.08]) Bound -1.0 point fixed before the first run; needle 40 of 40 at every depth. Details in that PR's description

One served-model round on a tree with the host code of 3c77ea12e (ad1808d27) starts through the real hook, serves GSM8K and passes the needle check (strict INT4 95.83, exact 96.21). Not claimed: a mechanism, other benchmarks or models, TP4 / TP8, gfx942, MTP.

Unverified:

  • gfx942 on a GPU: compile-only builds and a static resource budget only; the preflight and its residency check ran on gfx950 only. The multi-GPU CI job skips drafts and needs the ci:multi-gpu label.
  • PCIe and the finegrained inbox (the host refuses these modes there), TP8 on any node but that one, hidden sizes other than 2560, and a fresh install of this tree (the runs used the overlay above). Under FlyDSL 0.5.0 TP8 runs only in the multi-GPU CI job.
  • The 4 GiB window refusal is tested with one oversized pair that only that check can refuse. The same test with the guard removed was not run, because a launch on 4 GiB of uninitialized payload could fault the device.
  • The upstream all-reduce op tests ran at TP2 only. MI250X: the op supports gfx942 and gfx950 only.
  • The ISA comparison and the 487-cell op-test comparison with main were made against 5eccc0c7b under FlyDSL 0.4.1 and not repeated on the merged tree. The performance table was not re-timed after the merge.
  • Accuracy rows 1 to 3 did not run the current host code, and row 4 ran a head from before the merge of main.
  • Open PRs on the same area: [FlyDSL] QuickAllReduce INT4/INT5/INT6: fp32 divisor and pair-shared-exponent group scales #7326 (draft: fp32 divisor and adaptive group scales; kernel, host, codec, README, all-reduce op test; it would change the accuracy figures above) and [FlyDSL] QuickAllReduce INT4: faster poll and codec, kernel-arg peers, gfx950 engine plans #7093 (faster poll and codec, kernel-arg peers, gfx950 engine plans; kernel and host). Both target the quick_allreduce_int4.py paths that [FlyDSL] QuickAllReduce INT5/INT6 and all-reduce cleanup #5555 renamed, so they need a rebase in either order. Not trial-merged here.

PR-specific question

Before this PR the three methods do not exist, so the new test stops at its first call with AttributeError. Against mutants of the kernel (TP2 on another node, each run once, on an earlier commit of this branch whose kernel file is identical to the current one):

Kernel mutant Result
shard offset one tile off fails (AG NMSE 16.3)
own block stored from the input in all-gather fails
own share added exactly in reduce-scatter fails (owner dependence)
flag published before the payload stores have drained fails (RS NMSE 0.234)
colour not stored back at the end of a launch; ready wait removed from either mode hangs until FLYDSL_QR_TIMEOUT (120 s here, default 3600 s), cause not determined
own packet accumulated first in reduce-scatter not caught at TP2 (equivalent: two terms, one rounding). At TP4 and TP8 it fails owner independence on the ranged fill (at TP8 also on half the heavy-tailed rows); the other fills could not see that order, which is why the ranged fill exists

Host-side mutants (TP2 on a gfx950 pair; the CPU runs on ad1808d27):

  • Two scratch copies of the test (the all-gather NMSE term made NaN; the same NaN written into every interleave output) pass the extras on the parent file and fail on the fix.
  • Four host mutants (no size comparison, no residency call, build and residency check after the vote, validation before the vote) each fail the preflight pool's checks.
  • 10 of 10 protocol mutants of the preflight (CPU, gloo, the real _sp_preflight / _run_sp over a stubbed engine) fail their harness. Seven variants of the residency comparison fail its CPU stub test.

Delayed-rank coverage, each test run alone at TP2 on 5d4a4c149 (an earlier commit with the current kernel file) against three mutants (the ready wait removed from either mode, the colour not stored back):

Test Result
CUDA graph replay; delayed-rank interleave on a one-rung super_tile=1 engine pass all three: they do not detect them
interleave on the shipping ladder hangs under all three (detected, as a hang after the 90 s pool timeout)
stall control (in the op test as of this head) detects: with ready removed, one mode at a time, the stalled rank's output of that mode is wrong in 255 of 256 launches in 17 of 18 runs on the cap-64 engine (the 18th, all-gather, hung until the pool timeout, cause not determined) and in 2 of 2 on the shipping ladder. The same trees without the stall give 0 of 256, and the other mode stays clean
  • Stall control on the unmutated kernel: rank 1 of a TP2 pair sleeps between its data wait and its reads, 256 back-to-back launches per mode equal the isolated outputs, and a stalled launch takes 287 to 291 us against 17 to 20 us unstalled (MI355X, FlyDSL 0.5.0; five revisions of the test file with the same kernel file, the last on the head's tree).
  • Through main() the whole file fails each of the two mutants in 16 to 17 s with the section's message. The section runs first: before it did, the whole file on the reduce-scatter mutant did not finish in 240 s or 600 s and never reached it (stopped in its first phase, the validity pools).
  • Mutants of the test: a hook with 0 sleeps fails the stall check, a different reference input fails the digest comparison, a build that does not use its own cache directory fails the cache check, and six one-line mutants of the assertion (CPU, synthetic results) are all caught.

The all-reduce tests cannot cover the new methods: test_flydsl_quick_allreduce.py shares the codec but not the shard ownership, the ready handshake or the output layout.

Changed op tests

op_tests/multigpu_tests/test_flydsl_quick_reduce_scatter_all_gather.py is new and covers the two modes only:

  • Placement and accuracy against fp32 references (normal, heavy-tailed, ranged and all-zero inputs), owner independence, bitwise-equal all-gather output, buffer guards.
  • Alternating back-to-back launches with a delayed rank, and all-reduce / reduce-scatter / all-gather alternating on one engine in every ordered pair with each rank delayed in turn (one-rung engine and shipping ladder).
  • CUDA graph capture and replay after compile_sp, and refusal to capture before it.
  • Refusal of malformed tensors, a payload past the 4 GiB window, and engines the modes cannot run on (ring, finegrained, INT5 mesh).
  • A separate pool for the collective preflight: unequal valid sizes, invalid tensors through compile_sp and through the first eager call, a build and a residency failure on one rank, reduce-scatter against all-gather as first calls, compile_sp inside a capture, an agreeing retry, and no vote on a ready engine. A stub makes any launch after a failed preflight an error. A CPU stub test covers the residency comparison.
  • A slow-reader section (TP2 only, first in main()):
    • one exact-text edit of the kernel source (the anchor must occur once), loaded from a temporary file under another module name over the host's make_quick_allreduce_mesh_kernel, with its own FlyDSL cache directory that must hold the compiled kernels afterwards;
    • two pools, the shipped kernel and the copy: 256 back-to-back reduce-scatters and 256 all-gathers on the one-rung cap-64 engine, alternating two inputs;
    • every launch must equal the isolated output of its input, the stalled pool's isolated outputs must equal the shipped kernel's (sha256), and a stalled launch must take at least 50 us longer than an unpatched one.

Harness:

  • --tp is honored through select_world_sizes, as in the sibling test: the no-argument run covers TP2 / 4 / 8 where the GPUs exist, and a named size that cannot run is an error.
  • The worker pool takes multiprocessing.get_context("spawn"), with no import-time set_start_method. _run_pool takes a timeout; these pools end after 600 s (the shorter of that and FLYDSL_QR_TIMEOUT applies).
  • Graph-replay NMSEs, isolated interleave outputs and the reference outputs of the back-to-back launches are tested for NaN and non-finite values.
  • It skips in main() on an unsupported arch like its sibling test_flydsl_quick_allreduce.py, but reads the arch with get_gfx_runtime() (the live GPU) where the sibling and .github/instructions/aiter-ops-flydsl.instructions.md use get_gfx(). That follows GPU_ARCHS (the last entry when several are listed) and can differ from the GPU the spawned workers run on.

🤖 Generated with Claude Code

…sequence parallelism

Add reduce_scatter(inp, out), all_gather(inp, out) and compile_sp(full, shard)
to QuickAllReduceInt4. They run one phase of the INT4 all-reduce on its own,
on its codec (group-16 signed E4M3 scales, 1152 B per 2048 bf16), IPC inbox
and colored flags, and leave each rank a contiguous row block: the kernel maps
the all-reduce's per-tile atom ownership to contiguous shards by an address
transpose. Both modes are super_tile=1 only; every partial, a rank's own
included, goes through the codec, so a row's value does not depend on which
rank owns it.

A single phase has no second-phase guard against inbox reuse, so both modes
send through the all-gather slots and start each round with a `ready` flag
(the reduce-scatter phase's release flag, no payload).

The all-reduce is unchanged (ISA and output hash identical); the host helpers it
shares were split (_check_tensors) or routed through _variant.

Add op_tests/multigpu_tests/test_flydsl_quick_reduce_scatter_all_gather.py:
placement and accuracy against fp32 references on normal, heavy-tailed and
all-zero inputs, owner independence, sentinel and guard buffers, alternating
back-to-back launches with a delayed rank, and refusal of malformed tensors.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
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 gfx1201 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 7444 --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.

@aiter-bot

aiter-bot commented Nov 4, 2026 •

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision 1748d5d56179 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

New methods only: no existing call, default or output changes (`check_payload` keeps its behaviour and signature, and the all-reduce ISA was byte-identical to main's before the merge, see Changes). Sequence-parallel layouts get INT4 collectives with row-contiguous shards, which the all-reduce kernel's per-tile ownership could not produce.

One behaviour differs from the all-reduce on purpose: the reduce-scatter quantizes the rank's own partial, where the all-reduce adds its own share exactly, so that a row's value does not depend on its owner. Taking the exact add instead is local to `_own_packets` and `_reduce_scattered_sp`; the owner-independence check would then no longer hold for reduce-scatter.

Validation and unverified scope

All runs on MI355X (gfx950), hidden 2560, bf16, in `vllm/vllm-openai-rocm` nightly `dd4e40142a32` (amd-aiter 0.1.27, torch 2.13.0+rocm10.0.0, RCCL 2.30.4), with this tree's `aiter/ops/flydsl` and four `aiter/dist` files over the image's, md5-checked against the commit in every job. FlyDSL 0.4.1 (the `requirements.txt` pin) over the image's 0.4.0 for the pre-merge rows. FlyDSL 0.5.0 (PyPI wheel), a `git archive` snapshot and 8 to 13 md5-checked files per job for the others: the only runs under 0.5.0. `30f37d948`, `3c77ea12e` and `584df31bd` are pre-merge; the head `0fd0532e2` is `584df31bd` plus the merge of main `6efb333ad` and an adaptation commit.

| Tree | What ran | Result |
|---|---|---|
| `30f37d948` | op test `python3 op_tests/multigpu_tests/test_flydsl_quick_reduce_scatter_all_gather.py --tp 2 4 8 -s 8192,2560` on 8 GPUs, from a copy outside the repo so that `import aiter` resolves to the overlay | exit 0 in 199 s with a cold JIT cache: validity at TP2 / 4 / 8 at both grid caps, the extras, the timed sweep (source of the NMSE figures, not of the graph timings) |
| `30f37d948` | a driver calling the op test's functions, per world size | 48 / 64 / 128 validity rows at TP2 / 4 / 8 (four fills, both grid caps, every rank): per-rank NMSE inside 3 % of an out-of-tree CPU model of the codec on every row; owner independence, bitwise-equal all-gather output, clean buffers and back-to-back launches all True; extras pass on every rank |
| `3c77ea12e` | the op test per world size, fresh JIT cache each; the upstream `test_flydsl_quick_allreduce_int4.py --tp 2 -a mesh` | exit 0: `--tp 2` 54 s, `--tp 4` 61 s, `--tp 8` 87 s (preflight pool included); the upstream test passes; TP2 and TP4 repeated on a second gfx950 node pass (62 s, 64 s), same correctness columns |
| `584df31bd`, 0.5.0 | probe (on merge commit `5bbeb2589`, whose kernel and host code are the head's); the op test, whole file, fresh cache | `max_blocks_per_cu()` works in 36 of 36 builds, limits equal the 0.4.1 ones (TP2 4 against a need of 2, TP4 5 against 4, TP8 5 to 6 against 2), the residency check passes at every probed grid and raises one block per CU above the limit (36 of 36 each). Op test: TP2 rc 0 in 74 s, TP4 rc 0 in 62 s, correctness columns equal to the 0.4.1 runs digit for digit (rs NMSE 0.00650243 at TP2, 0.00650306 at TP4) |
| `584df31bd`, 0.5.0 | one TP4 row alternately on 0.4.1 (tree `3c77ea12e`) and 0.5.0 (the head), one lease | rs 99.5 / 90.8 us against 91.4 / 91.8 us, ag 92.4 / 91.2 against 91.5 / 91.6 us, NMSE equal bit for bit |
| `0fd0532e2` (head), 0.5.0 | op test, whole file, fresh FlyDSL cache per world size; main's `test_flydsl_quick_allreduce.py --tp 2` | op test TP2 rc 0 in 99 s, TP4 rc 0 in 64 s; main's test rc 0 in 36 s (int4 codecs, SQNR 20.079 dB); no `Traceback`, `Error`, `fail` or `skip` line in any of the logs |
| head, mutant | the builder's `or codec != "int4"` check removed from the overlay's `quick_allreduce_mesh.py`; op test `--tp 2` | rc 1 in 57 s: the INT5 mesh case in `_check_unsupported_engines` fails with `a launch was reached` |

Timing note: in two earlier whole-file TP4 runs three of the four timed values (174.8, 174.7 and 225.6 us; the fourth was 96.0 us) were far above the 0.4.1 ones while another job of mine was running on the node. Four later runs with no other job of mine running gave 90.8 to 91.8 us, and two runs on the merged tree gave 90.9 to 91.3 us. The cause of the slow runs is not shown.

End-to-end accuracy through the INT4 hook of vllm-project/vllm#65628 (Qwen3.8-Flash-Next MXFP4, TP2, GSM8K 5-shot, 1,319 questions, strict match unless noted). The first three rows ran the first version of that hook (`--enable-hc-sp-quick-reduce` against `--enable-hc-sp-aiter-ipc`), whose flags no longer exist, on the host file of `30f37d948` (no collective preflight or residency check). The last row is the reworked PR, which reaches these kernels through ROCm/aiter#7819.

| Run | INT4 minus exact | Remarks |
|---|---|---|
| O

[truncated in readiness report; see the PR description for the full answer]

PR-specific question

Before this PR the three methods do not exist, so the new test stops at its first call with `AttributeError`. Against mutants of the kernel (TP2 on another node, each run once, on an earlier commit of this branch whose kernel file is identical to the current one):

| Kernel mutant | Result |
|---|---|
| shard offset one tile off | fails (AG NMSE 16.3) |
| own block stored from the input in all-gather | fails |
| own share added exactly in reduce-scatter | fails (owner dependence) |
| flag published before the payload stores have drained | fails (RS NMSE 0.234) |
| colour not stored back at the end of a launch; `ready` wait removed from either mode | hangs until `FLYDSL_QR_TIMEOUT` (120 s here, default 3600 s), cause not determined |
| own packet accumulated first in reduce-scatter | not caught at TP2 (equivalent: two terms, one rounding). At TP4 and TP8 it fails owner independence on the ranged fill (at TP8 also on half the heavy-tailed rows); the other fills could not see that order, which is why the ranged fill exists |

Host-side mutants (TP2 on a gfx950 pair; the CPU runs on `ad1808d27`):

- Two scratch copies of the test (the all-gather NMSE term made NaN; the same NaN written into every interleave output) pass the extras on the parent file and fail on the fix.
- Four host mutants (no size comparison, no residency call, build and residency check after the vote, validation before the vote) each fail the preflight pool's checks.
- 10 of 10 protocol mutants of the preflight (CPU, gloo, the real `_sp_preflight` / `_run_sp` over a stubbed engine) fail their harness. Seven variants of the residency comparison fail its CPU stub test.

Delayed-rank coverage, each test run alone at TP2 on `5d4a4c149` (an earlier commit with the current kernel file) against three mutants (the `ready` wait removed from either mode, the colour not stored back):

| Test | Result |
|---|---|
| CUDA graph replay; delayed-rank interleave on a one-rung `super_tile=1` engine | pass all three: they do not detect them |
| interleave on the shipping ladder | hangs under all three (detected, as a hang after the 90 s pool timeout) |
| stall control (in the op test as of this head) | detects: with `ready` removed, one mode at a time, the stalled rank's output of that mode is wrong in 255 of 256 launches in 17 of 18 runs on the cap-64 engine (the 18th, all-gather, hung until the pool timeout, cause not determined) and in 2 of 2 on the shipping ladder. The same trees without the stall give 0 of 256, and the other mode stays clean |

- Stall control on the unmutated kernel: rank 1 of a TP2 pair sleeps between its data wait and its reads, 256 back-to-back launches per mode equal the isolated outputs, and a stalled launch takes 287 to 291 us against 17 to 20 us unstalled (MI355X, FlyDSL 0.5.0; five revisions of the test file with the same kernel file, the last on the head's tree).
- Through `main()` the whole file fails each of the two mutants in 16 to 17 s with the section's message. The section runs first: before it did, the whole file on the reduce-scatter mutant did not finish in 240 s or 600 s and never reached it (stopped in its first phase, the validity pools).
- Mutants of the test: a hook with 0 sleeps fails the stall check, a different reference input fails the digest comparison, a build that does not use its own cache directory fails the cache check, and six one-line mutants of the assertion (CPU, synthetic results) are all caught.

The all-reduce tests cannot cover the new methods: `test_flydsl_quick_allreduce.py` shares the codec but not the shard ownership, the `ready` handshake or the output layout.

Changed op tests

`op_tests/multigpu_tests/test_flydsl_quick_reduce_scatter_all_gather.py` is new and covers the two modes only:

- Placement and accuracy against fp32 references (normal, heavy-tailed, ranged and all-zero inputs), owner independence, bitwise-equal all-gather output, buffer guards.
- Alternating back-to-back launches with a delayed rank, and all-reduce / reduce-scatter / all-gather alternating on one engine in every ordered pair with each rank delayed in turn (one-rung engine and shipping ladder).
- CUDA graph capture and replay after `compile_sp`, and refusal to capture before it.
- Refusal of malformed tensors, a payload past the 4 GiB window, and engines the modes cannot run on (ring, `finegrained`, INT5 mesh).
- A separate pool for the collective preflight: unequal valid sizes, invalid tensors through `compile_sp` and through the first eager call, a build and a residency failure on one rank, reduce-scatter against all-gather as first calls, `compile_sp` inside a capture, an agreeing retry, and no vote on a ready engine. A stub makes any launch after a failed preflight an error. A CPU stub test covers the residency comparison.
- A slow-reader section (TP2 only, first in `main()`):
  - one exact-text edit of the kernel source (the anchor must occur once), loaded from a temporary file under another module name over the host's `make_quick_allreduce_mesh_kernel`, with its own FlyDSL cache directory that must hold the compiled kernels afterwards;
  - two pools, the shipped kernel and the copy: 256 back-to-back reduce-scatters and 256 all-gathers on the one-rung cap-64 engine, alternating two inputs;
  - every launch must equal the isolated output of its input, the stalled pool's isolated outputs must equal the shipped kernel's (sha256), and a stalled launch must take at least 50 us longer than an unpatched one.

Harness:

- `--tp` is honored through `select_world_sizes`, as in the sibling test: the no-argument run covers TP2 / 4 / 8 where the GPUs exist, and a named size that cannot run is an error.
- The worker pool takes `multiprocessing.get_context("spawn")`, with no import-time `set_start_method`. `_run_pool` takes a `timeout`; these pools end after 600 s (the shorter of that and `FLYDSL_QR_TIMEOUT` applies).
- Graph-replay NMSEs, isolated interleave outputs and the reference outputs of the back-to-back launches are tested for NaN and non-finite values.
- It skips in `main()` on an unsupported arch like its sibling `test_flydsl_quick_allreduce.py`, but reads the arch with `get_gfx_runtime()` (the live GPU) where the sibling and `.github/instructions/aiter-ops-flydsl.instructions.md` use `get_gfx()`. That follows `GPU_ARCHS` (the last entry when several are listed) and can differ from the GPU the spawned workers run on.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • FAIL — an active Copilot finding has no substantive reply from the PR author

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • FAIL — Aiter Test Gate: failed
  • Required CI failed; fix it before requesting human review.

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

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.

🟡 Changes recommended

Regression coverage is missing for multi-rank CUDA graph capture/replay and delayed-rank transitions between allreduce and the new modes, leaving shared-state advancement and inbox reuse unverified.

2 open issues
What changed in this PR

Adds standalone INT4 reduce-scatter and all-gather to QuickAllReduceInt4, providing row-contiguous shards for sequence parallelism while retaining the existing all-reduce path.

Changes:

  • Adds single-phase kernel modes with contiguous shard addressing and inbox-reuse synchronization.
  • Exposes reduce_scatter, all_gather, and compile_sp, with payload validation.
  • Adds multi-GPU correctness checks, delayed-rank stress tests, and timing sweeps.
File Description
op_tests/​multigpu_tests/​test_flydsl_quick_reduce_scatter_all_gather.py Tests accuracy, shard placement, synchronization, and malformed-input rejection.
aiter/​ops/​flydsl/​quick_allreduce_int4.py Adds public methods, validation, and cached mode-specific launchers.
aiter/​ops/​flydsl/​kernels/​quick_allreduce_int4.py Implements standalone collective modes and their synchronization protocol.

Review effort: Balanced

eppaneamd and others added 8 commits November 4, 2026 11:16
Conflict resolution only. Upstream #5461 moved the FlyDSL INT4 quick all-reduce
kernel to kernels/comm/ and rewrote the host class, so this takes main's host
file and accepts the deletion of kernels/quick_allreduce_int4.py. The
reduce-scatter / all-gather modes are not on the tree after this commit (the
new op test does not run here); the next commit ports them onto main's mesh
kernel.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…odes onto the #5461 mesh kernel

Re-apply the sequence-parallel modes of this PR on the kernel and host that
#5461 rewrote (per-rank binaries, peers-only publish/wait, runtime n_blocks,
inbox memory modes, engines keyed by (super_tile, block)) and on the E5M2 group
scale of #7258.

Kernel (kernels/comm/quick_allreduce_int4.py): make_quick_allreduce_int4_kernel
takes mode="ar" | "rs" | "ag". "rs" and "ag" run one phase of the INT4 mesh on
its own, for super_tile=1, the 8-atom tile and no fused norm. Rank d owns a
contiguous block of N / world_size bytes; the tile machinery is unchanged and
only the HBM address of an atom moves, through a full / shard layout local to the
mesh kernel (_sp_payload_io) with the runtime n_blocks stride. Both modes send
through the all-gather slots and start every round with a payload-free `ready`
flag, since a single phase has no second-phase guard against inbox reuse.
Unlike the all-reduce, which adds its own share from registers, "rs" quantizes
this rank's own partial through the codec and accumulates every rank in rank
order with the same dequant, so a row's value does not depend on which rank owns
it. The JIT symbol gets an `_rs` / `_ag` suffix and the single-phase builds pin
waves_per_eu to the plain kernel's residency.

Host (quick_allreduce_int4.py): reduce_scatter(inp, out), all_gather(inp, out)
and compile_sp(full, shard). They run on the super_tile=1 engine at the default
block (shared inbox and colors) and raise for the ring, an inbox other than
"uncached", or a ladder without that engine. There is no min_bytes floor.
compile_sp now loads both builds with preload_launcher like preload: it checks
the shapes, launches nothing and overwrites nothing, and takes no stream. A
single-phase launch under CUDA graph capture raises unless its build is loaded.
check_tensors is split out of check_payload (same behaviour and signature) for
the pair check.

README documents the modes. The op test imports from kernels.comm and builds its
engine from a one-rung ladder instead of super_tile / grid_cap.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…rleave and unsupported engines

Close two gaps in the op test of this PR and cover the refusals of the host.

Graph: after compile_sp (which launches nothing and leaves its tensors alone),
capture reduce_scatter and all_gather into one CUDA graph with torch.cuda.graph
and the all-rank capture vote of the rmsnorm test, then replay it with new
inputs written in place. Every replay must equal an eager run of the same
inputs bit for bit and stay within NMSE_MAX of a fresh fp32 reference. A
capture on an engine that has not loaded its builds must be refused with a
message that names compile_sp.

Interleave: all-reduce, reduce-scatter and all-gather alternate on one engine
with no sync between them, each call with its own input, in a cycle that
contains every ordered transition between the three modes (asserted when the
cycle is built), with each rank slowed in turn by fp32 matmuls on a side stream.
Every output must equal the isolated result of its call bit for bit. It runs on
a one-rung ST=1 engine at grid cap 64 (several tiles per block) and on the
shipping ladder, where one all-reduce size is kept for each binary the ladder
picks.

Refusals: reduce_scatter, all_gather and compile_sp raise on an engine built
with the ring or with a fine-grained inbox.

The rank setup and the spawn pool are shared by the existing and the new
workers.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…ero for all-zero inputs

The test required the outputs for all-zero inputs to be bitwise +0.0. On the
current codec they come out as -0.0 (int16 bit pattern -32768 at TP2, TP4 and
TP8), which compares equal to zero but is not +0.0. Check that every output
element equals zero (NaN and stray values still fail), and put the observed
int16 bit patterns in the failure message.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…e accumulation order shows in the result

With the normal and heavy-tailed fills the reduce-scatter result barely depends
on the order in which the ranks' packets are accumulated: a dequantized product
is exact in fp16 and a sum of terms of similar magnitude rarely rounds, so a
kernel that accumulates a rank's own packet first (owner-dependent order) can
pass the owner-independence check, which is the property the single-phase modes
exist to guarantee. Add a fill in which rank r's partial is 4**(r % 4) times as
large (up to 64x, far below the fp16 maximum), whose sums round, so a row's value
depends on its owner whenever the accumulation order does. With two ranks the sum
has two terms and a single rounding, so the order cannot show at TP2.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…sp-rs-ag

No conflicts; main's new commit touches only op_tests/op_benchmarks/triton/bench_sage.py.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…he 4 GiB window; fix two stale comments

reduce_scatter and all_gather raise before any launch when the full tensor is
larger than the 4 GiB buffer window, as the all-reduce does; nothing exercised
that check. Add one oversized, uninitialized pair to the refusal cases (whole
tiles, tp times the shard, one step past MAX_PAYLOAD_BYTES): every other check
passes on it, so only the window check can refuse it.

Also: the test's expected-NMSE comment named the E4M3 group scale (the codec has
the E5M2 scale since #7258), the ranged-fill comment said a sum of similar
magnitudes is exact (it rarely rounds), and a host comment named a method that
does not exist (sp_launch for _sp_launcher).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>

@johannes-graner johannes-graner 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.

Reviewed at head 30f37d9.

On gfx950 at TP2, the new test passed at 1024x2560 and 8192x2560 with RS/AG NMSE about 6.50e-3, matching the PR. TP4/TP8 and gfx942 were not run here. The existing all-reduce regression tests (test_flydsl_quick_allreduce_int4.py --tp 2 -a mesh and test_flydsl_quick_allreduce_int4_rmsnorm.py --tp 2) also pass at this head, including cross-rank bit identity and the skewed-rank dispatch agreement.

Must fix: the graph accuracy check in the new test can accept NaN output, SP kernel co-residency needs a verified resource check, and SP launches need an in-library all-rank readiness check. The accuracy question on the same-layout GSM8K comparison below also needs settling before this is enabled for serving.

Accuracy: the same-layout comparison (B vs C) loses 1.14 strict-match points with the INT4 SP collectives, past the PR's own 1.0-point bound, and the 23/8 split on the questions where B and C disagree is unlikely under no effect (p=0.011). One run per configuration can't tell a fluke from a regression. Could you check this more closely before landing: repeat the B/C pair with additional seeds or sampling, or on a second benchmark, and if the gap holds, run an ablation that keeps the own share exact in RS (diagnostic only, not a proposed fix) to see whether self-quantization drives it? Until that is settled, please keep INT4 SP opt-in on the consumer side.

eppaneamd and others added 4 commits November 6, 2026 07:59
…, keep the start method

Review of #7444 (op test):

- Graph replay: the NMSE of every replay and mode is kept and tested on its
  own. The worker accumulated them with max(), and max(0.0, nan, nan) is 0.0,
  so a graph that replayed NaN passed (the replay also compares bitwise
  against an eager run, which writes the same NaN). A NaN now fails.
- Interleave: every comparison is against the isolated outputs, so a kernel
  that wrote the same NaN in both runs passed. The isolated outputs are now
  checked finite.
- --tp: it only chose the timed sweep (default 2); the validity and the
  graph / interleave checks ran at every size that fit the visible GPUs. It
  now names the world sizes of all three, through select_world_sizes as in
  test_flydsl_quick_allreduce_int4.py. Without it every size the visible GPUs
  can run is run, so the timed sweep covers TP2/4/8 where it covered TP2; a
  size that is named but cannot run is an error, and so is an empty selection
  (a host with fewer than 2 GPUs used to skip everything with a warning and
  exit 0).
- The module no longer sets the process-wide start method at import;
  _run_pool uses a spawn context.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…idency check; state the stream-ordering contract

Review of #7444 (host):

- compile_sp is now a collective preflight, and the single-phase launches need
  one to have passed: an eager reduce_scatter / all_gather on an engine that has
  not passed runs it with its own tensors (which makes that first call a
  collective: every rank makes it, in the same mode and with the same sizes),
  and a call under CUDA graph capture is refused, naming compile_sp. Each rank
  catches what raises locally (the engine and codec rules, the tensors, both
  builds, the residency check) and the ranks vote through the group on whether
  any rank failed, together with the call kind and the full and shard sizes,
  which are all that can differ between ranks that get this far (the world size
  is the group's, the grid the minimum over the ranks, and the single-phase
  builds take the INT4 codec only). If a rank failed or the kinds or sizes
  differ, every rank raises: the failing rank its own exception, the others a
  RuntimeError naming it, and the engine is not ready. Before, a rank that
  failed validation or the compile while a peer launched could leave that peer
  polling its flags, and locally valid but unequal sizes could give different
  block counts, as the review points out. A ready engine takes no collective on
  a launch. The capture refusal used to depend on the build not being loaded and
  now depends on the preflight not having passed.
- Residency: both builds of the engine are checked, as part of the preflight,
  with ceil(grid / CUs) <= max_blocks_per_cu() of the compiled artifact (the
  kernels are persistent and spin on peers' flags, so a block that is not
  resident deadlocks the launch), and the call fails where the limit is not
  met. Nothing is clamped.
- The class, allreduce, reduce_scatter, all_gather and compile_sp docstrings
  and the README state that launches and graph replays of every mode on one
  communicator run in one serialized device order (they share colors and inbox
  slots; independent streams need an event dependency), and that later shapes
  must agree across ranks.

Tests (op test): a preflight pool in which rank 1 differs from the others
(valid but unequal sizes after a ready compile_sp, invalid tensors through
compile_sp and through the first eager call, reduce-scatter against
all-gather as the first calls): every rank raises and the engine is not ready,
and after the size mismatch a capture is refused; an agreeing retry passes,
calls the residency check for both builds at the engine's grid and CU count and
is correct; ready launches vote no more. The residency comparison is also run
against stub artifacts before any rank is spawned. The zero-tensor helper of
the refusal cases is shared with the new pool.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…; test local build and residency failures

Host (quick_allreduce_int4.py, kernels/comm/README.md):
- the single-phase preflight refuses a CUDA graph capture itself, so compile_sp
  inside a capture is refused before any vote (it loads modules, which a capture
  cannot); before, only the lazy first call in _run_sp checked. The message
  still names compile_sp, and a refused capture leaves the engine's readiness
  as it was.
- the vote's fingerprint drops the shard size, which the full size fixes
  (_check_sp_payload enforces full == world_size * shard); a mismatch is now
  reported as kind / full_bytes only.
- docstrings and README: launches share inbox slots and colors per engine (the
  single-phase modes and the all-reduce sizes the ladder gives the same
  super_tile=1 engine), one serialized order for all launches stays the rule;
  the exception types differ between ranks after a failed preflight; a failed
  repeat compile_sp revokes an earlier pass; later shapes are checked on their
  own rank, the address-dependent checks included.

Op test:
- a build or a residency failure on rank 1 alone must be raised by every rank
  (two new preflight cases; a stub makes any launch after a failed preflight an
  error instead of a persistent kernel);
- the residency check is shown to run on the reduce-scatter build and then the
  all-gather build, and the CU count in use is compared with the device's;
- the residency stub covers every artifact in either order and a second CU
  count, and a RuntimeError of another kind is not a refusal;
- the reference outputs of the back-to-back launches must be finite, and the
  number of graph replay NMSE values is checked, so a loop that did not run
  fails;
- compile_sp inside a capture, on a ready engine, is refused and the engine
  stays ready;
- the refusal cases also run on a ready engine, where the check of each launch
  (not the preflight's copy of it) refuses.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…l check; pin compile_sp-under-capture to no vote and no load

Follow-up to the review of the previous commit.

Op test:
- every refusal check (the malformed-tensor cases, on a not-ready and on a
  ready engine, and the engines the modes cannot run on) runs with a stub that
  raises at any launch, as the preflight cases already did, so a refusal that
  regresses fails as an assertion instead of launching a persistent kernel on
  invalid tensors;
- compile_sp inside a capture, on a ready engine, is now shown to refuse before
  any vote and any module load (neither all_gather_object nor preload_launcher
  is called), not only to raise a message that names compile_sp and keep the
  engine ready;
- a peer's failed capture is reported once; the healthy ranks no longer add
  "missing replay values" and "not refused" lines;
- the module docstring lists the new coverage, the worker docstring no longer
  says that no case launches (the retry and the steady-state calls do), a
  comment on the back-to-back references is corrected, and the non-finite count
  is one helper.

Docs (no behaviour change): the all-reduce, the fused RMSNorm and the
single-phase modes share inbox slots and colors per engine, now said in the
class docstring, the _sp_engine and reduce_scatter docstrings and the README.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
@eppaneamd

Copy link
Copy Markdown
Contributor Author

On the accuracy request in the review body (reviewed head 30f37d948):

Repeated with three new pairs; the rule, the bound and the analysis were fixed before the first run. Setup as the pair in the description: Qwen3.8-Flash-Next MXFP4, TP2, GSM8K 5-shot, 1,319 questions, temperature 0, same seed; INT4 = --enable-hc-sp --enable-hc-sp-quick-reduce, exact = --enable-hc-sp --enable-hc-sp-aiter-ipc (AITER's IPC reduce-scatter / all-gather at every size), INT4 environment identical in both arms; one arm at a time, order alternated per round.

Shipped 8 MiB gate, INT4 minus exact in points (pooled = per-question paired difference, mean over the rounds, SE over the 1,319 questions because the rounds reuse them):

strict flexible
per round (3) +0.53, -0.68, -0.08 +0.61, -0.45, +0.00
pooled, 3 pairs -0.08 (SE 0.22, 95 % CI [-0.52, +0.36]) +0.05 (SE 0.22, CI [-0.39, +0.49])
pooled with the earlier +0.83 pair, 4 pairs +0.15 (SE 0.21, CI [-0.25, +0.56]) +0.21 (SE 0.20, CI [-0.19, +0.61])

The bound was -1.0 point on the lower CI limit of both filters: no loss beyond the bound.

Code these runs used: the kernel file is byte-identical to the current head's; the host file was 30f37d948's up to one comment line, so the preflight and the residency check were not in these end-to-end runs. The current head is covered by the op test at TP2, TP4 and TP8, the vLLM two-GPU tests through the real hook, and one served-model check on a tree with identical host code (ad1808d27; the last commit changed docstrings and tests only): both arms start through the real hook (the collective compile_sp returns on both workers, no preflight error), serve GSM8K and pass the needle check. That single round (strict INT4 95.83, exact 96.21) says nothing about a small effect.

Run-to-run spread, same configuration: exact arm, thirteen runs, strict 95.60-96.82 (range 1.21 points, 0.76 without the earliest run); INT4 arm, four runs, 96.13-96.66. A one-point difference between two runs of one configuration is within what is seen, so one pair cannot settle the question, which is why a pooled CI is given. The earlier single pair in the description (-1.14) had an RCCL exact arm and an earlier tree; this spread does not explain it.

Exposure at 8 MiB: a separate run with step statistics on (INT4 arm, lm-eval only) shows 104 of 6,243 engine steps (1.7 %) above 2,048 tokens, certainly above the gate, and 762 (12 %) between 1,024 and 2,048, which may or may not be; the rest are far below it. The pairs above exercise INT4 on a minority of steps and bound the loss for that exposure only.

Upper bound, gate lowered to about 1 MiB (VLLM_ROCM_QUICK_REDUCE_MIN_SIZE_BYTES_MB=1; the sequence-parallel collectives take INT4 on every step above 512 tokens, at most 18.5 % of that run's steps), against the same exact arm; not the shipped configuration. The variable also lowers the gate of the server's INT4 all-reduces (the exact arm keeps 8 MiB for them), so the difference is not attributable to the sequence-parallel collectives alone.

1 MiB gate strict flexible
3 pairs (inconclusive by the rule) -0.51 (SE 0.27, CI [-1.04, +0.03]) -0.43 (CI [-0.97, +0.11])
6 pairs -0.51 (SE 0.18, CI [-0.86, -0.15]) -0.47 (SE 0.18, CI [-0.82, -0.11])
  • The second three pairs were an extension decided after the first three and registered before they started (an earlier planned set of rounds never started, because of a script defect, and the first three of this gate replaced it); alone they give strict -0.51, CI [-1.02, +0.01].
  • Strict per round: -0.61, 0.00, -0.91, -0.68, -0.38, -0.45; accuracies 95.60-96.29, at the lower end of the exact runs' range (95.60-96.82).
  • By the rule stated before the runs the six-pair result is within the -1.0 bound, but both intervals exclude zero: about half a point lower accuracy at a 1 MiB gate. At the shipped 8 MiB gate the interval includes zero and INT4 is exercised on fewer steps. I have not tested whether the difference between the two estimates is real or what causes it.

Not claimed: a mechanism, other benchmarks or models, TP4 / TP8, gfx942, gates other than the two tested (8 MiB, and 1 MiB as the upper bound), MTP.

@eppaneamd

Copy link
Copy Markdown
Contributor Author

Pushed 3c77ea12e (four commits on 30f37d948); every inline comment has a reply. Summary:

  • NaN in the graph check, --tp ignored, forced start method: fixed in 4afeb24ad (op test only).
  • Stream-ordering contract: documented in 3efb7d7e9, worded per engine in ad1808d27.
  • Collective SP preflight with a co-residency check: 3efb7d7e9, hardened in ad1808d27 and 3c77ea12e; one deviation and a question are in its thread.
  • Slow-reader regression: no code yet, the question is in its thread.
  • Accuracy: the repeat pairs and the 1 MiB-gate upper bound are in the PR-level reply. At the shipped 8 MiB gate there is no loss beyond the bound; at a 1 MiB gate the six pairs show about half a point lower accuracy.
  • INT4 sequence-parallel collectives stay opt-in on the consumer side: vllm#65628 enables them only with --enable-hc-sp-quick-reduce (default off).
  • Not verified: gfx942 on a device; the end-to-end accuracy rounds ran the host file of 30f37d948, not the preflight.

@johannes-graner

Copy link
Copy Markdown
Contributor

On the accuracy request: the repeat pairs at the 8 MiB gate (pooled CI inside the bound) and the default-off opt-in in vllm#65628 are enough for me to land this, with no further ablation or second benchmark needed here. The 1 MiB result stays a caveat for anyone lowering the gate.

eppaneamd and others added 4 commits November 10, 2026 06:45
Docs only; the code is unchanged (the module's AST with docstrings stripped is
identical to the parent's).

- the class docstring gets one paragraph of call rules for every method that
  takes stream: stream=None is the current PyTorch stream of the device; a call
  only enqueues work, so its tensors must stay allocated until that work has
  finished (for a captured call, until the graph's last replay), out is not
  valid and inp must not be modified before then, and a tensor of another
  stream needs an event dependency; inp and out are checked by check_tensors
  (torch tensors, bf16, this rank's CUDA device, contiguous, 16-byte aligned),
  must not overlap, and are sized by check_payload (all-reduce, fused RMSNorm)
  or _check_sp_payload (single-phase modes);
- reduce_scatter names the INT4 codec among the engine requirements (the
  single-phase build refuses the fp16 wire codec) and points to the class
  docstring for the ordering rule and the call rules; all_gather points there
  and inherits the engine and codec rules of reduce_scatter;
- one over-long line in the reduce_scatter docstring is rewrapped.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…kreduce-sp-rs-ag

No conflicts: main (9c119bb) and this branch changed disjoint files. The
tree differs from origin/main in the five files of this PR only, with the same
diffstat as the branch against its previous merge base (1859 insertions, 12
deletions).

Main pins flydsl>=0.5.0 (aiter/ops/flydsl/__init__.py), so this head needs
FlyDSL 0.5.0 or newer.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…on a patched copy of the kernel

A section of the op test (TP2 only) runs the single-phase modes
with one rank delayed at a fixed point of the kernel, so that a defect in the
slot-reuse handshake shows as a wrong output instead of depending on timing:

- _slow_reader_source() makes one exact-text edit of the kernel source: rank 1
  sleeps (40 x s_sleep(127), the unrolled hook of the earlier stall control)
  between its data wait and its reads in the single-phase loop. The anchor must
  occur exactly once, so a kernel edit that moves or repeats it fails the test
  with the count instead of testing nothing. No factory parameter is added: the
  copy is loaded from a temporary file under another module name and replaces
  the host's make_quick_allreduce_int4_kernel for the life of the engine, with
  its own FlyDSL cache directory; after compile_sp the test requires that
  directory to hold the compiled kernels (skipped when FlyDSL's disk cache is
  off), so a build that did not use it fails.
- Two spawn pools run the same work: P with the shipped kernel and S with the
  copy. Each rank computes the isolated outputs of two inputs, then launches
  256 reduce-scatters and 256 all-gathers back to back on the one-rung cap-64
  engine, alternating the inputs, each into its own output buffer, with one sync
  at the end. Asserted: no launch differs from the isolated output of its input
  (P and S), S's isolated outputs equal P's (sha256), and a stalled launch is
  at least 50 us slower than an unpatched one, so a hook that stops stalling
  fails instead of passing.
- _run_pool() takes a timeout; the section passes 600 s and
  min(FLYDSL_QR_TIMEOUT, that) applies, so a hang in this section ends in
  minutes instead of at the 3600 s default. The other pools are unchanged.
- main() runs the section first, through _check_slow_reader(), which does nothing
  unless TP2 is among the selected world sizes (--tp names what runs); the module
  docstring lists it. First, because the other phases can hang on a missing
  handshake: with it removed from reduce-scatter in the production kernel the
  whole file did not finish in 240 s or 600 s (a stack dump showed its first
  phase, the validity pools), where the section ends the file in 17 s with the
  wrong outputs.

Authoring runs (MI355X, FlyDSL 0.5.0, TP2), not part of the test: unpatched
17-20 us per launch, stalled 287-291 us, no mismatch in either pool. With the
slot-reuse handshake removed from the production kernel, one mode at a time, the
mutated mode shows 255 of 256 wrong launches on rank 1 in 17 of 18 runs on the
cap-64 engine (the 18th, all-gather, ended at the pool timeout) and in 2 of 2 on
the shipping ladder, while the same trees without the stall show 0 of 256.
Through main() the same defect fails the whole file with the section's message
(one run per mode). A hook with 0 sleeps fails the stall check, a different
reference input fails the digest comparison, and a build that skips its own cache
directory fails the cache check.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
…nous, shorter pointers

Docs only (the host file's AST with docstrings stripped is identical to the
parent's). Follow-up to the call-rules paragraph of the earlier docstring commit:

- that commit said a call "only enqueues work"; the first eager reduce_scatter /
  all_gather (compile_sp preflight) and the first allreduce_rmsnorm at a new
  width also compile, load kernels or run a collective before they enqueue. The
  paragraph now says the call returns once its work is enqueued on the stream,
  which holds for every call, and the method docstrings keep their first-call
  rules;
- reduce_scatter and all_gather point to the class docstring's call rules
  without listing what is in them again.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>

@johannes-graner johannes-graner 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.

Nice, thanks for the fixes!

…kreduce-sp-rs-ag

main renamed quick_allreduce_int4 to quick_allreduce (QuickAllReduceInt4 to
FlyQuickAllReduce, the kernel module to quick_allreduce_mesh) and moved
MAX_PAYLOAD_BYTES, SUPPORTED_BLOCKS and QUANT_MIN_PAYLOAD_BYTES to
allreduce_policy (#5555). Conflicts: the module docstring and the factory name
of quick_allreduce_mesh.py, and the import block, the class header and a
docstring of quick_allreduce.py. The single-phase modes keep their code; their
renamed references follow in the next commit.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
@eppaneamd
eppaneamd marked this pull request as ready for review November 12, 2026 10:22
@eppaneamd
eppaneamd requested review from a team and a balanced review from Copilot November 12, 2026 10:22

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.

🟡 Changes recommended

The capture guard checks the current device and stream rather than the engine’s effective targets, allowing cold calls on capturing streams to enter module loading and collective voting instead of being refused.

1 open issue
2 resolved since last review

Review effort: Balanced

which a CUDA graph capture cannot do, so it is refused there before any
vote; every rank must be outside a capture.
"""
if torch.cuda.is_current_stream_capturing():
eppaneamd added a commit that referenced this pull request Nov 12, 2026
…a timed sweep of the router, the engine and RCCL

The aiter-op-test standard asks an op test for checkAllclose and a run_perftest sweep with
a markdown summary, as the #7444 test does.

Both modes now also run checkAllclose against the exact fp32 result with the #7444 test's
tolerances and mismatch bound. NMSE and bit identity with the engine stay the strict
checks, as there.

After the checks, a sweep over the shapes of the two configurations (a @benchmark
function, run_perftest with CUDA events, a markdown table) times the router, the engine on
an input padded in the test (no padding copy, no copy of the result back to the unpadded
shape) and the exact collective (RCCL), and checks every output against the exact result.
Times are reported, not asserted. A world size whose factory returned None has no router
and is not timed. The engine and router setup is shared by the checks and the sweep.

The comm README's paragraph on the test mentions the sweep.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@TennyWang1223 TennyWang1223 added the ci:multi-gpu Trigger multi-GPU op tests on PR label Nov 13, 2026
@TennyWang1223

Copy link
Copy Markdown
Contributor

No correctness issues found. This can be approved once CI passes.

…kreduce-sp-rs-ag

Brings in #7804, which makes the attention A2A op reserve the MX Q-scale
slack that the mha_v4 query-tile gather requires. Without it,
op_tests/multigpu_tests/test_attention_a2a.py fails in the 8-GPU job. No
conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 14: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.

🔵 Needs a closer look

The capture guard checks the caller’s current device and stream rather than the engine’s actual launch context, allowing capture to go undetected and unsafe kernel loading and collective voting to proceed.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 16, 2026 16: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.

🔵 Needs a closer look

The capture check queries the current device instead of the engine’s device, allowing module loading and collective voting during an active capture or incorrectly rejecting an uncaptured preflight.

1 open issue

Review effort: Balanced

@zufayu zufayu 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.

AITER SOP code review on current head 1748d5d:

Verified blocker: the capture guard in quick_allreduce.py checks the caller's current device/current stream, not the engine device and the effective launch stream. If the engine is on another device, or RS/AG is given an explicit capturing stream, this path can still perform JIT/module loading and the cross-rank vote during capture, which can invalidate capture or hang ranks.

Primary reviewer: @TennyWang1223 (communication/all-reduce owner).

Author action: bind capture detection to self._device_index and the actual effective launch stream, add coverage for explicit-stream and cross-device cases, then rerun fresh multi-GPU CI. The current Aiter Gate is red; the new target passed but the overall multi-GPU job timed out, so both code and CI gates remain open.

@TennyWang1223 TennyWang1223 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.

Blocked on:
(1) rebase onto main after #5670 (mesh kernel/host refactor — please re-port the SP path and re-validate TP2/4/8);
(2) the open capture-guard thread (check capture on self._device_index + effective stream, with tests);
(3) the new test takes ~22 min in the 8-GPU job (TP8 ≈17 min) and pushes it past the 120-min timeout — please trim the default CI run. hgemm / capture_registration failures are unrelated.

eppaneamd added a commit that referenced this pull request Nov 18, 2026
Note that the 8 MiB floor is the only floor for the single-phase modes,
since the engine's min_bytes does not apply to them, and that a gate of
about 1 MiB lost about half a GSM8K point in #7444.

Signed-off-by: Rony Leppänen <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
amd-pedghazi added a commit to amd-pedghazi/sglang that referenced this pull request Nov 25, 2026
…l prefill

The INT4 reduce-scatter of ROCm/aiter#7444 (open) is not in any AITER release yet. These are its files at 3c77ea12e, verbatim except for the package-relative import lines (see `MANIFEST.tsv`), as served in the tested image. Remove this commit when SGLang's AITER pin carries sgl-project#7444.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
amd-pedghazi added a commit to amd-pedghazi/sglang that referenced this pull request Nov 25, 2026
Under pure TP each rank repeats the per-token work of a DeepSeek-V4.1 layer for all prefill rows. On gfx950 this work runs in the Mega-mHC seams, the HIP radix backend's projections and the MXFP8 MoE-input quant, which sgl-project#47888 (gfx942) does not cover. With `SGLANG_DSV4_TOKEN_PARALLEL_PREFILL=1` (and `SGLANG_DSV4_TOKEN_PARALLEL_DSPARK=1` under DSpark capture) eager extend chunks keep 1/tp of the rows per rank in layers before the bounded-replay tail.

- New `deepseek_common/amd/deepseek_v4_token_parallel.py`: row layout, exact gathers, INT4 reduce-scatter (ROCm/aiter#7444), eligibility checks
- Hooks in `deepseek_v4.py` and the AITER MoE runner (pre-quantized MXFP8 input)
- CPU test of the layout and the collectives on 4 gloo ranks

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:multi-gpu Trigger multi-GPU op tests on PR FlyDSL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants