Repository navigation
[CI] Run the provider interface tests as a CPU-only gate on every PR - #7466
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
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 two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
ec14f3a to
27430a4
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
8927afb to
fbb04a0
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
fbb04a0 to
e26dd18
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
e26dd18 to
0436206
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
0436206 to
1b34b9f
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
1b34b9f to
bb8ab09
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
bb8ab09 to
cda519f
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
cda519f to
32cc5fb
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
32cc5fb to
548163d
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
…ests P0/P1 of the provider-architecture refactor: extract the semantic contract of the gemm_fusion/sp_qkv framework into a flat, backend-free public op and hand the native implementation to the runtime module, without importing the provider interface on main. - aiter/ops/gemm_fusion/sp_qkv/CONTRACT.md: op name/version, exact signature, dtypes/shapes/layouts, outputs/mutation, tolerance/determinism, workspace/lifetime (prepare outside capture), error behaviour, coverage matrix and non-goals. States explicitly that native is coverage-limited today (skill §5 option B) and that option A (unfused fallback owned by native) is the named follow-up. - aiter/ops/gemm_fusion/sp_qkv/op.py: sp_qkv_fused v1 with the flat signature (15 positional-or-keyword tensors + keyword-only mode/outputs/eps/group/stream); mode and mode-specific tensor validation; an explicit payload dict whose keys are the contract names in signature order; lazy native delegation to runtime.sp_qkv_native(payload). The aiter.plugin route is guarded (try/except ImportError -> identity shim) because the #7465/#7466/#7484 interface is not on main; __aiter_plugin_op__ is set when the real plugin is present. - aiter/__init__.py: lazy sp_qkv_fused export via __getattr__ (no eager framework/ torch-heavy import at aiter import time). - op_tests/test_gemm_fusion_sp_qkv_op.py: CPU-only tests for the real signature, guarded-route registration/inertness, native payload delegation, defaults, mode validation and the fake-provider serve/decline dispatch path. Gate: op tests 14 passed; op_tests/test_gemm_fusion_profile_rules.py 52 passed; Black/Ruff clean; python -c 'import aiter; print(aiter.sp_qkv_fused.__name__)' works CPU-only. runtime.py is owned by the runtime implementor and is not part of this commit.
548163d to
dd3b2fe
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
RFC ROCm#7240 lists "CPU-only handshake validation for Provider API and routed op versions" among the checks that block every AITER PR. Nothing ran them as a gate: `plugin` does not appear anywhere in .github/workflows, and tests/ has a single execution point in CI -- aiter-test.yaml, inside a container on a MI35X self-hosted runner, gated on `matrix.label == 'MI35X' && shard_idx == 0` and subject to the path filter. The contract-stability gate, the version handshake tests and the interface tests were all decorative. They now run in pre-checks, on a hosted runner, with no ROCm build and no GPU queue. What makes that possible is that aiter.plugin imports nothing but the standard library. Importing it the normal way still runs aiter/__init__.py, which needs torch and a compiled module that a bare checkout does not have, so tests/conftest.py loads the plugin module directly when the full package is unavailable. The fallback is narrow on purpose: it triggers only when the real package cannot be imported, so a built checkout always tests the real thing. The arrangement also protects the property it relies on. Giving aiter/plugin a third-party import turns this job red, which is the right outcome -- a dispatch interface that cannot be checked without a GPU build cannot be checked on every PR, and the RFC asks for exactly that. Measured: 87 tests in roughly a second without a build, against sixteen seconds with one, almost all of which is importing torch. Co-Authored-By: Claude Code <[email protected]>
The benchmark asserted two things: that the whole aiter-side overhead costs less than one Signature.bind of the same signature, and that it is under 4us. The first is machine-independent, because both sides of the comparison scale with the machine. The second is not, and on its first CI run it failed at 4.212us on a hosted runner -- against 2.45us on the machine the number came from, which is about 1.7x. Nothing had regressed. The ratio gate passed; only the absolute one fired. That is the failure mode this file's own docstring warned about two paragraphs earlier, and keeping the ceiling as a backstop was the mistake: a gate that goes red for reasons unrelated to the change is a gate people learn to ignore. Absolute numbers are still printed, including how the overhead compares to the 1us design budget and to one Signature.bind, so the measurement stays visible in every run's output. Only the assertion is gone. Co-Authored-By: Claude Code <[email protected]>
dd3b2fe to
3107fcc
Compare
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
The two ops RFC ROCm#7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from ROCm#7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (ROCm#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]>
…7466) * Run the provider interface tests as a CPU-only gate on every PR RFC #7240 lists "CPU-only handshake validation for Provider API and routed op versions" among the checks that block every AITER PR. Nothing ran them as a gate: `plugin` does not appear anywhere in .github/workflows, and tests/ has a single execution point in CI -- aiter-test.yaml, inside a container on a MI35X self-hosted runner, gated on `matrix.label == 'MI35X' && shard_idx == 0` and subject to the path filter. The contract-stability gate, the version handshake tests and the interface tests were all decorative. They now run in pre-checks, on a hosted runner, with no ROCm build and no GPU queue. What makes that possible is that aiter.plugin imports nothing but the standard library. Importing it the normal way still runs aiter/__init__.py, which needs torch and a compiled module that a bare checkout does not have, so tests/conftest.py loads the plugin module directly when the full package is unavailable. The fallback is narrow on purpose: it triggers only when the real package cannot be imported, so a built checkout always tests the real thing. The arrangement also protects the property it relies on. Giving aiter/plugin a third-party import turns this job red, which is the right outcome -- a dispatch interface that cannot be checked without a GPU build cannot be checked on every PR, and the RFC asks for exactly that. Measured: 87 tests in roughly a second without a build, against sixteen seconds with one, almost all of which is importing torch. Co-Authored-By: Claude Code <[email protected]> * Drop the absolute ceiling the gate did not need The benchmark asserted two things: that the whole aiter-side overhead costs less than one Signature.bind of the same signature, and that it is under 4us. The first is machine-independent, because both sides of the comparison scale with the machine. The second is not, and on its first CI run it failed at 4.212us on a hosted runner -- against 2.45us on the machine the number came from, which is about 1.7x. Nothing had regressed. The ratio gate passed; only the absolute one fired. That is the failure mode this file's own docstring warned about two paragraphs earlier, and keeping the ceiling as a backstop was the mistake: a gate that goes red for reasons unrelated to the change is a gate people learn to ignore. Absolute numbers are still printed, including how the overhead compares to the 1us design budget and to one Signature.bind, so the measurement stays visible in every run's output. Only the assertion is gone. Co-Authored-By: Claude Code <[email protected]> --------- Co-authored-by: zufayu <[email protected]> Co-authored-by: Claude Code <[email protected]>
…ed op report its signature (#7484) * Let a compiled op report its own signature, and keep imported routes Two things a routed production op needs before it can be routed at all. **A compiled op's public signature was (*args, **kwargs).** torch_compile_guard returns a closure and does not use functools.wraps, so inspect.signature() of any @compile_ops function reported the closure's parameters rather than the op's. The guard already knows the original as calling_func_; both branches now expose it as __wrapped__. This is not cosmetic for this interface. route() captures the public signature as the op contract. Against (*args, **kwargs) a per-op binder cannot be generated at all, so every call falls back to Signature.bind -- sixty times the cost -- and, worse, apply_defaults() has no defaults to apply, so a provider's select() would see a different number of arguments depending on how the caller spelled the call. The contract would be unusable. Side effects are small: both wrappers are plain Python functions, not OpOverloadPacket, so the assignment cannot raise; it happens after torch.library registration; and nothing else in the tree reads __wrapped__ on these. The visible change is that introspecting a compiled op now gives its real parameters, which is what it always should have given. **_reset_for_testing() cleared ops routed by importing aiter.** The autouse fixture calls it per test, so production routes registered at import vanished after the first test: status()["routed_ops"] and explain("rmsnorm", ...) would report them as unrouted for every test after that. Import-time routes are now captured on the first reset and restored on every one; test-registered ops are still cleared. tests/test_jit_signature.py covers the first, and skips where AITER is not built, so the CPU-only gate stays buildless. Both of its tests fail without the __wrapped__ change. Co-Authored-By: Claude Code <[email protected]> * Route rmsnorm and pertoken_quant, and record their contracts The two ops RFC #7240's first milestone names. Both stay native by default: routing only changes what happens once a provider is explicitly enabled. tests/plugin_contracts.json now records their signatures, so the gate from #7460 stops being vacuous and starts guarding something. Either signature changing without an op_version bump now fails CI. The end-to-end tests live in tests/test_plugin_routed_ops.py rather than in tests/test_plugin.py, because they import torch and call the real ops. The interface's own tests have to stay buildless so they can gate every PR without a GPU runner (#7466), and mixing these in would have ended that. That exposed an interaction worth naming: pytest.importorskip("aiter") does not skip when tests/conftest.py has already put a stub under that name, so tests needing a real build ran against the stub and failed instead of skipping. The stub is now marked, and requires_built_aiter() checks for it. Verified both ways: a built checkout runs 240 tests, a checkout with no compiled module runs 88 and skips the two modules that need one. What this routes, stated plainly because the PR description is where a provider author will look: - rmsnorm is the low-level HIP binding, not a public entry point. It is reached from rms_norm and rmsnorm2d_fwd only when _use_hip_common() holds; the opus path never passes through it, and the output buffer is already allocated by the caller. A provider covers that subset, not the op. - rmsnorm2d_fwd_with_add, the residual-add path, goes through add_rmsnorm instead and is not routed at all. - pertoken_quant is the torch reference implementation rather than a production kernel, and it is reused by per_block_quant_wrapper, so serving it also serves the per-block quant torch path. Co-Authored-By: Claude Code <[email protected]> * Serve a routed contract from an installed provider RFC #7240's first milestone is complete when, among other things, "one external reference Provider serves the two routed contracts". Every other condition was covered; this one was not, and it is the only one that shows the interface is usable rather than merely present. A reference provider now arrives the way a real one would -- a package and a .dist-info on sys.path, found through importlib.metadata, with nothing monkeypatched into discovery -- and serves aiter.rmsnorm end to end: enabled by environment, selected, recorded with its kernel id and artifact digest, and checked against the op's own arithmetic so the test proves it computed the op rather than merely claimed the route. The same provider declines pertoken_quant, and declines rmsnorm per call for a shape it does not cover. Both are ordinary operation rather than failure, and both are visible: provider-declined in the record, and the reason per provider in explain(). A provider that is installed, enabled and simply not serving this call is the state an operator most often needs explained, so it is the state most worth having a test for. The provider source is written out in full in the test rather than imported from a fixture, because it is also the smallest complete answer to "what does a provider have to ship" -- a name, the API versions it supports, the op versions it serves, a select() that may decline, and an evidence reference AITER records without interpreting. Co-Authored-By: Claude Code <[email protected]> * Route the residual-add path, and expose signatures from the guard itself rmsnorm2d_fwd_with_add is the per-layer residual-add path vLLM, SGLang and ATOM call -- its own docstring says so -- and it was the most conspicuous gap in what this milestone routes. It dispatches to a different kernel than rmsnorm and has a second output, so it is a separate contract rather than a shape of the first one: op "rmsnorm_with_add". Routing it needed the signature fix to move. torch_compile_guard is used directly here rather than through compile_ops, so the __wrapped__ assignments in jit/core.py did not reach it and its public signature was still (*args, **kwargs) -- unroutable, because no binder can be generated and no default can be applied. The guard now exposes calling_func on every path it returns, which covers both its own users and compile_ops'; the two assignments in jit/core.py are redundant and gone. All three entry points now report their own parameters: rmsnorm, rmsnorm2d_fwd and rmsnorm2d_fwd_with_add. The reference provider serves both contracts from one release, which is the shape an out-of-tree provider actually has -- it covers part of an op family, not all of it. It declines pertoken_quant and declines per call for a shape it does not cover, and the tests check that each contract is answered on its own terms: separate kernel ids, separate provenance, separate counts. What is still not covered, so that it is not mistaken for coverage: the opus branch of either path, which a provider never sees because the HIP check precedes it. Co-Authored-By: Claude Code <[email protected]> * Route rmsnorm where the op begins, not where one backend does The route was on `rmsnorm`, which is the HIP binding behind `module_rmsnorm_quant`. It is a public name only because `aiter/ops/rmsnorm.py` is star-imported; what it actually is, is one backend's entry point. Mounting a route there means a provider declaring op "rmsnorm" sees neither public spelling of the op. `rms_norm` and `rmsnorm2d_fwd` both call `_rms_norm_fwd_dispatch` directly -- deliberately, so the no-add path pays a single torch_compile_guard -- and that function chooses between the HIP binding and opus. Everything above the binding bypassed the route, and the opus branch could never reach a provider at all. The op name was backend-neutral while what it resolved to was not, which is the same defect #7150 exists to remove, one level further down. The route now sits on `_rms_norm_fwd_dispatch`: below both public spellings, above the backend choice. Both spellings are covered, both branches are, and downstream is unaffected -- vLLM calls `rms_norm`, ATOM calls `rmsnorm2d_fwd`, and neither changes. **Version 2, and deliberately not a supersedes of version 1.** The contracts are different shapes, not different spellings of one: v1 took an output buffer first and returned nothing, v2 takes the input first and returns the result. A provider written against v1 handed a v2 call would treat the input tensor as its output buffer. `supersedes=` means "still acceptable", which this is not. The contract gate caught the change and required the bump, which is what it is for. Two tests called `aiter.rmsnorm` directly with CPU tensors and passed only because the provider intercepted them -- with the route moved, they reached the real ROCm kernel and dumped core. They now go through a public spelling, which is what they meant to exercise. Co-Authored-By: Claude Code <[email protected]> * Check the kernel takes the contract, and let the version stay quiet A declared op version is a provider's claim that it implements this contract. Nothing checked the claim, and the failure when it is wrong is silent: a kernel written for a write-out contract, handed a functional one, has argument counts that line up by accident and writes its result into the caller's input. Verified: four positional arguments into a five-parameter function with one default raises nothing and corrupts the input. So dispatch now checks it. Before a candidate is accepted, its run is bound against the contract's shape -- how many positional arguments, which keyword-only names -- and a kernel that cannot take the call is refused with reason "contract-mismatch" rather than handed the call. A *args/**kwargs forwarder binds anything and passes, which is right: it does accept the call. Checked once per (run, op) and remembered, so the hot path is one dict lookup; measured at 0.14us, and the gate's ratio is unchanged at 0.56 of a Signature.bind. This catches shape, not meaning. A contract whose parameters are unchanged but whose semantics moved is what the version number is for, and nothing automatic can see it. The two are complements, which is why both are here. With the check in place the version can stop being ceremony: - `route(op=...)` defaults to version 1. An op whose contract has never moved says nothing about versions, and the number appears where it carries information -- on the one op here that has moved. - A provider may list op names instead of mapping them to versions: `op_versions = {"rmsnorm"}` means whichever version is current. Most providers have nothing to say about versions and should not have to say it; one spanning a contract change still declares explicitly. Naming an op claims that op only, not the ones it did not name. Letting a provider mean "current" is safe because of the check: a provider that declared "current" and was built against an older shape is refused rather than run. Without the check it would have been a blank cheque. Co-Authored-By: Claude Code <[email protected]> * Stop last_decision() answering with a record the kill switch invalidated With AITER_PLUGINS=0 dispatch records nothing, which is what makes that path cost 0.141us. The consequence was that last_decision() went on returning whatever was recorded before the switch was turned off, with nothing about the answer saying it was stale. It is a convincing wrong answer, which is worse than no answer, and it misled the first demo written against it. Reporting None there is the honest answer, and it is a stronger statement than "this call decided nothing": with the feature off, nothing is being decided at all. A record taken before the switch describes a world that no longer holds. The check is on the read rather than on the dispatch path. Clearing the record per call would have cost 0.056us on every one of them, and recording a Decision anyway 0.973us, to make a handful of reads correct -- the kill switch exists to cost nothing. Reading costs 0.011us and reads are rare, so the cost goes where the question is asked. Measured: the kill-switch path is unchanged at 0.141us. The record is hidden rather than destroyed, so turning the switch back off restores it. Co-Authored-By: Claude Code <[email protected]> * Have the reference provider read each contract on its own terms Its select() read args[0] for both contracts to find the hidden size. That works today by coincidence: the functional contract takes the input first and the write-out one takes the output, and both happen to carry the hidden size in the same axis. It would break silently the first time a contract's parameter order moved, and the failure would be a wrong coverage decision rather than an error. The provider source in this file is written out in full because it doubles as the answer to "what does a provider ship". Something written to be copied should demonstrate the careful version, so it now names which argument carries the shape for each contract, and the comment says why reading one position for both is the wrong habit. Co-Authored-By: Claude Code <[email protected]> * Route the two blockscale GEMM entries The GEMM pilot routes gemm_a8w8_blockscale and gemm_a8w8_blockscale_bpreshuffle as they already exist. AITER exposes the shuffled-b weight layout as its own public function; that is a layout rather than a backend, and whether the two should converge is #7150's question. Routing them unchanged keeps this pilot out of a public API change. The two are not independent: gemm_a8w8_blockscale with isBpreshuffled delegates to the other one's E8M0 route, so both are recorded in the contract baseline rather than only the entry a caller is likeliest to name. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Record in the baseline that no routed op accepts an older version rmsnorm is at version 2 and accepts only version 2; the gate now reads that from the file rather than from a default. A later edit adding version 1 back has to change this line, which is the point: it moves no signature and no fingerprint, so nothing else would show it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Pin what a captured graph does to a routing decision "capture" appeared nowhere in this tree -- not in the module, not in a test -- while the RFC names graph capture as part of the contract. It is the quietest failure mode in the design: replay runs no Python, so whatever dispatch decided on the capturing call is what the graph does for its whole life, and because replay records no Decision, nothing afterwards says which call decided it. A first call that landed inside capture could freeze an op on the wrong route with no observable trace. Measured on an MI355X before writing the tests: select() is called once during capture and zero times across three replays, and last_decision() after replay still describes the capturing call. Two tests hold it: - a provider selected at capture stays selected; replays add no Decision at all, and the reading still describes the capturing call, which is precisely why an operator cannot tell replays apart from it; - AITER_PLUGINS=0 does not reach an already-captured graph. The switch stops future dispatch; it cannot un-bake a kernel, because there is no dispatch left inside the graph to stop. Anyone reaching for it during an incident needs to know the graphs have to be rebuilt. Both run on a real device (8x gfx942 here) rather than being skipped, and both were mutation-checked: breaking each assertion's premise turns them red. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Stop charging every caller for a route nobody enabled On the day this merges, every caller is in the state where no provider is enabled -- and that state walked eligibility and built a frozen Decision for a call that no provider could possibly serve. Measured here: 1.902us per routed call against the kill switch's 0.137us. Five routed ops, rmsnorm twice per layer, is roughly 0.23ms of CPU per decode step in eager mode. It is a pure loss: nobody paying it gets anything back. An empty enable list and the kill switch say the same thing -- no provider can serve this call -- so dispatch now treats them as one branch and goes straight to native. 1.902us -> 0.149us, which is what the kill switch costs. Profiling first, because the expensive half was not the one I expected: _config() 0.036us _eligible() 0.109us (cache hit) _run_native() 1.613us of which Decision(...) alone is 0.863us A frozen dataclass costs more to build than everything else on the path put together. Skipping the branch skips both. The cost is that these calls record no Decision, so last_decision() and decision_counts() stay empty while nothing is enabled. Same trade the kill switch already makes. explain() and status() still answer in full, on demand, and three tests now say so rather than leaving it to the commit message. Two things fell out of the change that were defects, not consequences: - last_decision() would have returned the *stale* provider route after configure(enable=()) turned routing off. Its docstring already argued why that is worse than returning nothing -- for the kill switch. The read now applies the same rule to both states. - the route-change log lost its most useful line. An op with no entry was treated as having no comparable past, so the first provider route after a framework enables one was recorded as a silent baseline. What it was doing before is not unknown -- it was running native -- so that transition is now an audit line, which is the one an operator most wants. Tests: the three that used default-deny as a convenient "no provider" fixture now use an enabled provider that declares another contract version, so the recording path keeps its coverage instead of losing it to the shortcut. The overhead file gains a second machine-independent gate: nothing-enabled must cost within 3x of the kill switch, which the 1.9us path would fail. pytest -q tests/ -- 318 passed, 1 skipped, 463 subtests, on 8x gfx942. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: zufayu <[email protected]> Co-authored-by: Claude Code <[email protected]>
The checks RFC #7240 says must block every AITER PR were not running as checks.
Companion to #7465 (the interface) and #7484 (routing). This one touches
.github/workflows/pre-checks.yamlandtests/conftest.pyonly, so it wants aCI reviewer.
The gap
Nothing ran them.
pluginappears nowhere in.github/workflows/, andtests/has a single execution point in CI —
aiter-test.yaml, inside a container on aMI35X self-hosted runner, gated on
matrix.label == 'MI35X' && shard_idx == 0, and subject to the path filter.So the contract-stability gate, the version handshake tests and the interface
tests were decorative: they queued behind GPU hardware, and a PR that did not
touch the filtered paths skipped them entirely. That is not the gate the RFC
asks for.
What this does
They run in
pre-checks, onubuntu-latest, with no ROCm build and no GPUqueue.
What makes that possible is that
aiter.pluginimports nothing but thestandard library. Importing it the normal way still runs
aiter/__init__.py,which needs torch and a compiled module a bare checkout does not have, so
tests/conftest.pyloads the plugin module directly when the full package isunavailable.
The fallback is narrow on purpose: it triggers only when the real package cannot
be imported, so a built checkout always tests the real thing — the GPU run
is unaffected.
It also protects the property it relies on
Giving
aiter/plugina third-party import turns this job red. That is the rightoutcome rather than an inconvenience: a dispatch interface that cannot be
checked without a GPU build cannot be checked on every PR, and the RFC asks for
exactly that. The constraint becomes enforced instead of merely true.
Cost
90 tests in roughly a second without a build, against sixteen seconds with one —
almost all of the difference is importing torch.
Testing
pytest -q tests/— unchanged, this adds no tests. Verified in a simulated barecheckout where
import aiterraises.actionlintclean on the modifiedworkflow.
🤖 Generated with Claude Code
PR Self-Review
Reviewed revision
3107fcc334Behavior and intent
The checks RFC #7240 requires on every AITER PR were not running as checks.
pluginappeared nowhere in.github/workflows/, andtests/had exactly oneexecution point in the whole CI, gated on
matrix.label == 'MI35X' && shard_idx == 0— a GPU self-hosted runner. So the contract-stability gate, theversion handshake tests and the interface tests were decorative: a PR that did
not trigger the GPU workflow could change a routed op's public signature and
nothing would object.
This adds a
plugin-interfacejob onubuntu-latestthat runs them on everyPR with no build and no GPU, plus
tests/conftest.pysupport for loading theplugin module standalone when the compiled package is absent. A built checkout
still imports the real package, so the gate does not quietly test a stub where
the real thing exists.
Validation and unverified scope
The job runs green on this PR in 19 seconds — visible as the
Kernel Provider Interfacecheck — which is the point: it completes without a GPU runner andwithout a build. 90 plugin tests in roughly a second, against sixteen seconds
with a build, almost all of the difference being
import torch.python -m pytest -q tests/— 299 passed, 1 skipped; this PR adds no tests, itonly makes existing ones block. Verified in a simulated bare checkout that the
standalone loader path is taken and that
requires_built_aiter()skips ratherthan fails.
Unverified: the job has only ever run on this repository's hosted runners. An
earlier revision asserted an absolute microsecond ceiling and failed at 4.2µs
on a hosted runner against 2.4µs locally — about 1.7× — so the ceiling was
removed and only the machine-independent ratio gate kept. That history is why
no absolute timing bound is asserted in CI here.
PR-specific question
What permissions and untrusted-input boundary does this CI change have, and
can fork PR code or text reach a privileged execution path?
The job runs under
pull_request, notpull_request_target, so a fork PR'scode executes with the default read-only
GITHUB_TOKENand no access torepository secrets. It checks out the PR head and runs
pytest,black --checkandruff check— fork code does execute, which is inherent torunning tests, but it executes in that unprivileged context. The job writes
nothing back: no comment, no label, no artifact upload, no cache write keyed on
untrusted input. No PR title, branch name or body text is interpolated into a
shell command, so there is no injection path from attacker-controlled text into
a privileged step. It adds no
permissions:escalation and inherits theworkflow's existing read-only default.
Changed op tests
None. This PR changes
.github/workflows/pre-checks.yaml,tests/conftest.pyand
tests/test_plugin_overhead.pyonly. No file underop_tests/is touched.