Skip to content

[FlyDSL] [gfx1250] Launch the GEMM and grouped-MoE kernels through the AOT cache - #8678

Merged
coderfeli merged 1 commit into
mainfrom
feat/flydsl-aot-gfx1250-port
Nov 30, 2026
Merged

coderfeli merged 1 commit into
mainfrom
feat/flydsl-aot-gfx1250-port

Conversation

@coderfeli

@coderfeli coderfeli commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #8565 and #8600, on main. Supersedes #8567 and #8777 (closed).

What

The gfx1250 FlyDSL GEMM kernels, and the kernels the grouped MoE rows reach, traced on their first call in every process. The replays (aiter.aot.flydsl.gemm, aiter.aot.flydsl.moe) compiled them, but nothing launched through the AOT cache, so a launch could load none of it. They now launch through FlyDSLAotCache, like the gfx942/gfx950 launchers: a launch loads the entry a prebuild wrote and otherwise takes the JIT path as before.

Cache Kernel / wrapper How
gemm_a16w16_gfx1250 gemm_a16w16_gfx1250.gemm_a16w16 existing cached factory becomes an aot_factory; .lazy()
gemm_a16w16_tdm_gfx1250 gemm_a16w16_tdm the same; the factory takes a torch.device instead of a device index, so one entry on disk serves every device
gemm_a8w8_gfx1250, gemm_a8w8_256x256_gfx1250 mxfp8_bpreshuffle_gemm_gfx1250, bpreshuffle_gemm_gfx1250, batched_gemm_a8w8_gfx1250 a factory with no argument per launcher; constexprs in specialization_key
gemm_a8w8_splitk_reduce_gfx1250 the first two wrappers above a factory of its own, apart from the ASM GEMM's use of the kernel
gemm_a4w4_gfx1250, gemm_a4w4_256x256_gfx1250 a4w4_mxscale_bpreshuffle_gemm_gfx1250 a factory with no argument per launcher
grouped_gemm_a8w4_tdm_gfx1250 launch_gemm_a8w4_tdm, the grouped GEMM bind_aot in the kernel file; the launch already passes every constexpr in specialization_key
moe_fused_quant_preshuffle_route_ksplit build_moe_fused_quant_preshuffle_route_ksplit_module aot_factory on the builder; the wrapper's getter returns builder.lazy(...)
moe_gather_reduce build_moe_gather_reduce_module the same
  • The a8w8 and a4w4 launchers are module-level @flyc.jit functions bound by the wrappers' _lazy_import; there was no factory to decorate, which is why those diffs are larger than a gfx950 conversion. Their factories import the kernel module, so a hit skips that import (about 0.7 s for each a8w8 module).
  • The grouped-MoE caches are created in the kernel files, not in grouped_moe_gfx1250.py / moe_kernels.py: the file that creates a cache is one of its sources, and those wrappers read a dozen host-side variables (debug switches, table paths) that would then have to be inputs of the entries.
  • Constexpr launch arguments that come from callers (the mxfp8 flags, the grouped GEMM's specs) are coerced to one type: the cache compares their values, so False and 0 under one key would raise.
  • preload_a4w4_kernel preloads the bound launcher under the key its launches look up.
  • Sources and variables of the ten caches are declared in aiter/aot/flydsl/sources.py.
  • Only AOT-related code changes; no kernel computation changes. aot_cache.py, aot_launch.py and tensor_shim.py are untouched.

Not in this PR

  • No replay prebuilds them, so they stay on the JIT path: the gfx1250 attention kernels (fmha, MLA, PA decode), the gather projection, the ASM GEMM's split-K reduce, and the other kernels of the grouped rows (route maps, contiguous prefix sums, token multi-destination quant, scatter copies; 8 builders with fewer specializations each).
  • An EP launch of the grouped GEMM bakes its arena handle, a value of the process, so no prebuild can write its entry: it traces as before, and logs the error of a missing entry once per config in each process.

Validation

Compile-only for gfx1250 on a gfx942 host (FlyDSL 0.5.3). The host has Python 3.10 / Triton 3.7 / torch 2.8, so the tree was imported with a local placeholder for gl.amd.cdna5; only FlyDSL code ran.

  • ruff==0.16.0 and black==26.10.1 pass on the changed files.
  • tests/test_flydsl_aot_launch.py and tests/test_flydsl_aot_replay.py: 60 passed, including the checks that the table matches the caches created and that every cache declares the kernel files and variables its sources use. The 4 cases of test_a_split_k_tdm_gemm_replay_reaches_flydsl fail on this host, on main as well: torch.cuda.stream() of torch 2.8 reaches the GPU runtime under the dry run.
  • GPU_ARCHS=gfx1250 python -m aiter.aot.flydsl.gemm on 41 tuned rows (plain bpreshuffle, mxfp8_32 general and compute-bound, a4w4 general and compute-bound, bmm mxfp8_128, bf16): 41 ok. A second run writes nothing; verify and mode 0 pass. (5 fused-quant variants of the bmm rows are refused by the runtime in every mode, as on main.)
  • GPU_ARCHS=gfx1250 python -m aiter.aot.flydsl.moe on 44 rows of the grouped tables (232 jobs): 87, 21 and 21 objects for the three grouped-MoE caches. A second run writes nothing; verify and mode 0 pass.
  • gemm_a16w16_tdm under dry_run("gfx1250", 256), with torch.cuda.stream stubbed for the reason above: one object; a second run writes nothing; verify passes.
  • preload_a4w4_kernel in a prebuild writes the entry; the launch of that config then writes nothing.
  • No launch took the JIT path in these runs.

Not run on gfx1250 hardware at this revision.

A launch with no entry traces with one error per key, as for every converted launcher: a tuner's candidates (run tuners under AITER_FLYDSL_AOT_CACHE=0) and shapes with no tuned row.

🤖 Generated with Claude Code

@coderfeli
coderfeli requested a review from a team November 25, 2026 10:24
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

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

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

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

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

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

@aiter-bot

aiter-bot commented Nov 25, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 45db59135e9e · 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 is the most important boundary or failure mode introduced by this change, and what evidence covers it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

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

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer

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

@zufayu
zufayu requested a review from aoli26 November 26, 2026 02:48
@coderfeli
coderfeli force-pushed the feat/flydsl-aot-gfx1250-port branch from 5ddfea0 to 1378944 Compare November 26, 2026 07:04
@coderfeli
coderfeli changed the base branch from main to feat/flydsl-aot-remaining-gfx9 November 26, 2026 07:05
Base automatically changed from feat/flydsl-aot-remaining-gfx9 to main November 26, 2026 14:25
@coderfeli
coderfeli force-pushed the feat/flydsl-aot-gfx1250-port branch 2 times, most recently from 55a9534 to 3a9ca3e Compare November 26, 2026 15:08
@coderfeli
coderfeli force-pushed the feat/flydsl-aot-gfx1250-port branch from 3a9ca3e to a63a784 Compare November 27, 2026 09:39
@coderfeli coderfeli changed the title [FlyDSL] [gfx1250] Launch the GEMM kernels through the AOT cache [FlyDSL] [gfx1250] Launch the GEMM and grouped-MoE kernels through the AOT cache Nov 27, 2026
…e AOT cache

The gfx1250 FlyDSL GEMM kernels, and the kernels the grouped MoE rows
reach, traced on their first call in every process. The replays
(aiter.aot.flydsl.gemm, aiter.aot.flydsl.moe) compiled them, but nothing
launched through the AOT cache, so a launch could load none of it. They
now launch through FlyDSLAotCache, like the gfx942/gfx950 launchers: a
launch loads the entry a prebuild wrote and otherwise takes the JIT path
as before.

GEMM:
- gemm_a16w16 and gemm_a16w16_tdm already had a cached launcher factory:
  it becomes an aot_factory and the launch uses factory.lazy(). The TDM
  factory takes a torch.device instead of a device index, so that one
  entry on disk serves every device.
- The a8w8 (mxfp8, plain bpreshuffle, batched) and a4w4 launchers are
  module-level @flyc.jit functions with constexpr launch arguments, bound
  by the wrappers' _lazy_import. Each gets a factory with no argument
  that imports its kernel module; the constexprs stay in
  specialization_key. A hit then skips the kernel module's import (about
  0.7 s for each a8w8 module). The a8w8 split-K reduce gets a factory of
  its own, apart from the ASM GEMM's use of the same kernel, which no
  replay prebuilds.
- preload_a4w4_kernel preloads the bound launcher under the key its
  launches look up.

Grouped MoE (the three kernels with the most specializations):
- launch_gemm_a8w4_tdm, the grouped GEMM: bind_aot in the kernel file.
  The launch already passes every constexpr in specialization_key.
- build_moe_fused_quant_preshuffle_route_ksplit_module and
  build_moe_gather_reduce_module: aot_factory on the builder; the
  wrappers' cached getters return builder.lazy(...).
- These caches are created in the kernel files, so that the host-side
  variables the wrappers read (debug switches, table paths) are not
  inputs of the entries.

Constexpr launch arguments that come from callers (the mxfp8 flags, the
grouped GEMM's specs) are coerced to one type: the cache compares their
values, so False and 0 under one key would raise. Sources and variables
of the ten caches are declared in aiter/aot/flydsl/sources.py.

Only AOT-related code changes; no kernel computation changes. Left on
the JIT path, since no replay prebuilds them: the attention kernels
(fmha, MLA, PA decode), the gather projection, the ASM GEMM's split-K
reduce and the other kernels of the grouped rows. An EP launch of the
grouped GEMM bakes its arena handle, a value of the process: it has no
entry and traces as before, with the error of a missing entry.

Validated compile-only for gfx1250 on a gfx942 host: both replays
prebuild, a second run writes nothing, verify and mode 0 pass. Not run
on gfx1250 hardware at this revision.

Co-Authored-By: yadaish <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
@coderfeli
coderfeli force-pushed the feat/flydsl-aot-gfx1250-port branch from a63a784 to 45db591 Compare November 27, 2026 10:28
@coderfeli
coderfeli merged commit eaac683 into main Nov 30, 2026
61 checks passed
@coderfeli
coderfeli deleted the feat/flydsl-aot-gfx1250-port branch November 30, 2026 03:06
lirui927 pushed a commit to lirui927/aiter that referenced this pull request Nov 30, 2026
…umer

main (ROCm#8678) launches the GEMM and the split-K reduce through the AOT cache launchers; _launch_splitk_reduce takes splitk_reduce_launcher the same way.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
XiaobingSuper added a commit to XiaobingSuper/aiter that referenced this pull request Nov 30, 2026
…e AOT cache

The mxfp8_32 B = 1 kernels the tuned rows select (weight streaming,
decode, balanced decode, full M) still launched on the JIT path: the
gfx1250 replay compiled them but wrote no entry, and every process
traced them on their first call. Each launcher now has an aot_factory
with no argument that imports its kernel module, as the a8w8 launchers
of ROCm#8678 do, and the launch uses factory.lazy(). Every constexpr was
already in specialization_key, with one type.

The specialization keys held the device index. They hold the
torch.device now: in memory it keeps one launcher per device, as the
JIT path needs, and on disk only its type, so one entry serves every
GPU.

The four caches and their sources are declared in
aiter/aot/flydsl/sources.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
aoli26 added a commit that referenced this pull request Nov 30, 2026
Conflicts resolved (all from #8678, AOT-cache launchers):
- mxfp8 and plain bpreshuffle wrappers: keep this branch's launch arguments
  (runtime cluster_m, c_pad, quad_early, no_loop_cbar, rank0) and launch
  through gemm_a8w8_launcher.lazy(), _gemm_a8w8_compute_bound_launcher.lazy()
  and splitk_reduce_launcher.lazy(); keep both import lists.
- Normalize c_pad, quad_early, no_loop_cbar and fused_splitk to int/bool like
  main's other constexprs: the AOT key compares them by value.

Merged cleanly but needed changes:
- aot/flydsl/sources.py: gemm_a8w8_gfx1250 also lists
  splitk_fused_epilogue_gfx1250.py, which the generic kernel now imports.
- test_gemm_a8w8_mxfp8_bpreshuffle.py: count reduce launches through
  splitk_reduce_launcher.lazy (_compile_splitk_reduce is gone).
aoli26 added a commit that referenced this pull request Nov 30, 2026
Conflicts resolved (all from #8678, AOT-cache launchers), as in #8246's merge
94fefb8:
- mxfp8 and plain bpreshuffle wrappers: keep this branch's launch arguments
  and launch through gemm_a8w8_launcher.lazy(),
  _gemm_a8w8_compute_bound_launcher.lazy() and splitk_reduce_launcher.lazy().
  The compute launch keeps bounded_n and a_scale_unaligned in
  specialization_key; _lazy_import also binds tensor_shim.data_ptr.

Merged cleanly but needed changes (taken from #8246's merge):
- aot/flydsl/sources.py: gemm_a8w8_gfx1250 also lists
  splitk_fused_epilogue_gfx1250.py, which the generic kernel imports.
- test_gemm_a8w8_mxfp8_bpreshuffle.py: count reduce launches through
  splitk_reduce_launcher.lazy (_compile_splitk_reduce is gone).
XiaobingSuper added a commit to XiaobingSuper/aiter that referenced this pull request Dec 2, 2026
…e AOT cache

The mxfp8_32 B = 1 kernels the tuned rows select (weight streaming,
decode, balanced decode, full M) still launched on the JIT path: the
gfx1250 replay compiled them but wrote no entry, and every process
traced them on their first call. Each launcher now has an aot_factory
with no argument that imports its kernel module, as the a8w8 launchers
of ROCm#8678 do, and the launch uses factory.lazy(). Every constexpr was
already in specialization_key, with one type.

The specialization keys held the device index. They hold the
torch.device now: in memory it keeps one launcher per device, as the
JIT path needs, and on disk only its type, so one entry serves every
GPU.

The four caches and their sources are declared in
aiter/aot/flydsl/sources.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
XiaobingSuper added a commit to XiaobingSuper/aiter that referenced this pull request Dec 3, 2026
…e AOT cache

The mxfp8_32 B = 1 kernels the tuned rows select (weight streaming,
decode, balanced decode, full M) still launched on the JIT path: the
gfx1250 replay compiled them but wrote no entry, and every process
traced them on their first call. Each launcher now has an aot_factory
with no argument that imports its kernel module, as the a8w8 launchers
of ROCm#8678 do, and the launch uses factory.lazy(). Every constexpr was
already in specialization_key, with one type.

The specialization keys held the device index. They hold the
torch.device now: in memory it keeps one launcher per device, as the
JIT path needs, and on disk only its type, so one entry serves every
GPU.

The four caches and their sources are declared in
aiter/aot/flydsl/sources.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gbyu-amd pushed a commit that referenced this pull request Dec 3, 2026
…15808c7, head 2026-11-19T10:14:52Z)

Applied as the diff ce334d0..15808c7 (26 files) onto the rebased 1116 tree; PR state: open, author aoli26, base main.

Squash-applied: #8246's branch merges main (ce334d0, this tree's base) and carries rebased copies of aoli26's
#7827 (head 9d38b5c, every added line present here) and #7868 (head 570805d; 3 of its added lines
are superseded by #8246's later edits), so this one diff applies the #7827 -> #7868 -> #8246 stack as #8246 has it.

(cherry picked from commit f58bb7e)

Rebase onto main 12-03: kept at the 15808c7 snapshot (the PR head is now c4f8a6d, see the rebase report). Main's #8678 (AOT launchers) and #7449 (deferred split-K partials) conflict with it in the two wrappers: bpreshuffle_gemm_gfx1250.py takes both fused_splitk and main's partials (a launch with partials runs unfused, main's _launch_splitk_reduce / reduce_splitk_partials_gfx1250 kept, skipped when fused); mxfp8_bpreshuffle_gemm_gfx1250.py keeps fused_splitk_ok (generic kernel included) and launches gemm_a8w8_launcher.lazy() with this PR's argument layout (arg_out, runtime cluster_m, fused_splitk). Same as the PR author's own merge of main, without the later lean_stripe_fits guard. aiter/aot/flydsl/sources.py: the gemm_a8w8_gfx1250 cache now also hashes kernels/splitk_fused_epilogue_gfx1250.py, which the kernel imports (as on the PR head).

Rebase onto main 12-03: op_tests/test_gemm_a8w8_mxfp8_bpreshuffle.py counts reduce launches through splitk_reduce_launcher.lazy (main #8678 replaced _compile_splitk_reduce), as on the PR head.
gbyu-amd pushed a commit that referenced this pull request Dec 3, 2026
#8978)

* K3 TP1 a8w8 GEMM: compute N tail, underfilled tiles, aligned A-scale loads, retuned rows (#8778 @ ea7a5d8)

#8778 (aoli26; base main; open) applied to k3-455-dev as its net change on its 19 files at head
ea7a5d8 (2026-11-26T14:47:07Z), 3-way against the PR's main base adbb6ac. The 8 files k3-455-dev had
changed (all only by #8246 @ 15808c7) take the PR's version, so all 19 files equal the PR head. It
carries the newer #8246 (ccc4270), the table PRs #8579 / #8586 / #8601 and main's #8566 (its compute
guard, which #8778 replaces); no other main change rides in.

Validated in the K3 1P1D integration branch (aiter zejun/k3-455-dev 627e1eb) on 16 MI455X
(wuhuikx/LLM-Booster#578). The PR head has moved on since (204ce9d: merges of #8246 @ 0d6cf15 and of
main, which brings #8737); those can follow when #8778 lands.

Co-authored-by: zejunchen-zejun <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Update K3 FP8 kernels to c997 and add exact-M tuning

Preserve the existing dev wrappers and bucket tables. Add 162 accepted retuned exact configurations and 3 c997-default compatibility records, with CPU dispatch coverage for all 675 measured points. Backport the three kernel files from c99781c without merging main history. Integrated-head GPU validation remains outstanding.

---------

Co-authored-by: aoli26 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zhang <[email protected]>
(cherry picked from commit 1cc9d02)

Rebase onto main 12-03: the 19 files keep this commit's content; only main's later changes are added: the AOT launcher factories of #8678 (mxfp8 / batched wrappers launch gemm_a8w8_launcher.lazy(), _gemm_a8w8_compute_bound_launcher.lazy(), splitk_reduce_launcher.lazy(); _lazy_import keeps _data_ptr), #7449's deferred split-K entry points and #8636's ragged-K fallback. gemm_a8w8_gfx1250.py: this commit's rank0 split-K epilogue and flush_addr (it already carries #8737's flush). gemm_op_a8w8.py: main's #8566 guard in get_mxscale_bpreshuffle_config (no padded row below a compute kernel's M tile) is removed, as on the #8778 head, because the c997 compute kernel serves underfilled tiles; test_gemm_host_dispatch_cache.py takes #8778's test_mxscale_compute_row_serves_underfilled_m_tile in place of main's two guard tests. kimik3 mxscale tuned CSV: this commit's rows (626 changed or added) replayed by key; the result equals this commit's table.

Rebase onto main 12-03: main #7449 moved the bpreshuffle row lookup into _bpreshuffle_config(XQ, WQ); this commit's Kimi-K3 exact-row lookup there needs x_scale, w_scale and Y, so _bpreshuffle_config takes them (the deferred split-K path passes a meta tensor of the output's shape and dtype, so it picks the same row as gemm_a8w8_bpreshuffle).

Rebase onto main 12-03: op_tests/test_gemm_a8w8_mxfp8_bpreshuffle.py counts reduce launches through splitk_reduce_launcher.lazy (main #8678 replaced _compile_splitk_reduce).
yhl-amd added a commit to yhl-amd/aiter that referenced this pull request Dec 4, 2026
A shared expert whose down projection reads MXFP8 runs the gate_up GEMM
(bf16 [M, 2I]), silu_and_mul and quantize_fp8 as three launches. The
batched mxfp8_32 gfx1250 kernel now applies the SwiGLU before its fused
group-32 MXFP8 epilogue, so the three become one GEMM.

Kernel (kernels/gemm_a8w8_gfx1250.py), new fuse_act_mul / act_limit
constexprs (batched mxfp8_32, 32x32 B scale, fuse_quant_out, no K tail):
- B is the unmodified [gate; up] weight. Each CTA gathers its tile_n B
  rows, and their scale rows, as tile_n/64 blocks of [32 gate rows, the
  matching 32 up rows] through one nested TDM view, so a wave's 64 columns
  hold gate and up of the same 32 outputs in the same lanes.
- The epilogue rounds the accumulators to bf16 and forms
  bf16(silu(bf16(min(g, L))) * clamp(u, -L, L)) as aiter silu_and_mul
  does (L = 0: no clamp), then quantizes each 32-column group with ROCm#7667's
  emit_mxfp8_acc_pair_to_lds / emit_mxfp8_scale_rows_store; only the e4m3
  TDM store stays local, shared with the accumulator-quant epilogue.
- Against the bf16 GEMM + silu_and_mul + quantize_fp8 chain, a SwiGLU
  value can sit one bf16 step from silu_and_mul's (exp/rcp rounding), so
  an e4m3 code can differ by one step; where that value is its group's
  amax at 448 * 2**k, the group's e8m0 scale moves by one instead (and so
  all 32 codes).
- The kernel name gets a _silu<limit>q suffix, so it never collides with
  the plain GEMM; fuse_act_mul defaults to off.

Host (batched_gemm_a8w8_gfx1250.py):
- run_gate_up_silu_mxfp8_32_gfx1250: the raw launch. Operand dtypes,
  strides, shapes, devices, alignment, the limit and the kernel name are
  checked before the arch check; the e8m0 x_scale / w_scale checks run
  after it. swiglu_limit is read as the f32 silu_and_mul receives.
  kernel_name=None picks the tile from the runtime row count.
- gate_up_silu_supported(n2, k): gfx1250 with the measured CU count at
  the measured [2I, K]; independent of the row count.
- gate_up_silu_kernel_for(m, n2, k): the table tile for the measured
  device and shape only, else None. A host helper for code that sees the
  real row count; not for branching in a traced forward.
- The table tiles end in _pl (the pipelined K loop).

Op (batched_gemm_op_a8w8.py): functional registered op
gate_up_silu_mxfp8_32 (mutates_args=[]) that picks the tile from the
runtime row count and returns the e4m3 / e8m0 outputs.

Tests: op_tests/test_flydsl_gate_up_silu_host.py (CPU: gating, picker,
limit and operand validation, functional op under fullgraph dynamic
shapes) and test_gate_up_silu_fused in op_tests/test_flydsl_batched_gemm.py
(gfx1250: every tile bucket, limits 10, 0 and 5.02, vs the unfused chain).

Rebased onto main: the launch goes through gemm_a8w8_launcher.lazy(), the
AOT-cache factory ROCm#8678 put in place of the module-level launcher.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants