Repository navigation
[Docs] [RFC #7240] How to serve an AITER op from an out-of-tree kernel library - #7695
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
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 |
The interface is on main and nothing says how to use it. The next library that wants to serve an op has to read 1200 lines of implementation to find out that installing a provider does nothing until a framework calls configure(), or that `select()` has to be pure because `explain()` calls it without running anything. Deliberately not a second RFC. ROCm#7240 holds the rationale, the open questions and the deprecation policy; this holds the smallest provider that works, the entry point declaration, what `select()` must honour, and the four reads that answer "I installed it and nothing happens". Two things stated here that are easy to get wrong by omission: - **no op is routed on main today.** The interface is complete and tested, and the first ops to pass through it arrive in ROCm#7484. A provider can be written, installed, enabled and inspected right now, and every call still goes native. Saying so is better than letting someone conclude their provider is broken. - **nothing checks your `run` against the contract yet.** The arity check comes with ROCm#7484. Until then a kernel bound to the wrong contract runs silently. The failure section is four things that cost real debugging time on the first provider to use this interface, rather than invented examples: a kernel bound to a layout instead of a contract; matching hardware on `get_device_name()` (which reads "AMD Radeon Graphics" on MI355X under rocm/atom-dev) instead of `gcnArchName`; reporting offline validation timings as if they described the call in hand; and treating a decline as a failure. The arity point is worth the space it takes. Even once ROCm#7484 lands, the check compares argument counts, not meaning — `mla_sparse_prefill_v4` and `_v41` both take 15 arguments and their second parameter is `q_rope` in one and `q_scale` in the other. A provider bound to the wrong one reads a scale tensor as a RoPE component with every gate green. Every API name, keyword, status() key and reason string in this file was checked against the module on this commit. The one reference to something that does not exist on main yet (`contract-mismatch`) is marked as arriving with ROCm#7484. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Three statements in this file were written against a main where the interface existed and nothing used it. ROCm#7484 changed that, and ROCm#7654 adds the cost field, so: - "no op is routed on main today" becomes the actual list of five, with the pointer to tests/plugin_contracts.json as the description that cannot drift; - "nothing checks your run against the contract yet" becomes the arity check that now exists — and keeps the warning that matters more, that arity is not meaning: v4 and v41 both take 15 arguments with a different second one; - a section on `latency_us`: what it means, why an offline validation ratio is not it, and why omitting beats extrapolating. Documentation that describes a main it is not merging into is worse than none, which is why this waits for ROCm#7654 rather than landing in two passes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
a5a317a to
0c60744
Compare
The interface is on
mainand nothing says how to use it. The next librarythat wants to serve an AITER op has to read 1200 lines of implementation to
discover that installing a provider does nothing until a framework calls
configure(), or thatselect()has to be pure becauseexplain()calls itwithout running anything.
This is not a second RFC. #7240
holds the rationale, the open questions and the deprecation policy. This holds
the smallest provider that works, the entry-point declaration, what
select()must honour, and the four reads that answer "I installed it and nothing
happens".
Two things stated that are easy to get wrong by omission
No op is routed on
maintoday. The interface is complete and tested; thefirst ops to pass through it arrive in #7484. A provider can be written,
installed, enabled and inspected right now — and every call still goes native.
Saying so plainly is better than letting someone conclude their provider is
broken.
Nothing checks your
runagainst the contract yet. The arity check comeswith #7484. Until it lands, a kernel bound to the wrong contract runs silently.
The failure section is real incidents, not invented ones
Four things that cost actual debugging time on the first provider to use this
interface:
bpreshufflekernel offered for the
blockscalecontract, seven arguments about to reacha six-argument kernel;
get_device_name(), which readsAMD Radeon Graphicson MI355X under
rocm/atom-dev, instead of ongcnArchName(
gfx950:sramecc+:xnack-). Zero kernels loaded, every call declined, theinterface looking broken while behaving exactly as specified;
hand;
The arity point earns its space. Even once #7484 lands, the check compares
argument counts, not meaning.
mla_sparse_prefill_v4and_v41both take 15arguments, and their second parameter is
q_ropein one andq_scalein theother. A provider bound to the wrong one reads a scale tensor as a RoPE
component — silently, with every gate green.
Verification
Every API name, keyword argument,
status()key and reason string in the filewas checked programmatically against
aiter/plugin/__init__.pyat this commit.The single reference to something that does not exist on
mainyet(
reason="contract-mismatch") is marked as arriving with #7484.Merge order — this one has a hard prerequisite
No git dependency: this branch sits on
main, touches one new file andconflicts with nothing. The dependency is in the content. The second commit
describes
KernelCandidate.latency_us, which #7654 adds. Merged first, thisfile documents a field that does not exist — the one failure mode that makes
documentation worse than none.
#7484 has landed, so the routed-op list and the arity check in here are now
true.
latency_usis the only part still waiting.Downstream: #7696 references
aiter/plugin/README.mdby path, so it wants toland after this one.
PR Self-Review
Reviewed revision
0c607440a9Behavior and intent
No behaviour changes: one new file,
aiter/plugin/README.md, and nothingimports it. The intent is that the next provider author does not have to read
the implementation to learn the enablement model, and does not have to
rediscover the four failures above.
The judgement worth reviewing is what was left out. Rationale, alternatives and
open questions stay in #7240 — duplicating them here creates two documents that
drift. What is here is only what someone writing a provider needs in hand.
Validation and unverified scope
Checked against the module at this commit: every
plugin.*name referencedexists,
ENTRY_POINT_GROUP == "aiter.plugins",API_VERSION == 1, everyKernelCandidatekeyword is a real field, everystatus()key referenced isreally returned, and every
reasonstring quoted is really produced — with theone exception marked as #7484's.
Unverified: the example provider is illustrative and is not executed by any
test. If the interface changes, nothing here goes red — the file has to be
updated by whoever changes it. That is the standing cost of documentation that
is not executable, and it is the reason this sits next to the module rather
than in a wiki.
PR-specific question
Should the example provider become an executable test, so the contract this
document describes cannot drift from the one the module implements? It would
cost a test that is mostly prose-shaped, and it would catch exactly the failure
mode documentation has.
Changed op tests
None. This PR adds
aiter/plugin/README.mdonly. No code, no test, no fileunder
op_tests/.🤖 Generated with Claude Code