Repository navigation
Description
Following up on the conversation about offering these kernels through AITER's
plugin interface — the README says you plan to, and I went through this
repository to work out what that actually costs you. Short answer: one new
file, and one extra column in benchmarks you already run. No kernel changes,
no API changes, nothing about how vLLM calls you today.
Writing this as an issue here rather than sending a doc, so the details stay
next to the code they describe.
What does not change
from amd_kernels.norm.gemma_rmsnorm_bf16_mxfp8_h6144.host import gemma_rmsnorm_mxfp8
gemma_rmsnorm_mxfp8(x, weight, eps, code_tile_rows, bf16_out=True)This keeps working exactly as it does now. Going through AITER adds a second
path, it does not replace the first. Your day-0 cadence is not something we want
to put behind our review cycle — a kernel written the week a model lands should
ship the week a model lands.
What you add: one file
# amd_kernels/aiter_provider.py
from aiter import plugin
from amd_kernels.norm.gemma_rmsnorm_bf16_mxfp8_h6144.host import gemma_rmsnorm_mxfp8
def _rmsnorm(input, weight, epsilon, use_model_sensitive_rmsnorm=0):
"""Translate AITER's contract parameters into your kernel's. A few lines."""
return gemma_rmsnorm_mxfp8(
input, weight, epsilon, code_tile_rows=..., bf16_out=True
)
class Provider:
name = "amd_kernels"
api_versions = {plugin.API_VERSION}
op_versions = {"rmsnorm": {2}} # AITER's contract name, not yours
def select(self, op, args, kwargs):
"""Decide whether to serve THIS call. Pure, no launch."""
if not on_gfx950():
return None # your existing predicates
if args[0].shape[-1] != 6144:
return None # shape specialisation lives here
return plugin.KernelCandidate(
provider="amd_kernels",
kernel_id="gemma_rmsnorm_mxfp8",
artifact_digest="...",
run=_rmsnorm,
latency_us=4.2, # see "the one new thing" below
baseline_us=7.8,
baseline_path="aiter rmsnorm",
measured_under={"mode": "graph replay", "rounds": 100},
measurement_ref="benchmarks/norm/gemma_rmsnorm.py",
)Plus one entry point:
[project.entry-points."aiter.plugins"]
amd_kernels = "amd_kernels.aiter_provider:Provider"Installing it does nothing on its own — a framework has to enable it. That is
deliberate: a provider arriving as somebody's transitive dependency must not be
able to change which kernels run.
Your supports_* go straight in
select() is exactly the question your predicates already answer. I wired two
of yours into a select() without rewriting either:
supports_nvfp4_sparse_prefill(16, 1, 128, 16, 128) -> False
supports_qkv_norm_rope_insert(qkv, cos_sin, None) -> False
(on a gfx942 box, so False is the right answer). The provider declined, the
call went native, explain() reported the decline. rope_blocker,
insert_blocker, layer_blocker and the rest fit the same way — they are
relocation, not new work.
Shape specialisation is not a problem either. Your root README says the host
code picks the variant by shape, and gemm/mxfp8_common already does that
selection. AITER's contract carries no shape: select() reads x.shape and
returns None when nothing matches. If shapes went into the contract you would
need one contract per shape, which is the arrangement that does not survive the
next model.
Where your packages land
Going through the 34 packages against AITER's 23 contracts:
| count | what to do | |
|---|---|---|
| already match an AITER contract | ~20 | implement select(), nothing on our side needed |
| no contract yet, but one launch | ~7 (sampling, embedding, activation) | we add a contract from your signature |
| not a single launch | ~7 (6 collectives, the sparse-attention layer object) | stays where it is — see below |
The collectives/ packages hold IPC pools, span ranks and have
warmup/close lifecycles. A contract is "a caller passes inputs and gets
outputs", and they are not that. nvfp4_sparse_layer is orchestration over
kernels that are each contract-shaped on their own. We are not going to pretend
otherwise and then discover it does not fit.
The closest pair I checked parameter by parameter —
mxfp8_qkv_norm_rope_nvfp4_insert against AITER's sp_qkv_fused — matched on
19 of 23 arguments. The real differences are packing (qkv as one tensor vs
q, k, v; one cos_sin_cache vs two; one kv_cache vs k_cache, v_cache) and
one genuinely missing parameter, index_slot_mapping, which we will add.
The one new thing: a baseline column
For a reported measurement to be usable, it has to say what it was measured
against:
latency_us=4.2,
baseline_us=7.8,
baseline_path="aiter rmsnorm",
measured_under={"mode": "graph replay", "rounds": 100},
measurement_ref="benchmarks/norm/gemma_rmsnorm.py",Of your 34 packages, 24 already publish a full table with conditions — rounds,
cold weights, graph replay, median. 7 of them compare against AITER. The
rest compare against another variant of your own, which is a real measurement
but not one we can act on: it says the fused form beats the unfused form, not
whether it beats what AITER would have run.
All four fields or none: a latency without a baseline says a kernel took 4.2us
and leaves open whether AITER would have taken 3 or 30. An incomplete report is
not an error and not a rejection — the candidate is still selectable, it just
does not take part in the comparison.
One thing to know about the baseline itself
AITER's MXFP8 tuning tables are empty. a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv
and its siblings have zero rows, so those shapes run the flydsl bmm heuristic
rather than a tuned row. That is what your numbers are currently measured
against — your own tables name it, generic AITER fallback and AITER any row.
We are filling those tables, and when we do, those baselines move. Not a
reason to wait: a baseline is a measurement of what AITER runs at a point in
time, and measured_under plus measurement_ref are in the report precisely so
a number carries when and how it was taken. Re-running a column in a harness you
already have is cheap; blocking on us is not. We will say when the tables land,
so you can re-measure deliberately rather than discovering it.
Two traps, both found the hard way
1. run must not call the public AITER name that routes to it.
from aiter.ops.rmsnorm import rms_norm_cu # correct
import aiter; aiter.rms_norm(...) # RecursionErrorThe public name is the one dispatch came through, so it re-enters routing,
reaches your provider again, and recurses until the stack ends. Call the
binding below the routed layer. A provider with its own kernel never meets this;
one that starts as a wrapper meets it on the first call. I hit it writing the
tests.
2. Measure what the parameter translation costs.
Your qkv is packed where the contract takes q, k, v; your cos_sin_cache is
one tensor where it takes two. If the regrouping is a view or a slice it is
free. If it copies, it spends exactly the margin you were selected for.
Measure it rather than assuming — and if an adapter turns out to cost real time,
tell us: the contract should grow an optional parameter for the other packing
rather than you paying for a copy on every call.
Today vs. after the pending PR
You can start now. The provider file, the supports_* relocation and the
entry point all work against AITER as it ships today. A provider that reports
nothing is selected by the framework's enable order, which is the behaviour that
exists now.
Pending in ROCm/aiter#8081 (not merged):
latency_usplus a baseline selects among enabled providers, instead of
being recorded and ignored;configure(exclude=("amd_kernels:rmsnorm",))so a framework that finds one
kernel unfit can stop that one rather than every provider;- a provider-served exception carries
provider/kernel_id, so a failure
reads as yours rather than as AITER's; plugin.validate("amd_kernels")andplugin.check_report(candidate)— a
check of your wiring that runs no kernel. It catches the mistakes you cannot
otherwise see: an op name that AITER does not route produces no error and no
routing, which looks exactly like declining correctly.
So the measurement fields are worth filling in now even though nothing reads
them yet — and nothing in the list above needs to land before you start.
What we are doing on our side
- #8081 (above), in review;
sp_qkv_fusedgainsindex_slot_mappingso your fused QKV path fits;- contracts for the ~7 packages that have none, from your signatures — your
reference.pyfiles are already the torch reference we would ask for; - filling the MXFP8 tuning tables.
Happy to go through any of this on a call, or to take the first provider file as
a PR here and work through it in review — whichever is less work for you.
Activity
zufayu commentedon Nov 17, 2026
Correction: AITER's MXFP8 tables are not empty, and yours are in them
I got a fact wrong above and it matters for how you read your own numbers, so
correcting it here rather than quietly editing.
I wrote "AITER's MXFP8 tuning tables are empty". The tables I looked at —
aiter/configs/a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csvand itssiblings — do have zero rows, but they are templates. The real tuning data
lives per model in
aiter/configs/model_configs/, andjit/core.pymergesevery matching per-model CSV with the canonical one at load:
And there is a MiniMax-M3 table:
Against your package names:
gemm/mxfp8_n2560_k6144(QKV projection)gemm/mxfp8_n6144_k2048(attn output projection)gemm/mxfp8_n6144_k8192(full output projection)gemm/mxfp8_gateup_swiglu_n6144_k6144_i3072mxfp8_common's tableEvery shape you benchmarked has tuned rows on gfx950.
What this changes for your numbers
Your tables name the baselines
AITER any rowandgeneric AITER fallback.generic AITER fallbackis the bmm heuristic — the path taken when no tunedrow matches. If that is what you measured against on these shapes, then the
comparison was against AITER with its MiniMax-M3 table not loaded, which is a
configuration rather than a result.
Worth checking on your side, because it decides what the 19–62% means:
aiter/configs/model_configs/present in the image you measured in?It ships in the wheel, but a trimmed or hand-assembled install can drop it;
get_mxscale_bpreshuffle_configreturn a row, orNone? A miss islogged once per (N, K, w_scale_block), so the measurement run's log says which
happened;
w_scale_blockdid your activations use? The table is keyed on it(
128x128vs32x32), and a row tuned for one is not used for the other —a 32-wide x_scale against a 128x128 w_scale row falls through to the
heuristic by design.
If a tuned row was being used and you still measured 19–62%, that is a real
gap and the more interesting answer — we would want the repro. If it was not,
the numbers are measuring our fallback path rather than our tuned one, and
re-running with the table loaded would give both of us a baseline worth
comparing against.
Either way, the rest of the issue stands: the provider file, the
supports_*relocation and the entry point are unaffected, and so is the point about
reporting a baseline alongside a latency. This correction is about which
baseline.
Apologies for the wrong fact in the original.