Repository navigation
Conversation
…by payload size
The single-phase reduce-scatter and all-gather of `FlyQuickAllReduce` need the
full tensor to be a whole number of 32 KiB tiles, an aligned contiguous input
and zero padding rows. A sequence-parallel caller that also has an exact
collective (an IPC kernel, RCCL) should not own those rules or the payload
policy: it asks, and where AITER does not serve the call it continues with its
own collective.
- `aiter/dist/device_communicators/sp_collectives.py`:
`SequenceParallelCollectives(quick, window)` with `reduce_scatter(inp)` and
`all_gather(inp)`. Each returns the result for a bf16 2-D input whose full
tensor (the reduce-scatter input, the all-gather output) is inside the window
(reduce-scatter also needs `T` divisible by the group size) and whose padded
tensor is under the 4 GiB limit of the kernels, and None otherwise: the
caller's exact path. The router pads each rank's block with zero rows to a
whole number of tiles, copies a misaligned or non-contiguous input, and
returns the unpadded result; the padding does not count towards the window,
so a block of a few rows is never served because its padding fills whole
tiles. Whether a call is served depends on shape, dtype, window and platform
only, so every rank decides alike. `create_sp_collectives(quick)` is a
collective: the ranks compare their windows, then it builds the router, or
returns None on every rank when FlyDSL is unavailable, a rank has no window,
the windows differ or `compile_sp` fails.
- `allreduce_policy.py`: `SP_INT4_WINDOWS` and `sp_int4_window`, one `Window`
per `(arch, link, world_size)`. The only row is gfx950 / xGMI / TP2 from
8 MiB of full tensor, the lower bound checked end to end. There is no
environment override.
- Tests: `tests/test_sp_collectives.py` (58 CPU cases against a stand-in
engine: hand-derived padding units and window boundaries, zero padding rows,
alignment copy, the 4 GiB cap on the padded bytes, the factory's vote and
failure paths, the window ignoring `AITER_FLY_AR_MESH_{MIN,MAX}_BYTES`) and
`op_tests/multigpu_tests/test_flydsl_sp_collectives.py` (TP2 through the
factory, which must return a router exactly on gfx950 / xGMI / TP2 and None
elsewhere; TP4 over an engine with a window that admits every size. Accuracy
against the exact result, bit identity with the engine on a test-padded input
and zero padding rows at both; payloads below the window, including a block
whose padding fills whole tiles, and graph replay at TP2).
- `kernels/comm/README.md` describes the router.
No change to `FlyQuickAllReduce`, `communicator_cuda.py` or the all-reduce
policy rows.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Rony Leppänen <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The availability vote can fail when a rank lacks a compatible FlyDSL installation because deserializing a peer’s Window retries the optional import, while the TP4 test setup and required correctness and performance coverage also need fixes.
2 open issues
What changed in this PR
Adds a sequence-parallel router over #7444’s INT4 reduce-scatter and all-gather kernels, allowing callers to retain exact collectives outside the supported payload window.
Changes:
- Adds collective initialization, payload routing, alignment copies, and per-rank padding and unpadding.
- Enables gfx950/xGMI/TP2 payloads from 8 MiB through a centralized policy table.
- Adds CPU routing tests, multi-GPU correctness and graph-replay tests, and router documentation.
| File | Description |
|---|---|
tests/test_sp_collectives.py |
Tests routing boundaries, padding, alignment, and factory failure paths. |
op_tests/multigpu_tests/test_flydsl_sp_collectives.py |
Checks TP2/TP4 correctness, engine equivalence, and graph replay. |
aiter/ops/flydsl/kernels/comm/README.md |
Documents router behavior, policy, and tests. |
aiter/ops/flydsl/allreduce_policy.py |
Defines the sequence-parallel INT4 payload window. |
aiter/dist/device_communicators/sp_collectives.py |
Implements collective setup, routing, and tensor preparation. |
Review effort: Balanced
…gines on the uncached inbox create_sp_collectives gathered each rank's Window with all_gather_object. A peer unpickles it, which imports aiter.ops.flydsl, and that import raises on a rank whose flydsl is missing or older than 0.5.0: the rank raised from the vote while its peers returned None. The vote is now (min, max) or None. On a package with the real router, policy and flydsl import guard and two CPU ranks, one without flydsl, that rank raised ModuleNotFoundError from all_gather_object before and returns None now. The new test fails on the previous code: the vote must not name an aiter class. The multi-GPU test built its engines with inbox_memory="auto", which is the fine-grained inbox at TP4 and TP8 on a host whose GPUs are linked by PCIe, and _sp_engine() refuses that. The engines are now built on the uncached inbox, which auto resolves to on xGMI and at TP2. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
On the review summary's point that the availability vote can fail on a rank without a compatible FlyDSL: valid, and it reproduces. |
…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]>
johannes-graner
left a comment
There was a problem hiding this comment.
Reviewed at head 0a0abe41.
The router shape looks right to me: it returns None and the consumer keeps its exact path, and the size policy lives in aiter as the vLLM review asked. Locally, the CPU suite passes (60 tests at 0a0abe41). The TP2 op test passed on gfx950 with xGMI at 98a6d468, and I measured router overhead with a TP2 timing probe at the same head. I have not run the GPU tests at 0a0abe41. Below are the items I would like to see addressed before merge:
- Factory vote can diverge across ranks
- Padding copies the whole tensor
- SP_INT4_WINDOWS key validation
- Import of
TILE_BYTESbreaks silently after rebase - GPU test gives no per-case values
Design questions
- The all-reduce FlyDSL path is gated by
AITER_FLY_AR=1, the INT4 regime, and per-window byte overrides. The router reads none of these, so the only off switch is the consumer's: in vllm#65628, dropping the INT4 env also drops the INT4 all-reduces. Is a consumer-only gate the intent? Would a disable-only variable in aiter, voted through the factory with the rest of the plan, fit, so an operator can turn the pair off without a vLLM change? - vllm#65628 adds
QuickAllReduce.sp_collectives()over its own engine, while aiter'sQuickAllReducealready holds the same mesh engine and runs the plan vote at init. Is an aiter-side accessor planned, so the dist path and vLLM share one gate and one build point? Until then, could the README nameaiter.dist.device_communicators.sp_collectives.create_sp_collectivesas the supported entry point? A consumer that turns anImportErrorinto "no router" would otherwise lose the feature silently after a rename. - The policy comment says 8 MiB is where accuracy was signed off, and that the crossover below it was not swept. The new sweep covers 1640x2560 (just above 8 MiB), 3302x2568 and 4096x2560 at TP2. In those rows the router is 1.8 to 2.9 times faster than RCCL. There is no point below 8 MiB, no graph replay and no IPC baseline. Could you add RS-only and AG-only timings below 8 MiB, with graph replay, against the exact path vLLM falls back to? RS and AG share one threshold, and once vllm#67010 lands the exact reduce-scatter becomes aiter's IPC kernel. I would like to know whether 8 MiB is at, above or below the crossover for each. If it is above, a note in the policy comment naming the baseline would help the next retune.
Lower importance
- FlyDSL availability (nit, lower importance): the comment at line 40 names the wrong cases. FlyDSL is required on Linux and optional only on Windows and Triton-only installs. The version-check
ImportErroris caught by the guard at line 48, so the decline is silent. Ask for that failure to be logged, as in item 1. - Floor comment (nit, lower importance): a sentence beside
SP_INT4_WINDOWSon why the SP floor (8 MiB) differs from the all-reduce mesh floor (512 KiB) would help. The SP floor is where the end-to-end accuracy check was signed off (the 1 MiB gate lost accuracy in #7444), and the engine'smin_bytesdoes not apply to the single-phase modes, so this window is their only floor. - Wording (nit, lower importance): "another dtype or rank" in the
reduce_scatterandall_gatherdocstrings and in the README reads as process rank. "not a 2-D tensor" avoids that. The GPU test docstring refers to "the 7444 test's bound" (line 18) and "the 7444 test's tolerances" (line 31); namingNMSE_MAXfromtest_flydsl_quick_reduce_scatter_all_gather.pysurvives the merge. - CI runtime (nit, lower importance): the sweep adds six spawn pools to a file that the multi-GPU CI job runs in full. Gating the sweep behind a flag, or adding the file to the skip list, would keep the job's runtime unchanged.
- Pool timeout (nit, lower importance): a regression that makes ranks disagree would wait the default 3600 s. A
timeout=of a few minutes in_run_poolwould keep a hang cheap in multi-GPU CI. - Redundant CPU cases (nit, lower importance):
test_tile_is_32_kibis implied by the hand-derivedblock_row_unitvalues. Intest_reduce_scatter_window, the 1000-row, 16384-row and 2040-row cases repeat a neighbour on the same side of the bound. Dropping them keeps every distinct rule covered.
| if padded == rows: | ||
| src = _aligned(inp) | ||
| else: | ||
| src = inp.new_zeros((w, padded, hidden)) |
There was a problem hiding this comment.
Item 2: padding copies the whole tensor (category: performance) Performance note: measured on TP2, gfx950 with xGMI, H=2560, eager, single runs, reduce-scatter latency in µs, router against the engine on a pre-padded input: T=1640 (832 rows per rank after padding) 44.3 vs 31.7 (RCCL 108.3); T=8190 152.6 vs 120.8; T=16382 280.9 vs 231.9; aligned T=8192 122.9 vs 120.9. All-gather is similar at T=1640 (44.5 vs 31.4). Padded shapes cost +12.6 to +54.1 µs (21–43 % of engine time). Aligned shapes cost at most 4.3 µs. Your sweep shows the same direction: the PR text gives +19 to +67 % for padded shapes and +3 to +9 % for aligned ones. The overhead grows with tensor size rather than with padding rows: one padding row at T=8190 costs +31.8 µs (inferred from these rows, consistent with the full-buffer zero fill and copy-in, plus the unpad copy-out for all-gather). Could the router zero only the padding rows, copying the real rows into a new_empty buffer? The copy itself may be part of the cost (inferred, not measured separately). The window counts unpadded bytes, so padding can move more bytes than the window priced. At the H=2560 floor the moved/sent ratio is about 1.015 (computed from block_row_unit); at H=2880 it is 1.053 with a 128-row unit, and at H=2561 it is 10x at the floor. A ratio guard such as moved <= 2 * sent in _padded_rows would keep the window close to what was measured, without affecting the real models.
Contiguity question: does vLLM ever pass a non-contiguous or misaligned input? _aligned (62-66) clones in that case, but only on the no-padding path, since the padded path copies anyway. If vLLM never does, the clone is a cold path and a fallback is enough. Torch allocations are 512 B aligned, so only sliced views would reach the clone, and each would pay one full-tensor copy.
There was a problem hiding this comment.
Still open as far as I can see: new_zeros at lines 115 and 136 zero-fills and copies the whole tensor, and _padded_rows has no limit on how much padding a shape can carry. Could the router copy only the tail rows (allocate with new_empty and zero just the padding rows), or bound the ratio (for example moved <= 2 * sent) and fall back to the standard path past it?
| # gfx950 / xGMI / TP2 [8 MiB, inf) -- the lower bound the INT4 path was | ||
| # checked against end to end (GSM8K) on MI355X TP2. Below it the INT4 | ||
| # crossover has not been swept and the accuracy has not been signed off. | ||
| SP_INT4_WINDOWS: dict[tuple[str, str, int], Window] = { |
There was a problem hiding this comment.
Item 3: SP_INT4_WINDOWS key validation (category: correctness) FamilyPolicy.__post_init__ checks arch, link and world size. SP_INT4_WINDOWS is a plain dict, and sp_int4_window returns any key it holds, so a row for PCIe TP4 or an unsupported arch is accepted. The only symptom would be a logged warning when compile_sp fails on the node. Could the dict get the same checks (arch in SUPPORTED_ARCHS, link in LINKS, world size in SUPPORTED_WORLDS), plus a test that each key has a MESH_ST_LADDER rung with super_tile=1 that resolves an uncached inbox? A later row for an unserved platform would then fail in CI.
There was a problem hiding this comment.
SP_INT4_WINDOWS is still a bare dict. Could its keys be validated at import time, with the same arch, link and world-size checks that FamilyPolicy.__post_init__ applies, so a typo fails loudly instead of silently disabling INT4?
| MAX_PAYLOAD_BYTES, | ||
| PAYLOAD_ALIGN_BYTES, | ||
| ) | ||
| from aiter.ops.flydsl.kernels.comm.allreduce_shared import TILE_BYTES |
There was a problem hiding this comment.
Item 4: import of TILE_BYTES breaks silently after rebase (category: correctness, medium) TILE_BYTES is imported from aiter.ops.flydsl.kernels.comm.allreduce_shared. #5670, merged to main on 2026-11-17, renamed that module to transport.py, where TILE_BYTES now lives. This head predates the rename, so the import works here. Once the base is rebased onto main, the import raises ImportError. The guard at 48-49 swallows it, fly_policy becomes None, and the router is off on every rank with no log. This is inferred from the code and main's tree, not run. Could the router take the tile size from the engine (_sp_engine().tile_bytes, which the GPU test already compares), and could the guard log the failure?
There was a problem hiding this comment.
The logging change helps, but line 50 still imports TILE_BYTES from allreduce_shared, which main no longer has after #5670 (TILE_BYTES is in transport.py now). After a rebase the import fails, the router is off on every rank, and the log says "FlyDSL cannot be imported" although FlyDSL is fine. Could you fix the import in the rebase, and log which import actually failed?
| fails += _failures(ranks, tp=tp, factory=factory) | ||
| if not ranks[0]["factory_none"]: | ||
| served.append(tp) | ||
| print( |
There was a problem hiding this comment.
Item 5: GPU test gives no per-case values (category: tests, low importance) The asserted checkAllclose and the timed sweep are in place. The sweep runs run_perftest for the router, the engine on a test-padded input, and RCCL, and logs a markdown table. The success path still prints only the shape count and "all checks passed" (lines 492-495, 508), so a CI log has no NMSE or engine-equal result per case. The table has us, TFLOPS, TB/s and err columns and no NMSE, padded-row, engine-equal or served column. A per-case row with those values would show what each case checked. The sweep is eager with an event sync per iteration and has no graph replay (see design question 3).
There was a problem hiding this comment.
Fixed in 80fc2c5: main() now prints one line per checked shape and mode (rs/ag) before the shape count. Each line shows served, the worst NMSE and checkAllclose err across ranks, engine_equal, input_unchanged and, for all-gather, ranks_equal; the padded-row check has no separate value because the NMSE and engine_equal results cover it.
| # and ``max`` exclusive, as above. A missing row disables them. There is no | ||
| # environment override. | ||
| # | ||
| # gfx950 / xGMI / TP2 [8 MiB, inf) -- the lower bound the INT4 path was |
There was a problem hiding this comment.
Nit: floor comment (nit, lower importance) A sentence beside SP_INT4_WINDOWS on why the SP floor (8 MiB) differs from the all-reduce mesh floor (512 KiB) would help. The SP floor is where the end-to-end accuracy check was signed off (the 1 MiB gate lost accuracy in #7444), and the engine's min_bytes does not apply to the single-phase modes, so this window is their only floor.
| """The block of the element-wise sum over ranks that this rank owns, | ||
| ``[T / world_size, H]``, from this rank's bf16 ``[T, H]`` partial; the | ||
| rows ``[rank * T/W, (rank + 1) * T/W)`` of the sum. ``None`` when not | ||
| served: another dtype or rank, ``T`` not divisible by the group size, |
There was a problem hiding this comment.
Nit: wording (nit, lower importance) "another dtype or rank" reads as process rank in a collective module. "not a 2-D tensor" avoids that. The same phrase appears in all_gather (line 118) and in the README (line 86). The GPU test docstring refers to "the 7444 test's bound" (line 18) and "the 7444 test's tolerances" (line 31); naming NMSE_MAX from test_flydsl_quick_reduce_scatter_all_gather.py survives the merge.
There was a problem hiding this comment.
Fixed in a125042: "another dtype or rank" now reads "another dtype, not a 2-D tensor" in the reduce_scatter and all_gather docstrings, and the README says "for a tensor that is not a 2-D tensor". The GPU test docstring no longer says "the 7444 test". It names NMSE_MAX, the checkAllclose tolerances and the CLOSE_ERR_RATIO mismatch bound of test_flydsl_quick_reduce_scatter_all_gather.py.
|
|
||
| @benchmark() | ||
| def test_sp_router(tokens, hidden, tp): | ||
| ranks = _run_pool(tp, _bench_rank, tokens=tokens, hidden=hidden, factory=tp == 2) |
There was a problem hiding this comment.
Nit: CI runtime (nit, lower importance) The sweep adds six spawn pools (_bench_rank), each of which rebuilds a FlyQuickAllReduce. .github/scripts/aiter_test.sh runs every op_tests/multigpu_tests/*.py under timeout 60m (glob at line 25, run at line 98), and this file is not on its skip list (lines 42-58). I have not timed this file in CI. Could the sweep be gated behind a flag, or the file added to the skip list?
There was a problem hiding this comment.
Not changed: aiter's op-test standard (.claude/skills/aiter-op-test/SKILL.md, rules 6 and 8) makes the timed sweep and its summary table part of every op test and rules out behaviour-toggle flags, and the skip list would drop the checks from CI as well. The file has not been timed in CI.
| served = [] # the world sizes with a router here, which the sweep times | ||
| for tp in tps: | ||
| factory = tp == 2 | ||
| ranks = _run_pool(tp, _run_rank, factory=factory) |
There was a problem hiding this comment.
Nit: pool timeout (nit, lower importance) If a regression makes the ranks disagree, _run_pool(tp, _run_rank, ...) waits the default 3600 s. The sweep pools at line 448 have no timeout= either. A timeout= of a few minutes would keep a hang cheap in multi-GPU CI.
There was a problem hiding this comment.
Fixed in 33f046a: both _run_pool calls in main() and test_sp_router now pass timeout=_POOL_TIMEOUT_S (600 s).
| (1634, 2560, False), # its padded payload, 8,519,680 B, is above 8 MiB | ||
| (1633, 2560, False), # odd: no equal blocks | ||
| (16385, 2560, False), # odd, and its floor would be inside the window | ||
| (1000, 2560, False), |
There was a problem hiding this comment.
Nit: redundant CPU cases (nit, lower importance) The 1000-row case (170) repeats a neighbour on the same side of the bound, as do the 16384-row (171) and 2040-row (174) cases in test_reduce_scatter_window. test_tile_is_32_kib (120) is implied by the hand-derived block_row_unit values. Dropping these keeps every distinct rule covered.
There was a problem hiding this comment.
Fixed in 8bcf952: removed the 1000-row case and the 16384-row and 2040-row cases from test_reduce_scatter_window, and removed test_tile_is_32_kib. Each removed case sat on the same side of the bound as a case that stays, and the tile size is already fixed by the block_row_unit values.
WAITING ON AUTHORPR Self-ReviewRevision 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
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
The success path printed only the shape count. Print one line per shape and mode with served, worst NMSE and checkAllclose err over the ranks, engine equality, input unchanged and, for all-gather, equality across ranks. Signed-off-by: Rony Leppänen <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The import guard swallowed every exception, so an old or missing FlyDSL turned the router off silently. Keep the exception and log it as a warning in create_sp_collectives. Correct the comment: FlyDSL is required on Linux, optional on Windows and Triton-only installs. Signed-off-by: Rony Leppänen <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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]>
"Rank" read as process rank in a collective module, so the docstrings and the README now say "not a 2-D tensor". The GPU test docstring names NMSE_MAX, the checkAllclose tolerances and CLOSE_ERR_RATIO of test_flydsl_quick_reduce_scatter_all_gather.py instead of "the 7444 test", which will mean nothing after the merge. Signed-off-by: Rony Leppänen <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Ranks that disagree leave their peers polling, and _run_pool then waits its default 3600 s. Pass a 600 s timeout from the main sweep and the benchmark pools. Signed-off-by: Rony Leppänen <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Remove window cases that repeat a neighbour on the same side of the bound (1000, 16384 and 2040 rows) and test_tile_is_32_kib, which the block_row_unit values already imply. Signed-off-by: Rony Leppänen <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
detect_arch, the window lookup and the probe tensors now run in one try
before the vote. The vote is {"min", "max"} of the window, or a string
naming why this rank declines (FlyDSL import failure, no window, setup
failure), logged once on that rank. Disagreements are logged by the
helper. The tests stub get_world_size and use string/dict peer votes.
Signed-off-by: Rony Leppänen <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The vote goes through all_ranks_agree_on_plan, so sp_collectives no longer calls torch.distributed itself (ruff F401). The tests' peers fixture now patches it through flydsl_utils, which makes the calls. Signed-off-by: Rony Leppänen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
johannes-graner
left a comment
There was a problem hiding this comment.
Thanks for the fixes. I checked the vote fix and the six nit fixes against the code, and they hold. I also ran the multi-GPU test at 182148d2 on gfx950 (FlyDSL 0.5.3): TP2 and TP4 pass, and every case is served by INT4 with err 0 and NMSE about 6.5e-3. That matters because your earlier runs predate the vote and logging commits. The CPU suite passes (56 tests).
On the sweep flag: agreed, the op-test convention forbids behaviour-toggle flags, so I withdraw that nit.
Test gap: no CPU test pins the vote fix. Narrowing except Exception so that a setup error escapes before the vote (the original hang) still leaves all 56 tests passing, and so does removing the decline logging. Could you add CPU cases where detect_arch, the tensor allocation or quick.link raises, asserting exactly one vote and a logged reason?
Question on the vote: after it, the code relies on "compile_sp raises on every rank when any rank cannot run the kernels". What guarantees that? If one rank can fail locally while the others enter a collective, they hang. Does compile_sp end in a collective that every rank reaches, for example?
The PR description is stale: it says 60 CPU tests (56 now), describes the old (min, max) vote, still has the "dtype or rank" wording, and still lists two Limits bullets that these commits fixed (the silent import-guard decline and the allocation failure between votes).
Minor, all optional:
- The 600 s pool timeout includes the first JIT build, so a cold CI cache could fail it spuriously.
_case_linesraisesIndexErrorif ranks disagree on the row count, which would mask the real failure.- The
peersfixture hardcodes world size 2, including for the TP4 and TP8 window cases.
Three design questions from the first review are still unanswered: an aiter-side off switch beyond the consumer gate, the entry point (QuickAllReduce.sp_collectives()), and the INT4 window against the crossover below 8 MiB (graph replay, IPC baseline). Are they deferred to follow-ups? That is fine, I would just like it on record.
Reviewed at head 182148d2.
|
|
||
| import torch | ||
|
|
||
| from aiter.dist.device_communicators.flydsl_utils import all_ranks_agree_on_plan |
There was a problem hiding this comment.
all_ranks_agree_on_plan is imported from flydsl_utils outside the guard. #5670 deleted flydsl_utils.py from main, and the function is in flydsl_backends.py now. After the rebase this line raises when the module is imported, instead of the router declining, so the CPU tests fail at collection and a consumer that feature-detects with ImportError loses the router. Could you fix it in the same rebase as the TILE_BYTES import?

Summary
Stacked on #7444 (base branch
eppaneamd/flydsl-quickreduce-sp-rs-ag, so the diff shows only the router's own changes, not #7444's).A sequence-parallel layer reduce-scatters a bf16
[T, H]activation over a tensor-parallel group and all-gathers it back. Its caller already has an exact collective for both (an IPC kernel, RCCL).This PR adds
SequenceParallelCollectives. Inside a size window for the platform it runs #7444's INT4 single-phase kernels. Outside it, it returnsNone, meaning "not served here, continue with the exact collective".Why in AITER: the review of vllm-project/vllm#65628 asked for routing to the best kernel configuration in AITER instead of new arguments in vLLM. That PR is being reworked to ask this router and to carry no flag or environment variable of its own for it.
What changes
aiter/dist/device_communicators/sp_collectives.py(new)create_sp_collectives(quick)takes theFlyQuickAllReducethe caller already has. It is a collective: every rank calls it, outside graph capture.(min, max)orNone, so a rank without FlyDSL never unpickles aWindow), then compile the single-phase kernels withcompile_sp.Noneon every rank if FlyDSL is unavailable, a rank has no window for its platform, the windows differ, or the kernels cannot run.reduce_scatter(inp)andall_gather(inp)return a tensor, orNonefor another dtype or rank,Tnot divisible by the group size (reduce-scatter), a payload outside the window, or a padded tensor of 4 GiB or more.aiter/ops/flydsl/allreduce_policy.py:SP_INT4_WINDOWS, keyed(arch, link, world_size), next to the other tuned decisions. One row: gfx950, xGMI, TP2, from 8 MiB. No row means no INT4 there. There is no environment override.aiter/ops/flydsl/kernels/comm/README.md: documents the router.FlyQuickAllReduce, the all-reduce policy rows, andcommunicator_cuda.py(a rung there would apply INT4 to everyaiter.distgroup and caller).How a call is decided:
Tests
tests/test_sp_collectives.py(CPU, 60 cases against a stand-in engine)op_tests/multigpu_tests/test_flydsl_sp_collectives.py(GPU)Noneelsewhere. Also payloads below the window and CUDA graph replay.autois the fine-grained inbox at TP4 and TP8 over PCIe).checkAllclosewith the [FlyDSL] FlyQuickAllReduce: reduce-scatter and all-gather modes for sequence parallelism #7444 test's tolerances and mismatch bound), bit identity with the engine on a test-padded input, and zero padding rows. A world size named with--tpthat cannot run is an error, not a skip.@benchmarksweep (run_perftestwith CUDA events, a markdown summary) times the router, the engine on a test-padded input and RCCL, for both modes on every shape, and checks each output withcheckAllclose. Times are reported, not asserted. Numbers below.sp_collectives.py, 2 ofallreduce_policy.py), each failing a CPU test that names its decision.sp_collectives.py, by decision:<for<=, absent row compiling, the factory returningNonewhere the table has a row;allreduce_policy.py: the window read fromAITER_FLY_AR_MESH_MIN_BYTES, the table row removed.98a6d468d, not rerun on the follow-up). Three (wrong rows, padding before the rows, result not unpadded) were run against the GPU test with thecheckAllclosechecks: each fails, with thecheckAllclosemessage among its failures (NMSE and the engine comparison fail on the same shapes).Timed sweep (microseconds per call; MI355X gfx950, FlyDSL 0.5.0, one run, other jobs were leased on the node; "engine" is the engine on an input padded in the test, so it has neither the router's padding copy nor the copy of its result back to the unpadded shape; RS reduce-scatter, AG all-gather):
checkAllclosemismatch fraction is 0 except one: in the TP4 4096 x 2560 reduce-scatter, the router and the engine each have 3.8e-7, which is one element of the 2,621,440 per rank. The bound is 0.5.Used in a served model
With this router and the vllm-project/vllm#65628 rework (Qwen3.8-Flash-Next-Quark-MXFP4, TP2,
--enable-hc-sp,VLLM_ROCM_QUICK_REDUCE_QUANTIZATION=INT4; two arms that differ only by this router):bd54a9deeover an earlier head of [FlyDSL] FlyQuickAllReduce: reduce-scatter and all-gather modes for sequence parallelism #7444. The final commit has the same router code, docstrings, import lines and a policy comment aside (TILE_BYTESis 32,768 in both; the op test compares it with the engine's tile).Limits
(arch, link, world_size), not by hidden size.except Exception, as inquick_all_reduce.py) turns the router off without a log line for any import problem, not only a missing FlyDSL.compile_sp's vote until the process group times out.branches: [main], so this stacked PR gets no CI until it is retargeted to main after [FlyDSL] FlyQuickAllReduce: reduce-scatter and all-gather modes for sequence parallelism #7444 merges. The evidence above comes from our own CPU and GPU runs.🤖 Generated with Claude Code