Skip to content

[OPUS] [RFC #7240] Route MLA sparse prefill where its two public spellings converge - #7791

Merged
zufayu merged 9 commits into
mainfrom
codex/route-dsv41-framework-entrypoints
Nov 12, 2026
Merged

zufayu merged 9 commits into
mainfrom
codex/route-dsv41-framework-entrypoints

Conversation

@zufayu

@zufayu zufayu commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

The problem this solves

An out-of-tree provider that wants to serve DSV4.1's sparse prefill — the hottest path in the model, and the one a competing kernel library would most want to take over — has exactly two options today: fork AITER, or monkey-patch aiter.ops.pa_sparse_prefill_opus.pa_sparse_prefill_opus. Monkey-patching depends on import order, has no contract check, cannot be enabled per deployment, and is invisible to explain() / status(). Removing that is what #7240 exists for.

Routing was already available; it just was not pointed anywhere the frameworks actually call.

Why routing either public name would have covered nobody

mla_sparse_prefill and pa_sparse_prefill_opus are one op under two names:

mla_sparse_prefill   (q, unified_kv, …, out=None, num_kv_splits=None, backend=None)   # 12 params
pa_sparse_prefill_opus(q, unified_kv, …, out=None, num_kv_splits=None)                # the same 11

Both forward the same eleven arguments, unchanged, to the same _opus_sparse_prefill. The second differs only by pinning the backend the first would have chosen anyway — _check_backend("mla_sparse_prefill", backend, ("opus",)) admits nothing else.

And the callers are all on one side of that pair. Scanned against current heads (vLLM 2026-11-11, SGLang 2026-11-10, ATOM 2026-11-11), every import is the backend-named spelling:

caller imports
vLLM v1/attention/ops/rocm_aiter_mla_sparse.py:69 pa_sparse_prefill_opus
SGLang kernels/ops/attention/dsv4/opus_sparse_prefill_hip.py:83 pa_sparse_prefill_opus
SGLang kernels/ops/attention/dsv4/unified_kv_kernels/paged_prefill.py:57 pa_sparse_prefill_opus
ATOM model_ops/v4_kernels/paged_2src.py:60 pa_sparse_prefill_opus

Nobody imports the neutral name. So routing mla_sparse_prefill alone reaches no one, and routing pa_sparse_prefill_opus would put a backend in a contract that providers implement against — the thing the first routed ops (rmsnorm, pertoken_quant) were chosen to avoid.

What this does instead

Routes the layer both names call, which is the pattern already merged for rmsnorm:

Routed here rather than on either public spelling or on a backend binding. rms_norm and rmsnorm2d_fwd are two public names for one op and both call this directly, so this is where the op begins

_mla_sparse_prefill_routed carries @route(op="mla_sparse_prefill", version=1); mla_sparse_prefill calls it after its backend check, and pa_sparse_prefill_opus calls it instead of reaching past into _opus_sparse_prefill.

No renames, no deprecations, no downstream change. Both public names keep their signatures and their behaviour; each takes the same path it took before, one frame lower.

Why backend= is not in the contract

It selects which native implementation AITER would run — a question the dispatcher settles before the op begins. A provider has one kernel, not a choice of AITER's, so handing it a pin naming AITER's would leave it declining every call from the spelling that pins, which here is every downstream caller. Keeping backend= above the routed layer is what makes the backend-named spelling routable at all.

This is consistent with the ownership model: routing is the selection mechanism AITER owns, backend= is a public op argument of the dispatcher. test_the_sparse_prefill_contract_carries_no_backend_pin fails if it ever leaks into the contract.

Tests

  • test_sparse_prefill_serves_through_either_public_spelling — a provider declaring mla_sparse_prefill serves calls arriving by both names, and select is asked twice. This is the property the whole change exists for; it is the direct analogue of the existing test_rmsnorm_provider_serves_through_either_public_spelling.
  • test_the_backend_pin_is_not_part_of_the_sparse_prefill_contract — backend="opus" still routes rather than forcing native.
  • test_the_sparse_prefill_contract_carries_no_backend_pin — buildless; mutation-checked by splicing backend into the baseline signature, which fails it.

The first two live in tests/test_plugin_routed_ops.py and need a built AITER, like the rest of that file; the third runs on every PR without a GPU.

Buildless suites pass locally (test_plugin, test_plugin_contracts, test_plugin_discovery, test_plugin_selector_arity). black and ruff check clean. Contract baseline regenerated with routed_contracts() — one entry added, +7 lines, no reformatting of the rest.

What this deliberately leaves alone

The same shape exists one version up — mla_sparse_prefill_v4 is pa_sparse_prefill_fp8_opus / mla_sparse_prefill_fp8_asm plus num_kv_splits and backend — but there the pin is load-bearing: that contract really has two native backends, so redirecting a pinned spelling through the dispatcher without its pin would change which kernel runs. That needs a decision rather than a refactor, and it is raised on #7150 rather than settled here.

Related: #7240 (the interface), #7728 (routes mla_sparse_prefill_v41, the sibling that had no backend-named spelling to begin with), #7150 (the naming question this change turns out not to need).

🤖 Generated with Claude Code

PR Self-Review

Reviewed revision

4d46c5c7f01329322e36caf59562ce6e44cd5014

Behavior and intent

mla_sparse_prefill and pa_sparse_prefill_opus are one op under two public names, and every downstream caller uses the second one. Routing either name alone would therefore reach nobody, and routing the private _opus_sparse_prefill would put a backend into a contract providers implement against. The route moves to the layer both names call, so a provider serves callers of either without one of them changing a line.

The existing behavior is insufficient in a narrow sense: nothing is wrong at runtime today, but no out-of-tree provider can serve this op at all, which is what #7240 exists to make possible.

Validation and unverified scope

Verified on gfx942 (torch 2.9.1, 8 GPUs):

  • buildless plugin suites pass (tests/test_plugin*.py);
  • the contract baseline regenerates to 17 entries — main's 16 plus mla_sparse_prefill — with none lost and none carrying a backend or kernelName, checked by regenerating with routed_contracts() rather than editing the JSON;
  • both public spellings' signatures are byte-identical to main, compared by AST rather than by eye;
  • black and ruff check clean.

Unverified, and the reason: the native opus kernel is not exercised through the new routed layer anywhere in this PR. op_tests/test_mla_sparse_prefill.py is the target that does exercise it, and running it here skips all 38 cases:

SKIPPED [32] opus MLA sparse prefill requires one of (gfx950, gfx1250), found gfx942
SKIPPED [3]  the source-compiled OPUS paths require gfx950
SKIPPED [2]  the source-compiled OPUS paths require gfx950

So that file has to run on a gfx950 runner. It was being skipped entirely until ci:all was added to this PR, which is the gap aiter-bot flagged and the reason the label matters here rather than being routine.

The two tests this PR adds use a fake provider, so they pin which callers reach a provider and that the contract carries no backend pin — not that the opus kernel still produces the same numbers.

PR-specific question

Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?

No configuration or tuning keys change. The only selection logic touched is _check_backend("mla_sparse_prefill", backend, ("opus",)), which stays exactly where it was, above the routed layer. With no provider enabled — every deployment today — dispatch returns the same _opus_sparse_prefill call with the same eleven arguments it made before, one Python frame lower. Unrelated shapes do not enter into it because nothing in this change reads a shape.

Changed op tests

None. tests/test_plugin_routed_ops.py is an interface test rather than an op test, and the op-test target that covers the native path, op_tests/test_mla_sparse_prefill.py, is unchanged by design — it already exercises both spellings and should keep passing untouched.

`mla_sparse_prefill` and `pa_sparse_prefill_opus` are one op under two public
names: identical arguments, forwarded unchanged to the same
`_opus_sparse_prefill`, the second differing only by pinning the backend the
first would have chosen anyway (`_check_backend` admits only "opus").

Every downstream caller on the DSV4.1 prefill path uses the backend-named
spelling -- vLLM, SGLang and ATOM all import `pa_sparse_prefill_opus`, none
imports the neutral name. Routing either spelling alone would therefore
cover nobody, and routing `_opus_sparse_prefill` would put a backend in the
contract. So the route goes on the layer both call, which is the pattern
`rmsnorm` already uses for `rms_norm` / `rmsnorm2d_fwd`.

`backend=` stays above that layer. It picks which native implementation AITER
would run, which the dispatcher settles before the op begins; a provider has
one kernel rather than a choice of AITER's, so being handed a pin naming
AITER's would leave it declining every call from the spelling that pins.

No behaviour change and no downstream change: both names take the same path
they took before, one frame lower.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zufayu
zufayu requested a review from a team November 11, 2026 04:04
@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 7791 --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.

@github-actions github-actions Bot changed the title [RFC #7240] Route MLA sparse prefill where its two public spellings converge [OPUS] [RFC #7240] Route MLA sparse prefill where its two public spellings converge Nov 11, 2026
@github-actions github-actions Bot added the OPUS label Nov 11, 2026
@aiter-bot

aiter-bot commented Nov 11, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 4d46c5c7f013 · 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. Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
  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.

The previous run's merge commit was computed before #7774 landed, so it still
carried the FlyDSL 0.5.0 test breakage. Nothing in this branch changes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zufayu added a commit that referenced this pull request Nov 11, 2026
The first version put `@route` straight on `pa_fwd_asm`, which made that
function's whole signature the contract -- including `kernelName`, a knob
that picks one asm kernel. A provider has its own kernel and no way to
satisfy that, so a contract carrying it would have the provider decline
every call that passes one. The op name was neutral and the backend came in
through an argument instead.

This is the same reasoning #7791 already applied to `backend=`, written
there as: a provider asked to serve this contract "cannot be asked to honour
a pin it has no kernel for". It applies to `kernelName` unchanged; I failed
to apply it here.

So the route moves below both pins:

    pa_fwd(..., backend=None)        neutral name
    pa_fwd_asm(..., kernelName=None) historical spelling, signature untouched
            |  pin given -> that kernel runs, no routing
            |  no pin    ->
    _pa_fwd_routed(...)              @route, carries neither pin
            |
        the asm binding

An ordinary `pa_fwd_asm(...)` call routes, so a framework is served without
changing a line -- the `_asm` there is an artifact of `pa_fwd` having had no
public spelling, not a caller asking for that backend. An explicit pin
bypasses routing and runs exactly what was asked for. `pa_persistent_fwd` is
already neutral and takes no pin; it is unchanged beyond its route.

Both public spellings keep their exact signatures (checked against
origin/main), so nothing downstream changes.

The gate grows a second half: a contract may not carry a parameter a
provider cannot honour, and a route may not sit on a backend-named function
(which is how `kernelName` got in, while the op name looked clean).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zufayu and others added 2 commits November 11, 2026 15:05
#7728 added seven contracts, so the baseline conflicted. Resolved by
regenerating it with routed_contracts() rather than reconciling the
conflict markers -- they cut through the JSON objects themselves, and a
mechanical resolution produces something that parses as neither.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions github-actions Bot changed the title [OPUS] [RFC #7240] Route MLA sparse prefill where its two public spellings converge [Triton/Gluon] [OPUS] [RFC #7240] Route MLA sparse prefill where its two public spellings converge Nov 11, 2026
zufayu added a commit that referenced this pull request Nov 11, 2026
#7728 landed seven contracts, which conflicts the baseline (regenerated
with routed_contracts(), not reconciled by hand) and brings in one that
this PR's own gate rejects: `mla_sparse_prefill_v41` carries `backend`.

That is the same defect this PR was reworked to remove from `pa_fwd`, in
an op that merged minutes earlier. The gate caught it immediately, which
is what it is for -- so the fix belongs here rather than in a PR of its
own that this one would then have to wait for.

The treatment is `mla_sparse_prefill`'s from #7791: a routed layer below
the backend check, carrying no pin. `backend` names which implementation
AITER runs, which the dispatcher settles before the op begins; a provider
has its own kernel and would have to decline every call passing one.

Version 2, and v1 is NOT superseded: a v1 provider was built against
fifteen arguments and a v2 call offers fourteen, so the arity check
rejecting it is the correct outcome rather than a regression to absorb.

The public signature of `mla_sparse_prefill_v41` is byte-identical to
main (AST-checked), as are all three attention entry points. Nothing
downstream changes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zufayu and others added 3 commits November 11, 2026 12:37
#7787 appended three gates to tests/test_plugin_contracts.py and this
branch appends one, so the two collide at the end of the file. Both kept:
main's gates first, this PR's sparse-prefill contract check after.

Baseline regenerated with routed_contracts(): 13 contracts, main's 12 plus
mla_sparse_prefill, none lost.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Triton shard 7 failed on 'GnuTLS recv error' fetching composable_kernel,
not on anything in this branch. The run could not be re-run through the
API, so this takes a fresh one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Resolving the last conflict I ran black over aiter/ and tests/ wholesale
instead of the files this branch touches. That collapsed two @gluon.jit
signatures in sparse_mla_fp8.py onto 200-character lines -- lines whose
author had marked '# fmt: skip' precisely so a formatter would leave them
alone. The local black evidently treats that marker on a multi-line
signature differently from the one CI pins, and the file was passing the
style gate on main either way, so the change was loss with no gain.

Back to main's version. Nothing else in this branch touches that file.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions github-actions Bot changed the title [Triton/Gluon] [OPUS] [RFC #7240] Route MLA sparse prefill where its two public spellings converge [OPUS] [RFC #7240] Route MLA sparse prefill where its two public spellings converge Nov 11, 2026
@zufayu
zufayu requested a review from valarLip November 12, 2026 01:11
zufayu added a commit that referenced this pull request Nov 12, 2026
…7807)

* feat(plugin): route the three attention entry points frameworks call

`pa_fwd_asm` (vLLM, ATOM), `pa_decode_bf16_asm` (ATOM) and
`pa_persistent_fwd` (ATOM) are the attention ops downstream imports directly
and no provider can serve. Each is an ordinary Python implementation over a
private asm binding, with exactly one public spelling -- so unlike
`mla_sparse_prefill` there is no second spelling to converge; the route goes
straight on the public entry point.

Two of the three carry a backend in their Python name. The contract does not:
`@route(op=...)` names the operation and is independent of the function it
decorates, which is what lets `pa_fwd_asm` be routed as `pa_fwd` without a
rename and without one downstream caller changing. `rmsnorm` on
`_rms_norm_fwd_dispatch` is the merged precedent.

`pa_fwd_asm` gains a docstring and `pa_decode_bf16_asm`'s says what it
returns; both now state the fact a signature cannot carry -- whether `out`
is written, returned, or both.

A new gate pins the rule this relies on: no routed op name may carry a
backend suffix. A contract named `_asm` would ask a provider to be a backend
it is not, which is what the first routed ops were chosen to avoid.

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

* fix(plugin): route beneath the pins, so no pin reaches the contract

The first version put `@route` straight on `pa_fwd_asm`, which made that
function's whole signature the contract -- including `kernelName`, a knob
that picks one asm kernel. A provider has its own kernel and no way to
satisfy that, so a contract carrying it would have the provider decline
every call that passes one. The op name was neutral and the backend came in
through an argument instead.

This is the same reasoning #7791 already applied to `backend=`, written
there as: a provider asked to serve this contract "cannot be asked to honour
a pin it has no kernel for". It applies to `kernelName` unchanged; I failed
to apply it here.

So the route moves below both pins:

    pa_fwd(..., backend=None)        neutral name
    pa_fwd_asm(..., kernelName=None) historical spelling, signature untouched
            |  pin given -> that kernel runs, no routing
            |  no pin    ->
    _pa_fwd_routed(...)              @route, carries neither pin
            |
        the asm binding

An ordinary `pa_fwd_asm(...)` call routes, so a framework is served without
changing a line -- the `_asm` there is an artifact of `pa_fwd` having had no
public spelling, not a caller asking for that backend. An explicit pin
bypasses routing and runs exactly what was asked for. `pa_persistent_fwd` is
already neutral and takes no pin; it is unchanged beyond its route.

Both public spellings keep their exact signatures (checked against
origin/main), so nothing downstream changes.

The gate grows a second half: a contract may not carry a parameter a
provider cannot honour, and a route may not sit on a backend-named function
(which is how `kernelName` got in, while the op name looked clean).

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

---------

Co-authored-by: zufayu <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
#7807 landed three attention contracts and a general parameter gate. Only
tests/test_plugin_contracts.py conflicted; mla_sparse_prefill.py merged
cleanly and both operators survived it -- checked by AST, not by eye:
_mla_sparse_prefill_routed (v1) and _mla_sparse_prefill_v41_routed (v2)
each sit below their backend check, and all three public spellings still
take backend=.

Dropped this branch's test_the_sparse_prefill_contract_carries_no_backend_pin.
#7807's test_no_routed_contract_carries_a_parameter_a_provider_cannot_honour
scans every contract for the same pins, so the narrow version now asserts a
strict subset of what main already enforces.

Baseline regenerated: 16 contracts, main's 15 plus mla_sparse_prefill, none
lost, none carrying a backend parameter.

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

zufayu commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@aiter-bot review

@aiter-bot

Copy link
Copy Markdown

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

@aiter-bot

Copy link
Copy Markdown

⚠️ aiter-bot — this review could not complete: a problem with the GLM model service, not with this PR.

GLM backend unavailable at http://localhost:30000 (deep inference probe returned '000')

@yhl-amd — please take a look.

Triage: if GLM serves but its output is malformed it may be the ATOM framework (@valarLip); if the box, GPU, disk or network is unhealthy it may be the machine (@gyohuangxin).

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

#6689 added sp_qkv_fused to the baseline. Clean merge -- the two entries
are far enough apart in a sorted file not to collide this time. Verified:
17 contracts, main's 16 plus mla_sparse_prefill, none lost.

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

zufayu commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@aiter-bot review

@aiter-bot

Copy link
Copy Markdown

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

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

ROCm/aiter PR #7791 — [OPUS] [RFC #7240] Route MLA sparse prefill where its two public spellings converge

Review (advisory): ⚠️ NEEDS WORK
Validation (deterministic): NOT RUN — the PR changes runtime code but ships no test target; the changed path is executed at run time (every call of either spelling now passes through the routed layer), and the native path is covered only by the pre-existing op_tests/test_mla_sparse_prefill.py in the automatic standard CI job, not by anything this PR ships
Perf (advisory): NOT RUN — the PR ships no perf target (a routing refactor, no kernel change); the pre-existing op_tests/test_mla_sparse_prefill.py carries a perftest/@benchmark harness for the routed spelling, but no GPU was usable in this environment (no gfx arch visible, auto-validation disabled) — an environment gap, not a PR defect
Size: 142 lines / 4 files
Design (advisory): route the op at the convergence layer beneath the backend pin, so the backend-named spelling pa_sparse_prefill_opus — the one every downstream caller imports — is served by a provider while backend= stays out of the contract; this extends the merged rmsnorm pattern (route where two public names converge) to the first op where one of the two names is itself a backend pin
Human: recommend kaiyang-1 review whether serving the explicitly opus-pinned spelling pa_sparse_prefill_opus through a provider (rather than letting the pin force the native kernel) is the right contract for mla_sparse_prefill in PR #7791 — kaiyang-1 is the top committer of both changed op files

📝 [verified] The description's test section names test_the_sparse_prefill_contract_carries_no_backend_pin as a third test gating the contract this PR records in tests/plugin_contracts.json, but no test by that name exists in either tree — the buildless mutation check it describes is actually the pre-existing generic gate test_no_routed_contract_carries_a_parameter_a_provider_cannot_honour in tests/test_plugin_contracts.py — and together with the description's AI-generation footer this marks the PR's elevated AI-code risk, so the claimed coverage should not be taken at face value. Author must correct the test name in the description.

2 finding(s) posted inline, on the lines they are about:

  • aiter/ops/pa_sparse_prefill_opus.py:93 — is the entry vLLM, SGLang and ATOM all import (per the PR's own scan of their current heads), and this PR…
  • aiter/ops/pa_sparse_prefill_opus.py:93 — The PR changes the runtime dispatch of the DSV4.1 sparse prefill's both public spellings…

Comment thread aiter/ops/pa_sparse_prefill_opus.py Resolved
Comment thread aiter/ops/pa_sparse_prefill_opus.py Resolved
@zufayu zufayu added the ci:all label Nov 12, 2026
@zufayu
zufayu merged commit 861f92f into main Nov 12, 2026
@zufayu
zufayu deleted the codex/route-dsv41-framework-entrypoints branch November 12, 2026 07:24
zufayu added a commit that referenced this pull request Nov 12, 2026
#7791 added mla_sparse_prefill. Clean merge; verified rather than assumed:
20 contracts, main's 17 plus this branch's three, none lost, none carrying
a backend or kernelName.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zufayu added a commit that referenced this pull request Nov 12, 2026
#7791 added mla_sparse_prefill. This branch adds no contract, so the
baseline is main's 17 unchanged; the plugin changes and the one registered
op survive the merge, checked rather than inferred from a clean auto-merge.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
vpietila-amd pushed a commit that referenced this pull request Nov 12, 2026
…7807)

* feat(plugin): route the three attention entry points frameworks call

`pa_fwd_asm` (vLLM, ATOM), `pa_decode_bf16_asm` (ATOM) and
`pa_persistent_fwd` (ATOM) are the attention ops downstream imports directly
and no provider can serve. Each is an ordinary Python implementation over a
private asm binding, with exactly one public spelling -- so unlike
`mla_sparse_prefill` there is no second spelling to converge; the route goes
straight on the public entry point.

Two of the three carry a backend in their Python name. The contract does not:
`@route(op=...)` names the operation and is independent of the function it
decorates, which is what lets `pa_fwd_asm` be routed as `pa_fwd` without a
rename and without one downstream caller changing. `rmsnorm` on
`_rms_norm_fwd_dispatch` is the merged precedent.

`pa_fwd_asm` gains a docstring and `pa_decode_bf16_asm`'s says what it
returns; both now state the fact a signature cannot carry -- whether `out`
is written, returned, or both.

A new gate pins the rule this relies on: no routed op name may carry a
backend suffix. A contract named `_asm` would ask a provider to be a backend
it is not, which is what the first routed ops were chosen to avoid.

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

* fix(plugin): route beneath the pins, so no pin reaches the contract

The first version put `@route` straight on `pa_fwd_asm`, which made that
function's whole signature the contract -- including `kernelName`, a knob
that picks one asm kernel. A provider has its own kernel and no way to
satisfy that, so a contract carrying it would have the provider decline
every call that passes one. The op name was neutral and the backend came in
through an argument instead.

This is the same reasoning #7791 already applied to `backend=`, written
there as: a provider asked to serve this contract "cannot be asked to honour
a pin it has no kernel for". It applies to `kernelName` unchanged; I failed
to apply it here.

So the route moves below both pins:

    pa_fwd(..., backend=None)        neutral name
    pa_fwd_asm(..., kernelName=None) historical spelling, signature untouched
            |  pin given -> that kernel runs, no routing
            |  no pin    ->
    _pa_fwd_routed(...)              @route, carries neither pin
            |
        the asm binding

An ordinary `pa_fwd_asm(...)` call routes, so a framework is served without
changing a line -- the `_asm` there is an artifact of `pa_fwd` having had no
public spelling, not a caller asking for that backend. An explicit pin
bypasses routing and runs exactly what was asked for. `pa_persistent_fwd` is
already neutral and takes no pin; it is unchanged beyond its route.

Both public spellings keep their exact signatures (checked against
origin/main), so nothing downstream changes.

The gate grows a second half: a contract may not carry a parameter a
provider cannot honour, and a route may not sit on a backend-named function
(which is how `kernelName` got in, while the op name looked clean).

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

---------

Co-authored-by: zufayu <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
vpietila-amd pushed a commit that referenced this pull request Nov 12, 2026
…lings converge (#7791)

* feat(plugin): route MLA sparse prefill where its two spellings converge

`mla_sparse_prefill` and `pa_sparse_prefill_opus` are one op under two public
names: identical arguments, forwarded unchanged to the same
`_opus_sparse_prefill`, the second differing only by pinning the backend the
first would have chosen anyway (`_check_backend` admits only "opus").

Every downstream caller on the DSV4.1 prefill path uses the backend-named
spelling -- vLLM, SGLang and ATOM all import `pa_sparse_prefill_opus`, none
imports the neutral name. Routing either spelling alone would therefore
cover nobody, and routing `_opus_sparse_prefill` would put a backend in the
contract. So the route goes on the layer both call, which is the pattern
`rmsnorm` already uses for `rms_norm` / `rmsnorm2d_fwd`.

`backend=` stays above that layer. It picks which native implementation AITER
would run, which the dispatcher settles before the op begins; a provider has
one kernel rather than a choice of AITER's, so being handed a pin naming
AITER's would leave it declining every call from the spelling that pins.

No behaviour change and no downstream change: both names take the same path
they took before, one frame lower.

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

* ci: retrigger against main carrying #7774

The previous run's merge commit was computed before #7774 landed, so it still
carried the FlyDSL 0.5.0 test breakage. Nothing in this branch changes.

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

* ci: retrigger after a submodule fetch failure

Triton shard 7 failed on 'GnuTLS recv error' fetching composable_kernel,
not on anything in this branch. The run could not be re-run through the
API, so this takes a fresh one.

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

* Revert an unrelated reformat of sparse_mla_fp8.py

Resolving the last conflict I ran black over aiter/ and tests/ wholesale
instead of the files this branch touches. That collapsed two @gluon.jit
signatures in sparse_mla_fp8.py onto 200-character lines -- lines whose
author had marked '# fmt: skip' precisely so a formatter would leave them
alone. The local black evidently treats that marker on a multi-line
signature differently from the one CI pins, and the file was passing the
style gate on main either way, so the change was loss with no gain.

Back to main's version. Nothing else in this branch touches that file.

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

---------

Co-authored-by: zufayu <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
eppaneamd added a commit that referenced this pull request Nov 13, 2026
…d/mla-sparse-prefill-triton-backend

Brings in main up to 85ccf17 through #7680.

Conflicts:
- aiter/ops/mla_sparse_prefill.py: main routes the op through the plugin
  interface (#7791). mla_sparse_prefill now dispatches as
  mla_sparse_prefill_v41 does: enabled providers first, then a native
  fallback that picks triton or opus from backend=. The routed op
  (_mla_sparse_prefill_routed, opus) and its contract are unchanged.
- op_tests/test_mla_sparse_prefill.py: docstrings. main replaced
  --total_tokens with --window and passes total_tokens=n, so the gfx950
  triton candidate now keys on an empty kv_indices_extend (what the triton
  backend requires) instead of total_tokens == 0.

tests/test_plugin_routed_ops.py: the backend-pin test also covers
backend="triton".

Signed-off-by: Rony Leppänen <[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.

4 participants