Skip to content

[Triton/Gluon] [OPUS] [FlyDSL] Route seventeen more ops through the kernel plugin interface - #8075

Merged
valarLip merged 8 commits into
mainfrom
kyle/aklr-plugin-routes
Nov 18, 2026
Merged

valarLip merged 8 commits into
mainfrom
kyle/aklr-plugin-routes

Conversation

@kyle-256

@kyle-256 kyle-256 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Route seventeen more ops through the kernel plugin interface (RFC #7240), so that a provider can serve them, and fix a bug that stops a Triton module from adding a route.

Motivation

AKLR (AMD-AGI/AKLR) is a provider of this interface (AMD-AGI/AKLR#226). It has qualified MI355X kernels for these aiter functions, which sglang and vLLM call, but aiter does not route the functions. A provider cannot serve an op that is not routed. The last seven are the ones Kimi-K3 calls on MI355X (vLLM 0.32.1 with aiter 0.1.26; SGLang 0.5.22) that AKLR has kernels for: its MLA prefill, its fp8 in_proj GEMM, and KDA's convolution and decode.

Changes

  • Fix: _backward_compat_find_spec returned the spec of the new module path, so the import system ran the module a second time under the old name. A routed op in the module then raised already routed on the second import. Now the old name gets the module that is already loaded.
  • New routed ops, all version 1. No public signature changes.
op routed function registration
gemm_a16w16 tuned_gemm._gemm_a16w16 (tgemm.mm, gemm_a16w16, gemm_a16w16_out) _NOT_REGISTERED: out buffer, callers are in torch_compile_guard ops
gemm_a16w16_activation Triton gemm_a16w16, body under its guard _NOT_REGISTERED: out buffer
gemm_a8w8_blockscale_out Triton gemm_a8w8_blockscale _NOT_REGISTERED: out buffer, dict config
fused_moe fused_moe_, under its torch_compile_guard opaque through the guard
biased_grouped_topk ops.topk.biased_grouped_topk fake, mutates topk_weights, topk_ids
mla_decode_fwd mla.mla_decode_fwd _NOT_REGISTERED: no annotations, out buffer
mla_paged_decode mla_gluon when has_pe and no attn_sink _NOT_REGISTERED: out buffer
fp8_paged_mqa_logits deepgemm_fp8_paged_mqa_logits _NOT_REGISTERED: kv_cache has no annotation
mla_sparse_prefill_v4 mla_sparse_prefill_v4 with backend=None; pa_sparse_prefill_fp8_opus when the automatic choice is opus _NOT_REGISTERED: out buffer
mhc_fused_post_pre _mhc_fused_post_pre_routed fake, mutates_args=[]
flash_attn_varlen flash_attn_varlen_func _NOT_REGISTERED: no annotations, out buffer, autograd.Function beneath
mla_prefill_ps mla_prefill_ps_asm_fwd, over its ctypes binding _NOT_REGISTERED: out buffers
mla_reduce mla_reduce_v1, over its HIP binding _NOT_REGISTERED: out buffers
gemm_a8w8_bpreshuffle gemm_a8w8_bpreshuffle, under its torch_compile_guard opaque through the guard
causal_conv1d_split_qkv Triton causal_conv1d_split_qkv_triton_tile_fn _NOT_REGISTERED: metadata has no annotation, writes conv_states
fused_recurrent_kda Triton attention.kda.fused_recurrent_kda _NOT_REGISTERED: out buffer, state in place, dict config
fused_recurrent_kda_packed_decode Triton attention.kda.fused_recurrent_kda_packed_decode _NOT_REGISTERED: out buffer, state in place, dict config
  • A backend= argument or force_fused=True skips the route, as for pa_fwd. gfx1250 keeps its kernel for pa_sparse_prefill_fp8_opus.
  • per_1x32_mx_quant_hip: the fp8, e8m0, unshuffled path calls the routed per_group_quant. It is the same kernel call with the same allocations. No new op.
  • gemm_a16w16_out now checks that the result is out.
  • mla_prefill_ps_asm_fwd and mla_reduce_v1 were @compile_ops bindings. The bindings move to private names, and fc_name keeps their symbols; the public names become routed Python functions over them. AITER's own split-KV MLA decode also reaches mla_reduce.
  • flash_attn_varlen_func's docstring now opens the function; it used to follow the block_table check, so it was not a docstring.
  • The fused_moe docstring tells a provider to pop a presort registered with register_presorted_moe itself.
  • Annotations: biased_grouped_topk returns None; the Triton blockscale dtype is torch.dtype | None; the deepgemm_fp8_paged_mqa_logits schedules are torch.Tensor | None.
  • tests/plugin_contracts.json is regenerated with routed_contracts(): 17 new entries, the 23 other entries do not change.

Testing

  • Unit tests added or updated (tests/plugin_contracts.json)
  • Performance benchmarks run: routing only, no kernel change (the Performance section is deleted)
  • Tested on MI250X
  • Tested on MI300X

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None.

PR Self-Review

Reviewed revision

1443ad3

Behavior and intent

With no provider enabled, every call runs aiter's own code, as before. With a provider enabled, aiter asks it before these ops. The Python dispatch layer of several backends changes, as in #7728 and #7807; no kernel changes.

Validation and unverified scope

  • CPU: pytest tests/test_plugin*.py: 164 passed, 1 skipped (test_plugin_routed_ops.py needs a built aiter). black and ruff: no new findings.
  • MI355X (gfx950), lmsysorg/sglang:v0.5.22-rocm10-mi35x with aef9a9a built and AKLR's provider (AMD-AGI/AKLR 00d010ca) enabled: a call at a point AKLR serves went to the provider and matched aiter's own result (largest difference over the largest aiter value): fused_moe (≤ 3.1e-2, MXFP4 weights), biased_grouped_topk (same experts), gemm_a16w16 (7.2e-3), Triton gemm_a16w16 (2.9e-7), Triton gemm_a8w8_blockscale (2.4e-4), mla_decode_fwd after the rebase onto [ASM] [HIP] [JIT] Add gfx1250 R1 NVFP4 MLA decode and cache producers #7987 (1.6e-2), mla_paged_decode (6.3e-3), mla_sparse_prefill_v4 (3.6e-3), mhc_fused_post_pre (6.1e-3).
  • per_1x32_mx_quant_hip at m1792 n7168: the same y and scale bytes as before the change with no provider, and with the provider serving per_group_quant.
  • MI355X (gfx950), this branch built in lmsysorg/sglang:v0.5.22-rocm10-mi35x with flydsl 0.5.0, no provider: tests/test_plugin*.py 223 passed, every route's public name included. The op tests of the seven new routes pass: test_causal_conv1d_prefill_split_qkv.py 58 passed; triton_tests/attention/test_kda.py 71 passed; test_gemm_a8w8_bpreshuffle_out.py 53 passed, _pad_k.py 43 passed; test_mla_reduce.py all PASS; MLA_PS_RESULT; MHA_VARLEN_RESULT.
  • Not verified on a GPU: the seven new routes served by a provider (AKLR's provider maps them in a later AKLR PR), fp8_paged_mqa_logits served by a provider (AKLR declined the tested points), mla_decode_fwd's NVFP4 keyword-only path with a provider (AKLR declines it; checked on CPU), and gfx1250.
  • Not run on MI250X or MI300X: the change is in the Python dispatch layer, and with no provider each routed op calls the same function as before, on any GPU.

PR-specific question

Changed op tests

None.

@kyle-256
kyle-256 requested review from a team and a balanced review from Copilot November 17, 2026 02:05
@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 8075 --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 Route ten more ops through the kernel plugin interface [Triton/Gluon] [OPUS] Route ten more ops through the kernel plugin interface Nov 17, 2026
@aiter-bot

aiter-bot commented Nov 17, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 3382c9926fe8 · 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 — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — PR-specific question has no substantive answer
  • FAIL — changed op test not explained in Changed op tests: op_tests/test_mha_optional_flydsl.py
  • FAIL — Changed op tests must explain why each changed op test is necessary and non-redundant

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new public dispatch paths lack mocked-provider tests for routing, argument forwarding, and bypass behavior, allowing disconnected routes or incorrect pin handling to pass the current checks.

1 open issue
What changed in this PR

Extends the kernel plugin interface from RFC #7240 so external providers can serve ten more AITER operations, while preserving public call signatures and existing kernel implementations.

Changes:

  • Adds versioned routes for GEMM, MoE, top-k, attention, and MHC operations, with explicit backend selections bypassing routing where applicable.
  • Fixes legacy Triton imports to reuse loaded modules and avoid duplicate route registration.
  • Documents provider contracts, declares fake and mutation behavior, and updates the contract baseline.
File Description
tests/​test_plugin_contracts.py Records registration exemptions for the new contracts.
tests/​plugin_contracts.json Adds ten version-1 contract entries.
aiter/​tuned_gemm.py Routes shared GEMM dispatch and checks output-buffer use.
aiter/​ops/​triton/​gluon/​mla_gluon.py Routes eligible MLA decode calls; keeps prefill native.
aiter/​ops/​triton/​gemm/​basic/​gemm_a8w8_blockscale.py Adds blockscale GEMM routing below explicit backend selection.
aiter/​ops/​triton/​gemm/​basic/​gemm_a16w16.py Adds activation GEMM routing beneath the compile guard.
aiter/​ops/​triton/​attention/​pa_mqa_logits.py Routes paged FP8 logits and clarifies output semantics.
aiter/​ops/​triton/​__init__.py Reuses canonical modules for legacy import aliases.
aiter/​ops/​topk.py Routes biased grouped top-k with fake and mutation declarations.
aiter/​ops/​quant.py Sends eligible MXFP8 quantization through routed group quantization.
aiter/​ops/​pa_sparse_prefill_opus.py Connects eligible FP8 sparse-prefill calls to the shared route.
aiter/​ops/​mla_sparse_prefill.py Adds v4 sparse-prefill routing while retaining native backend selection.
aiter/​ops/​mhc.py Routes unpinned fused post/pre calls and adds a fake implementation.
aiter/​mla.py Routes MLA decode and documents output ownership.
aiter/​fused_moe.py Routes guarded MoE execution and documents provider obligations.

Review effort: Balanced

Comment on lines +117 to +118
if backend is None:
return _gemm_a16w16_routed(
@kyle-256
kyle-256 force-pushed the kyle/aklr-plugin-routes branch from aef9a9a to 2c12d2f Compare November 17, 2026 08:46
Copilot AI balanced review requested due to automatic review settings November 17, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new contract allows returning o instead of split logits even though existing callers inspect split dimensions and partial values, so providers must preserve those semantics or reject calls requiring partial logits.

2 open issues

Review effort: Balanced

Comment thread aiter/mla.py Resolved
@kyle-256
kyle-256 force-pushed the kyle/aklr-plugin-routes branch from 2c12d2f to 373c7a4 Compare November 17, 2026 09:08
Copilot AI balanced review requested due to automatic review settings November 17, 2026 09:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The provider contract allows replacing partial logits with o even when return_logits=True; it should restrict that permission and specify the required partial-logit layout.

2 open issues

Review effort: Balanced

@kyle-256 kyle-256 changed the title [Triton/Gluon] [OPUS] Route ten more ops through the kernel plugin interface Route ten more ops through the kernel plugin interface Nov 17, 2026
@zufayu

zufayu commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@aiter-bot review

@aiter-bot

Copy link
Copy Markdown

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

@zufayu zufayu self-assigned this Nov 17, 2026
@zufayu zufayu added the ci:all label Nov 17, 2026
@zufayu
zufayu self-requested a review November 17, 2026 09:48

@zufayu zufayu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placement looks right. I checked the things that usually go wrong: _v4_auto_tries_asm is shared rather than duplicated, mla_decode_fwd does not call the already-routed mla_decode_fwd_v4_nm* (no nested route), and guard-over-route on fused_moe_ matches mhc_pre/mhc_post. Four things.

1. Two of the seven _NOT_REGISTERED entries don't need to be there

The other five hold up. But four of the seven sit outside any torch_compile_guard — mla_decode_fwd, gemm_a8w8_blockscale_out, and these two — and those are where an enabled provider actually adds Python to a caller's graph. Two of the four are avoidable.

fp8_paged_mqa_logits. #7881's "adding annotations moves the fingerprint" cost applies to an op that already has a published fingerprint; a new route has none, so the listed reason doesn't transfer. And it's easier than the entry suggests: deepgemm_fp8_paged_mqa_logits has no return statement at all — it writes out_logits and returns None, so there is no aliasing to resolve — and kv_cache is a plain tensor (.size(), .view(), slicing). That leaves kv_cache: torch.Tensor, -> None, mutates_args=["out_logits"] and a fake returning None: the shape biased_grouped_topk already uses in this PR. You are annotating two other parameters on this same function already.

mla_paged_decode. Worth flagging before you reach for #7875: that PR makes the contract the allocating form and bypasses the route when a buffer is named, but mla_gluon has no allocating form — o is a required positional with no default, and the function returns (o, lse). Applied literally, every call takes the bypass and the op never routes. What removes the aliasing here is mutates_args=["o"] on the routed wrapper returning lse alone (torch.Tensor | None), with the public wrapper reassembling (o, lse) — again the biased_grouped_topk shape.

Seven new entries become five, each either already opaque through a guard or genuinely blocked.

2. fused_moe can leave a registered presort behind

_fused_moe_impl opens with "Consume a caller's presort first, so every path (including early returns and errors) clears it", and register_presorted_moe's docstring promises the same. The route sits on fused_moe_, above it, so a served call is the first path that returns without clearing.

match_presorted_moe validates on topk_ids_ptr / topk_weights_ptr / M / block_m / num_experts / topk — pointers and shapes. A decode loop reuses the same routing buffers every step, so a leftover registration passes that check on the next native call and is used with stale contents: no presorted_moe_ignored warning, no exception, wrong routing. A provider serving some layers and declining others is the default shape, not an edge case.

An unconditional pop_presorted_moe() in the public fused_moe after the call restores the invariant in one line and changes no signature: the registration is for "the next fused_moe call", and the served call is that call. Fine as a separate PR — it just shouldn't rest on a docstring.

3. Two things for the PR body

  • Two new routes are neither registered nor under a guard: mla_decode_fwd and gemm_a8w8_blockscale_out. Both are genuinely blocked, I think (mla_decode_fwd is unannotated and its first result may be a view of o; config is a dict). But #7881's own wording is that such a route "splits a caller's graph the day a provider is enabled", and the entries record why each cannot be registered, not what that costs. The two gemm_a16w16 entries do say "already one opaque op"; these two can't, which is the distinction worth making explicit. A line on whether your framework callers have them inside a compiled region would close it.
  • pa_sparse_prefill_fp8_opus changes what a public opus-pinned name does. The pa_sparse_prefill_opus precedent is justified by "opus is the only backend this contract has"; v4 has two, so that doesn't carry over. _v4_auto_tries_asm requires gfx1250, so on gfx950 every call to this name goes to a provider, with no per-call opt-out (no backend=, and it is star-exported from aiter/__init__.py). Probably the right trade — but it belongs in the body rather than under "Breaking Changes: None".

4. Minor

gemm_a16w16 called with out= doesn't get the data_ptr check that gemm_a16w16_out now has — a provider answering in its own tensor leaves out unwritten there too, just without the error. And the _AliasLoader fix takes effect with no provider enabled and changes import semantics for every deprecated Triton module path (the old and new names used to end up as two module objects with separate module-level state, and now share one) — worth naming the Triton tests you ran that touch module-level caches or registries.

CI

The JIT op smoke red is not yours. aiter/ops/flydsl/__init__.py:8 does a bare import flydsl at module scope and fused_moe.py imports aiter.ops.flydsl.kernels.mega_moe_gfx1250.types eagerly, so collecting op_tests/windows/test_moe_small_m_direct.py fails with ModuleNotFoundError: No module named 'flydsl' on the Windows gfx1201 runner. It is pre-existing on main and only surfaces when a PR touches fused_moe.py. A separate fix is going up; rerun after it lands.

@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 #8075 — Route ten more ops through the kernel plugin interface

Review (advisory): 🔴 HIGH RISK
Validation (deterministic): NOT RUN — the PR changes runtime code but ships no test target; the changed dispatch paths are executed at run time (not a data-only diff), the PR's own tests mock every native body so no automated test runs a real kernel through the routes, and this box has no GPU (rocminfo reports no gfx device, import aiter fails), so nothing could execute here either
Perf (advisory): NOT RUN — no perf target for the same reason there is no test target (the PR changes runtime code but ships no test target), and no GPU on this box to measure by hand; the added per-call dispatch hop on per-layer hot paths is unmeasured
Size: 1296 lines / 16 files — over the review bar
Design (advisory): SPLIT — the natural seams: the _backward_compat_find_spec import fix (aiter/ops/triton/init.py) is load-bearing and merges alone; then the GEMM routes (aiter/tuned_gemm.py + the Triton gemm pair), the MoE/topk/quant routes (aiter/fused_moe.py, aiter/ops/topk.py, aiter/ops/quant.py), the MLA routes (aiter/mla.py, mla_gluon.py, mla_sparse_prefill.py, pa_sparse_prefill_opus.py, pa_mqa_logits.py), and the MHC route (aiter/ops/mhc.py); tests/plugin_contracts.json and the _NOT_REGISTERED table ride with the first stack to land
Human: recommend zufayu review the ten route placements and out-buffer contract declarations of PR #8075 — they authored aiter/plugin/init.py and the prior routing PRs (#7854, #7875, #7926), and the question is whether each route sits at the right seam (under the guard vs on the public entry, below the backend pins) and whether mla_decode_fwd's "a provider may return o" permission and gemm_a16w16_out's data_ptr check state the contract right

🔴 [verified] The PR puts a plugin query in front of the default dispatch path of aiter/fused_moe.py, aiter/mla.py, aiter/ops/quant.py and aiter/tuned_gemm.py — ops ATOM/SGLang/vLLM consume — yet carries no ci:* label (labels: Triton/Gluon, OPUS) so every downstream job is skipped, and the only reviews so far are copilot's; a routing or import regression that aiter's own suite misses would break sglang/vLLM silently after merge, and the _backward_compat_find_spec change directly affects the old Triton import paths SGLang still uses. Reviewer must add ci:all (DeepSeek is exercised by atom+sglang+vllm) and @-mention the de-facto owners (la for fused_moe.py/tuned_gemm.py by git top-committer) requesting sign-off before merge.

⚠️ [inferred] The mla_decode_fwd contract added in aiter/mla.py lets a provider return o in the first return slot ("a provider may return o there") with no restriction to return_logits=False — in-repo no caller reads the split partials (return_logits=True appears only in tests asserting it raises), but if a downstream consumer does read the per-split partials, a provider following this contract silently hands it a view of o instead. Author must restrict the permission to return_logits=False calls or confirm no downstream consumer reads the partial logits.

📝 [verified] The PR ships no test target the validator can run, and every native body in the new tests in tests/test_plugin_routed_ops.py is monkeypatched or provider-served, so no automated test executes a real kernel through the ten routes — the no-provider path is covered by the existing op_tests in CI, but the only provider-served GPU evidence is the author's manual pre-rebase MI355X run. Reviewer should ask for one device-executed routed case per op family so the routed-to-native forwarding is exercised with real kernels.

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

  • aiter/tuned_gemm.py:29 — The patch no longer applies to the merge target
  • aiter/fused_moe.py:1622 — No base-vs-head timing exists for the dispatch hop the ten routes add on per-layer hot paths…

Comment thread aiter/tuned_gemm.py Resolved
Comment thread aiter/fused_moe.py Resolved
zufayu added a commit that referenced this pull request Nov 17, 2026
)

`op_tests/windows/test_moe_small_m_direct.py` landed on main at 02:29 UTC
today (#4740). It re-exports `op_tests.test_moe_small_m_direct`, which
imports `aiter.fused_moe`, which imports FlyDSL unconditionally -- 39 names
across three `aiter.ops.flydsl` modules.

FlyDSL ships Linux-only wheels, and `requirements.txt` says so:
`flydsl==0.4.2; sys_platform != "win32"`. The Windows smoke runner therefore
logs `Ignoring flydsl: markers 'sys_platform != "win32"' don't match your
environment` and never installs it, so pytest raises
`ModuleNotFoundError: No module named 'flydsl'` while COLLECTING the module.

A collection error is not a skip: it fails the whole smoke job. Guarding the
import inside `aiter/fused_moe.py` instead would need fallbacks for all 39
names and leave the module half-defined, so the skip belongs here, next to
the platform that deliberately lacks the dependency. It costs no coverage
Windows had -- `aiter.fused_moe` has never been importable there.

The daily scheduled run (13:00 UTC) is green through 2026-11-16 because it
last ran before #4740 merged; today's would be the first to hit this.
PR #8075 found it earlier only because it carries `ci:all`, which is what
lets this job run on a pull request at all.

Verified: black and ruff clean; 47 tests still collect on Linux, where
FlyDSL is present, so the happy path is unchanged.

Co-authored-by: zufayu <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 11:47
@kyle-256
kyle-256 force-pushed the kyle/aklr-plugin-routes branch from 373c7a4 to 7afdcc8 Compare November 17, 2026 11:47
kyle-256 added a commit to AMD-AGI/AKLR that referenced this pull request Nov 17, 2026
ROCm/aiter#8075 now registers mla_paged_decode as a custom op that writes o in place and returns lse
alone, so no result aliases an input; a custom op cannot return None for a tensor, so the op returns an
empty fp32 tensor when return_lse is off. AKLR's run still writes its output into o, and now returns
that lse instead of (o, lse).
@valarLip
valarLip merged commit ee71544 into main Nov 18, 2026
@valarLip
valarLip deleted the kyle/aklr-plugin-routes branch November 18, 2026 09:18
gyohuangxin pushed a commit that referenced this pull request Nov 18, 2026
…8179)

`aiter/fused_moe.py` gained `@drop_presort_on_error` on the routed custom op
in #8075, but the import block below it lists only `drop_presort_after`.
Importing the module therefore raises at decoration time:

    aiter/fused_moe.py:2824: in <module>
        @drop_presort_on_error
    NameError: name 'drop_presort_on_error' is not defined

`import aiter` still works -- `aiter/__init__.py` does not import `fused_moe`
-- so this surfaces only for callers that reach the module, which includes
`tests/test_plugin_routed_ops.py`. That file now fails during collection, so
the plugin suite cannot run on main at all.

Both names are defined side by side in `aiter/presorted_moe.py`; only one
was listed.

Verified: `import aiter.fused_moe` succeeds, and
`tests/test_plugin_routed_ops.py tests/test_plugin_contracts.py` is 77 passed.
black and ruff clean.

Co-authored-by: zufayu <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
kyle-256 added a commit to AMD-AGI/AKLR that referenced this pull request Nov 18, 2026
ROCm/aiter#8075 now registers mla_paged_decode as a custom op that writes o in place and returns lse
alone, so no result aliases an input; a custom op cannot return None for a tensor, so the op returns an
empty fp32 tensor when return_lse is off. AKLR's run still writes its output into o, and now returns
that lse instead of (o, lse).
kyle-256 added a commit to AMD-AGI/AKLR that referenced this pull request Nov 18, 2026
…KLR's provider serves

ROCm/aiter#8075 routes flash_attn_varlen, mla_prefill_ps, mla_reduce,
gemm_a8w8_bpreshuffle, causal_conv1d_split_qkv and the two KDA recurrences
through aiter.plugin; #8179 restores the import aiter.fused_moe needs. This
aiter pins flydsl==0.5.0 (a0c4b69c pinned 0.4.2).
andrei-kochin added a commit to sshlyapn/aiter that referenced this pull request Nov 18, 2026
main (ROCm#8075) routes fused_moe through the kernel plugin interface at
version 1 and records that signature in tests/plugin_contracts.json. This
PR adds w1_global_scale / w2_global_scale to it, so the contract gate
failed after the merge ("signature of fused_moe changed without an
op_version bump").

- fused_moe_ route: version=2. v1 is not superseded: a v1 provider cannot
  bind the two new arguments (the arity check rejects it), and a *args
  forwarder that binds them would serve an NVFP4 call as MXFP4.
- Routed docstring documents the two arguments for providers.
- tests/plugin_contracts.json: fused_moe entry regenerated with the gate's
  own routed_contracts() (new signature, fingerprint, version 2).
- test_plugin_routed_ops.py: _serve declares the version the op is routed
  at instead of 1, so the fused_moe cases are still served under v2.

Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
ZLkanyo009 added a commit that referenced this pull request Nov 18, 2026
…n route

aiter/fused_moe.py conflicted with three main commits:

- #8075 (ee71544) routes fused_moe_ through the kernel plugin interface
  and decorates the public fused_moe with drop_presort_after instead of
  drop_presort_on_error. Taken as is. fused_moe_'s _eager_body is now the
  plugin's routed wrapper, so the eager call that skips the torch.ops
  dispatch still asks the providers first; the plan cache and scratch sort
  sit below the route, in the native body. The op test checks that the
  directly called body is the fused_moe route.
- #7135 (ca7cfa1) sizes the config lookup by config_M / config_topk
  (_config_shape). The plan's recorded get_2stage_cfgs arguments use them,
  and a call with _config_shape takes no plan, like one with
  _stage2_override.
- #8179 (a6c759b) imports drop_presort_on_error again; taken as is.
ZLkanyo009 added a commit that referenced this pull request Nov 18, 2026
Conflict in aiter/tuned_gemm.py with ee71544 (#8075), which routes
`_gemm_a16w16` through the kernel plugin interface (op "gemm_a16w16").
Both sides added an import at the same place and code right above
`_gemm_a16w16`: this branch the eager fast path, main the @_route
decorator. Kept both, with the decorator on `_gemm_a16w16`.

The fast path calls hipBLASLt without reaching `_gemm_a16w16`, so it
would skip the route. It now declines while any provider is enabled and
the kill switch is off, and the call goes through the custom op to the
route, which asks the providers and records its decision. It runs only
in the state where the route's dispatch calls the native body and records
nothing: AITER_PLUGINS=0 or nothing enabled by configure(). That is read
from the same config snapshot the dispatch reads, once per call.

op_tests/test_tuned_gemm_eager.py gains check_plugin_route: with a
provider enabled for gemm_a16w16, `tgemm.mm` with and without out= runs
the provider; when it declines, the custom op runs with its bits; with
nothing enabled again the fast path takes the call. Without the new check
in `_hipblaslt_eager` the first of these fails.
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.

5 participants