Skip to content

[Triton/Gluon] [OPUS] [FlyDSL] Gfx1250/microbench - #5391

Merged
JiaoliangYu merged 49 commits into
mainfrom
gfx1250/microbench
Sep 13, 2026
Merged

JiaoliangYu merged 49 commits into
mainfrom
gfx1250/microbench

Conversation

@JiaoliangYu

Copy link
Copy Markdown
Contributor

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

JiaoliangYu and others added 19 commits September 3, 2026 17:08
* perf(gfx1250): add the combined gfx1250 microbench (#5076)

Two files, both new, on top of main:

  op_tests/bench_gfx1250_combo.py                        combined bench
  op_tests/triton_tests/attention/test_mla_v4_triton.py  MLA v4 triton reference

The bench imports the top-level @benchmark sweep fns from the op_tests
siblings and runs each over its own shape axes, printing only the per-op
summary tables -- all the JIT/ROCTracer/import noise is silenced at the fd
level. Two suites: --perf for hardware-oriented single-op numbers, --dsv4
for the DeepSeek-V4 shapes. Token sweeps come from AITER_BENCH_TOKENS; ops
whose axis means something else, or whose usable range is fixed, pin their
sweep in the source and say why.

Everything else the branch used to carry has reached main on its own since:
test_pa_sparse_prefill.py (#4926), test_mega_moe_gfx1250.py (#5052),
test_flydsl_qk_norm_rope_quant.py and the mla_v4 hsa artifacts. Only these
two files were ever unique to it, so this is what is left to upstream.

Notes worth carrying, all measured on gfx1250 / 20260827-28:

a16w16 does not pre-check the >4 GiB operand limit. That guard belongs to
one fallback path -- opus_dispatch_a16w16_gfx1250 searches the tuned table
first and only reaches check_shape_4g on a miss, en route to the split-K
kid whose launcher builds the 32-bit gmem descriptors. A tuned 4wave_wl_co
winner never gets there. Predicting it in Python skipped shapes that tuning
had already made runnable, so the kernel is left to raise and the exception
is recorded as a row. It also checks the error ratio the UT returns against
_A16W16_MAX_ERR: all four M=65536 shapes come back err=0.96-0.99 while
every other row is 0 or ~1e-5, and nothing in the UT raises or warns, so
those used to print as data.

a8w8_blockscale sweeps M from 1024. Below that, get_CKGEMM_config's
M -> get_padded_m -> nextPow2 retry lands on #4773's M=16/M=64 gluon rows,
and the UT's extra "ck strided x_scale" check (line 120, added by #4406 and
gated on ck_preshuffle alone) hands triton a stride != 1 specialization
that fails to compile in make_llir. The mxfp8_128 path declares its layout
with is_x_scale_transposed=True and never reads the stride, so that check
tests nothing there. Fixing the gate is upstream's call; starting at 1024
keeps this bench clear of it. Verified 36/36, err=0, 2207-7003 TFLOPS.

mla_v4_prefill is pinned to n=1024 and mla_v4_prefill_fp8 drops
nnz_prefix=8192; both are kernel/verify faults, measured and documented at
the pins.

Co-authored-by: Yu <[email protected]>

* perf(gfx1250): let AITER_BENCH_TOKENS reach every op (#5082)

Three token constants were hardcoded and never consulted the variable --
_INVERSE_ROPE_TOKENS, _MLA_DECODE_TOKENS, _MEGA_MOE_TOKENS -- with comments
saying so ("Pinned, not env-driven", "deliberately not consulted"). The
reasoning was that a global token count means the wrong thing for those
ops, which is true of the default but not of an explicit request: if a
caller sets the variable, that is their decision to make, including asking
for a shape the op is known to fail on.

All nine token constants now go through _tokens(): unset, each op runs its
own default and says at its constant why that default is not the shared
list; set, the variable wins everywhere and the file does not argue with
it. Behaviour with the variable unset is unchanged.

The module docstring said "Two ops ignore it and pin their sweep in the
source" -- no longer true, and it only listed two of the five ops whose
default differs. It now lists all five with the reason for each.

Should have been part of #5076; amended in after that PR was pushed.

Co-authored-by: Yu <[email protected]>

* perf(gfx1250): sweep the fp4 dispatch wire beside bf16 (#5147)

mori_ep measured only the bf16 wire, which is not the leg DSv4 serves on.
The receiver hands the dispatched payload straight to the expert GEMM as its
A operand, and that GEMM is a4w4 -- ATOM's serve script pins MEGA_WIRE=fp4
with AITER_FORCE_A8W4=0 -- so bf16 alone measures a path production does not
take, and misses the wire whose payload is a quarter as wide.

Sweeps bf16 and fp4 by default, one child each: bench_ep.py reads $DISP once
at import and builds the transport for that dtype, so the tiers cannot share
a process. $DISP still overrides, now comma-separated, and is forwarded
unvalidated -- mori owns the value set, this file does not restate it.

fp4 rows are labelled UNCHECKED. mori forces its own comparison off on fp4
("fp4 combine is too lossy to compare"), so CHECK=1 is silently dropped
there; without the label a passing fp4 row reads as verified next to a bf16
row that actually was.

Co-authored-by: Yu <[email protected]>

* perf(gfx1250): follow the sparse-prefill UT through #5084 (#5170)

#5084 rewrote test_pa_sparse_prefill.py and mla_v4_prefill stopped running
against it: --nnz-prefix is gone, so the child aborted with "unrecognized
arguments" before reaching a kernel.

- drop --nnz-prefix. The nnz axis no longer exists: the CSR is generated from
  --mode under --seed (sparse draws a random nnz per row, dense fills every
  row), so nnz is an outcome, not an input
- delete the mla_v4_prefill_fp8 op. Its entire content was that nnz sweep, and
  it has no equivalent under the new UT. mla_v4_prefill already covers fp8 --
  and now covers the backends too, since #5084 compares opus/asm/triton
- _space_table: decide a data row by counting numeric fields instead of
  testing the first one. The new table leads with prec/mode (bf16, dense), so
  the first-field test dropped the whole table and the op reported "no result
  rows" while the UT itself had exited 0

Raise _MLA_PREFILL_TOKENS to 1024..16384. Re-measured on the new UT (b45-2,
one process per tier): 1024 through 16384 all clean, where 4096/8192/16384
faulted on the old one. 16384 is the DSv4 prefill chunk and the reason this
op exists, so this is the coverage the pin was costing us.

65536 stays out. It faults with a memory access at 0x7f2ddbec0000 and writes
an 89 GB coredump doing it -- a third of the free disk on a shared host -- and
it is past the chunk size the model prefills anyway.

Both the tier sweep and this op run --no-verify, hardcoded at the call site,
and that is now load-bearing rather than a speed choice: with verification on,
even n=1024 dies at the first case (fp8/dense, fault at 0x43000), so the
reference or the comparison is what breaks, not the kernel under test. These
are therefore timings from an unverified kernel. The comment says so, because
a16w16's M=65536 rows looked exactly this healthy until _A16W16_MAX_ERR was
added and caught err=0.99.

Co-authored-by: Yu <[email protected]>

* perf(gfx1250): stop every child from shelling out to rocminfo (#5180)

chip_info runs rocminfo twice per process -- once for the arch, once for the
CU count -- and rocminfo takes a per-device rocm_smi mutex on its way in. One
process is fine, and the nine single-GPU ops never noticed. A torchrun op
starts four ranks at once, and they contend for that mutex.

Both multi-GPU ops have now lost a run to it. On b45-1 a rank lost the mutex
and aborted:

    init_mutex /rocm_smi_renderD128: unlock timed lock, ret: 1
    terminate called after throwing an instance of 'std::runtime_error'
      what():  Allgather operation failed

The allgather is the symptom, not the cause: the rank died first and took the
collective with it. On b45-2 the other shape of the same problem -- four
rocminfo processes sat in the mutex for minutes, one wedged in D state, the op
never produced a line, and even docker stop hung waiting for the driver to
let go.

Detect once here, where the call is serial, and hand the answer down:

    GPU_ARCHS -> get_gfx_list()          skips _detect_native()
    CU_NUM    -> get_cu_num_custom_op()  skips its own rocminfo

Both are read from the environment before either shells out, so a child that
inherits them runs no rocminfo at all. Set on os.environ in main() for the
children that inherit our environment, and setdefault() in _run_child for the
ones handed an explicit env -- setdefault throughout, so an exported value
from the caller still wins.

The value is what this process detected on this machine, not a hardcoded
gfx1250, so it is the same answer the child would have computed. Verified in
the child's /proc/<pid>/environ: GPU_ARCHS=gfx1250, AITER_GPU_ARCHS=gfx1250,
CU_NUM=256, matching get_gfx()/get_cu_num() here.

mega_moe on b45-1 after the change: rc=0, all 36 configs, zero mutex warnings,
and zero rocminfo processes observed while it ran. Before it, the same op on
the same host was rc=1 with 6 mutex warnings.

Co-authored-by: Yu <[email protected]>

* test_common:data generate

---------

Co-authored-by: Yu <[email protected]>
* [test] Add bench controls to test_opus_a16w16_gemm

Add configurable warmup/iteration counts, data-init modes
(zero/constant/uniform/norm) with a seed, and rotating-tensor control
to the opus a16w16 GEMM test, and report both TFLOPs and bandwidth
(TB/s) explicitly across all three timing paths.

The opus graph sweep table now also surfaces the tuned CSV's splitK and
kernelName (kid) per shape, so the algorithmic winner is visible and
tracks CSV updates. test_a16w16 keeps a backward-compatible signature so
the gfx1250 combo bench is unaffected.

Co-authored-by: Cursor <[email protected]>

* [test] Fix ruff C408 in test_opus_a16w16_gemm

Rewrite init_kwargs dict() call as a dict literal to satisfy
`ruff check` (C408); black is unchanged.

Co-authored-by: Cursor <[email protected]>

* test_common:data generate

* [test] Adopt shared test_common data-init in a16w16 gemm

Use the cherry-picked aiter.test_common data-init API (make_generator /
add_data_init_args / fill / DATA_DISTS) in test_opus_a16w16_gemm.py instead of
the local DATA_INITS/_make_generator/_make_tensor helpers, so operand init and
--data-init/--seed CLI match every other op test.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: binglue.lyu <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: JiaoliangYu <[email protected]>
Co-authored-by: blyu <[email protected]>
* test(gemm): use common data initialization options for gfx1250 asm gemm

Signed-off-by: Double Young <[email protected]>

* test(gemm): expose warmup/iters/graph/rotate CLIs for gfx1250 asm gemm

Signed-off-by: Double Young <[email protected]>

* test(gemm): show algorithmic details for gfx1250 asm gemm

Signed-off-by: Double Young <[email protected]>

---------

Signed-off-by: Double Young <[email protected]>
* update

* update

* support a8w8 ubench

* revert ck module

* apply aiter common interface

---------

Co-authored-by: yadaish <[email protected]>
Add --seed, --init {normal,uniform,zero,constant}, --init-scale,
and --init-val CLI flags so callers can control how input tensors
are initialised, enabling reproducible perf sweeps across data
distributions.

Co-authored-by: jli-melchior <[email protected]>
Co-authored-by: Claude <[email protected]>
Wire test_common.fill, --data-init, and --seed so MHC inputs are reproducible.

Co-authored-by: Cursor <[email protected]>
* perf(gfx1250): complete DSv4 data init controls

* perf(gfx1250): report per-case SMI telemetry

* perf(gfx1250): monitor Mega MoE per rank

---------

Co-authored-by: JiaoliangYu <[email protected]>
* docs(gfx1250): document bundled amdsmi binding

* perf(gfx1250): emit benchmark summaries as JSON

---------

Co-authored-by: JiaoliangYu <[email protected]>
* perf(gfx1250): label SMI replays per benchmark call

* perf(gfx1250): cover saturated DSv4 MLA decode KV

* perf(gfx1250): sweep DSv4 score-QK decode batches

* perf(gfx1250): cover TP4 inverse RoPE shape

* perf(gfx1250): add M256 blockscale coverage

* perf(gfx1250): add 64K Mega MoE coverage

---------

Co-authored-by: JiaoliangYu <[email protected]>
… head schedule and the PTL prefetch hazard fixed

Replaces mla_a8w8_qh128_1tg_32mx4_32nx1_sparse_pfl.co (462a5ee0, as shipped by
#4926) with a build carrying the 09-07/09-08 head work plus one correctness fix.

The correctness fix. The page-table prefetch built its row offset from a VGPR
written by v_writelane_b32 at the end of KV_page_prefetch_build; the consumers
are the two v_lshlrev at the top of KV_page_prefetch_issue, on the far side of
the _s_p_tiles branch with zero VALU in between:

    v_writelane_b32 v4, s60, 0
    s_cmp_eq_u32    s103, 0
    s_cbranch_scc0  label_1028
    v_lshlrev_b32   v2, 9, v4      <- 2 SALU after the write

SCHED_MODE 2 has no VALU->VALU interlock, so the shift could read the stale
register (Q addr-gen leftovers). `stale << 9` off a bounds-free 64-bit base is a
wild address, observed under batched prefill as

    Memory access fault by GPU node-3 ... Reason: Page not present

No numeric test can catch this: a prefetch has no destination register, so the
bad address never reaches a result. Fixed with one s_wait_alu placed before the
branch, covering both the fall-through (extend) and taken (prefix) arms.
+4 bytes; the core loop is byte-identical.

Also in this build, relative to 462a5ee0:
  * head schedule: HEAD_INDPTR_EARLY, HEAD_INDEX_HOIST, HEAD_TDM_SLOT_AWARE
  * HEAD_KV_PTL_* page-table prefetch over tile 0's KV rows
  * the packed-row scale tail mask (448:511 pad), which 462a5ee0 lacks -- that
    pad reads as NaN once the host stops zero-filling it

Source: junxiaguo/my_agent_skills @ 495b486 (0805_base/32mx4_32nx1.sp3).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Replaces the mla_a8w8_qh128_1tg_32mx4_32nx1_sparse_pfl.co binary added in
e566d68 with a newer build.

Validated end-to-end on DeepSeek-V4-Pro (gfx1250, tp4, expert parallel,
dp attention, kv_cache_dtype=fp8, index_cache_dtype=fp8):

  lm_eval gsm8k, full 1319 questions, 3-shot
    flexible-extract  exact_match  0.9507 +/- 0.006
    strict-match      exact_match  0.9500 +/- 0.006

  No memory access faults, page-not-present or HSA_STATUS errors in the
  server log across the full run.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This reverts 12f16de ("[ASM][gfx1250] mla v4 prefill: update sparse_pfl
kernel binary") and e566d68 ("[ASM][gfx1250] mla v4 prefill: rebuild the
sparse_pfl kernel with the head schedule and the PTL prefetch hazard
fixed"), restoring
hsa/gfx1250/mla_v4/mla_a8w8_qh128_1tg_32mx4_32nx1_sparse_pfl.co to
462a5ee0 -- the build shipped by #4926.

No other file is touched; both reverted commits changed only that binary.

The kernel work is being resubmitted against main directly rather than
landing here first.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
* perf(gfx1250): compare MegaMoE modes in one run

* perf(gfx1250): honor tuned backend in a16w16 bench

* perf(gfx1250): add Mori EP inputs and telemetry

* perf(gfx1250): add 16K Mega MoE coverage

---------

Co-authored-by: JiaoliangYu <[email protected]>
@JiaoliangYu
JiaoliangYu requested a review from a team September 10, 2026 02:47
@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; main branch always runs both MI35X and MI300X
multigpu 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: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
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 5391 --add-label <label>

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 opt this PR out.

@github-actions github-actions Bot changed the title Gfx1250/microbench [Triton/Gluon] [OPUS] [FlyDSL] Gfx1250/microbench Sep 10, 2026
valarLip
valarLip previously approved these changes Sep 12, 2026
@valarLip

Copy link
Copy Markdown
Collaborator

Reviewed commit 4a896606efab1ab23c2bdb50ff5baea0cc3b8929. I recommend addressing the following before merging, particularly the measurement accuracy and separation of responsibilities.

  1. [P2] SMI can monitor the wrong GPU. In smi_monitor.py:405, the device defaults to AITER_SMI_DEVICE=0, while perftest does not pass the workload device. With all devices visible and torch.cuda.set_device(3), the workload executes on GPU 3 but monitoring selects GPU 0. I reproduced this using a real GPU 3 tensor and a monitor spy. Please pass the workload device explicitly, retaining the environment override if needed. The distributed Mega MoE path already passes current_device() correctly.

  2. [P2] run_perftest loses callable identity, breaking SMI filtering and labels. The new hook in test_common.py:218 filters by function name, but run_perftest wraps every callable in worker(*args, **kwargs). With AITER_SMI_SKIP_FUNCTIONS=run_torch, run_perftest(run_torch, ...) still performs the replay and emits benchmark_case/worker#1; signature-based tagging also loses backend selectors in the variadic wrapper. Please preserve the original callable metadata/signature or pass explicit backend identifiers. This was reproduced; direct @perftest usage correctly honors the filter.

  3. [P2] GEMM1 bandwidth accounting omits top-k output multiplicity. In test_flydsl_grouped_gemm.py:590, FLOPs include topk, but output bytes use only tokens * stage1_n * 2. Under the documented logical GEMM model, the output has tokens * topk rows. Executing the helper confirms that GEMM1 bytes remain unchanged when top-k increases from 1 to 8. Please correct the routed-row count. If the intention is to model actual fused-kernel traffic instead, activation and quantized output formats need separate accounting; logical bytes should not be interpreted as measured HBM traffic.

  4. [P3] The data-init CLI accepts empty inputs and silently discards requested distributions. The shared parser uses nargs="*", allowing a bare --data-init to produce an empty list. test_opus_a16w16_gemm.py:539 then indexes the first element and raises IndexError, while entry points that iterate the list can execute zero cases. Conversely, --data-init uniform norm silently runs only uniform in OPUS. Please reject empty lists and either honor every distribution or explicitly accept a single value.

The code organization also needs attention:

  • Keep the Mega MoE implementations in separate modules. test_mega_moe.py:17 combines two complete runners in a 2,024-line file under architecture branches, retaining separate CLIs, reference implementations, communication setup/teardown, and reporting, with formatting disabled. A thin architecture dispatcher would provide a unified entry point while preserving backend boundaries.
  • Keep test_common.py focused. Input generation and packed-format encoding, JSON reporting, and SMI metadata/state should have dedicated modules with narrow interfaces, leaving a small integration hook in the timing utility. The separate _make_data implementation and different CLI vocabulary added to the QK norm test should also be reconciled with the shared helpers.

Validation in ljin_dev on MI355X/gfx950, using the reviewed source snapshot: 114 passed, 10 skipped for the new MLA test file, including both FP8 cases exercising strides beyond 2 GiB. Another 27 input-generation determinism checks passed. The SMI findings were reproduced with actual GPU work and a monitor spy, not measured power/utilization data. gfx1250 hardware was unavailable, so these results do not validate gfx1250 FlyDSL/OPUS performance; the full distributed Mega MoE benchmark was not executed.

The shared seeded generators, SWA sentinel checks, and large-stride regression tests are useful additions. They can be retained while correcting the measurement semantics and tightening module boundaries.

@JiaoliangYu

JiaoliangYu commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review. Addressed in 5fff12bd4 and 7422c7770:

  1. SMI device: regular UTs and SMI both default to logical HIP device 0. --smi-device explicitly selects the monitored logical device, and the BDF mapping handles visibility remapping. Mega MoE already uses each rank's current device. A mismatch occurs only if the workload device is changed without updating --smi-device, so we kept the existing explicit contract.
  2. run_perftest: fixed with functools.wraps, preserving names, signatures, filters, and labels.
  3. Grouped GEMM bytes: fixed GEMM1 logical input/output accounting to use tokens * topk routed rows.
  4. Data-init CLI: changed multi-value options to require at least one value; OPUS now rejects multiple distributions instead of silently taking the first.
  5. Mega MoE organization: restored test_mega_moe_v2.py and moved the end-to-end benchmark intact to bench_mega_moe.py, removing the combined architecture-branch file.
  6. test_common.py: moved data initialization and packed-format encoding to aiter/benchmark_data_init.py, JSON output to aiter/benchmark_reporting.py, and SMI metadata/state to aiter/smi_monitor.py. The timing utility now keeps only the small hooks needed to establish benchmark label context and hand off prepared replays. QK norm also uses the shared data helper and --data-init/--seed vocabulary.

@JiaoliangYu
JiaoliangYu merged commit 6566fb4 into main Sep 13, 2026
71 checks passed
@JiaoliangYu
JiaoliangYu deleted the gfx1250/microbench branch September 13, 2026 00:41
sammysun0711 pushed a commit to sammysun0711/aiter that referenced this pull request Sep 16, 2026
* Gfx1250/microbench (ROCm#5241)

* perf(gfx1250): add the combined gfx1250 microbench (ROCm#5076)

Two files, both new, on top of main:

  op_tests/bench_gfx1250_combo.py                        combined bench
  op_tests/triton_tests/attention/test_mla_v4_triton.py  MLA v4 triton reference

The bench imports the top-level @benchmark sweep fns from the op_tests
siblings and runs each over its own shape axes, printing only the per-op
summary tables -- all the JIT/ROCTracer/import noise is silenced at the fd
level. Two suites: --perf for hardware-oriented single-op numbers, --dsv4
for the DeepSeek-V4 shapes. Token sweeps come from AITER_BENCH_TOKENS; ops
whose axis means something else, or whose usable range is fixed, pin their
sweep in the source and say why.

Everything else the branch used to carry has reached main on its own since:
test_pa_sparse_prefill.py (ROCm#4926), test_mega_moe_gfx1250.py (ROCm#5052),
test_flydsl_qk_norm_rope_quant.py and the mla_v4 hsa artifacts. Only these
two files were ever unique to it, so this is what is left to upstream.

Notes worth carrying, all measured on gfx1250 / 20260827-28:

a16w16 does not pre-check the >4 GiB operand limit. That guard belongs to
one fallback path -- opus_dispatch_a16w16_gfx1250 searches the tuned table
first and only reaches check_shape_4g on a miss, en route to the split-K
kid whose launcher builds the 32-bit gmem descriptors. A tuned 4wave_wl_co
winner never gets there. Predicting it in Python skipped shapes that tuning
had already made runnable, so the kernel is left to raise and the exception
is recorded as a row. It also checks the error ratio the UT returns against
_A16W16_MAX_ERR: all four M=65536 shapes come back err=0.96-0.99 while
every other row is 0 or ~1e-5, and nothing in the UT raises or warns, so
those used to print as data.

a8w8_blockscale sweeps M from 1024. Below that, get_CKGEMM_config's
M -> get_padded_m -> nextPow2 retry lands on ROCm#4773's M=16/M=64 gluon rows,
and the UT's extra "ck strided x_scale" check (line 120, added by ROCm#4406 and
gated on ck_preshuffle alone) hands triton a stride != 1 specialization
that fails to compile in make_llir. The mxfp8_128 path declares its layout
with is_x_scale_transposed=True and never reads the stride, so that check
tests nothing there. Fixing the gate is upstream's call; starting at 1024
keeps this bench clear of it. Verified 36/36, err=0, 2207-7003 TFLOPS.

mla_v4_prefill is pinned to n=1024 and mla_v4_prefill_fp8 drops
nnz_prefix=8192; both are kernel/verify faults, measured and documented at
the pins.

Co-authored-by: Yu <[email protected]>

* perf(gfx1250): let AITER_BENCH_TOKENS reach every op (ROCm#5082)

Three token constants were hardcoded and never consulted the variable --
_INVERSE_ROPE_TOKENS, _MLA_DECODE_TOKENS, _MEGA_MOE_TOKENS -- with comments
saying so ("Pinned, not env-driven", "deliberately not consulted"). The
reasoning was that a global token count means the wrong thing for those
ops, which is true of the default but not of an explicit request: if a
caller sets the variable, that is their decision to make, including asking
for a shape the op is known to fail on.

All nine token constants now go through _tokens(): unset, each op runs its
own default and says at its constant why that default is not the shared
list; set, the variable wins everywhere and the file does not argue with
it. Behaviour with the variable unset is unchanged.

The module docstring said "Two ops ignore it and pin their sweep in the
source" -- no longer true, and it only listed two of the five ops whose
default differs. It now lists all five with the reason for each.

Should have been part of ROCm#5076; amended in after that PR was pushed.

Co-authored-by: Yu <[email protected]>

* perf(gfx1250): sweep the fp4 dispatch wire beside bf16 (ROCm#5147)

mori_ep measured only the bf16 wire, which is not the leg DSv4 serves on.
The receiver hands the dispatched payload straight to the expert GEMM as its
A operand, and that GEMM is a4w4 -- ATOM's serve script pins MEGA_WIRE=fp4
with AITER_FORCE_A8W4=0 -- so bf16 alone measures a path production does not
take, and misses the wire whose payload is a quarter as wide.

Sweeps bf16 and fp4 by default, one child each: bench_ep.py reads $DISP once
at import and builds the transport for that dtype, so the tiers cannot share
a process. $DISP still overrides, now comma-separated, and is forwarded
unvalidated -- mori owns the value set, this file does not restate it.

fp4 rows are labelled UNCHECKED. mori forces its own comparison off on fp4
("fp4 combine is too lossy to compare"), so CHECK=1 is silently dropped
there; without the label a passing fp4 row reads as verified next to a bf16
row that actually was.

Co-authored-by: Yu <[email protected]>

* perf(gfx1250): follow the sparse-prefill UT through ROCm#5084 (ROCm#5170)

ROCm#5084 rewrote test_pa_sparse_prefill.py and mla_v4_prefill stopped running
against it: --nnz-prefix is gone, so the child aborted with "unrecognized
arguments" before reaching a kernel.

- drop --nnz-prefix. The nnz axis no longer exists: the CSR is generated from
  --mode under --seed (sparse draws a random nnz per row, dense fills every
  row), so nnz is an outcome, not an input
- delete the mla_v4_prefill_fp8 op. Its entire content was that nnz sweep, and
  it has no equivalent under the new UT. mla_v4_prefill already covers fp8 --
  and now covers the backends too, since ROCm#5084 compares opus/asm/triton
- _space_table: decide a data row by counting numeric fields instead of
  testing the first one. The new table leads with prec/mode (bf16, dense), so
  the first-field test dropped the whole table and the op reported "no result
  rows" while the UT itself had exited 0

Raise _MLA_PREFILL_TOKENS to 1024..16384. Re-measured on the new UT (b45-2,
one process per tier): 1024 through 16384 all clean, where 4096/8192/16384
faulted on the old one. 16384 is the DSv4 prefill chunk and the reason this
op exists, so this is the coverage the pin was costing us.

65536 stays out. It faults with a memory access at 0x7f2ddbec0000 and writes
an 89 GB coredump doing it -- a third of the free disk on a shared host -- and
it is past the chunk size the model prefills anyway.

Both the tier sweep and this op run --no-verify, hardcoded at the call site,
and that is now load-bearing rather than a speed choice: with verification on,
even n=1024 dies at the first case (fp8/dense, fault at 0x43000), so the
reference or the comparison is what breaks, not the kernel under test. These
are therefore timings from an unverified kernel. The comment says so, because
a16w16's M=65536 rows looked exactly this healthy until _A16W16_MAX_ERR was
added and caught err=0.99.

Co-authored-by: Yu <[email protected]>

* perf(gfx1250): stop every child from shelling out to rocminfo (ROCm#5180)

chip_info runs rocminfo twice per process -- once for the arch, once for the
CU count -- and rocminfo takes a per-device rocm_smi mutex on its way in. One
process is fine, and the nine single-GPU ops never noticed. A torchrun op
starts four ranks at once, and they contend for that mutex.

Both multi-GPU ops have now lost a run to it. On b45-1 a rank lost the mutex
and aborted:

    init_mutex /rocm_smi_renderD128: unlock timed lock, ret: 1
    terminate called after throwing an instance of 'std::runtime_error'
      what():  Allgather operation failed

The allgather is the symptom, not the cause: the rank died first and took the
collective with it. On b45-2 the other shape of the same problem -- four
rocminfo processes sat in the mutex for minutes, one wedged in D state, the op
never produced a line, and even docker stop hung waiting for the driver to
let go.

Detect once here, where the call is serial, and hand the answer down:

    GPU_ARCHS -> get_gfx_list()          skips _detect_native()
    CU_NUM    -> get_cu_num_custom_op()  skips its own rocminfo

Both are read from the environment before either shells out, so a child that
inherits them runs no rocminfo at all. Set on os.environ in main() for the
children that inherit our environment, and setdefault() in _run_child for the
ones handed an explicit env -- setdefault throughout, so an exported value
from the caller still wins.

The value is what this process detected on this machine, not a hardcoded
gfx1250, so it is the same answer the child would have computed. Verified in
the child's /proc/<pid>/environ: GPU_ARCHS=gfx1250, AITER_GPU_ARCHS=gfx1250,
CU_NUM=256, matching get_gfx()/get_cu_num() here.

mega_moe on b45-1 after the change: rc=0, all 36 configs, zero mutex warnings,
and zero rocminfo processes observed while it ran. Before it, the same op on
the same host was rc=1 with 6 mutex warnings.

Co-authored-by: Yu <[email protected]>

* test_common:data generate

---------

Co-authored-by: Yu <[email protected]>

* Blyu/opus gemm benchmark update (ROCm#5250)

* [test] Add bench controls to test_opus_a16w16_gemm

Add configurable warmup/iteration counts, data-init modes
(zero/constant/uniform/norm) with a seed, and rotating-tensor control
to the opus a16w16 GEMM test, and report both TFLOPs and bandwidth
(TB/s) explicitly across all three timing paths.

The opus graph sweep table now also surfaces the tuned CSV's splitK and
kernelName (kid) per shape, so the algorithmic winner is visible and
tracks CSV updates. test_a16w16 keeps a backward-compatible signature so
the gfx1250 combo bench is unaffected.

Co-authored-by: Cursor <[email protected]>

* [test] Fix ruff C408 in test_opus_a16w16_gemm

Rewrite init_kwargs dict() call as a dict literal to satisfy
`ruff check` (C408); black is unchanged.

Co-authored-by: Cursor <[email protected]>

* test_common:data generate

* [test] Adopt shared test_common data-init in a16w16 gemm

Use the cherry-picked aiter.test_common data-init API (make_generator /
add_data_init_args / fill / DATA_DISTS) in test_opus_a16w16_gemm.py instead of
the local DATA_INITS/_make_generator/_make_tensor helpers, so operand init and
--data-init/--seed CLI match every other op test.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: binglue.lyu <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: JiaoliangYu <[email protected]>
Co-authored-by: blyu <[email protected]>

* [ASM][gfx1250] enhance ASM GEMM microbench (ROCm#5251)

* test(gemm): use common data initialization options for gfx1250 asm gemm

Signed-off-by: Double Young <[email protected]>

* test(gemm): expose warmup/iters/graph/rotate CLIs for gfx1250 asm gemm

Signed-off-by: Double Young <[email protected]>

* test(gemm): show algorithmic details for gfx1250 asm gemm

Signed-off-by: Double Young <[email protected]>

---------

Signed-off-by: Double Young <[email protected]>

* test mega moe data init and warmup (ROCm#5248)

* Dev/ubench gemm (ROCm#5252)

* update

* update

* support a8w8 ubench

* revert ck module

* apply aiter common interface

---------

Co-authored-by: yadaish <[email protected]>

* [Bench] Add data-init options to qk_norm_rope_quant test (ROCm#5253)

Add --seed, --init {normal,uniform,zero,constant}, --init-scale,
and --init-val CLI flags so callers can control how input tensors
are initialised, enabling reproducible perf sweeps across data
distributions.

Co-authored-by: jli-melchior <[email protected]>
Co-authored-by: Claude <[email protected]>

* [HIP] Add data-init to test_mhc (ROCm#5245)

Wire test_common.fill, --data-init, and --seed so MHC inputs are reproducible.

Co-authored-by: Cursor <[email protected]>

* perf(gfx1250): add ubench init controls and SMI monitor (ROCm#5257)

Co-authored-by: JiaoliangYu <[email protected]>

* [Perf][gfx1250] Complete DSv4 attention data-init support (ROCm#5258)

* perf(gfx1250): complete DSv4 data init controls

* perf(gfx1250): report per-case SMI telemetry

* perf(gfx1250): monitor Mega MoE per rank

---------

Co-authored-by: JiaoliangYu <[email protected]>

* perf(gfx1250): add M512 A8W8 DSv4 case (ROCm#5284)

Co-authored-by: JiaoliangYu <[email protected]>

* [Perf][gfx1250] Emit ubench summaries as JSON (ROCm#5288)

* docs(gfx1250): document bundled amdsmi binding

* perf(gfx1250): emit benchmark summaries as JSON

---------

Co-authored-by: JiaoliangYu <[email protected]>

* fix(gfx1250): scope bundled amdsmi import (ROCm#5291)

Co-authored-by: JiaoliangYu <[email protected]>

* perf(gfx1250): reuse process-wide amdsmi state (ROCm#5302)

Co-authored-by: JiaoliangYu <[email protected]>

* [Perf][gfx1250] Label SMI replays per benchmark call (ROCm#5304)

* perf(gfx1250): label SMI replays per benchmark call

* perf(gfx1250): cover saturated DSv4 MLA decode KV

* perf(gfx1250): sweep DSv4 score-QK decode batches

* perf(gfx1250): cover TP4 inverse RoPE shape

* perf(gfx1250): add M256 blockscale coverage

* perf(gfx1250): add 64K Mega MoE coverage

---------

Co-authored-by: JiaoliangYu <[email protected]>

* [ASM][gfx1250] mla v4 prefill: rebuild the sparse_pfl kernel with the head schedule and the PTL prefetch hazard fixed

Replaces mla_a8w8_qh128_1tg_32mx4_32nx1_sparse_pfl.co (462a5ee0, as shipped by
ROCm#4926) with a build carrying the 09-07/09-08 head work plus one correctness fix.

The correctness fix. The page-table prefetch built its row offset from a VGPR
written by v_writelane_b32 at the end of KV_page_prefetch_build; the consumers
are the two v_lshlrev at the top of KV_page_prefetch_issue, on the far side of
the _s_p_tiles branch with zero VALU in between:

    v_writelane_b32 v4, s60, 0
    s_cmp_eq_u32    s103, 0
    s_cbranch_scc0  label_1028
    v_lshlrev_b32   v2, 9, v4      <- 2 SALU after the write

SCHED_MODE 2 has no VALU->VALU interlock, so the shift could read the stale
register (Q addr-gen leftovers). `stale << 9` off a bounds-free 64-bit base is a
wild address, observed under batched prefill as

    Memory access fault by GPU node-3 ... Reason: Page not present

No numeric test can catch this: a prefetch has no destination register, so the
bad address never reaches a result. Fixed with one s_wait_alu placed before the
branch, covering both the fall-through (extend) and taken (prefix) arms.
+4 bytes; the core loop is byte-identical.

Also in this build, relative to 462a5ee0:
  * head schedule: HEAD_INDPTR_EARLY, HEAD_INDEX_HOIST, HEAD_TDM_SLOT_AWARE
  * HEAD_KV_PTL_* page-table prefetch over tile 0's KV rows
  * the packed-row scale tail mask (448:511 pad), which 462a5ee0 lacks -- that
    pad reads as NaN once the host stops zero-filling it

Source: junxiaguo/my_agent_skills @ 495b486 (0805_base/32mx4_32nx1.sp3).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* support print overlap ratio (ROCm#5311)

* [ASM][gfx1250] mla v4 prefill: update sparse_pfl kernel binary

Replaces the mla_a8w8_qh128_1tg_32mx4_32nx1_sparse_pfl.co binary added in
e566d68 with a newer build.

Validated end-to-end on DeepSeek-V4-Pro (gfx1250, tp4, expert parallel,
dp attention, kv_cache_dtype=fp8, index_cache_dtype=fp8):

  lm_eval gsm8k, full 1319 questions, 3-shot
    flexible-extract  exact_match  0.9507 +/- 0.006
    strict-match      exact_match  0.9500 +/- 0.006

  No memory access faults, page-not-present or HSA_STATUS errors in the
  server log across the full run.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Revert the two sparse_pfl kernel binary updates

This reverts 12f16de ("[ASM][gfx1250] mla v4 prefill: update sparse_pfl
kernel binary") and e566d68 ("[ASM][gfx1250] mla v4 prefill: rebuild the
sparse_pfl kernel with the head schedule and the PTL prefetch hazard
fixed"), restoring
hsa/gfx1250/mla_v4/mla_a8w8_qh128_1tg_32mx4_32nx1_sparse_pfl.co to
462a5ee0 -- the build shipped by ROCm#4926.

No other file is touched; both reverted commits changed only that binary.

The kernel work is being resubmitted against main directly rather than
landing here first.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* [Perf][gfx1250] Use tuned paths in combo benchmarks (ROCm#5323)

* perf(gfx1250): compare MegaMoE modes in one run

* perf(gfx1250): honor tuned backend in a16w16 bench

* perf(gfx1250): add Mori EP inputs and telemetry

* perf(gfx1250): add 16K Mega MoE coverage

---------

Co-authored-by: JiaoliangYu <[email protected]>

* style: satisfy black and ruff checks

* test: keep MLA benchmark entrypoints out of pytest

* test: use architecture fp8 dtype for blockscale gemm

* test: unify FlyDSL grouped GEMM coverage

* test: unify architecture-specific Mega MoE runners

* test: preserve grouped GEMM suites behind arch gates

* bench: default combo output to readable tables

* test: place unified FlyDSL MoE coverage under flydsl tests

* style: remove stale shebangs from merged MoE test

* test: isolate FlyDSL MoE suites by runtime arch

* test: split FlyDSL MoE and grouped GEMM suites

* ci: leave test sharding config unchanged

* test: move grouped GEMM suite under FlyDSL tests

* refactor: move SMI monitor into aiter package

* test: restore readable benchmark summaries

* style: satisfy Black after JSON helper removal

* revert: restore JSON benchmark summaries

* perf: preserve profiler kernel names

* perf: avoid clearing allocator cache per iteration

* fix: address microbenchmark review feedback

* refactor: split benchmark support helpers

Signed-off-by: JiaoliangYu <[email protected]>

* fix: serialize benchmark dtypes as strings

* style: format benchmark reporting helper

Signed-off-by: JiaoliangYu <[email protected]>

---------

Signed-off-by: Double Young <[email protected]>
Signed-off-by: JiaoliangYu <[email protected]>
Co-authored-by: Yu <[email protected]>
Co-authored-by: demonsan <[email protected]>
Co-authored-by: binglue.lyu <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: blyu <[email protected]>
Co-authored-by: Double Young <[email protected]>
Co-authored-by: yanboshao <[email protected]>
Co-authored-by: yadaish <[email protected]>
Co-authored-by: jli-melchior <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: la <[email protected]>
Co-authored-by: junxiaguo <[email protected]>
Co-authored-by: Xin Huang <[email protected]>
Signed-off-by: Xiake Sun <[email protected]>
junhaha666 pushed a commit that referenced this pull request Sep 18, 2026
* [FlyDSL] [gfx1250] Quantize the MoE a1 scale compact and rebuild it in one launch

The stage1 quant pass wrote its e8m0 straight into the 16-row-interleaved WMMA
layout, once per route. That layout spaces a row consecutive blocks wmma_rep*16
dwords apart, so every store landed 4 useful bytes in a 64 B line, and topk
repeated it: at 16384 tokens the scale cost 143 us of a 68 us pass.

#5313 had answered this by letting the quant write row-major and moving the
interleave into gemm1 LDS read. That is the layout #5391 then dropped, because
producer and consumer derived the choice independently and disagreed under EP.
This keeps the single interleaved layout gemm1 reads and fixes the write
instead: one compact row-major row per source token, then a rebuild pass that
walks destination tiles so both its load and its store cover whole lines.

The rebuild cannot run inside the token loop. A cache line of the interleaved
scale spans 16 consecutive grouped rows, which belong to 16 unrelated tokens; no
workgroup owns them, so it needs every token quantized first. A persistent grid
plus a spin barrier buys that ordering without a second launch, reusing the
protocol build_moe_fused_route_psum_quant_scatter_module already uses. Two
blocks per CU: one also works but gives up the cross-block latency hiding, and
measured 93 us against 75.

Falls back to the scattered write when the shape cannot take it -- prequantized
input, EP route counts, a routing the token-multidest quant does not cover, or a
scale row too wide to stage a tile in LDS.

Measured on gfx1250, a4w4, 16384 tokens, 7168/768, E=384, topk=6, no bias
(device time summed over the layer kernels):

  scattered interleaved write   1014 us   quant 143.1
  compact + rebuild, 2 launches  915 us   quant 54.3 + rebuild 7.9 + map 6.1
  compact + rebuild, 1 launch    953 us   quant 75.1

The two-launch form is faster on device and the one-launch form on wall time:
merging the passes saves two launches but the persistent grid costs the GEMMs
after it about 30 us. This ships the single launch; logits_diff is 3.5076e-06 on
all three, unchanged from the scattered write.

Also packs the fallback scattered write into one dword per 4 MX blocks, which
share a destination dword in the interleaved layout too (143.1 -> 142.7 us).

* [FlyDSL] Format the fused MoE quant kernel for black and ruff

Style only, no behaviour change. Four things CI would have caught:

  - black 26.5.1 wants a blank line after two module-level statements the
    branch touched.
  - The LDS-budget environment knob went away with the simplification, and
    took the only use of `os` in this module with it.
  - The fused builder inherited dst_scale_dwords_per_row and its constants
    from the plain one, but its scale destination is the source token row,
    so nothing reads them.
  - Phase 1 closures captured the persistent loop token0, which ruff reports
    as B023 even though the tracer walks the body once. Taking it as a
    parameter binds them to a local and says the same thing more directly.

ruff 0.16.0 and black 26.5.1, the versions pre-checks.yaml pins, are clean on
the five changed files. logits_diff stays 3.5076e-06 and the fused kernel 74.4
us at 16384 tokens; pre- and post-format trees measured 1097.58 us against
1097.58 on the same machine state.

* [FlyDSL] [gfx1250] Address the grouped MoE output past 4 GiB in gather-reduce

The gather-reduce pass read grouped_out through one buffer descriptor covering
the whole tensor, indexed in dwords. Two 32-bit quantities in that scheme break
once the tensor passes 4 GiB, which contiguous_m * model_dim * 2 does at around
48k tokens with topk=6:

  - The descriptor bound was built as an i32 product of dwords and 4. Landing
    in the negative half is harmless -- create_buffer_resource_from_addr sign
    extends to the i64 num_records field, and the hardware reads that as a huge
    unsigned bound -- so the wrap goes unnoticed until it crosses 2**32 and
    lands on a small positive bound instead. At 301056 rows that bound is 20 MB
    and every row past it reads as zero.

  - The buffer offset itself is 32-bit, so even a correct bound cannot reach
    the far end of the tensor.

Folding the grouped row into the 64-bit descriptor base fixes both: the offset
then only has to span one row. The base is loop-invariant, so the address math
runs once per route instead of once per access -- which is also why this is not
slower. A dropped EP route now takes a zero-length descriptor rather than an
out-of-range row, so switching its loads off no longer depends on the bound the
first hunk just changed.

Measured on gfx1250, 7168/3072, E=96, topk=6, logits_diff against the fp32
reference (gate 0.01):

  tokens   before      after
   16384   4.22e-06    4.22e-06
   48128   9.90e-01    4.23e-06
   49152   9.51e-01    4.23e-06
   65536   nan         4.22e-06

a4w4 moves with it: 47104 tokens 9.50e-01 -> 6.65e-06, 65536 nan -> 6.67e-06.
The route-ksplit quant faulted outright at these sizes (Memory access fault on
a page not present); the multidest one only wrote the zeros, because its stores
go through descriptors whose bounds check drops them silently.

bench_gfx1250_combo.py --dsv4 --ops moe now passes all ten token tiers. The
gather-reduce kernel measures 108.3 us against 113.8 at 16384 tokens, a4w4
7168/768 E=384, interleaved over three pairs.

* [FlyDSL] [gfx1250] Split the MoE scale rebuild into its own launch

The compact-scale quant and the WMMA scale rebuild ran as one launch over a
persistent grid of cu_num*2 workgroups, separated by a hand-rolled grid-wide
spin barrier. FlyDSL has no cooperative launch, so nothing makes those
workgroups co-resident, and the barrier deadlocks if even one of them is not:
the others spin forever, the kernel never returns, and the device reads as
100% busy while producing nothing. A serving runtime cannot promise that
residency -- collectives and other streams hold CUs of their own -- so this
only ever held on a benchmark that owned the device.

Launching the two phases back to back on one stream buys the same ordering
from the inter-kernel dependency and assumes nothing about residency. Both
were already grid-stride loops, so a grid that just covers the work leaves
each block one iteration, and each kernel now allocates only the LDS its own
phase uses. The pair is also the faster of the two at prefill sizes, 65.6 us
against 79.4 at 16384 tokens and wmma_rep=2, since the persistent grid slowed
the GEMM behind it.

Below roughly a thousand tokens the pair loses to writing the interleaved
scale inline: the rebuild launch is a fixed cost, while coalescing the scale
write pays off only in proportion to the token count. Gate the compact path on
batch size, with a higher threshold at wmma_rep=1 whose narrower interleave
stride is exactly one cache line:

  inline / pair, us, run_perftest with rotated inputs, fd7168 topk=6 fp4
  wmma_rep=1   512  7.1/11.8   1024  10.7/12.6   2048  18.4/14.4
  wmma_rep=2   512  8.4/12.0   1024  15.3/13.0   2048  23.5/14.8

AITER_FLYDSL_COMPACT_SCALE_MIN_TOKENS overrides the threshold.

Since the two paths fill the same buffer gemm1 reads, they cross-check
bitwise: payload and interleaved scale agree on both sides of the threshold,
at wmma_rep 1 and 2, and with padding tiles exercising the rebuild's
zero-fill. End to end on a4w4 the logits_diff is unchanged at 3.60e-06.

* [FlyDSL] [gfx1250] Reuse the scatter-copy kernel for the MoE scale rebuild

The compact scale path had its own rebuild kernel, but
build_moe_scatter_copy_preshuffle_scale_module already turned a compact
per-token scale plus a grouped-row -> token map into the interleaved layout the
GEMM reads, with the same index math and the same -1 padding rule. Two copies of
one pass, and only ours was outside the oracle test in test_flydsl_moe_aux.

What ours had that the shared one lacked was LDS staging. Written straight out,
adjacent lanes read adjacent grouped rows, so the source side moves one dword
per line; going through LDS lets the load walk a row instead and leaves both
sides on whole lines. Port that over, keeping the direct path for a tile too wide
to stage, since this module also serves gather=False and wider scale rows.

The shared kernel then beats the one it replaces -- 7.9 us against 9.4 at 16384
tokens wmma_rep=2, 7.5 against 8.6 at wmma_rep=1 -- because it takes one tile per
workgroup off a 2D grid rather than a grid-stride loop. Output is bitwise equal
on every shape tried.

Net effect on the layer is a wash, which is expected at 12% of the pair: r1/2048
13.9 us against 14.4, r2/1024 12.8 against 13.0, 16384 unchanged either way.
gemm1/gemm2 stay at 1945/1024 us and logits_diff at 3.6030e-06.

Drops 139 lines: build_moe_scale_rebuild_module, its compile cache, and the
fused_preshuffle_out parameter that selected it. row_to_token now selects the
compact scale on its own, and the caller does the rebuild -- one launch each,
which is what the pair always was.

---------

Co-authored-by: root <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants