Repository navigation
[MLA] [RFC #7240] Route mla_sparse_prefill_v41 through the kernel provider interface - #7783
zhiding512 wants to merge 1 commit into
Conversation
…vider interface Decorate the public mla_sparse_prefill_v41 with the plugin route, above its torch_compile_guard as gemm_a8w8_blockscale does, and record its v1 contract in tests/plugin_contracts.json. The signature and the OPUS native path are unchanged; with no provider enabled dispatch goes straight to native. mla_sparse_prefill_v4 is not routed: it has the same arity, but its second parameter is q_rope, and no provider serves it. Co-authored-by: Cursor <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
NOT READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change adding provider routing to mla_sparse_prefill_v41.
No open issues 🎉
What changed in this PR
This PR enables kernel providers to serve mla_sparse_prefill_v41 through aiter.plugin, while preserving its public signature and native OPUS fallback.
Changes:
- Adds provider routing to the public
mla_sparse_prefill_v41function. - Records its version 1 signature and fingerprint in the contract baseline.
- Updates the plugin documentation to list six routed operations.
| File | Description |
|---|---|
tests/plugin_contracts.json |
Adds the version 1 contract for mla_sparse_prefill_v41. |
aiter/plugin/README.md |
Adds the operation to the routed-op table and updates the count. |
aiter/ops/mla_sparse_prefill.py |
Imports and applies the routing decorator above the existing compile guard. |
Review effort: Balanced
|
Current next action is with the author before review:
Please rebase and resolve the conflict, triage the failing tests, and post exact-head validation results. Re-request review once the branch is mergeable and the required CI is clear. |
zufayu
left a comment
There was a problem hiding this comment.
Re-reviewed the code on current head 994ffaa. The routing decorator preserves the existing public signature and native OPUS fallback, and the provider contract/interface tests cover the new boundary. The two failing standard-test files are unrelated FlyDSL MoE/HGEMM tests, not this MLA routing change. Approving the code as-is; the author still needs to resolve the merge conflict and required CI must be green before merge.
kaiyang-1
left a comment
There was a problem hiding this comment.
Thanks for the PR! Two things before this can move forward:
- The branch is 200+ commits behind main and conflicts in
aiter/ops/mla_sparse_prefill.pyandtests/plugin_contracts.json. Please rebase onto main. mla_sparse_prefill_v41is already routed on main (#7728), as version 2 withbackendkept out of the contract. This PR's v1 contract (withbackend) is the one main moved away from. Could you check whether anything is still missing after the rebase? If not, this PR can probably be closed.
The two failing MI35X shards (test_flydsl_moe_a16wfp4.py, test_flydsl_hgemm.py) are unrelated to this change. The first is fixed on main (#7774), so a rebase will clear it.
Summary
Route
mla_sparse_prefill_v41throughaiter.plugin, so a kernel provider can serve it. This adds one decorator on the public function and records its v1 contract intests/plugin_contracts.json. The signature and the OPUS native path do not change.Motivation
mla_sparse_prefill_v41is the DeepSeek-V4.1 MXFP8 sparse attention. ATOM calls it for prefill and decode when the KV cache is FP8 (sparse_attn_v41_paged_2src). An out-of-tree FlyDSL implementation for gfx950 already implements this contract:flydsl-sparse-mla-providerin coderfeli/plugin_poc, entry pointplugins.aiter.sparse_mla:provider. The op is not routed today, so that provider'sselect()is never reached, and no framework can enable it.Changes
aiter/ops/mla_sparse_prefill.py: adds@_route(op="mla_sparse_prefill_v41")above the existingtorch_compile_guard, the same waygemm_a8w8_blockscaleis routed. Version 1 is the default, as theroute()docstring asks.tests/plugin_contracts.json: the v1 baseline for the op, generated withrouted_contracts()fromtests/test_plugin_contracts.py. The five existing entries are unchanged.aiter/plugin/README.md: the routed-op table now lists six ops.mla_sparse_prefill_v4is not routed. It has the same arity, but its second parameter isq_ropeinstead ofq_scale, and no provider serves it.Testing
Documentation
aiter/plugin/README.md)Dependencies
Breaking Changes
None. Without a
plugin.configure(...)call, or underAITER_PLUGINS=0, dispatch goes straight to the OPUS native and records nothing. Once a framework enables a provider, any call the provider declines still runs OPUS. Examples: a GPU other than gfx950, a shape outside the provider's coverage, or a forcedbackendornum_kv_splits.PR Self-Review
Reviewed revision
994ffaaa179da304c74517635dcd5d5cb7354261Behavior and intent
With no provider enabled, behavior is the same as before. The change makes
mla_sparse_prefill_v41a recorded public contract. From now on, changing its signature requires a version bump and a baseline update, enforced bytests/test_plugin_contracts.py, and an enabled provider can serve the calls it accepts.Validation and unverified scope
CPU only, with the GPUs hidden (
ROCR_VISIBLE_DEVICES=):python3 -m pytest -q tests/test_plugin.py tests/test_plugin_contracts.py tests/test_plugin_discovery.py tests/test_plugin_overhead.py(the "Kernel Provider Interface" gate): 98 passed.python3 -m pytest -q tests/test_plugin_selector_arity.py: 4 passed.PYTHONPATHso it reads this baseline:tests/sparse_mla_provider_test.pyin the provider repo, 25 passed. The provider's selector unpacks the same 15 parameters as the committed baseline, and the second one it binds isq_scale.Unverified: GPU. No provider runs in this PR. End-to-end serving through the provider in ATOM has not been run yet. The ATOM side is ROCm/ATOM#3179, a draft stacked on ROCm/ATOM#3114.
PR-specific question
Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
No workload key changes.
tests/plugin_contracts.jsonis the baseline of routed-op contracts, not a tuned-kernel config. No shape, CSV row or kernel choice reads it at runtime; onlytests/test_plugin_contracts.pydoes. Kernel selection stays the same for every shape:_dispatchreturnsnative(*args, **kwargs)before it looks at the call. The native is the sametorch_compile_guard-wrapped OPUS function as before. This free path is covered bytests/test_plugin_overhead.py.Changed op tests
None.