Skip to content

[Test] [RFC #7240] Pin what a provider's first call may do inside a graph capture - #7713

Merged
zufayu merged 2 commits into
ROCm:mainfrom
zufayu:codex/aklr-capture-first-call
Nov 11, 2026
Merged

zufayu merged 2 commits into
ROCm:mainfrom
zufayu:codex/aklr-capture-first-call

Conversation

@zufayu

@zufayu zufayu commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

#7484 pinned what a replay does to a routing decision, and what the kill
switch cannot undo once a kernel is baked into a graph. Neither covers the case
a real deployment hits first: an op whose first call lands inside a capture,
because the warmup pass never reached it.

The existing _capture helper warms before recording — by design, following
#7240's guidance. So the uncovered path is precisely the one that helper exists
to avoid.

The path is not hypothetical in this tree

def capture_cudagraph(self):
    # M3 indexer-only CP puts an all-to-all in the captured decode path, and
    # NCCL sets up peer connections on a group's FIRST collective -- doing
    # that inside a capture hangs. warmup_model() does not cover it: its
    # dummy batch is prefill-only ...
    warmup_exchange(self.device)

A decode-only routed op is in exactly that position: warmup_model() runs a
prefill-only dummy batch, so the op's first call is the capture.

Two tests, two questions a provider author actually has

Can I allocate lazily? Yes — and this is worth a test because the intuition
runs the other way. Capture-time allocations are widely assumed to land in the
graph's private pool and die with it. Measured on gfx950: 16 MiB allocated on a
first call inside a capture belongs to the provider, survives the graph's
destruction, same address. A provider does not need to pre-allocate to be
correct
, and this is the test that stops that obligation being invented.

Can I read a result back? No, and the refusal is not recoverable. The
second assertion is the point:

REFUSED AcceleratorError          ← expected
CONTEXT_POISONED RuntimeError     ← the part worth pinning

After the failure the CUDA context is unusable, and the next unrelated
torch.rand(8, device="cuda") raises expected scalar type Long but found UNKNOWN_SCALAR — naming neither capture nor the provider. So the cost of a
logger.info(f"...{probe.item()}") in a lazy init is not an error in that
init; it is every CUDA operation in the process from then on, surfacing
somewhere else entirely.

Why one of them is a subprocess

Because proving this ruins the process that proves it.

An earlier draft parametrised five readback forms (.item(), .cpu(),
device/stream/event synchronize(), print) inline. The first passed and
poisoned the other four — and took #7484's own capture tests down with
them
, which is how the behaviour was found in the first place:

inline:     5 failed, 12 passed    ← including pre-existing tests
subprocess: 13 passed

Subprocess isolation here is not fastidiousness about test hygiene; it is the
only way this assertion can coexist with any other CUDA test in the file.

Testing

Verified on MI355X (gfx950, torch 2.10.0+rocm7.2.4): 13 passed, including
the pre-existing tests that the inline version took down. black --check and
ruff check clean.

Not runnable on a checkout whose flydsl predates the pin main now requires —
requires_built_aiter() skips the module there rather than failing it, which
is the behaviour #7484 added for exactly this situation.

Relationship to #7240

These pin the obligation stated there: a provider's first call may run inside a
capture; allocation is safe, reading a result back is not, and the failure is
process-level. If a future ROCm or PyTorch makes readback under capture legal
or recoverable, the second test goes red and the RFC should be corrected rather
than the test relaxed — the assertion message says so.

PR Self-Review

Reviewed revision

147c1e5393

Behavior and intent

No production code changes — one test file, +142 lines, nothing imports it. The
intent is that the two properties #7240 now states about capture are checked
rather than believed.

The judgement worth reviewing is the subprocess. It is unusual in this suite,
and the alternative (dropping the context-poisoning assertion, keeping only the
refusal) would let the test run inline — at the cost of not pinning the half
that actually makes this dangerous.

Validation and unverified scope

Run on MI355X, 13 passed. The allocation test asserts the pointer is unchanged
after del graph + gc.collect(), so it fails if the allocation ever starts
being pooled with the graph.

Unverified: collective setup under capture, the failure mode that hangs rather
than raising. It needs more than one device; the evidence for it is ATOM's
warmup_exchange() workaround, cited in #7240 rather than reproduced here.
Single GPU, single ROCm/torch build.

PR-specific question

Should the readback probe cover more than .item()? It is one of five forms
measured to behave identically, and each additional one costs a subprocess
spawn. The current choice trades coverage of forms that provably behave the
same for a test that stays fast.

Changed op tests

tests/test_plugin_routed_ops.py only, additions only. No existing test is
modified and no file under op_tests/ is touched.

🤖 Generated with Claude Code

ROCm#7484 pinned what replay does to a routing decision. Neither of those tests
covers the case a real deployment hits first: an op whose first call lands
*inside* a capture, because the warmup pass did not reach it. The existing
`_capture` helper warms before recording, by design -- so the uncovered path is
the one the helper exists to avoid.

That path is not hypothetical in this tree. `capture_cudagraph()` calls
`warmup_exchange()` before recording because `warmup_model()`'s dummy batch is
prefill-only, and an all-to-all on the decode path would otherwise set up its
NCCL peer connections inside the capture, where that hangs. A decode-only
routed op is in exactly that position.

Two tests, answering the two questions a provider author has.

**Can I allocate lazily?** Yes, and the test says so because the intuition runs
the other way. Capture-time allocations are widely assumed to land in the
graph's private pool and die with it. Measured: 16 MiB allocated on a first call
inside a capture belongs to the provider, survives the graph, same address. A
provider does not need to pre-allocate to be correct -- an obligation worth not
imposing.

**Can I read a result back?** No, and the refusal is not recoverable. The
second assertion is the one that matters: after the failure the CUDA context is
unusable, and the next unrelated `torch.rand` fails naming neither capture nor
the provider. The cost of a `logger.info(f"...{probe.item()}")` in a lazy init
is not an error in that init; it is every CUDA operation in the process
afterwards, reported somewhere else.

That test runs in a subprocess, and the reason is the finding itself: proving
this ruins the process that proves it. Run inline, it fails every CUDA test
after it in this file -- including ROCm#7484's own capture tests, which is how the
behaviour was found. An earlier draft parametrised five readback forms inline;
the first passed and poisoned the other four.

Verified on MI355X (gfx950, torch 2.10.0+rocm7.2.4): 13 passed, including the
pre-existing tests that the inline version took down. Not runnable on a
checkout whose flydsl predates the pin main now requires -- `requires_built_aiter`
skips the module there rather than failing it.

The obligation these pin is stated in ROCm#7240.

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

@aiter-bot

aiter-bot commented Nov 10, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 89847d4565af · 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. What is the most important boundary or failure mode introduced by this change, and what evidence covers it?
  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 — Reviewed revision must contain at least the first 7 characters of the current head SHA

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@zufayu
zufayu requested a review from valarLip November 11, 2026 00:53
zufayu added a commit to zufayu/aiter that referenced this pull request Nov 11, 2026
DeepSeek V4.1's attention path calls six AITER ops and not one of them is
routed: the five ops ROCm#7484 routed are rmsnorm, pertoken_quant and the two
blockscale GEMMs, which the V4.1 path does not touch. A provider can serve
nothing on that model today.

This routes the one of the six that needs no other decision first.

**Why this one.** Five of the six run only on the decode path, which is inside
a CUDA graph, and `warmup_model()`'s dummy batch is prefill-only — so their
first call lands in a capture, the case ROCm#7240 now states obligations for and
ROCm#7713 pins. `mla_sparse_prefill_v41` is prefill. It is reached outside any
capture, so routing it exercises the DSV4.1 contract end to end without
depending on anything else landing first.

**Mounted where the op begins.** `@compile_ops` wraps only the low-level asm
entry point; the public `mla_sparse_prefill_v41` is plain Python, so the route
sits on the contract rather than on one backend's implementation — the lesson
from routing rmsnorm at `_rms_norm_fwd_dispatch`.

**Not folded in with v4.** `mla_sparse_prefill_v4` stays unrouted and will be
its own contract when it is. The two take the same fifteen arguments and mean
different things by them — v4's second is `q_rope`, v41's is `q_scale` — so a
kernel bound to the wrong one passes the arity check and reads a scale tensor
as a RoPE component. ROCm#7240 states the rule.

**`backend=` needs no special handling.** It is a contract parameter, not a
routing switch (ROCm#7240), and on this op it is degenerate anyway: `"opus"` is the
only accepted value, both spellings reach the same implementation, and ATOM's
call site passes neither.

The baseline gains one entry and the existing five are untouched, which is the
property worth checking in the diff.

`pytest -q tests/test_plugin*.py` — 98 passed. On MI355X,
`plugin.status()["routed_ops"]` lists six ops with `mla_sparse_prefill_v41`
among them. No provider serves it yet, so every call still routes native,
exactly as the first five did when they landed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zufayu added a commit to zufayu/aiter that referenced this pull request Nov 11, 2026
…t means

handle. Until now that was an assertion nobody had executed: no routed op had
one, so nothing in the tree demonstrated it, and nothing would have noticed if
it stopped being true.

`mla_decode_fwd_v4_nm_ps` takes `MlaV4NmPsWorkspace`, a NamedTuple of five
tensors the caller allocates through `get_mla_v4_nm_ps_workspace`. Routing it
makes the claim testable, and the test is the point of this PR rather than the
decorator.

The question the claim hides is concrete. Dispatch canonicalizes arguments
through generated code before handing them to a Provider, and a NamedTuple
could plausibly arrive rebuilt, flattened into its fields, or copied. Any of
those breaks the ownership the pattern exists for: the Provider would be
writing into scratch the caller cannot read back, and nothing would say so.

It arrives as the same object. The test asserts `is`, not `==`, on the way into
`select()` and again on the way into `run()`, checks the field names survive,
and checks that defaults past the workspace are still canonicalized into
positional arguments. Mutation-checked by making dispatch rebuild NamedTuples
after canonicalization, which turns it red on the first assertion.

Worth stating what this does not establish: no Provider has served this
contract against real V4.1 tensors, and the workspace's *lifetime* rules --
who may write to it, when it may be reused -- are semantics the contract
carries, not something argument passing can check.

Decode-path op, so the first-call-under-capture consideration from ROCm#7716
applies here too: provider obligations in ROCm#7240, pinned by ROCm#7713, framework
gap filed as ROCm/ATOM#3157. With no Provider enabled, every call routes
native and nothing changes on merge.

Baseline gains one entry, existing six untouched, generated with the gate's own
scanner. `pytest -q tests/test_plugin*.py` -- 99 passed. On MI355X,
`plugin.status()["routed_ops"]` lists it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
zufayu added a commit to zufayu/aiter that referenced this pull request Nov 11, 2026
The last V4.1 op this series routes is `batched_gemm_a8w8_mxscale_bpreshuffle`.
Routing it alone would have been wrong: its non-shuffled sibling
`batched_gemm_a8w8_mxscale` takes the same five arguments and is reached from
the same path, so leaving one unrouted would let a Provider serve half the
pair and look complete. Both are routed here.

They get the same fingerprint, and that is correct rather than a bug in the
gate. The gate reads signatures, and these signatures are identical:
`x, wo_a, x_scale, w_scale, dtype`. What separates them is the *content* of
`wo_a` -- row-major in one, baked into the (16, 16) MFMA-fragment layout in the
other -- with the same shape, dtype and strides either way.

AITER already says what that costs, in the entry point's own docstring:

    That is why it is a separate entry rather than a flag: the shuffled weight
    has the same shape, dtype and strides as the row-major one, so a mismatched
    kernel reads the right bytes in the wrong order and returns a plausible
    wrong answer instead of failing.

This is the sharpest case of what ROCm#7240 states about contract granularity.
`v4`/`v41` at least differ in parameter names; here nothing differs. Neither
the contract gate nor the candidate arity check can tell a kernel bound to the
wrong one apart, and there is no downstream mechanism that recovers.

So the test added here does not assert correctness -- nothing available can.
It asserts that the pair stays a pair. The two look like an obvious duplicate,
so the plausible way to break this is a later cleanup routing one and calling
the other redundant; the assertion makes that delete an explanation rather
than a line. First draft of it skipped when an op was missing, which let
exactly that mistake pass -- mutation-checked after the fix: removing either
route turns it red.

Decode-path ops, so the first-call-under-capture consideration from ROCm#7716 and
ROCm#7717 applies: obligations in ROCm#7240, pinned by ROCm#7713, framework gap filed as
ROCm/ATOM#3157. With no Provider enabled every call routes native.

Baseline gains two entries, existing seven untouched. `pytest -q
tests/test_plugin*.py` -- 99 passed. On MI355X both appear in
`plugin.status()["routed_ops"]`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Swapping the probe's `.item()` for a `torch.empty` -- legal under capture --
reports NOT_REFUSED and CONTEXT_SURVIVED, failing both assertions. Without
that, the test could have passed for a reason other than the one it names,
and the next person would have to rerun the experiment to find out.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zufayu
zufayu merged commit b569f6b into ROCm:main Nov 11, 2026
zufayu added a commit that referenced this pull request Nov 11, 2026
* Route mla_sparse_prefill_v41, the first DSV4.1 op

DeepSeek V4.1's attention path calls six AITER ops and not one of them is
routed: the five ops #7484 routed are rmsnorm, pertoken_quant and the two
blockscale GEMMs, which the V4.1 path does not touch. A provider can serve
nothing on that model today.

This routes the one of the six that needs no other decision first.

**Why this one.** Five of the six run only on the decode path, which is inside
a CUDA graph, and `warmup_model()`'s dummy batch is prefill-only — so their
first call lands in a capture, the case #7240 now states obligations for and
#7713 pins. `mla_sparse_prefill_v41` is prefill. It is reached outside any
capture, so routing it exercises the DSV4.1 contract end to end without
depending on anything else landing first.

**Mounted where the op begins.** `@compile_ops` wraps only the low-level asm
entry point; the public `mla_sparse_prefill_v41` is plain Python, so the route
sits on the contract rather than on one backend's implementation — the lesson
from routing rmsnorm at `_rms_norm_fwd_dispatch`.

**Not folded in with v4.** `mla_sparse_prefill_v4` stays unrouted and will be
its own contract when it is. The two take the same fifteen arguments and mean
different things by them — v4's second is `q_rope`, v41's is `q_scale` — so a
kernel bound to the wrong one passes the arity check and reads a scale tensor
as a RoPE component. #7240 states the rule.

**`backend=` needs no special handling.** It is a contract parameter, not a
routing switch (#7240), and on this op it is degenerate anyway: `"opus"` is the
only accepted value, both spellings reach the same implementation, and ATOM's
call site passes neither.

The baseline gains one entry and the existing five are untouched, which is the
property worth checking in the diff.

`pytest -q tests/test_plugin*.py` — 98 passed. On MI355X,
`plugin.status()["routed_ops"]` lists six ops with `mla_sparse_prefill_v41`
among them. No provider serves it yet, so every call still routes native,
exactly as the first five did when they landed.

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

* Route the two decode-path V4.1 ops whose contracts need nothing new

outside a graph capture. These are the next two, chosen because their contracts
raise no question this interface has not already answered: nine arguments each,
no workspace, no backend parameter, no backend word in the name — the same
shape as the five ops already routed.

Both mount on the public entry point. `@compile_ops` wraps
`_inverse_rope_group_quant_kernel`, not the function callers use, so the route
sits on the contract rather than on one backend's implementation.

**These are decode-path ops, and that has a consequence worth stating here
rather than discovering later.** A framework's warmup runs a prefill-only dummy
batch, so a decode-only op is not called during warmup and its first call lands
inside `capture_cudagraph()`. Allocation there is safe; reading a result back is
not, and the failure poisons the CUDA context rather than raising something a
provider author can act on. The obligation this places on providers is in
ROCm/ATOM#3157.

Routing them now is still correct: with no provider enabled, dispatch
short-circuits before eligibility and every call goes native, so nothing
changes for anyone today. What it buys is the contract being in place, so a
provider can be written against it while the framework-side warmup is sorted
out. The ordering risk is real but it is a deployment-time risk, not a
merge-time one, and it is documented in both places a provider author would
look.

`fused_qk_norm_rope_cache_quant_shuffle` is deliberately not here: nineteen
arguments fusing norm, rope, cache, quant and shuffle is a contract-granularity
question for #7240, and routing it first would freeze that granularity into
public contract. `mla_decode_fwd_v4_nm_ps` is also held back — it carries a
workspace, and no provider has ever served a contract with one, so it deserves
a PR that can say something about that rather than riding along in this one.

The baseline gains two entries and the existing five are untouched. Generated
with the gate's own `routed_contracts()` scanner.

`pytest -q tests/test_plugin*.py` — 98 passed. On MI355X,
`plugin.status()["routed_ops"]` lists seven ops with both of these among them.

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

* Route the first contract that carries a workspace, and check what that means

handle. Until now that was an assertion nobody had executed: no routed op had
one, so nothing in the tree demonstrated it, and nothing would have noticed if
it stopped being true.

`mla_decode_fwd_v4_nm_ps` takes `MlaV4NmPsWorkspace`, a NamedTuple of five
tensors the caller allocates through `get_mla_v4_nm_ps_workspace`. Routing it
makes the claim testable, and the test is the point of this PR rather than the
decorator.

The question the claim hides is concrete. Dispatch canonicalizes arguments
through generated code before handing them to a Provider, and a NamedTuple
could plausibly arrive rebuilt, flattened into its fields, or copied. Any of
those breaks the ownership the pattern exists for: the Provider would be
writing into scratch the caller cannot read back, and nothing would say so.

It arrives as the same object. The test asserts `is`, not `==`, on the way into
`select()` and again on the way into `run()`, checks the field names survive,
and checks that defaults past the workspace are still canonicalized into
positional arguments. Mutation-checked by making dispatch rebuild NamedTuples
after canonicalization, which turns it red on the first assertion.

Worth stating what this does not establish: no Provider has served this
contract against real V4.1 tensors, and the workspace's *lifetime* rules --
who may write to it, when it may be reused -- are semantics the contract
carries, not something argument passing can check.

Decode-path op, so the first-call-under-capture consideration from #7716
applies here too: provider obligations in #7240, pinned by #7713, framework
gap filed as ROCm/ATOM#3157. With no Provider enabled, every call routes
native and nothing changes on merge.

Baseline gains one entry, existing six untouched, generated with the gate's own
scanner. `pytest -q tests/test_plugin*.py` -- 99 passed. On MI355X,
`plugin.status()["routed_ops"]` lists it.

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

* Route both batched mxscale GEMMs, and pin why they stay two

The last V4.1 op this series routes is `batched_gemm_a8w8_mxscale_bpreshuffle`.
Routing it alone would have been wrong: its non-shuffled sibling
`batched_gemm_a8w8_mxscale` takes the same five arguments and is reached from
the same path, so leaving one unrouted would let a Provider serve half the
pair and look complete. Both are routed here.

They get the same fingerprint, and that is correct rather than a bug in the
gate. The gate reads signatures, and these signatures are identical:
`x, wo_a, x_scale, w_scale, dtype`. What separates them is the *content* of
`wo_a` -- row-major in one, baked into the (16, 16) MFMA-fragment layout in the
other -- with the same shape, dtype and strides either way.

AITER already says what that costs, in the entry point's own docstring:

    That is why it is a separate entry rather than a flag: the shuffled weight
    has the same shape, dtype and strides as the row-major one, so a mismatched
    kernel reads the right bytes in the wrong order and returns a plausible
    wrong answer instead of failing.

This is the sharpest case of what #7240 states about contract granularity.
`v4`/`v41` at least differ in parameter names; here nothing differs. Neither
the contract gate nor the candidate arity check can tell a kernel bound to the
wrong one apart, and there is no downstream mechanism that recovers.

So the test added here does not assert correctness -- nothing available can.
It asserts that the pair stays a pair. The two look like an obvious duplicate,
so the plausible way to break this is a later cleanup routing one and calling
the other redundant; the assertion makes that delete an explanation rather
than a line. First draft of it skipped when an op was missing, which let
exactly that mistake pass -- mutation-checked after the fix: removing either
route turns it red.

Decode-path ops, so the first-call-under-capture consideration from #7716 and
#7717 applies: obligations in #7240, pinned by #7713, framework gap filed as
ROCm/ATOM#3157. With no Provider enabled every call routes native.

Baseline gains two entries, existing seven untouched. `pytest -q
tests/test_plugin*.py` -- 99 passed. On MI355X both appear in
`plugin.status()["routed_ops"]`.

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

* Route the fused qk-norm/rope/cache/quant op, completing V4.1's API surface

This is the last op ATOM's DeepSeek V4.1 path imports from AITER that was not
routed. With it, every AITER entry point that path calls can be served by a
Provider: sparse prefill (#7715), the two paged decodes (#7716, #7717), the
inverse-rope quant (#7716) and both batched mxscale GEMMs (#7719).

I argued earlier for holding this one back, on two grounds that did not
survive checking.

The first was arity: nineteen parameters fusing five stages looked like a
contract too coarse to serve. Counted properly it is twelve tensors and seven
shape/strategy scalars, which for an op reading q, k, v, two weight sets, the
rope cache, two KV caches and two scale sets is not unusual.

The second was that routing one member would drag in a family -- there are six
nearby entry points differing in quant granularity, rope dimensionality and a
2way variant. ATOM imports exactly one of them, in two files. The others serve
paths outside this surface and can stay unrouted without leaving a hole.

Mounted on the public entry point; `@compile_ops` wraps
`_fused_qk_norm_rope_cache_quant_shuffle_hip`, not the function callers import.

**This contract returns None.** It is the first routed op that delivers
entirely through mutation -- q, k, and the KV caches are written in place. That
is a real constraint on dispatch, not just on providers: code that reads a
falsy return as "the provider declined" would fall through to native after the
provider had already written, running the work twice with the second pass over
the first's output. Nothing in dispatch inspects return values today, and the
test added here is what says so. Mutation-checked by making dispatch treat a
falsy result as a decline, which turns it red on the native-fallback assertion.

Decode-path op, so the first-call-under-capture consideration applies as in
ROCm/ATOM#3157. No Provider enabled means every call routes native.

Baseline gains one entry, existing eight untouched. `pytest -q
tests/test_plugin*.py` -- 99 passed. Verified on MI355X.

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants