Repository navigation
[Triton/Gluon] [gfx1250] Add a gfx1250 Gluon KDA gating kernel for ATOM's decode entry. - #7990
Conversation
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 |
kda_atom.fused_sigmoid_gating_delta_rule_update takes the arguments of ATOM's kernel of the same name and runs kda_gating_kernel for decode, state fork and speculative verify: in place, K = V = 128, BF16 or FP16 activations, an FP32 V-first state and int32 slot tables. For any other input it returns None without a launch, and ATOM runs its own kernel. One program keeps BV rows of a 128x128 state tile in registers and loads the whole tile before the math. In-place and fork calls use different layouts and cache policies; the kernel selects them at run time from the read and write slots. The configs are in configs/gfx1250/gluon/attention/kda_gating/DEFAULT.json, keyed by the number of sequences times value heads. On gfx1250 with cold states, the entry is 1.12x to 1.93x faster than ATOM's Triton kernel on 75 shapes (H = 12, 24, 48; decode, fork, and speculative verify with T = 8). bench_kda gets atom backends for each H, an atom_spec backend, and --timing rotating, which reads a cold state on each call as in a decode step.
ef139aa to
7bf8076
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Missing metadata capacity and device checks, along with unmasked empty-sequence loads, can cause out-of-bounds GPU reads or invalid launches.
5 open issues
What changed in this PR
This PR adds a gfx1250 Gluon KDA gating entry for ATOM’s Kimi-K3 decode, state forks, and speculative verification, with a None return path for unsupported inputs.
Changes:
- Adds an ATOM-compatible entry, metadata checks, and a specialized Gluon kernel.
- Adds configuration buckets for one-token and multi-token workloads.
- Adds reference and graph-replay tests, plus ATOM benchmark modes with cold-state timing.
| File | Description |
|---|---|
op_tests/triton_tests/attention/test_kda_atom.py |
Tests recurrence results, slot handling, graph replay, and unsupported inputs. |
op_tests/op_benchmarks/triton/bench_kda.py |
Adds ATOM benchmark modes and rotating-buffer timing. |
aiter/ops/triton/configs/gfx1250/gluon/attention/kda_gating/DEFAULT.json |
Defines workload-specific kernel configurations. |
aiter/ops/triton/attention/kda_gating.py |
Checks input metadata and launches the kernel. |
aiter/ops/triton/attention/kda_atom.py |
Exposes the ATOM-compatible entry and fallback behavior. |
aiter/ops/triton/_gluon_kernels/gfx1250/attention/kda_gating.py |
Implements the gfx1250 recurrence kernel and configuration selection. |
Review effort: Balanced
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (5)
- Expose a static support query and make the entry use it. ROCm/ATOM#3362 now copies the rule by hand (
get_gfx() == "gfx1250"andlower_bound is not Noneand an fp32 state). That copy already disagrees with this entry: the entry checks the live Triton arch forgfx1250orgfx1250-strict, but ATOM'sget_gfx()followsGPU_ARCHSand returnsgfx1250-stricton strict parts. Add one predicate, for examplesupports(*, lower_bound, state_dtype, head_k_dim, head_v_dim, act_dtype, ...) -> bool, that usesis_gfx1250_family(get_gfx_runtime()).fused_sigmoid_gating_delta_rule_updateandtry_kda_gatingmust call the same predicate, so there is one source of truth (kda_atom.py:64,kda_gating.py:56-121). - Make the API generic, not named after one consumer.
attention/kda_atom.pyand the "ATOM's ..." docstrings put a caller into aiter's public path. Name the module and the entry for what they compute (KDA lower-bound gating decode with a separate read-slot table). Remove the softplus-onlybeta/thresholdarguments that are always deleted. Changecu_seqlens: torch.LongTensorto an int32 tensor type, because int64 is declined. Rule 1 ofaiter/ops/triton/README.md:fused_recurrent_kda(attention/kda.pyplus_gluon_kernels/gfx1250/attention/kda_decode.py) already does this recurrence withlower_bound, a sigmoid beta, 2D slot tables andnum_accepted_tokenson gfx1250. The only missing feature is the read-slot table. Add that table to the existing op, or time this kernel againstfused_recurrent_kdaon the same no-fork shapes. Your tests already run both on these shapes. The table now compares only against ATOM's Triton kernel. - Decline inputs that give wrong results without a message. With a 1D slot table, only token
bosof each sequence is computed. The other rows ofostay uninitialized wheno is None(kda_gating.py:114,122; kernel:566). A host check without a sync is enough: decline whenq.shape[1] > n_seqfor a 1D table. In spec verify, the kernel loadsaccepted[seq]andread[seq, accepted-1]before it checkseos > bos. Soaccepted == 0readsread[seq, -1](kernel:479-487; Copilot found this too). Mask these loads, or state the[1, width]contract in the docstring. Log each decline reason at DEBUG withAiterTritonLogger. - Show that the new test runs on gfx1250 CI.
test_kda_atom.pyis skipped on the MI35X/MI300X Triton runners.ffm-bringup.yamlreplacesop_tests/triton_tests/with its own branch, so this file does not run there either. Give a CI run, or a log at the current head. The redStandard Tests (MI35X)shard fails inop_tests/test_flydsl_hgemm.py, which this PR does not touch. - Fix the small items. Use
fast_sigmoid/sigmoid_log2from_gluon_kernels/common/utils.pyfor beta (kernel:70-76,357). Add tests foro=Noneand for a 4Do(o.shape == v.shape). Fix Copilot's openbench_kda.pyitems: give an explicitdtype=torch.float32to the state,A_loganddt_bias, and use--deviceinmake_atom_case.
Reviewed at 7bf8076. The recurrence, gate, slot and MULTI_PRE math match ATOM's Triton kernel. The test reference is an independent loop that covers every config bucket, forks, negative slots, CUDA graph replay and declines.
try_kda_gating returns None, before it allocates o or launches, when a slot table has fewer rows than sequences, a 2D table has no columns, num_accepted_tokens has fewer entries than sequences, or a tensor is not on q's CUDA device. Speculative verify no longer reads a slot for an empty sequence, whose accepted count may be 0. The ATOM backends of bench_kda.py create their tensors on --device with explicit dtypes, and the benchmark runs in that device's context.
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (5)
- Expose a static support query and make the entry use it (still open).
kda_atom.py:64still comparesget_arch()strings, and there is no predicate a caller can use. ROCm/ATOM#3362 at 3515e07 still copies the rule by hand (gfx == "gfx1250" and lower_bound is not None and state_dtype == "fp32"), so it routesgfx1250-strictparts to its own kernel, and it raises when this entry declines a routed call. Add one predicate, e.g.supports(*, lower_bound, state_dtype, head_k_dim, head_v_dim, act_dtype) -> boolbuilt onis_gfx1250_family(get_gfx_runtime())(aiter/jit/utils/build_targets.py:75,chip_info.py:112). Have both the entry andtry_kda_gatingcall it, so #3362 can call it instead of keeping a copy. - Make the API generic and reuse the existing op (still open). Rename
attention/kda_atom.pyand drop the "ATOM's ..." wording from the docstrings of all three files. Removebeta/threshold, which the entry always deletes (kda_atom.py:31-32,63). Typecu_seqlensas an int32 tensor, nottorch.LongTensor(:36), because int64 is declined (kda_gating.py:100). Under rule 1 ofaiter/ops/triton/README.md:fused_recurrent_kda/kda_decode.pyalready pick the read slot fromnum_acceptedin spec verify, so the only missing piece is a separate read-slot table. Add that table to the existing op, or post timings of this kernel againstfused_recurrent_kdaon the same no-fork shapes. - Decline inputs that give wrong results without a message (partly fixed). A 1D slot table still runs only token
bosof each sequence, so witho=Nonethe remaining rows ofostaytorch.emptygarbage (kda_gating.py:116,148; kernel:566-567). Declinenot multi_token and q.shape[1] > n_seqon the host; this needs no device sync. In spec verify, a non-empty sequence withaccepted == 0still loadsread[seq, -1](kernel:480-482). Mask with(eos > bos) & (col >= 0), or state the[1, width]range in the docstring. Log each decline reason at DEBUG withAiterTritonLogger(README rule 20); none of the 14return Nonepaths logs anything. - Show that the new test passes on gfx1250 at the current head. No gfx1250 job runs this file. It is skipped on the MI35X and MI300X Triton runners, and
ffm-bringup.yamltakesop_tests/triton_testsfromshared/reduced_tests_for_FFM_CI. The posted "35 passed" and the self-review revision are both at 7bf8076, but head adds 4 new decline cases and a kernel change. Post a pytest log at 5d138c4 and update the self-review revision; aiter-bot reports it as FAIL. - Fix the small items. Use
sigmoid_log2/fast_sigmoidfrom_gluon_kernels/common/utils.pyinstead of the hand-written sigmoid (kernel:69-76,356-357). Fold the two_one_tokencalls that differ only in constexprs (:569-641) into one call. Add tests foro=None, for a 4Do, and for the untested decline branches: K/V != 128, badA_log/dt_bias/cu_seqlens, and badodtype, stride or shape. Fix the docstrings: in_gating_case(test_kda_atom.py:49) the odd rows fork, not "every second row" (:68). "Contiguous slots" (kda_gating.py:46) is not checked. Theorules and the rule that the read table must match the write table's shape and strides are missing. Witho=None, rows of empty or negative-read sequences stay uninitialized.
Re-reviewed at 5d138c4. Already fixed: Copilot's capacity checks (table rows, 2D width, accepted length), device checks, the masked read-slot load for empty spec sequences, and the bench_kda.py fp32 dtypes and --device.
|
@aiter-bot please review again |
attention/kda_atom.py is merged into attention/kda_gating.py. The entry is kda_gating_decode, without beta, threshold and is_kda, and cu_seqlens is int32. supports() checks the gate, the state and activation dtypes, the head sizes and is_gfx1250_family(get_gfx_runtime()), so that a caller can select its route one time. kda_gating_decode calls it on each call. The entry now declines a 1D slot table with more tokens than sequences, and speculative verify skips a sequence whose accepted count is below 1. Each decline logs its reason at DEBUG through AiterTritonLogger. The kernel uses fast_sigmoid from _gluon_kernels/common/utils.py. The in-place path at up to 4596 sequence-heads keeps the IEEE divide that its tuned config selects, because fast_sigmoid makes it up to 14% slower. The test is now test_kda_gating.py, with cases for o, supports() and each decline path. bench_kda gets recurrent backends, which time fused_recurrent_kda on the inputs of the gating backends.
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (3)
- Compare this kernel with
fused_recurrent_kda, or add the read-slot table to it (still open). Rule 1 ofaiter/ops/triton/README.mdapplies.bench_kda.pynow has therecurrent_same/recurrent_specbackends, but the description gives no numbers from them. Postgating_samevsrecurrent_sameandgating_specvsrecurrent_specat H = 12/24/48/96 with--timing rotating. Iffused_recurrent_kdais as fast on the no-fork shapes, add the read-slot table to it instead of a second kernel. - Re-measure and re-validate at ec44f53, then update the description. This head changes the kernel math. The non-in-place
_one_tokenpath now defaults toFAST_DIV=True(kernel:121), and_multi_token_prenow usesfast_sigmoid(:356-357). The non-in-place path runs every fork and every decode at ≤ 180 sequence-heads (INPLACE_VEC: 0). The speed-up tables, "35 passed" and the self-review revision are all from 7bf8076, and aiter-bot still reports FAIL. The description also nameskda_atom.py,test_kda_atom.pyandfused_sigmoid_gating_delta_rule_update, which this head removed. Post a pytest log oftest_kda_gating.pyand the perf table at head. No CI job runs this file on gfx1250: it is skipped on MI35X, andffm-bringup.yamluses its own test branch. - Fix the small items. Fold the two
_one_tokencalls that differ only in constexprs (kernel:571-643). The docstring "Both paths compute the same values" (:466) is now wrong: the in-place path can use the IEEE divide and the other path usesfast_dividef.resolve_config_dir(..., arch="gfx1250")(:659) is outside the twoarch=fallbacks thatconfigs/AGENTS.mdallows. Add it to that rule, or resolvegfx1250-strictthe way the other gfx1250 Gluon loaders do.
Re-reviewed at ec44f53. Already fixed: the supports() predicate, which the entry calls and which ROCm/ATOM#3362 now calls instead of its hand copy; the generic module and entry names; the beta/threshold removal and int32 cu_seqlens; the 1D T > n_seq decline; the masked accepted < 1 read with its test; DEBUG decline logs; fast_sigmoid; tests for o=None, a 4D o and the decline branches; the _gating_case docstring; all of Copilot's items.
- Fold the two _one_token calls into one call in a gl.static_range(2) loop. The in-place copy is first, so the LDS barrier that the compiler adds between the copies is on the fork path. - Correct the kernel docstring: the INPLACE_* config can use the IEEE divide, and the other one-token programs use fast_dividef. - Resolve the config directory by the running arch, as the other gfx1250 Gluon loaders do. supports() is now True only on gfx1250, because gfx1250-strict has no config tree. - Get the arch from arch_info, so that the entry imports with AITER_TRITON_ONLY=1. - Test that supports() is False on gfx1250-strict, and run the test module only on gfx1250.
Thanks. 1c4ed7d fixes the three items, and the description now gives the data at 1c4ed7d. 1. Comparison with Decode (T = 1):
Speculative verify (T = 8, no read table):
2. Re-measure and re-validate at the head: done.
pytest log3. Small items: done.
|
|
@aiter-bot re-review |
Merge upstream main b2bca5d and retain both the gate-fold imports and ROCm#7990's kda_gating benchmark imports. Keep the existing review history. Preserve the upstream benchmark/test updates and unrelated plugin contracts. The gate-fold kernel, public wrapper and the two provider v2 contracts are unchanged from the previous review head. KDA CPU guards (2), upstream plugin-contract tests (18), source/AST, Black 26.10.1, Ruff 0.16.0 and feature diff checks passed. No new local GPU, ISA, model, benchmark or E2E run was performed. Co-authored-by: OpenAI Codex <[email protected]> Signed-off-by: Sumin Hong <[email protected]>
…7916 @ 7e2f22e, head 2026-11-16T05:44:05Z) Applied as the diff 8bbce0d..7e2f22e (8 files) onto the rebased 1116 tree; PR state: open, author Liang-jianhao97, base main. (cherry picked from commit becedb0) Rebase onto main 12-03: main #8061 moved fast_launch from _triton_kernels/kimi_delta_attn/ to utils/fast_launch.py and already takes the ordinary path while a launch hook is set (this PR's _launch_hooks_idle). The old file stays deleted; this PR's other fast_launch change, falling back to the ordinary launch when CompiledKernel.run raises TypeError (launcher ABI changed), is ported into utils/fast_launch.py as a per-wrapper disable. kda_one_token.py and test_kda_one_token.py import utils.fast_launch. bench_kda.py keeps main's gating / recurrent case backends (#7990) and adds this PR's one_token / generic backends, --padded, and a shape check per family; --timing rotating takes both families.


Motivation
On gfx1250, KDA decode and speculative verify spend most of their time in the gating recurrence: the per-channel gate, then the delta-rule update of a 128x128 FP32 state for each (sequence, value head). This PR adds
kda_gating_decode, a Gluon kernel for this update that is optimized for gfx1250, andsupports, which a caller uses to select its route one time. ROCm/ATOM#3362 routes Kimi-K3's KDA gating to it.fused_recurrent_kdaruns the same recurrence, but it has no read-slot table apart from the write-slot table. A state fork reads its state from one slot and writes it to another slot in the same launch, so it needs that table. On the no-fork shapes that both ops take,kda_gating_decodeis 1.10x to 2.44x faster thanfused_recurrent_kda, from TP 8 (H = 12) to TP 1 (H = 96). It is also 1.16x to 1.91x faster than ATOM's Triton kernel on all 100 measured shapes. For an input that it does not take, the entry returns None without a launch and logs the reason at DEBUG.Technical Details
aiter/ops/triton/attention/kda_gating.py:supports(*, lower_bound, state_dtype, head_k_dim, head_v_dim, act_dtype) -> boolis True for a lower-bounded gate, an FP32 state, K = V = 128, BF16 or FP16 activations and a gfx1250 GPU (arch_info.get_arch() == "gfx1250"). The config tables are keyed by the exact arch, and only gfx1250 has them, so it is False ongfx1250-strict.kda_gating_decode(A_log, a, b, dt_bias, q, k, v, o=None, scale=None, initial_state=None, inplace_final_state=True, cu_seqlens=None, ssm_state_indices=None, num_accepted_tokens=None, use_qk_l2norm_in_kernel=False, ssm_state_indices_in=None, lower_bound=None)returns(o, initial_state). It callssupports(), then checks the shapes, dtypes, strides, devices and slot tables of the call. The checks read only tensor metadata, so they do not synchronize and work under CUDA graph capture. For an input that the kernel does not take, it returns None without a launch and logs the reason at DEBUG throughAiterTritonLogger.ssm_state_indicesis the int32 write-slot table.ssm_state_indices_inis the read-slot table, with the same shape and strides; None reads from the write slots. The read slot isread[seq, num_accepted_tokens[seq] - 1]in speculative verify, elseread[seq]. A read slot below 0, an empty sequence or an accepted count below 1 skips the sequence. A write slot below 0 still writes the output. Slot 0 is a real slot.kda_gating_kernel(aiter/ops/triton/_gluon_kernels/gfx1250/attention/kda_gating.py): in place, K = V = 128, HV a multiple of H, BF16 or FP16 activations, an FP32 V-first state. A 1D slot table gives each sequence 0 or 1 tokens. A 2D table gives each sequence up to one token for each column, for speculative verify and multi-token calls.fast_sigmoidfrom_gluon_kernels/common/utils.py. The in-place path at 181 to 4596 sequence-heads keeps the IEEE divide (INPLACE_FAST_DIVin the config), becausefast_sigmoidmakes that path up to 14% slower.configs/gfx1250/gluon/attention/kda_gating/DEFAULT.json: aone_tokentable for 1D slot tables and amulti_tokentable for 2D ones. They are keyed by sequences x value heads and loaded withresolve_config_dir, which takes the running arch as the other gfx1250 Gluon loaders do, andselect_leq_config.bench_kda.py:gating_same,gating_splitandgating_forkbackends for each H: one table as the read and the write table; a copy of it as the read table; every read from a slot that no sequence writes. Agating_specbackend for speculative verify.recurrent_sameandrecurrent_specbackends, which callfused_recurrent_kdaon the inputs ofgating_sameandgating_spec.--timing rotating(RotatingBufferBench), which gives each call a cold state, as in a decode step. The defaultcudagraphtiming replays the same buffers, so the state stays in cache.Test Plan
pytest op_tests/triton_tests/attention/test_kda_gating.pyon gfx1250, 59 cases:o=Noneand a 4Do, CUDA graph replay after the slots and lengths change, and agreement withfused_recurrent_kdawhere both apply.supports()with the Kimi-K3 setup and with each condition except the arch changed (6 cases), and ongfx1250-strict(1 case).bench_kda.py --timing rotatingat H = 12/24/48/96:kda_gating_decodeandfused_recurrent_kdaon the same no-fork shapes, and an A/B against ec44f53 in the same session.AITER_TRITON_ONLY=1: the entry imports, andsupports()is True on gfx1250.PYTHONPATH.Test Result
test_kda_gating.pyat 1c4ed7d: 59 passed.bench_kda.py --timing rotatingat 1c4ed7d, µs, median of 3 runs, mean of two rounds.fused_recurrent_kdagets the same inputs asgating_sameandgating_spec:Decode (T = 1).
gating_splituses a copy of the slot table as the read table, and ingating_forkevery sequence forks:gating_samerecurrent_samegating_splitgating_forkSpeculative verify (T = 8, no read table):
gating_specrecurrent_speckda_gating_decodeis faster thanfused_recurrent_kdaon all 32 shapes: 1.10x to 1.63x in decode and 1.22x to 2.44x in speculative verify. The smallest gains are at B = 1 in decode (1.10x to 1.20x), where both ops take 2 to 4 µs. Thusfused_recurrent_kdais not as fast on the no-fork shapes, and a read-slot table in it would add forks, but not this speed. In the same session, the 72gating_*values are between 1.4% faster and 1.5% slower than at ec44f53, apart fromgating_specat H = 24, B = 16, where ec44f53 was 6% slower in both rounds. A re-check with the order reversed gives 0.3% there, and the multi-token code of the two heads is the same.With Kimi-K3's fused beta at H = 12: 1.23x to 1.87x.
Detailed results
gfx1250,
rocm/fw-bringup-mlperf:gfx1250-atom-20261106-dsv41container, at 1c4ed7d. ATOM'sfused_sigmoid_gating_delta_rule_update(atom/model_ops/fla_ops/fused_sigmoid_gating.py, the same at ROCm/ATOM 2684c6d and 8f2903b62) and this entry get the same inputs and the same timing: CUDA graph replay with RotatingBufferBench over input sets that span at least 196 MB, so each call reads a cold state; 100 calls per graph, 10 replays, median of 3 runs. These tables use a different timing harness frombench_kda.py, so their values are not equal to thebench_kda.pyvalues.lower_bound = -5, q/k L2 normalization in the kernel.Each cell: ATOM µs / this PR µs (ATOM time ÷ this PR time).
Decode (T = 1; the read table is a separate buffer that holds the write slots)
Fork (T = 1; every sequence reads its state from a slot that no sequence writes)
Every row forks, which is the worst case. ATOM forks a sequence only for one forward, when it takes or resumes from a state checkpoint, and the other rows of the batch run as decode.
Speculative verify (T = 8,
--num-speculative-tokens 7; 2D write table, no read table, 1 to 8 accepted tokens)H = 12 with Kimi-K3's fused in_proj beta (median of 3 runs)
Beta is a view of the fused in_proj row
[q | k | v | g | beta | f_a]with token stride 6284, as Kimi-K3 passes it. Each cell: ATOM µs / this PR µs (ATOM time ÷ this PR time).PR Self-Review
Reviewed revision
1c4ed7d
Behavior and intent
This PR adds
aiter.ops.triton.attention.kda_gating.kda_gating_decodeandsupports, and the gfx1250 Gluon kernel behind them, so that a model can run KDA gating decode, state forks and speculative verify on aiter. ROCm/ATOM#3362 is the first caller, for Kimi-K3. Existing behavior does not change: every file exceptbench_kda.pyis new, and no existing kernel, wrapper or config is edited.fused_recurrent_kdahas no separate read-slot table, which forks need, and on the shapes that both ops take, the new kernel is 1.10x to 2.44x faster. For an input that it does not take, the entry returns None without a launch and logs the reason at DEBUG, so the caller keeps its own kernel.Validation and unverified scope
On gfx1250 in
rocm/fw-bringup-mlperf:gfx1250-atom-20261106-dsv41(ROCm 10.1.0, HIP 7.16, PyTorch 2.11.0, Triton 3.9.0.dev20261022):pytest op_tests/triton_tests/attention/test_kda_gating.py -vat 1c4ed7d: 59 passed.python -m op_tests.op_benchmarks.triton.bench_kda --timing rotating --metric time --num_heads 12 24 48 96 --runs 3, with--backends gating_same gating_split gating_fork recurrent_same --seq_lens 1 --batch_sizes 1 16 72 256 512and with--backends gating_spec recurrent_spec --seq_lens 8 --batch_sizes 1 16 72, at 1c4ed7d, in two rounds that alternate with the same runs at ec44f53: the tables in Test Result.pytest tests/models/test_kimi_k3_kda_gating_dispatch.py tests/models/test_kimi_k3_kda_gating_parity.py: 22 passed (6 dispatch, 16 parity).AITER_TRITON_ONLY=1: the entry imports andsupports()is True on gfx1250.black==26.5.1 --check,ruff==0.16.0 checkandgit diff --checkpass on the changed files.Unverified: architectures other than gfx1250,
gfx1250-strictincluded (it has no config tree), wheresupports()is False, the entry returns None and the test module is skipped; end-to-end accuracy and throughput in a model; benchmarks for FP16 and HV ≠ H, which only the unit tests cover. Also not checked at run time: the per-sequence lengths and accepted counts, which the host cannot read without a device sync. With a 1D slot table, a sequence with more than one token gets only its first token. In speculative verify, a count above the table width reads past the row of the sequence. The host declines a 1D table with more tokens than sequences, and the docstring states both rules.PR-specific question
Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
The only configuration change is the new
aiter/ops/triton/configs/gfx1250/gluon/attention/kda_gating/DEFAULT.json. Its only reader isget_kda_gating_config, and onlykda_gating_decodecalls that, after all of its checks pass. The table isone_tokenfor a 1D slot table (decode, fork) andmulti_tokenfor a 2D one (speculative verify).select_leq_config(prefix="SEQ_HEADS_LEQ_")then picks the bucket from sequences x value heads:one_tokenSEQ_HEADS_LEQ_180one_tokenSEQ_HEADS_LEQ_4596one_tokenanymulti_tokenSEQ_HEADS_LEQ_96multi_tokenanyNo existing config file, kernel or wrapper changes, and nothing on main calls the new entry, so every other op and shape keeps its previous selection:
git diff --stat e3931369c 1c4ed7d3blists only the newkda_gatingfiles, the new config and test, andbench_kda.py.test_gating_kernel_matches_referenceruns all five buckets at H = 12 against a PyTorch reference: decode at 1, 16 and 384 sequences, fork at 15, 16 and 384, and speculative verify and 2D tables without accepted counts at 8 and 9, so each bucket boundary has a case on both sides.Changed op tests
op_tests/triton_tests/attention/test_kda_gating.py(new, 59 cases): testskda_gating_decode,supportsandkda_gating_kernelagainst a PyTorch reference of the recurrence. It covers the slot rules (separate read and write slots, forks that leave the read slots unchanged, a negative read slot or an accepted count of 0 that skips the sequence, a negative write slot that still writes the output, slot 0, empty sequences, speculative verify that readsssm_state_indices_in[seq, accepted - 1]), each config bucket, H = 24 and 48, FP16, HV = 2H, a strided beta,o=Noneand a 4Do, CUDA graph replay after the slots and lengths change, agreement withfused_recurrent_kdawhere both apply,supports()(also ongfx1250-strict), and 22 inputs that must return None, log the reason and write nothing. Not redundant: no existing test calls this entry or kernel, andtest_kda.pytestsfused_recurrent_kda, which has no read-slot table.op_tests/op_benchmarks/triton/bench_kda.py(modified): adds thegating_same,gating_split,gating_forkandgating_specbackends, which time the new entry in Kimi-K3's layouts (beta as a view of the fused in_proj row, BF16 activations, FP32 V-first state); therecurrent_sameandrecurrent_specbackends, which timefused_recurrent_kdaon the same inputs; and--timing rotating, which replays a CUDA graph over a RotatingBufferBench pool so that each call reads a cold state. Not redundant: the existinggluonandflabackends timefused_recurrent_kdaand FLA on their own inputs, and the existingcudagraphtiming replays the same buffers, which keeps the state in cache. The new backends raise if the entry declines their case, so they cannot time an empty graph.Submission Checklist