Skip to content

feat(plugins): serve aiter's routed GEMM, MoE, MLA and mHC ops through the aiter provider, on aiter main and FlyDSL 0.5 - #271

Merged
zhenhuang12 merged 34 commits into
mainfrom
kyle/aiter-provider-routes
Nov 20, 2026
Merged

zhenhuang12 merged 34 commits into
mainfrom
kyle/aiter-provider-routes

Conversation

@kyle-256

@kyle-256 kyle-256 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Replaces #245, which closed when its base branch was deleted; same head.

Why

ROCm/aiter#8075 and the PRs before it route aiter's GEMM, MoE, MLA and mHC entry points through aiter.plugin. AKLR now serves them as aiter's provider, instead of sglang or vLLM plugin routes that wrap the same aiter functions. The CI baseline moves to that aiter (a6c759b1f), which requires FlyDSL 0.5. FlyDSL 0.5 traces a JitFunction again on every call, so AKLR puts back the per-specialization launch cache that FlyDSL 0.5 dropped.

Scope

  • New selectors: gemm_a16w16, gemm_a16w16_activation, gemm_a8w8_blockscale_out, fused_moe, biased_grouped_topk, mla_decode_fwd, mla_paged_decode, fp8_paged_mqa_logits (with the DSA target-verify regrouping), mla_sparse_prefill_v4, mhc_fused_post_pre, flash_attn_varlen (vLLM's MLA prefill with the lse, fp8).
  • Removed, because the provider serves them now: sglang's aiter_calls.py, vLLM's layers/{fused_moe,gemm,mla,mla_prefill}.py, aiter/{mla,triton_gemm,tuned_gemm}.py, and sglang's aiter_paged_mqa_logits route.
    • sglang's Indexer._get_topk_paged route now only notes a target verify for the provider.
  • Kept as framework routes: sglang's fp8 PS prefill (aiter's mla_prefill_ps receives fp8 Q with a PS plan, and AKLR's contract takes bf16), and vLLM's unified_attention (aiter does not route it).
  • Core changes:
    • aklr/core/jit/flydsl_cache.py: FlyDSLBuilder installs it. For JitFunctions defined in AKLR's kernel packages, each specialization is compiled once with flyc.compile and its CompiledFunction is launched after that. The key is FlyDSL 0.4.2's, built from FlyDSL's own argument signatures.
    • Validation's compile tripwire hooks that cache's miss on FlyDSL 0.5. Hooking _build_call_state tripped on every launch there.

Verification

Environment: head f397f52; MI355X; CI image sglang v0.5.23 (cff45eca) with amd-aiter@a6c759b1f installed as CI does; ROCm 7.15, FlyDSL 0.5.0, Triton 3.8.0. Old stack for comparison: AKLR main with aiter a0c4b69c and FlyDSL 0.4.2.
Gate overrides: none

Code

  • On CPU: tests/plugins and tests/core pass. The 8 that fail here also fail on main: 7 need a ROCm device and 1 depends on the environment. New tests: tests/core/jit/test_flydsl_cache.py (16), plus provider tests for flash_attn_varlen and the DSA verify path.
  • On the new aiter, on GPU:
    • The unit lanes pass, and so do tests/plugins/aiter through the real aiter.plugin (260).
    • aiter.flash_attn_varlen_func on the K3 MLA prefill shapes goes to AKLR; against aiter's bf16 result, output SQNR is 25–27 dB and lse SQNR is 60–70 dB.
  • Host time a call, FlyDSL 0.5.0 with the cache against FlyDSL 0.4.2:
    • mla_prefill_varlen_lse: 145 µs, against 161 µs on 0.4.2 (26 ms without the cache).
    • mla_decode_fwd: 71 µs, against 92 µs on 0.4.2 (352 ms without the cache).
    • Median over the 158 FlyDSL schemas of aklr/ops: 45.5 µs against 50.6 µs. Outputs are bitwise equal between the first (compiling) call and the cached one.
  • The aklr/core change revalidates every schema: the full aklr validate of aklr/ops on both stacks is running, and its workload-by-workload comparison will be posted here.

Not run

  • End to end serving with AKLR_AITER_PLUGIN=1: no deployment image ships an aiter with these routes yet.
  • The DSA verify selector against a measured fp8_paged_mqa_logits_verify: that schema is not measured on main, so AKLR declines it.

Risk

Affects: every FlyDSL kernel (the launch cache and the tripwire, on FlyDSL 0.5 only), and every schema's baseline (aiter a6c759b1f).

  • Before this aiter is in their images, sglang and vLLM no longer reach AKLR on these ops: the framework routes are removed, and the provider needs aiter.plugin.
  • aiter built from git reports a .dev version (0.1.30.dev236), which "aiter": ">=0.1.x" requires does not match. One aklr/ops schema is skipped for it.

@kyle-256 kyle-256 changed the title Kyle/aiter provider routes feat(plugins): serve aiter's routed GEMM, MoE, MLA and mHC ops through the aiter provider, on aiter main and FlyDSL 0.5 Nov 18, 2026
@kyle-256
kyle-256 marked this pull request as ready for review November 19, 2026 03:39
Copilot AI max review requested due to automatic review settings November 19, 2026 03:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

MoE tests skip installed routes, required off/on serving results are missing, and unresolved selection and fallback bugs remain in the provider paths.

7 open issues
What changed in this PR

Moves shared GEMM, MoE, MLA, and mHC integration into AKLR’s aiter provider, replacing duplicate framework wrappers and supporting the newer aiter/FlyDSL stack.

Changes:

  • Adds provider selectors and tests for routed aiter operations.
  • Removes redundant SGLang/vLLM routes and forwards DSA target-verify context to the provider.
  • Updates the aiter pin and adds a FlyDSL 0.5 specialization cache with revised validation hooks.
File Description
tests/​plugins/​vllm/​test_mla_prefill.py Removes tests for the deleted vLLM wrapper.
tests/​plugins/​sglang/​test_hook.py Removes obsolete route registration checks.
tests/​plugins/​sglang/​test_dsa_verify_logits.py Tests forwarding verify context to the provider.
tests/​plugins/​sglang/​test_aiter_calls.py Removes tests for deleted framework adapters.
tests/​plugins/​aiter/​test_routes.py Retains MoE adapter tests; removes GEMM cases.
tests/​plugins/​aiter/​test_provider.py Expands routed-operation contract snapshots.
tests/​plugins/​aiter/​test_provider_moe.py Adds MoE and grouped top-k provider tests.
tests/​plugins/​aiter/​test_provider_mla.py Adds MLA, prefill, mHC, and verify-path tests.
tests/​plugins/​aiter/​test_provider_gemm.py Adds GEMM selector and argument-mapping tests.
tests/​core/​jit/​test_flydsl_cache.py Adds specialization-cache behavior tests.
stack.json Pins the newer aiter revision.
aklr/​plugins/​vllm/​layers/​mla.py Removes the framework MLA decode wrapper.
aklr/​plugins/​vllm/​layers/​mla_prefill.py Removes the framework MLA prefill wrapper.
aklr/​plugins/​vllm/​layers/​gemm.py Removes the framework GEMM wrapper.
aklr/​plugins/​vllm/​layers/​fused_moe.py Removes the framework fused-MoE wrapper.
aklr/​plugins/​vllm/​layers/​__init__.py Stops importing deleted routes.
aklr/​plugins/​sglang/​layers/​dsa_backend/​api.py Replaces logits routing with provider context notification.
aklr/​plugins/​sglang/​aiter_calls.py Removes direct wrappers around aiter calls.
aklr/​plugins/​sglang/​__init__.py Stops registering deleted aiter wrappers.
aklr/​plugins/​README.md Documents provider ownership and routing boundaries.
aklr/​plugins/​aiter/​tuned_gemm.py Removes the superseded tuned-GEMM adapter.
aklr/​plugins/​aiter/​triton_gemm.py Removes the superseded Triton-GEMM adapter.
aklr/​plugins/​aiter/​provider/​topk.py Adds grouped top-k selection and execution.
aklr/​plugins/​aiter/​provider/​moe.py Adds fused-MoE selection and presort cleanup.
aklr/​plugins/​aiter/​provider/​mla.py Adds MLA decode, logits, and verify regrouping.
aklr/​plugins/​aiter/​provider/​mla_prefill.py Adds sparse and variable-length prefill adapters.
aklr/​plugins/​aiter/​provider/​mhc.py Adds fused post/pre mHC support.
aklr/​plugins/​aiter/​provider/​gemm.py Adds tuned, activation, and blockscale GEMM adapters.
aklr/​plugins/​aiter/​mla.py Removes the superseded MLA adapter.
aklr/​plugins/​aiter/​fused_moe.py Extracts reusable MoE argument mapping.
aklr/​plugins/​aiter/​__init__.py Narrows exports after adapter removal.
aklr/​core/​validation/​stages/​_bench/​_evaluation/​_candidate.py Updates compile-tripwire hooks for FlyDSL 0.5.
aklr/​core/​runtime/​builder/​builder.py Installs the cache before building FlyDSL kernels.
aklr/​core/​jit/​flydsl_cache.py Caches compiled launches for AKLR FlyDSL specializations.

Review effort: Max

Comment thread aklr/plugins/aiter/provider/gemm.py Resolved
Comment on lines +272 to +281
from aklr.core.jit import flydsl_cache

hooks: tuple[tuple[object, str], ...] = ((triton_jit.JITFunction, "_do_compile"),)
if flydsl_cache.is_needed():
# from FlyDSL 0.5 every JitFunction call traces again: the first call of a specialization in the
# process is the cache's miss for AKLR's kernels, and a compile for any other
hooks += ((flydsl_cache, "_compile"), (flydsl_jit.MlirCompiler, "compile"))
else:
# before 0.5 FlyDSL builds a specialization's call state on its first call in the process only
hooks += ((flydsl_jit, "_build_call_state"),)
Comment thread aklr/plugins/aiter/provider/mla.py Outdated
_SplitKV,
PersistentSchedule,
) = args
note, _TARGET_VERIFY[0] = _TARGET_VERIFY[0], None
) = args
# AKLR takes the pass vLLM merges over cached context: (output, lse), bf16 rows, no mask but the
# causal one, and an output of its own
if not return_lse or return_attn_probs or dropout_p or logits_soft_cap:
# AKLR's result has no autograd graph; aiter's own path keeps the backward
if torch.is_grad_enabled() and any(t.requires_grad for t in (q, k, v)):
return None
offsets, call = _varlen_call(q, cu_seqlens_q, cu_seqlens_k, softmax_scale, causal)
Comment on lines +223 to +226
def build(self, schema: OpContract) -> Runnable:
"""PythonBuilder's build, the launch cache FlyDSL 0.5 dropped put back first (``aklr.core.jit.flydsl_cache``)."""
flydsl_cache.install()
return super().build(schema)
@kyle-256
kyle-256 force-pushed the kyle/aiter-provider-routes branch from 6d12220 to aca6aa6 Compare November 19, 2026 06:27
@kyle-256 kyle-256 added ci:gpu-direct Run GPU CI directly on aklr-gpu runners and removed ci:gpu labels Nov 19, 2026
Selectors for the three GEMM contracts aiter routes next, in the provider's
gemm module:

- gemm_a16w16 (tuned_gemm: tgemm.mm, gemm_a16w16, gemm_a16w16_out) -> gemm.
  A with three or more dims is viewed as rows and the result viewed back;
  out is viewed to (rows, n) and returned. Declines scale_a/scale_b/scale_c,
  a shuffled B, an out whose dtype is not otype (aiter raises), and an A that
  cannot be viewed as rows (aiter runs F.linear).
- gemm_a16w16_activation (Triton gemm_a16w16) -> gemm, y as out. Declines an
  activation and skip_reduce; config, kernel_type and persistent pick aiter's
  schedule only.
- gemm_a8w8_blockscale_out (Triton gemm_a8w8_blockscale) ->
  gemm_a8w8_blockwise_scaled with operand_format "none:none", y as out.
  Declines skip_reduce, scales other than fp32, and an x_scale that is not
  contiguous (aiter's kernel reads it through its strides; AKLR's row-major
  a_scale is contiguous).

For the Triton ops the output dtype is y's when y is given, as aiter's.
Each run takes aiter's parameters by name and in order.
aiter routes two more MoE ops (ROCm/aiter, branch kyle/aklr-routes-moe):
fused_moe, on the layer beneath its public fused_moe, and
biased_grouped_topk. The provider gains a selector for each.

- fused_moe -> AKLR's fused_moe, through the mapping the sglang and vLLM
  routes of aiter's public fused_moe use, now op_kwargs in
  aklr/plugins/aiter/fused_moe.py. The call arrives with aiter's enums as
  ints and is read back with aiter's enums. Declined: block_size_M other
  than -1, padding, activation scales, biases, the stage-2 scatter (any
  ep_* field), activation quant overrides, herd_topk, deterministic=True,
  and SiTUv2 where aiter would not quantize to fp8. The sorting policy and
  the HERD routing factor alone are not taken.
- A sort a caller registered for aiter's next fused MoE
  (register_presorted_moe) is consumed beneath aiter's route, so the run
  pops it before anything else: left registered, it would apply to the
  next call aiter computes.
- biased_grouped_topk -> AKLR's biased_grouped_topk, whose eight parameters
  are aiter's first eight. Declined: num_valid_rows, dropped groups
  (topk_group != num_expert_group), a bias in another dtype than the
  scores, and one group while aiter routes by HERD
  (AITER_FLYDSL_USE_HERD=1). The run returns None, as aiter's op does.

tests/plugins/aiter/test_provider_moe.py covers both on CPU, with a
stand-in aiter and, where aiter.plugin is importable, aiter's own dispatch.
test_provider.py's contract table does not list the two ops yet, so its
test_each_selector_serves_an_aiter_contract_at_its_version fails until they
are added there.
aiter now routes five more ops through its kernel plugin interface
(kyle/aklr-routes-mla): mla_decode_fwd, mla_paged_decode (the decode mode of
mla_gluon), fp8_paged_mqa_logits, mla_sparse_prefill_v4 and
mhc_fused_post_pre. Each gets a selector that unpacks aiter's call by name,
declines what the AKLR contract does not take, and binds a run with aiter's
parameters.

- mla_decode_fwd -> mla_decode_fwd: the declines of aklr.plugins.aiter.mla,
  plus kv_layout, seq_lens, page_table, kv_csr_layout and return_logits;
  aiter's schedule metadata is ignored. Returns (o, lse).
- mla_paged_decode -> flash_mla_with_kvcache, dense pool: q_nope and q_pe go
  as the one q they are adjacent views of (two tensors apart decline), the
  pool rows as (N, 1, 1, 576), the 2-D table with cache_seqlens or the flat
  one with cu_seqlens_k, a 4-D q as causal queries. The output is copied
  into aiter's o; the lse is dropped unless asked for.
- fp8_paged_mqa_logits -> fp8_paged_mqa_logits: one query a request,
  preshuffled whole pages, no precomputed schedule, logits as wide as the
  block table and as max_model_len; [B, 1] lengths as [B].
- mla_sparse_prefill_v4 -> sparse_prefill_mxfp8, whose baseline is the same
  aiter kernel: the eleven tensors in order (fp8 NoPE as bytes), a sink
  required; the result is copied into out when given.
- mhc_fused_post_pre -> mhc_fused_post_pre: post_layer_mix (T, 4, 1) as
  (T, 4); shuffled fn or residual declines.
ROCm/aiter#7987 added q_aux, kv_aux, nvfp4_params and nvfp4_lse to
mla_decode_fwd as keyword-only parameters. The run takes them by name, and the
selector declines a call that passes any of them: that is aiter's NVFP4 path.
…route

ROCm/aiter#4740 threads the public fused_moe's splitk down to fused_moe_, between bias2 and
swiglu_limit, and aiter#8075 records the routed contract with it. The selector unpacked aiter's
arguments by position, so the 40-argument call no longer unpacked, and every field after bias2 would
have been read one place late.

splitk is a split-K request to aiter's own kernels and moves only the order of the K sums, so AKLR
serves the call whatever it is, as aiter's docstring for the route allows.
ROCm/aiter#8075 now registers mla_paged_decode as a custom op that writes o in place and returns lse
alone, so no result aliases an input; a custom op cannot return None for a tensor, so the op returns an
empty fp32 tensor when return_lse is off. AKLR's run still writes its output into o, and now returns
that lse instead of (o, lse).
…er function aiter routes

sglang's aiter_calls (fused_moe, tgemm.mm, the Triton gemm_a16w16, mla_decode_fwd) and vLLM's layer
routes on the same aiter functions (layers/fused_moe, gemm, mla) wrapped calls that aiter's kernel
plugin interface now offers to AKLR's provider itself, so with both on a call reached AKLR twice.
They go, with the argument mappings only they used (aklr/plugins/aiter/{mla,triton_gemm,tuned_gemm});
the provider serves these ops (fused_moe, gemm_a16w16, gemm_a16w16_activation, mla_decode_fwd) with
the same checks, KV layouts included.
…n_varlen

vLLM's ROCM_AITER_FA MLA prefill backend calls aiter.flash_attn_varlen_func
with the lse, over a step's new tokens and over each context chunk. The vLLM
route on that backend wrapped what is now aiter's routed flash_attn_varlen,
so the provider takes it instead: a selector that hands a bf16, causal or
unmasked pass of at least 256 query rows to mla_prefill_varlen_lse in fp8,
returning aiter's (out, softmax_lse as [heads, tokens]); every other call
stays on aiter. The vLLM route and its tests go.
…'s fp8_paged_mqa_logits

sglang's aiter_paged_mqa_logits calls aiter's deepgemm_fp8_paged_mqa_logits,
which aiter routes as fp8_paged_mqa_logits, and the provider already serves
its row calls. The sglang route on that wrapper goes. What it added, scoring
a target verify's rows by request under DCP, moves into the provider's
selector: the route on Indexer._get_topk_paged now only notes, through
note_target_verify, whether the logits asked next are such a verify's, and
the selector regroups those rows by views for fp8_paged_mqa_logits_verify,
writing aiter's out_logits. Rows it cannot regroup, or a verify AKLR falls
back on, take the row op as before.
…KLR's provider serves

ROCm/aiter#8075 routes flash_attn_varlen, mla_prefill_ps, mla_reduce,
gemm_a8w8_bpreshuffle, causal_conv1d_split_qkv and the two KDA recurrences
through aiter.plugin; #8179 restores the import aiter.fused_moe needs. This
aiter pins flydsl==0.5.0 (a0c4b69c pinned 0.4.2).
A route may not wrap an aiter function aiter routes, nor a framework function that only calls one; a route that runs nothing may note framework state for the provider; aiter functions aiter does not route keep their routes.
FlyDSL before 0.5 reaches _build_call_state on a specialization's first
call in the process only, so the tripwire hooked it to catch a kernel
compiled inside a CUDA graph capture. FlyDSL 0.5 dropped the call-state
cache: every JitFunction call traces again and rebuilds its call state, so
a warmed kernel launched in the capture tripped it, and its runner died as
candidate_crash (mla_decode_fwd_n_heads96 on aiter a6c759b1f). From 0.5 the
tripwire hooks MlirCompiler.compile, which only a compile reaches.
With an aiter that routes the MLA ops itself, routing a stand-in native under the same op name raised 'already routed' at setup (8 errors on aiter a6c759b1f). Those ops keep aiter's route: explain() checks the call against aiter's own contract, and only the test's own routes are called.
…'s kernels on FlyDSL 0.5

FlyDSL 0.5 dropped the call-state cache: every JitFunction call traces the
function again, lowers it and hashes the result before it launches. On
MI355X mla_prefill_varlen_lse's launcher took 24.8 ms a call and
mla_decode_fwd's 320 ms, against 0.16 and 0.09 ms on FlyDSL 0.4.2; aiter
since ca6bc0f85 requires FlyDSL 0.5.

FlyDSLBuilder now installs aklr.core.jit.flydsl_cache before it imports a
kernel: for the JitFunctions an AKLR kernel package defines, the first
call of a specialization goes through flyc.compile and every later one
launches its CompiledFunction. The key is FlyDSL 0.4.2's, from FlyDSL's
own signatures: the invalidating environment, the target, the compile
hints, a Constexpr's value, and each runtime argument's cache signature.
Other FlyDSL callers keep FlyDSL's path. Validation's compile tripwire
hooks the cache's miss on FlyDSL 0.5, the first call of a specialization
in the process, as _build_call_state was before 0.5.
…y mla_decode_fwd_cprr

vLLM's aiter MLA backend verifies draft tokens under decode context parallelism through aiter's
mla_decode_fwd with g_kv_indptr, cp_world_size and cp_rank, every request with max_seqlen_q causal
queries; the provider declined it as not one query a request. mla_decode_fwd_cprr is that call's
contract: q and o as [batch, queries, heads, width] views of aiter's rows, the lse back as a row's.
…ck their contracts

The fixture skipped both dispatch tests whenever aiter routed either op itself, so on the pinned
aiter they never ran. Now an op aiter routes keeps its route, asked with explain() and never run,
and only the others get a stand-in; a new test holds this file's contract snapshot to the
installed routes' versions and positional parameters.
…value

aiter's enums are pybind11's, a new object each lookup, so the identity test declined every
Kimi-K3 MoE call on aiter a6c759b1f (found on MI355X: route native, provider declined). The
stand-in enums of the tests were Python's, the same object each time; a test now uses enums
that compare by value only.
…ecome kernel-less schemas

On MI355X with aiter a6c759b1f, through aiter's provider and against the float64 reference:
- 16fab927 (61-1023 tokens): 1.00-1.04x over aiter, and 17.97 dB where aiter's own fused MoE
  reaches 30.46 dB;
- a5d411fa (1024-16384 tokens): 1.06-1.64x, but 17.97-17.98 dB where aiter reaches 27.98-30.42 dB.
Both pass the contract's 13 dB bound. The three kernels below 61 tokens match aiter (30.1-31.1 dB
both, 44.7-48.0 dB between them) and stay. As #253 did, the two keep their workloads as
kernel-less schemas for another round.
…oe's 13

aiter's own SiTUv2 A4W4 reaches 27.98-31.06 dB against the float64 reference on Kimi-K3's calls
(MI355X, aiter a6c759b1f), and so do the three kernels kept (30.12-31.06 dB). fused_moe's 13 dB let
two kernels 12 dB short of aiter through (17.97 dB); at 25 dB validation stops them.
@kyle-256
kyle-256 force-pushed the kyle/aiter-provider-routes branch from 01a205e to 94d6134 Compare November 19, 2026 10:39
@kyle-256
kyle-256 marked this pull request as draft November 19, 2026 15:45
…ome kernel-less schemas

#271 touches aklr/core, so its CI benches every plugin schema again, and these three have no
workload at 1.05 over sglang's own: kimi_k3_latent_moe 02471a7b (4096-8192 tokens, 0.95-0.99x;
main records 0.98-1.03x) and deepseek_v2_mxfp4_moe 22fee0b1 (24 tokens, 1.01x; main 1.02x) and
f8cbd122 (32 tokens, 0.97x; main 0.99x). As #253 did, their workloads stay as kernel-less schemas.
…59b1f's bpreshuffle takes

From aiter a6c759b1f gemm_a8w8_bpreshuffle's heuristic dispatch takes k > 192 and a multiple of
64, so test_backend_matches_reference failed at the Point's k = 128 (Unsupported K).
@kyle-256
kyle-256 marked this pull request as ready for review November 20, 2026 00:40
@zhenhuang12
zhenhuang12 merged commit 6889594 into main Nov 20, 2026
8 of 9 checks passed
xiaobochen-amd added a commit that referenced this pull request Nov 20, 2026
… aiter a6c759b1f runs

aiter's untuned gemm_a8w8_bpreshuffle pads m and k but not n of a preshuffled b. At k = 256
its heuristic tile is 256 wide, so n = 32 raised "This GEMM is not supported" in aiter-test
since #271; from k = 512 the tile is 32 wide. Checked on MI355X with aiter a6c759b1f: n = 32
fails at k = 256 and passes at k = 512 and 1024.
xiaobochen-amd added a commit that referenced this pull request Nov 20, 2026
… aiter a6c759b1f runs

aiter's untuned gemm_a8w8_bpreshuffle pads m and k but not n of a preshuffled b. At k = 256
its heuristic tile is 256 wide, so n = 32 raised "This GEMM is not supported" in aiter-test
since #271; from k = 512 the tile is 32 wide. Checked on MI355X with aiter a6c759b1f: n = 32
fails at k = 256 and passes at k = 512 and 1024.
zhenhuang12 added a commit that referenced this pull request Nov 20, 2026
…builder's package prefix

Main's flydsl_cache (#271) looked for packages named _aklr_flydsl_*, the old builder's; FlyDSLBuilder
imports a kernel as flydsl_<kernel name>_<hash>, so the cache kept nothing. Main's tests of it and of the
agentx environment are brought under tests/ruff.toml.
zhenhuang12 pushed a commit that referenced this pull request Nov 20, 2026
…he kernels (#293)

* refactor(contract): references, inputs and compare in float32; tie scores for router ids

References compute in float32 and take no decode argument; inputs are drawn,
decoded and encoded through float32; compare measures in float32 (scaled by the
peak against overflow) and compares integer outputs as integers. Integer
outputs come back in their declared dtype, and validation's float64 retry and
DType.FLOAT64 go. A reference module may give <contract>_tie_scores, under which
an id that differs only between two tied candidates passes; qwen2_moe_router
ties its bf16 logits one bf16 step apart.

* refactor(kernels): drop fp64 from the kernels for the float32 references

51 kernel files rewritten without fp64 (deepseek_v2 fp8 MoE, qwen3_next gated
attention, minimax_m2 MXFP4 MoE, qwen2_moe, biased_grouped_topk) and 4
qwen2_moe router+experts files withdrawn. biased_grouped_topk ranks near ties by
the reference's own fp32 key instead of a float64 one.

* refactor(contract): main's new references in float32, without decode

* docs(ops): how to write a reference and a baseline

* refactor(contract): compare router ids by their bf16 logits (id_scores)

* fix(contract): violation fractions as counts, overflow-safe SQNR and stress bounds, exact int8 gemm sums

* refactor(contract): main's KDA references in float32; the KDA chain verify kernel sums its taps in float32

* test(gemm): the preshuffled gemm_a8w8 small Point at k = 512, a shape aiter a6c759b1f runs

aiter's untuned gemm_a8w8_bpreshuffle pads m and k but not n of a preshuffled b. At k = 256
its heuristic tile is 256 wide, so n = 32 raised "This GEMM is not supported" in aiter-test
since #271; from k = 512 the tile is 32 wide. Checked on MI355X with aiter a6c759b1f: n = 32
fails at k = 256 and passes at k = 512 and 1024.
zhenhuang12 pushed a commit that referenced this pull request Nov 20, 2026
…ce past float32, withdraw gemm_n256_k6144/5b35f66b) (#316)

* fix(kda): the chain verify reference past float32's squares and exp(a_log)

Since the reference computes in float32 (#293), two sglang-test edge cases of
test_k31_kernel_edges failed against the committed kernel:

- q and k channels of 2**64: their squares pass float32 while their norms do not.
  The norm now scales by a power of two first, which rounds as unscaled, so it is
  bitwise the same wherever the squares fit.
- a_log = 100, a = dt_bias = 0: exp(a_log) is inf and inf * 0 nan. The gate's
  product is 0 where its factor is 0.

* chore(kernels): withdraw gemm_n256_k6144/5b35f66b, no Point at 1.05 over aiter a6c759b1

main 1fa2eed's aiter-test (run 44685037054, the first full measurement since
#271 moved the baseline to aiter a6c759b1) read 0.43-1.04 over its 13 Points
and failed on no_qualifying_workload. Its last served Point was m 2 at 1.062.
The kernel goes; its 13 Points stay as a schema without a kernel. The case note
pins the file to 1fa2eed.
ChengYao-amd added a commit that referenced this pull request Nov 23, 2026
main's #271 serves aiter's gemm_a8w8_blockscale_bpreshuffle through the
aiter provider (provider/gemm.py), mapped to gemm_a8w8_blockwise_scaled
with operand_format "none:preshuffled" as this branch's route did, and
drops sglang's aiter_calls. The branch's route, its aklr.plugins.aiter
wrapper and their tests go in favour of main's; what remains is the two
b_shuffled Triton schemas (n2048_k2048, n6144_k2048).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kyle-256 added a commit that referenced this pull request Nov 23, 2026
…situv2_a4w4_moe to aklr/ops

aklr/plugins/aiter/fused_moe.py was #160's route on aiter's public fused_moe. Since #271 the provider
serves that call and nothing ran the wrapper; provider/moe.py took only its argument mapping. The mapping
(op_kwargs and its three helpers) moves into provider/moe.py, unchanged; the wrapper, the package's
fused_moe export and test_routes.py go. test_routes.py's mapping tests now test op_kwargs
(test_provider_moe_mapping.py); its declined-argument test was test_provider_moe's DECLINED already.

situv2_a4w4_moe is an op: it moves to aklr/ops with its schemas, unchanged (contract [email protected]),
and its small Point to tests/ops/cases.py.
xiaobochen-amd pushed a commit that referenced this pull request Nov 23, 2026
* refactor(plugins/aiter): only the provider under aklr/plugins/aiter; situv2_a4w4_moe to aklr/ops

aklr/plugins/aiter/fused_moe.py was #160's route on aiter's public fused_moe. Since #271 the provider
serves that call and nothing ran the wrapper; provider/moe.py took only its argument mapping. The mapping
(op_kwargs and its three helpers) moves into provider/moe.py, unchanged; the wrapper, the package's
fused_moe export and test_routes.py go. test_routes.py's mapping tests now test op_kwargs
(test_provider_moe_mapping.py); its declined-argument test was test_provider_moe's DECLINED already.

situv2_a4w4_moe is an op: it moves to aklr/ops with its schemas, unchanged (contract [email protected]),
and its small Point to tests/ops/cases.py.

* refactor(plugins/sglang): drop the aiter MLA prefill and lm_head routes from sglang's layers

aiter_backend_mla_prefill replaced AiterAttnBackend._mla_fp8_prefill_attn_ps and _build_prefill_ps_metadata,
which run aiter's fp8 MLA prefill (mla_prefill_ps, mla_reduce): a route on an aiter call from a framework
plugin. aiter routes these ops, so AKLR serves them through the aiter provider or not at all; the provider has
no mla_prefill_ps selector yet. Until it has, sglang's fp8 MLA prefill runs on aiter, as with AKLR off,
including aiter's fault past 131072 keys a chunk that the route stepped around.

logits_processor_torch_gemm replaced LogitsProcessor._compute_lm_head, the lm_head GEMM of every sglang model:
a generic GEMM in a framework plugin. sglang's layers keep model-specific routes only.

* refactor(plugins/vllm): drop the route on aiter's Triton unified_attention

The route replaced aiter.ops.triton.unified_attention.unified_attention, an aiter function, from the vLLM
plugin. aiter does not route it (it is not among aiter's plugin contracts), so no route of AKLR's takes it
until aiter does; the README's exception for it goes. On stack.json's aiter its five new parameters also failed
the route's signature check, and with it the whole device_ready hook batch, so vLLM did not start with AKLR on.
The unified_attention op and its schemas stay.

* refactor(plugins): drop the routes that swap one aiter call: DeepSeek's MLA core and Muse Spark's experts

sglang's DeepseekMLARocmForwardMixin.forward_absorb_rocm_core route swapped two aiter calls one for one
(mla_kc_rope_cache for fused_fp8_bmm_rope_cat_and_cache_mla, mla_vc for the a8w8 batched GEMM) and called
sglang's attention and o_proj back unchanged. aiter routes neither function. The route, both ops and their
schemas go; the prepare route (mla_qkv_a_norm, qkv_a GEMM with both norms) stays and no longer yields to it.

vLLM's MuseSparkAiterExperts.apply route (muse_spark_moe) wrapped aiter's fused_moe behind one deferred RMSNorm
(_defer_norm). Both routes, the op, its schemas and test go; aiter's fused_moe reaches AKLR through the
provider. The pooler and unpooler route (_torch_linear) stays.

* docs(plugins): the vLLM plugin tutorial on Kimi-K3's attn_res; no route replaces an aiter function

The tutorial's example, Muse Spark's muse_spark_moe and its two routes, is gone: it walks through Kimi-K3's
attn_res instead, a model's own Triton kernel that aiter has no op for, and says what a route may replace.
hook.py's docstring and the plugins README said a route could replace an aiter function inside a vLLM custom
op; neither does any more.

* fix(ops): the moved situv2_a4w4_moe schemas without their measured fields

At their new path the audit's change rule finds no base for them, so the accuracy, speedup and microseconds
they carried read as edits (PERF_EDITED); only CI writes those. CI measures the three kernels again.

* refactor(plugins): keep Muse Spark's fused experts and DeepSeek MLA's absorb kernels

Muse Spark's route stays: its op fuses vLLM's pre-expert RMSNorm (what _defer_norm leaves) into
the MXFP4 experts' gather, one FlyDSL launch doing more than aiter's fused_moe call, so it
replaces a segment, not an aiter function; the plugins README and the vLLM hook say so. Its
contract, 4 schemas and tests are main's, unchanged.

DeepSeek MLA's mla_kc_rope_cache and mla_vc lose their route (each swapped one aiter call that
aiter does not route) but keep their kernels: both contracts move to aklr/ops/mla_absorb
(op_type mla_absorb) with their 7 schemas, without measured fields for CI to measure again. The
aiter provider serves them once aiter routes fused_fp8_bmm_rope_cat_and_cache_mla and its a8w8
batched GEMM.
zhenhuang12 added a commit that referenced this pull request Nov 25, 2026
…builder's package prefix

Main's flydsl_cache (#271) looked for packages named _aklr_flydsl_*, the old builder's; FlyDSLBuilder
imports a kernel as flydsl_<kernel name>_<hash>, so the cache kept nothing. Main's tests of it and of the
agentx environment are brought under tests/ruff.toml.
@kyle-256
kyle-256 deleted the kyle/aiter-provider-routes branch December 3, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:gpu-direct Run GPU CI directly on aklr-gpu runners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants