Skip to content

[FlyDSL] QuickAllReduce INT4: faster poll and codec, kernel-arg peers, gfx950 engine plans - #7093

Merged
TennyWang1223 merged 3 commits into
ROCm:mainfrom
a-sidorova:asidorov/flydsl_quick_reduce_opt
Nov 27, 2026
Merged

TennyWang1223 merged 3 commits into
ROCm:mainfrom
a-sidorova:asidorov/flydsl_quick_reduce_opt

Conversation

@a-sidorova

@a-sidorova a-sidorova commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Lower the latency of the FlyDSL quick all-reduce (FlyQuickAllReduce / QuickAllReduceInt4, mesh schedule) on gfx950, mostly at decode sizes. The kernel changes keep the output bitwise equal to main. The changes come in two commits.

1. Kernel: rounding, peers, colours (mesh and ring, all codecs, all archs; also speeds up FlyQuickAllReduceRMSNorm):

  • Magic-number rounding. The quantizer rounds with the fp16 magic number w + (1024 + bias), masked to the code width, instead of roundeven + cvt_i16 + bias:

    codec magic mask
    INT4 1032 0x000F000F
    INT5 1040 0x001F001F
    INT6 1056 0x003F003F

    After the clamp, w + 1024 + bias lies in [1024, 2048). There the fp16 ulp is 1, and 1024 + bias is even, so the add rounds half to even exactly like roundeven. It leaves roundeven(w) + bias in the low mantissa bits. The result is bit-identical over the whole input domain (see the new op test below), with no v_rndne_f16 / v_cvt_i16_f16 left in the kernel.

  • Peers as kernel arguments. The mesh and ring kernels take the inbox bases as kernel arguments (peer0..peer7) instead of loading the device-side peer table. The bases reach the wave in SGPRs, so the prologue no longer starts with the uncached table load that every inbox address depends on. The mesh's own inbox is a trace-time pick (peers[self_rank]).

  • Colours in device memory. The per-block colours (epochs) of mesh and ring engines live in an ordinary device tensor instead of the uncached metadata block. Only the owning rank's kernel reads or writes them. Within a launch, block bid reads its slot once at the start and writes it once at the end. Across launches, the kernel-boundary release/acquire orders them. The tensor is allocated eagerly at engine construction, never lazily, so a first call inside graph capture cannot capture the fill. A device synchronize follows the allocation, so a launch on any stream sees the initialized epochs. The one-shot keeps its uncached block.

2. Policy: block-64 mesh rung below 2 MiB on gfx950 xGMI. In MESH_ST_LADDER, each of TP2/TP4/TP8 gets a block=64 (4 KiB tile) ST=1 rung below 2 MiB. Below 2 MiB, block 64 spreads a payload over 4× the workgroups of block 256, each with a quarter of the tile. From 2 MiB on, the existing rungs are unchanged:

TP below 2 MiB (new) from 2 MiB (unchanged)
2 b64 ST1 cap512 b256 ST1 cap512
4 b64 ST1 cap1024 b256 ST1 cap1024
8 b64 ST1 cap512 b256 ST8 cap384

The rung comes from a sweep of block ∈ {64, 128, 256, 512} × super_tile ∈ {1, 8} × grid_cap ∈ {256, 512, 1024} at TP2/4/8:

  • Below 2 MiB: block 64 wins at every TP.
  • From 4 MiB on: no configuration beats the existing rungs by more than noise.

The rung changes which rank owns which chunk, so outputs below 2 MiB are statistically equivalent to block 256, not bit-identical (SQNR checks below). The fused ladders are untouched. Production dispatch sends payloads to the mesh from 512 KiB (TP2) or 384 KiB (TP4/8) (quantized_floor), so there the rung serves 384 KiB–2 MiB. QuickAllReduceInt4 (min_bytes=0) uses it for every payload below 2 MiB.

Not changed: the flag poll (transport._load_flag, system-scope sc0 sc1, no fence in the spin) and the inbox load policy (sc0 sc1 on the uncached inbox) stay as they are on main.

Test Result

MI355X (gfx950, 256 CUs, 8 GPUs, xGMI), ROCm 10.2, torch 2.15, FlyDSL 0.5.0, bf16. main is ce334d015.

Method:

  • Each point is a CUDA graph of 10 back-to-back calls, replayed 7 times under torch.profiler, each replay behind an NCCL barrier.
  • The time is the device time of the quick all-reduce kernel: per-rank median, then max over ranks, then the mean of two full runs.
  • main and the PR run in separate processes, alternating order, with the GPUs checked idle before every step.
  • Run-to-run spread is 0.3% median, 3.7% max.
  • Sweep: hidden 4096 × tokens 1…65536 (powers of 2) × TP {2, 4, 8}.

Plain all-reduce (QuickAllReduceInt4, mesh INT4), µs per call, main → PR (both commits)

tokens payload TP2 TP4 TP8
1 8 KiB 10.5 → 9.0 (−15%) 10.9 → 9.5 (−12%) 11.4 → 10.3 (−9%)
16 128 KiB 11.0 → 9.4 (−14%) 11.2 → 9.9 (−11%) 11.7 → 10.8 (−8%)
64 512 KiB 12.2 → 11.2 (−9%) 11.8 → 10.7 (−9%) 12.0 → 11.2 (−6%)
128 1 MiB 14.7 → 13.8 (−6%) 13.1 → 12.1 (−8%) 12.5 → 11.8 (−6%)
256 2 MiB 19.7 → 19.1 (−3%) 16.0 → 15.4 (−4%) 14.0 → 13.4 (−4%)
512 4 MiB 29.6 → 28.7 (−3%) 21.6 → 21.0 (−3%) 17.0 → 16.5 (−3%)
1024 8 MiB 51.5 → 50.8 (−1%) 33.2 → 32.6 (−2%) 23.5 → 23.0 (−2%)
2048 16 MiB 98.3 → 97.9 (0%) 59.0 → 58.6 (−1%) 43.1 → 37.9 (−12%)
4096 32 MiB 188.4 → 188.1 (0%) 107.6 → 107.1 (0%) 72.9 → 65.2 (−10%)
8192 64 MiB 369.6 → 369.6 (0%) 199.2 → 198.9 (0%) 134.0 → 120.1 (−10%)
16384 128 MiB 733.6 → 735.4 (0%) 388.1 → 387.8 (0%) 237.8 → 216.6 (−9%)
32768 256 MiB 1460.1 → 1463.8 (0%) 767.6 → 767.2 (0%) 459.3 → 414.8 (−10%)
65536 512 MiB 2907.8 → 2923.0 (+1%) 1526.1 → 1524.2 (0%) 877.8 → 797.8 (−9%)

Fused FlyQuickAllReduceRMSNorm (mesh), hidden 4096, µs per call, main → PR

Each cell is allreduce_rmsnorm / allreduce_rmsnorm_mxfp4.

tokens payload TP2 TP4 TP8
1 8 KiB 17.5 → 16.4 (−6%) / 19.7 → 18.3 (−7%) 12.3 → 11.9 (−3%) / 14.0 → 13.4 (−5%) 12.6 → 12.1 (−3%) / 13.9 → 13.4 (−3%)
128 1 MiB 21.2 → 19.9 (−6%) / 23.0 → 22.0 (−4%) 14.9 → 14.4 (−4%) / 16.3 → 15.8 (−3%) 14.0 → 13.4 (−4%) / 15.3 → 14.7 (−4%)
512 4 MiB 35.5 → 34.8 (−2%) / 37.4 → 36.7 (−2%) 23.8 → 23.3 (−2%) / 25.2 → 24.7 (−2%) 18.7 → 18.4 (−2%) / 20.2 → 19.7 (−2%)
1024 8 MiB 56.4 → 57.9 (+3%) / 59.2 → 58.3 (−1%) 36.5 → 35.8 (−2%) / 37.8 → 37.1 (−2%) 25.9 → 25.6 (−1%) / 27.5 → 26.9 (−2%)
2048 16 MiB 101.4 → 102.7 (+1%) / 103.5 → 104.1 (+1%) 63.5 → 63.0 (−1%) / 65.5 → 64.6 (−1%) 41.5 → 40.5 (−2%) / 43.0 → 42.3 (−2%)
4096 32 MiB 192.0 → 193.2 (+1%) / 195.9 → 194.3 (−1%) 110.3 → 109.8 (0%) / 114.1 → 112.9 (−1%) 73.0 → 71.7 (−2%) / 75.3 → 74.8 (−1%)
16384 128 MiB 749.5 → 746.5 (0%) / 759.8 → 765.2 (+1%) 396.9 → 393.8 (−1%) / 399.6 → 400.9 (0%) 242.1 → 235.3 (−3%) / 245.2 → 243.0 (−1%)
65536 512 MiB 2989.0 → 2957.8 (−1%) / 3011.6 → 3017.8 (0%) 1541.1 → 1531.7 (−1%) / 1543.5 → 1553.7 (+1%) 878.7 → 856.5 (−3%) / 871.8 → 864.7 (−1%)

Correctness

  • Bit-exact vs main (commit 1): every output, on every rank, compared by checksum on all 623 benchmark shapes (plain, allreduce_rmsnorm and allreduce_rmsnorm_mxfp4 outputs including the fp4 values and e8m0 scales).
  • Commit 2: all 129 plain shapes ≥ 2 MiB are bit-exact. The 122 shapes below 2 MiB run the new rung; they are not bit-identical, as designed, and their SQNR passes the verify.

How to run the tests

# New: quantizer rounding vs torch, every fp16 input x INT4/INT5/INT6 (single GPU)
python3 op_tests/test_flydsl_quick_allreduce_quant.py
#   e.g. a subset: python3 op_tests/test_flydsl_quick_allreduce_quant.py -c int4 -f all_fp16 -n 65536 -e 1.0

# Existing codec suite (single GPU, unchanged)
python3 -m pytest -q op_tests/flydsl_tests/test_flydsl_quick_allreduce_codec.py

# Multi-GPU verify: shipping ladders (incl. the new rung), mesh + ring, TP2/4/8, fused RMSNorm suites
python3 op_tests/multigpu_tests/test_flydsl_quick_allreduce.py
# Extended mesh coverage: block sweep on every rung, pinned fp16 transport, mesh INT5/INT6
python3 op_tests/multigpu_tests/test_flydsl_quick_allreduce.py --extended -a mesh

Results on MI355X:

test result
op_tests/test_flydsl_quick_allreduce_quant.py (24 rows: int4/int5/int6 × all-fp16/randn × 64 Ki/16 Mi elements × 2 encode factors) pass, err = 0 for both candidates in every row
op_tests/flydsl_tests/test_flydsl_quick_allreduce_codec.py 165 passed
op_tests/multigpu_tests/test_flydsl_quick_allreduce.py pass (exit 0)
op_tests/multigpu_tests/test_flydsl_quick_allreduce.py --extended -a mesh pass (exit 0, 23 tables). Run on commit 1; commit 2 is policy-only and is covered by the default verify.

PR Self-Review

Reviewed revision

02d5c1b

Behavior and intent

Commit 1 (kernel) changes no outputs, only how the quick all-reduce computes them. Three costs on main are avoidable:

  • The quantizer rounds with roundeven + cvt_i16 (64 v_rndne_f16 + 64 v_cvt_i16_f16 per mesh kernel).
  • Every mesh/ring kernel starts with an uncached load of the peer-pointer table, and every inbox address depends on it.
  • The per-block colours sit in uncached memory although only the owning GPU touches them.

The commit replaces the rounding with an exact fp16 magic-number add, passes the peer bases as kernel arguments, and moves the colours to ordinary device memory. Output is bitwise equal to main.

Commit 2 (policy) changes which geometry the gfx950/xGMI mesh uses below 2 MiB. main runs block 256 there, which gives a decode-size payload few workgroups; block 64 is 3–12% faster (sweep in the description above).

This does change rounding below 2 MiB. block decides which rank's share skips one quantization, so individual elements can round differently. SQNR is unchanged (+-0.03 dB on the verify shapes), ranks still agree bit for bit, and results are deterministic. main already has the same property where its ladders switch block: gfx942/xGMI and gfx950/PCIe 256 -> 512, and fused block = hidden / 8.

Validation and unverified scope

Validated on 8× MI355X (gfx950, xGMI), ROCm 10.2, torch 2.15, FlyDSL 0.5.0, against main ce334d015:

command result
python3 op_tests/test_flydsl_quick_allreduce_quant.py 24/24 rows err = 0. Fails with an off-by-one magic constant (99.99% of codes differ).
python3 -m pytest -q op_tests/flydsl_tests/test_flydsl_quick_allreduce_codec.py 165 passed
python3 op_tests/multigpu_tests/test_flydsl_quick_allreduce.py pass
python3 op_tests/multigpu_tests/test_flydsl_quick_allreduce.py --extended -a mesh pass (23 tables)
  • Accuracy cells: every accuracy cell of the multi-GPU verify (sqnr_db, min_tile_sqnr_db, lanes_differing) is identical to main for commit 1. That is 162 cells in the default run and 419 in --extended -a mesh, including INT5/INT6.
  • Bit-exactness: commit 1 matched main by checksum of every output on every rank, on 623 shapes. Those cover the plain, allreduce_rmsnorm and allreduce_rmsnorm_mxfp4 paths, hidden 1024–8192, tokens 1–65536 and TP2/4/8. With commit 2, all shapes >= 2 MiB stay bit-exact.
  • Benchmark: CUDA graph of 10 calls x 7 replays under torch.profiler, mean of two runs, GPUs checked idle before every step.
  • ISA, gfx950 TP2 mesh: 0 v_rndne_f16/v_cvt_i16_f16 (was 64/64); no peer-table load in the prologue; VGPRs 143 -> 139; no scratch.

Not verified:

  • gfx942 (MI300X) not run. Commit 1 applies there too (commit 2 is gfx950-only). It needs the ci:multi-gpu + ci:mi300x labels or a manual run.
  • Bit-exactness of INT5/INT6 on the mesh and of the ring vs main was shown only through identical verify accuracy cells, not by output checksums.
  • Full --extended (both algorithms) fails on gfx950/xGMI with NoPolicyError: no ring ladder for gfx950/xgmi/TP8. It fails identically on main (no gfx950/xGMI ring ladder), so it is pre-existing.
  • CI stack. Measured on ROCm 10.2, not the ROCm 7.x CI stack.

PR-specific question

What behavior would each changed op test fail on before this PR, and why is that coverage not already provided by an existing canonical test?

op_tests/test_flydsl_quick_allreduce_quant.py is new. Commit 1 is meant to preserve behavior, so on main the test passes; its flydsl_roundeven candidate is main's rounding. It fails on any rounding that is not exactly round-half-to-even of the clamped product. That covers an off-by-one magic constant (99.99% of codes differ), ties rounded away from zero, a wrong code mask for INT5/INT6, NaN/inf handling that differs from maxnumf + clamp, and words the kernel never writes (−1 sentinel).

The existing codec suite (op_tests/flydsl_tests/test_flydsl_quick_allreduce_codec.py) cannot catch these:

  • It grades the codec against an analytic error bound, |err| <= |ext| * (1/8 + 1.05/bias), which already allows half a code of rounding error. A tie resolved the wrong way has exactly that error and passes.
  • Its memory-vs-register test runs the same quantizer on both sides.
  • The multi-GPU verify grades by SQNR.

None of them compares individual codes against an exact reference over every fp16 input.

Changed op tests

  • op_tests/test_flydsl_quick_allreduce_quant.py (new).
    • What it checks: the quick-allreduce quantizer (_quant_atom_fp16, INT4/INT5/INT6), code by code, against a torch reference (torch.round half-to-even). Inputs are every fp16 bit pattern (all_fp16, 32 blocks for 65,536 values) and a normal fill, at two encode factors, with rtol = atol = 0.
    • Timing: it also times the production form against the roundeven form it replaced.
    • Why it is not redundant: existing tests grade accuracy with tolerances or SQNR and cannot see a rounding-direction error (see above).
    • How it runs: as a script, gated to gfx942/gfx950 in main().
  • No other op_tests/ file changed.

Submission Checklist

  • One backend (FlyDSL kernels + host), plus one new single-GPU op_test (op_tests/test_flydsl_quick_allreduce_quant.py).
  • Commit 1 output bitwise equal to main on gfx950, TP2/TP4/TP8, plain and fused (incl. MXFP4) paths. Commit 2 changes only the rung below 2 MiB; SQNR checks pass.
  • Benchmark results above.
  • Codec suite, new op test, multi-GPU verify and --extended -a mesh run on MI355X and pass.
  • gfx942 (MI300X) not run on hardware.

@github-actions

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 7093 --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.

@a-sidorova
a-sidorova force-pushed the asidorov/flydsl_quick_reduce_opt branch from 48ed980 to eefe455 Compare October 28, 2026 13:18
@a-sidorova
a-sidorova marked this pull request as ready for review October 28, 2026 13:23
@a-sidorova
a-sidorova requested review from a team and a balanced review from Copilot October 28, 2026 13:23

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 codec test checks only a quarter of fp16 bit patterns, allowing untouched zeroed outputs to pass, and lacks architecture guards for both standalone and pytest execution.

2 open issues
What changed in this PR

This PR aims to reduce FlyDSL QuickAllReduceInt4 latency while preserving bitwise results, combining shared protocol and codec optimizations with gfx950-specific engine plans.

Changes:

  • Reworks flag polling, codec arithmetic, peer-pointer arguments, and epoch storage for plain and fused paths.
  • Adds configurable workgroup geometry and payload-based engine selection for plain all-reduce; fused RMSNorm retains default geometry.
  • Adds a single-GPU test intended to exhaustively compare optimized and original codec operations.
File Description
op_tests/​test_flydsl_quick_allreduce_int4_codec.py Adds scale and INT4 rounding equivalence checks.
aiter/​ops/​flydsl/​quick_allreduce_int4.py Adds engine plans, payload-based dispatch, and revised peer/epoch handling.
aiter/​ops/​flydsl/​kernels/​quick_allreduce_int4.py Optimizes polling and quantization and supports configurable tile and thread geometry.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 28, 2026 14:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The codec test exercises only 16,384 of 65,536 fp16 patterns, leaving untested outputs to pass as zeros, and lacks the required GPU architecture gate before kernel launches.

4 open issues

Review effort: Balanced

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

Review: #7093 — QuickAllReduce INT4 faster poll/codec + gfx950 engine plans

Verdict: Not ready to approve. The kernel logic looks correct, but the PR is based on an old main and doesn't apply to the current one. It needs a re-port, not just a conflict fix.

Blocking

  1. Stale base, real conflicts [verified]
    • Since this PR's base (48295fab6), main has merged two changes that overlap it:
      • #5461 moved the kernel to kernels/comm/quick_allreduce_int4.py, rewrote the host wrapper and added allreduce_policy.py.
      • #7258 switched the group scale from E4M3 to E5M2 (bias 12) and added INT4/INT6 codec variants.
    • git merge-tree reports a modify/delete conflict on the kernel file and a content conflict in the host wrapper.
    • The new test imports aiter.ops.flydsl.kernels.quick_allreduce_int4, which no longer exists on main → ImportError.
    • DEFAULT_ENGINE_PLANS overlaps main's block/tile_atoms knobs and allreduce_policy.
  2. Codec equivalence proof no longer holds [verified]
    • _encode_scale assumes E4M3 with a fixed -0.125 step, and the exhaustive test covers only E4M3 bytes.
    • Main computes d = _e4m3_to_f32(e) * codec.dec_step over E5M2 bytes and clamps the encode scale to ±FP16_MAX (comm/quick_allreduce_codec.py:521-528).
    • The w + 1032 magic and the 0xF mask are INT4-only. INT6 needs different constants.
    • The 3612/3612 bit-exact checks and all benchmarks compare against the old base.

Should fix

  1. Memory ordering after removing buffer_inv
    • [verified] Payload reads now rely on NT loads to miss the CU cache. Main's own docs (comm/allreduce_shared.py:470-474) say NT "does not stop the load being answered from the reader's own L1/L2", and main uses sc0|sc1 for uncached-inbox reads.
    • [inferred] If a stale packet were read, the result would be silently wrong output, not a hang.
    • [verified] The change is not arch-gated, but gfx942 was only compile-tested.
    • Please justify NT or switch to sc0|sc1, and run multi-GPU tests on MI300X.
  2. CI coverage gap [verified]
    • Multi-GPU Tests (8 GPU) was skipped. The only new code CI exercised was the single-GPU codec test, run against the old base.

Notes

  1. Unsynchronized colors init [inferred]
    • colors = torch.ones(...) is async on the current stream (it was a synchronous hipMemcpy before), and __init__ never synchronizes.
    • A first launch on another non-blocking stream could read uninitialized epochs and hang.
    • Add a stream sync at the end of __init__.
  2. engine_plan not checked across ranks [verified]
    • Ranks with different plans will hang, either in the constructor's collectives or at runtime.
    • Consider an all_gather check in the constructor.

@zufayu

zufayu commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@aiter-bot review

@aiter-bot

Copy link
Copy Markdown

aiter-bot — queued behind 7 review(s); expect to start in about 3.5 h. The box reviews one PR at a time.

@aiter-bot

Copy link
Copy Markdown

⚠️ aiter-bot — this review could not complete: a problem with the review pipeline itself (bot logic / prompts), not with this PR.

prompts drifted from SKILL.md -- regenerate the prompt copies (check_prompts.py)

@zufayu — please take a look.

Re-comment @aiter-bot review once it is resolved.

@a-sidorova
a-sidorova force-pushed the asidorov/flydsl_quick_reduce_opt branch from 5bcb579 to 3593ead Compare November 19, 2026 14:02
Copilot AI balanced review requested due to automatic review settings November 19, 2026 14:02
@aiter-bot

aiter-bot commented Nov 19, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision f636fdc6fc72 · mode shadow

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

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. What behavior would each changed op test fail on before this PR, and why is that coverage not already provided by an existing canonical test?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

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

Missing or invalid answers

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

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

a-sidorova added a commit to a-sidorova/aiter that referenced this pull request Nov 19, 2026
…ice-memory colours

Port of ROCm#7093 onto the post-ROCm#5555 quick all-reduce (mesh/ring kernels in
kernels/comm). Output is bit-identical to before.

* Codec: the quantizer rounds with the fp16 magic number w + (1024 + bias),
  masked to the code width, instead of roundeven + cvt_i16 + bias, for INT4,
  INT5 and INT6. In [1024, 2048) the fp16 ulp is 1 and 1024 + bias is even,
  so the add rounds half to even exactly like roundeven.
  op_tests/test_flydsl_quick_allreduce_quant.py checks every fp16 input of
  every codec against torch (and times the old form).
* Mesh and ring take the inbox bases as kernel arguments (peer0..peer7), so
  the prologue no longer starts with an uncached peer-table load.
* The per-block colours of mesh/ring engines live in ordinary device memory
  (allocated and synchronized at engine construction), since only the
  owning GPU reads or writes them. The one-shot is unchanged.

Not ported from ROCm#7093:
* the flag poll and inbox-load cache policy: already covered upstream by
  transport._load_flag (system-scope atomic poll, no buffer_inv) and the
  sc0 sc1 recv policy;
* the v_rcp_f32 encode scale: bit-identical, but 3-6% slower on some fused
  all-reduce + RMSNorm shapes on gfx950 and no faster on the plain kernel;
* the gfx950 512-thread / 16 KiB-tile engine plans: upstream tunes the
  geometry through its own block knob and ladders.

Co-Authored-By: Claude <[email protected]>
a-sidorova added a commit to a-sidorova/aiter that referenced this pull request Nov 19, 2026
The decode-size half of ROCm#7093's engine plans, expressed with the existing
geometry knob instead of a new kernel geometry: below 2 MiB a 64-thread
block (4 KiB tile) spreads a payload over 4x the workgroups of block 256,
each with a quarter of the tile. From 2 MiB on the existing rungs stay.

Measured on MI355X (ROCm 10.2, hidden 4096, graph of 10 calls, mean of two
runs) against upstream: TP2 -6..-16%, TP4 -8..-12%, TP8 -6..-10% from 8 KiB
to 1 MiB; no shape slower by more than 1% (255 shapes, TP2/4/8). A sweep of
block x super_tile x grid_cap found nothing better from 4 MiB on.

A different block changes which rank owns which chunk, so outputs below
2 MiB are statistically equivalent to, not bit-identical with, the block
256 rung; the verify's SQNR checks pass.

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

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.

Comment thread aiter/ops/flydsl/allreduce_policy.py Resolved
@a-sidorova

a-sidorova commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Review: #7093 — QuickAllReduce INT4 faster poll/codec + gfx950 engine plans

Hi @TennyWang1223, thanks for the review. I've rebased the branch, so many things are updated or disappeared. Please take a look one more time

a-sidorova and others added 2 commits November 20, 2026 11:13
…ice-memory colours

Port of ROCm#7093 onto the post-ROCm#5555 quick all-reduce (mesh/ring kernels in
kernels/comm). Output is bit-identical to before.

* Codec: the quantizer rounds with the fp16 magic number w + (1024 + bias),
  masked to the code width, instead of roundeven + cvt_i16 + bias, for INT4,
  INT5 and INT6. In [1024, 2048) the fp16 ulp is 1 and 1024 + bias is even,
  so the add rounds half to even exactly like roundeven.
  op_tests/test_flydsl_quick_allreduce_quant.py checks every fp16 input of
  every codec against torch (and times the old form).
* Mesh and ring take the inbox bases as kernel arguments (peer0..peer7), so
  the prologue no longer starts with an uncached peer-table load.
* The per-block colours of mesh/ring engines live in ordinary device memory
  (allocated and synchronized at engine construction), since only the
  owning GPU reads or writes them. The one-shot is unchanged.

Not ported from ROCm#7093:
* the flag poll and inbox-load cache policy: already covered upstream by
  transport._load_flag (system-scope atomic poll, no buffer_inv) and the
  sc0 sc1 recv policy;
* the v_rcp_f32 encode scale: bit-identical, but 3-6% slower on some fused
  all-reduce + RMSNorm shapes on gfx950 and no faster on the plain kernel;
* the gfx950 512-thread / 16 KiB-tile engine plans: upstream tunes the
  geometry through its own block knob and ladders.

Co-Authored-By: Claude <[email protected]>
The decode-size half of ROCm#7093's engine plans, expressed with the existing
geometry knob instead of a new kernel geometry: below 2 MiB a 64-thread
block (4 KiB tile) spreads a payload over 4x the workgroups of block 256,
each with a quarter of the tile. From 2 MiB on the existing rungs stay.

Measured on MI355X (ROCm 10.2, hidden 4096, graph of 10 calls, mean of two
runs) against upstream: TP2 -6..-16%, TP4 -8..-12%, TP8 -6..-10% from 8 KiB
to 1 MiB; no shape slower by more than 1% (255 shapes, TP2/4/8). A sweep of
block x super_tile x grid_cap found nothing better from 4 MiB on.

A different block changes which rank owns which chunk, so outputs below
2 MiB are statistically equivalent to, not bit-identical with, the block
256 rung; the verify's SQNR checks pass.

Co-Authored-By: Claude <[email protected]>
@a-sidorova
a-sidorova force-pushed the asidorov/flydsl_quick_reduce_opt branch from 3593ead to 02d5c1b Compare November 20, 2026 07:13
Copilot AI balanced review requested due to automatic review settings November 20, 2026 07:13

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

Shared mesh/ring peer-addressing and epoch-storage changes need human review because gfx942 hardware validation is outstanding and GPU ordering and cross-launch epoch visibility could not be verified here.

No open issues 🎉

5 resolved since last review

Review effort: Balanced

@TennyWang1223 TennyWang1223 added the ci:multi-gpu Trigger multi-GPU op tests on PR label Nov 24, 2026
Copilot AI balanced review requested due to automatic review settings November 26, 2026 02:58

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

Shared epoch-caching and peer-address changes require human review because they affect gfx942, while reported hardware validation covers only gfx950 on a different stack, leaving gfx942 multi-GPU correctness and graph replay on the pinned stack unverified.

No open issues 🎉

Review effort: Balanced

@a-sidorova

Copy link
Copy Markdown
Contributor Author

@TennyWang1223 thank you for launching CI! It has successfully finished

@TennyWang1223
TennyWang1223 merged commit 8989520 into ROCm:main Nov 27, 2026
79 of 81 checks passed
samremes pushed a commit that referenced this pull request Nov 27, 2026
#7093 passes the mesh inboxes as eight kernel arguments instead of a
device pointer table, so the relay's two bounce pointers, which were
appended to that table, no longer reached the kernel. _StEngine.peer_args
now puts extra_ptrs in the slots after the TP ranks, and the relay blocks
read their bounces from peer_args[world_size] and [world_size + 1].

Co-authored-by: Cursor <[email protected]>
Signed-off-by: Mikko Tukiainen <[email protected]>
vedenev-amd added a commit that referenced this pull request Nov 30, 2026
…because main's kernel-arg peers (#7093) removed peer_vec and the auto-merged helpers/help_bal/help_pair code would fail to trace (ruff F821).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vedenev-amd added a commit that referenced this pull request Nov 30, 2026
…list, because main's kernel-arg peers (#7093) shifted the mesh launcher's arguments by seven and the hard-coded slot 12 overwrote a peer pointer (illegal address at M=4096; with the fix the fused arm is back at err 0.1539, 603 us).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vedenev-amd added a commit that referenced this pull request Nov 30, 2026
…to the PR branch, because CI checks the PR merged with main and main's kernel-arg peers change (#7093) removed peer_vec, which made Ruff fail with F821 in quick_allreduce_mesh.py.

Re-formatted with black and re-marked with ruff 0.16.0 on the merged tree (both clean repo-wide). GPU check on the merged tree, TP8 eager mini-e2e M=4096 nvb 8: INT4 fused 606.6 us err 0.1539, exact fused 633.9 us err 0.0156 (before: 602 / 627-631 us, same errors).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vpietila-amd added a commit that referenced this pull request Dec 1, 2026
Resolves the conflicts with #7093 (kernel-arg peers, device-memory
colours, magic-number codec rounding, gfx950/xGMI block-64 mesh rung)
and #8574 (fused-only "pull" schedule):

* mesh/ring take main's peer0..peer7 kernel arguments and
  device_colors; the Lamport mesh code uses main's self_inbox.
* The hier kernel moves to peer0..peer7 too, to match the host's
  shared launch arguments.
* "hier" and "pull" coexist in ALGORITHMS, _TWO_SHOT_CODECS and
  FamilyPolicy; both test blocks are kept.
* The gfx950/xGMI MESH_ST_LADDER keeps this branch's Lamport rungs in
  place of #7093's block-64 flag rungs.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.

6 participants