You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[OPUS] Tune gfx1250 a16w16 GEMMs for Kimi K2 on 96 CUs - #7514
This PR adds 63 tuned OPUS a16w16 rows for 12 Kimi-K2 BF16 GEMM shapes on gfx1250 96-CU partitions. It registers the gfx1250 a16w16 OPUS kernels for 96 CUs so that those rows resolve. It also makes the tuned-row lookup check an OPUS row under the device's exact arch, so a gfx1250-strict device skips rows its dispatch would reject. The Gluon configs for the same shapes are in #6595.
Motivation
On a gfx1250 96-CU partition, tuned_gemm serves these shapes with non-persistent Gluon. The only 96-CU tuned rows for them on main are 27 FlyDSL rows, none of them for the TP4 shapes. OPUS could not run on 96 CUs at all: KERNEL_REGISTRY["a16w16"]["gfx1250"] only had a 256-CU table, so an OPUS row's kernel ID did not resolve and the lookup skipped the row.
Registering the kernels is not enough on its own. Without a tuned row, OPUS falls back to a heuristic kernel, which is 1.23x to 6.05x slower than the tuned kernel at these points.
Changes
csrc/opus_gemm/opus_gemm_common.py: registers the gfx1250 a16w16 kernel list for 96 CUs as well as 256, with the same 717 kernels. The default compile set gets a matching (gfx1250, 96) entry, and the OPUS JIT build now compiles the kernels that 96-CU rows name.
aiter/tuned_gemm.py: get_GEMM_A16W16_tuned_config resolves an OPUS row's kernel under the device's exact arch, which is the arch dispatch uses, instead of the folded gfx1250. On non-strict devices the two are the same.
aiter/configs/model_configs/kimik2_bf16_tuned_gemm.csv: 63 OPUS rows for gfx1250, cu_num=96, bf16 input and output, no bias. No existing row changes.
op_tests/test_opus_a16w16_policy_parity.py: the pre-PR codegen map is now keyed by (arch, cu_num, M, N, K, outdtype).
Impact: only non-strict gfx1250 devices that report 96 CUs select the new rows. Non-strict 256-CU devices and other architectures select the same kernels as on main. On gfx1250-strict devices, every gfx1250 OPUS row now falls back to Triton. On main, those devices selected the row and then failed at launch with ValueError.
Performance
Measured on 9 Nov on one gfx1250 (MI450X) GPU in a 96-CU DPX partition, with current main and this PR merged (1eab5ae + af05baa). At each of the 63 points, these two kernels were timed in the same process, interleaved:
Untuned OPUS is the kernel OPUS uses when a shape has no tuned row. This is the kid that resolve_a16w16_heuristic_candidate picks, with no split-K, and it is what gemm_a16w16_opus launches without a row. It is kid 3 or 4 at M = 4-16, and kid 6 or 7 at M >= 128. It needs this PR's 96-CU registration.
This PR is the OPUS row that tuned_gemm resolves in the merged tree, launched the way tuned_gemm launches it.
Each kernel ran in a CUDA graph of at least 32 launches that rotates through at least 1 GiB of weight copies, so weights come from HBM. Each time is the median of 7 interleaved rounds, each the median of 10 graph replays. The spread across rounds was at most 3.6%, and under 3% for 122 of the 126 timings.
Shape (N x K)
Rows at M =
Speedup vs untuned OPUS
2112 x 7168
4, 8, 16, 512, 1024, 2048, 4096, 8192, 16384
2.31x to 3.85x
3072 x 1536
4, 8, 16, 8192, 16384
1.55x to 5.02x
4096 x 512
4, 8, 16, 8192, 16384
1.70x to 5.90x
7168 x 2048
4, 8, 16, 8192, 16384
1.23x to 5.13x
1536 x 1536
1024, 2048, 4096, 8192, 16384
3.61x to 5.04x
2048 x 512
512, 1024, 2048, 4096, 8192, 16384
3.13x to 5.79x
7168 x 1024
128, 512, 1024, 2048, 4096, 8192, 16384
2.79x to 6.05x
4608 x 7168
512, 1024, 2048, 4096, 8192, 16384
3.84x to 4.17x
7168 x 2304
128, 512, 1024, 2048, 4096, 8192, 16384
2.60x to 5.05x
7168 x 256
128
3.04x
512 x 7168
2048, 4096, 8192, 16384
2.60x to 3.93x
384 x 7168
1024, 4096, 16384
1.81x to 3.60x
Every row is faster than untuned OPUS. The 12 rows at M = 4, 8 and 16 are 1.23x to 2.62x faster (geomean 1.72x). The 51 rows at M >= 128 are 1.81x to 6.05x faster (geomean 4.09x). Through the padded-M lookup, the M = 4, 8 and 16 rows serve every M from 3 to 16.
All 63 rows
Shape (N x K)
M
Untuned kid
Untuned (µs)
This PR kid / split-K
This PR (µs)
Speedup
2112 x 7168
4
3
17.64
0 / 7
6.73
2.62x
2112 x 7168
8
3
17.67
0 / 7
6.82
2.59x
2112 x 7168
16
3
17.79
57 / 5
7.11
2.50x
2112 x 7168
512
6
65.31
561 / 0
28.23
2.31x
2112 x 7168
1024
6
125.5
527 / 0
38.15
3.29x
2112 x 7168
2048
6
255.2
527 / 0
74.83
3.41x
2112 x 7168
4096
6
523.9
596 / 0
141.4
3.70x
2112 x 7168
8192
6
1099.8
596 / 0
289.0
3.81x
2112 x 7168
16384
6
2269.7
596 / 0
590.2
3.85x
3072 x 1536
4
4
6.69
2 / 0
4.17
1.60x
3072 x 1536
8
4
6.71
57 / 5
4.06
1.65x
3072 x 1536
16
4
6.74
711 / 0
4.35
1.55x
3072 x 1536
8192
7
438.1
716 / 0
87.31
5.02x
3072 x 1536
16384
7
868.2
716 / 0
173.1
5.02x
4096 x 512
4
4
4.44
711 / 0
2.60
1.71x
4096 x 512
8
4
4.44
710 / 0
2.60
1.71x
4096 x 512
16
4
4.49
710 / 0
2.64
1.70x
4096 x 512
8192
7
319.5
715 / 0
57.26
5.58x
4096 x 512
16384
7
632.3
715 / 0
107.2
5.90x
7168 x 2048
4
4
8.68
111 / 3
7.00
1.24x
7168 x 2048
8
4
8.74
111 / 3
7.04
1.24x
7168 x 2048
16
4
8.75
103 / 3
7.11
1.23x
7168 x 2048
8192
7
1334.6
716 / 0
270.1
4.94x
7168 x 2048
16384
7
2704.3
716 / 0
526.7
5.13x
1536 x 1536
1024
7
30.36
548 / 0
8.40
3.61x
1536 x 1536
2048
7
59.16
597 / 0
13.14
4.50x
1536 x 1536
4096
7
118.1
541 / 0
25.20
4.69x
1536 x 1536
8192
7
244.0
541 / 0
49.32
4.95x
1536 x 1536
16384
7
495.8
541 / 0
98.36
5.04x
2048 x 512
512
7
12.37
572 / 0
3.95
3.13x
2048 x 512
1024
7
22.46
583 / 0
5.35
4.20x
2048 x 512
2048
7
39.56
715 / 0
9.93
3.98x
2048 x 512
4096
7
77.40
598 / 0
17.19
4.50x
2048 x 512
8192
7
163.1
715 / 0
28.92
5.64x
2048 x 512
16384
7
331.7
715 / 0
57.34
5.79x
7168 x 1024
128
7
17.43
562 / 0
6.25
2.79x
7168 x 1024
512
7
57.05
582 / 0
14.46
3.95x
7168 x 1024
1024
7
111.6
596 / 0
25.79
4.33x
7168 x 1024
2048
7
223.9
598 / 0
43.83
5.11x
7168 x 1024
4096
7
451.4
716 / 0
79.29
5.69x
7168 x 1024
8192
7
896.6
715 / 0
154.6
5.80x
7168 x 1024
16384
7
1790.9
716 / 0
296.2
6.05x
4608 x 7168
512
7
151.9
593 / 0
39.28
3.87x
4608 x 7168
1024
7
300.6
593 / 0
78.28
3.84x
4608 x 7168
2048
7
586.4
596 / 0
140.7
4.17x
4608 x 7168
4096
7
1161.1
597 / 0
287.7
4.04x
4608 x 7168
8192
7
2406.5
596 / 0
587.4
4.10x
4608 x 7168
16384
7
4858.9
596 / 0
1195.2
4.07x
7168 x 2304
128
7
29.48
562 / 0
11.35
2.60x
7168 x 2304
512
7
97.33
582 / 0
27.02
3.60x
7168 x 2304
1024
7
189.2
596 / 0
48.24
3.92x
7168 x 2304
2048
7
371.7
598 / 0
83.19
4.47x
7168 x 2304
4096
7
734.0
716 / 0
150.4
4.88x
7168 x 2304
8192
7
1461.0
716 / 0
299.4
4.88x
7168 x 2304
16384
7
2983.3
716 / 0
591.0
5.05x
7168 x 256
128
7
10.01
544 / 0
3.29
3.04x
512 x 7168
2048
7
70.42
561 / 0
27.12
2.60x
512 x 7168
4096
7
139.5
581 / 0
35.74
3.90x
512 x 7168
8192
7
270.3
582 / 0
76.38
3.54x
512 x 7168
16384
7
541.8
597 / 0
137.7
3.93x
384 x 7168
1024
7
26.21
707 / 0
14.52
1.81x
384 x 7168
4096
7
100.1
508 / 0
29.18
3.43x
384 x 7168
16384
7
415.4
525 / 0
115.3
3.60x
Testing
Re-benchmark on 9 Nov with main and this PR merged, on a 96-CU partition (the Performance tables):
All 63 points resolve through get_GEMM_A16W16_config to their OPUS row's kernel and split-K.
Both kernels match an fp32 reference at every point, with a relative Frobenius error of at most 1.7e-3.
Tuning correctness: before being timed, every OPUS candidate had to match an fp32 reference with a relative Frobenius error below 2e-2.
test_a16w16_tuned_config_lookup: the 5 existing tests and TestGfx1250StrictOpusRow pass. TestGfx1250FlydslCandidates errors because FlyDSL isn't installed, the same as without this PR.
test_gfx1250_strict_alias: 6/6.
test_opus_a16w16_policy_parity: 19/19.
test_config_shape_collision: 31/31.
af05baa only changes the CSV. The unit tests have not been rerun on it.
Documentation
No documentation change is needed. This PR adds tuned rows, registers an existing kernel list for another CU count and fixes a lookup check. No API changes.
Dependencies
Independent of #6595; the two PRs touch different files. Where both cover the same point, the OPUS row in this PR takes precedence over the Gluon config in #6595.
Breaking Changes
None for K-contiguous inputs. For non-K-contiguous A or B at these points, see the PR-specific question below.
On a non-strict gfx1250 device with 96 CUs, bf16 GEMMs at the 12 shapes now run the tuned OPUS kernel at the rows' M values and the M values that pad to them. This applies only to GEMMs with bf16 output, no bias, no scaleAB and no bpreshuffle. Before, these points ran non-persistent Gluon. To make this possible, the PR registers the gfx1250 OPUS kernels for 96 CUs, which previously only had a 256-CU table.
The PR also fixes the strict lookup. A gfx1250-strict device reuses the gfx1250 rows. The lookup used to check an OPUS row under the folded gfx1250 arch, but dispatch uses gfx1250-strict, which accepts no OPUS kernel, so the row was returned and then failed at launch. The lookup now checks the row under the same arch as dispatch, so the row is skipped and the GEMM uses Triton.
No point that main serves with FlyDSL changes.
Validation and unverified scope
Validated:
Latency and correctness of all 63 rows on a 96-CU partition, with main and this PR merged. Each tuned row was timed against untuned OPUS in the same process.
Dispatch: in the merged tree, tuned_gemm resolves every point to its OPUS row.
At af05baa: all 63 rows resolve to their kernels in the 96-CU registry.
At e0d087d on 256 CUs: the unit tests listed under Testing.
A gfx1250-strict device; the fix was only checked at the function level.
Non-K-contiguous inputs.
M values other than the tuned ones.
An end-to-end Kimi-K2 run.
PR-specific question
Which boundaries select the new rows:
Architecture: gfx1250 with cu_num == 96. A gfx1250-strict device looks up the same rows but skips every OPUS row, because no OPUS kernel resolves under gfx1250-strict.
dtype: bf16 input and bf16 output, with bias, scaleAB and bpreshuffle all False. The lookup key includes all of these.
Shape: one of the 12 (N, K) pairs, with M equal to a row's M or padded to it.
M = 3-16 pads to the 4, 8 and 16 rows.
Larger M is padded up to the next power of two and uses the row there, if there is one.
For N > 4096, M above 8192 uses the 8192 row, except M = 16257-16384, which uses the 16384 row.
M = 1-2 and M = 17-64 match no new row.
What stops unsupported inputs: the lookup only returns an OPUS row that dispatch on the same device will accept. It resolves the kernel ID for the device's exact arch and CU count, checks that the kernel name matches, and builds a launch plan for this shape and split-K. If any step fails, it falls back to the next padded row or to Gluon.
Gap: tensor strides. The lookup key has no stride information, and opus_gemm passes A and B to the launcher unchanged. The launcher requires both to be K-contiguous and raises NotImplementedError otherwise. For example, A = torch.randn(512, 4).T with B of shape (4096, 512) now raises, where main ran Gluon. Existing 256-CU OPUS rows already behave this way. Kimi-K2 serving uses the TN layout (K-contiguous activations, (N, K) weights), so it doesn't hit this. This PR does not fix it.
Changed op tests
op_tests/test_opus_a16w16_policy_parity.py, changed test_shipped_tuned_selection_diff_is_exhaustive and _pre_pr_codegen_tuned_map:
The test compares every shipped OPUS row against a rebuild of the pre-migration C++ table, which was keyed without cu_num.
With gfx1250 registered at both 96 and 256 CUs, 20 shapes have rows at both CU counts, and 19 of them name different kernels. One row would overwrite the other and the test would fail.
Adding cu_num to the key fixes this. It is the CI check that every new 96-CU row resolves.
op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py, new TestGfx1250StrictOpusRow:
Uses a mocked kid-0 row at (4, 2112, 7168) on 96 CUs.
Checks that gfx1250 selects the row, and that gfx1250-strict skips it and falls back to Triton.
It fails without the tuned_gemm.py fix. No existing test covers how OPUS rows resolve under the strict arch.
Register the gfx1250 a16w16 kernels for 96 CUs as well as 256, so OPUS
rows tuned on a 96-CU partition resolve. Add 20 OPUS rows to
kimik2_bf16_tuned_gemm.csv for the four Kimi-K2 BF16 projection shapes,
(N, K) = (2112, 7168), (3072, 1536), (4096, 512) and (7168, 2048), at
M = 4, 8, 16, 8192 and 16384.
The policy parity test keys its pre-PR codegen map by CU count too.
With two gfx1250 CU tables, a same-shape row on 96 and 256 CUs would
otherwise overwrite the other in that map.
Split out of #6595, which keeps the Gluon configs.
Co-authored-by: Cursor <[email protected]>
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 7514 --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.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The tuned lookup accepts a kid-0 row using the fallback architecture, but dispatch on a strict 96-CU device rejects it with ValueError instead of retaining the default backend.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The new BF16 GEMM selections lack current-revision correctness and latency validation on 96-CU gfx1250 hardware; available GPU evidence covers earlier dispatch revisions or 256-CU configurations.
On gfx1250/96 CUs, BF16 A = randn(512, 4).T and contiguous B of shape (4096, 512) match this new row, but OPUS rejects A's K stride of 4 with NotImplementedError. Selection does not check strides or convert the operands, so this loses the column-major input support of the previous Gluon fallback. Add a layout-aware fallback or materialize supported operands before launching OPUS, with regression coverage for transposed A/B on a newly tuned shape.
The reason will be displayed to describe this comment to others. Learn more.
a few small things..
ci PR Self-Review failed — not sure yet (medium): GitHub reports startup_failure, i.e. the run failed before any job started. The PR changes no workflow files and the other five runs on the same SHA succeeded, so the PR code cannot be the cause; no log exists under .valar/ci to identify the actual trigger.
Conflict in aiter/tuned_gemm.py with a3d7388 (#7514): main added
`_opus_reads_layout` right above `_gemm_a16w16`, where this branch has
`_gemm_gfx_cu`. Kept both.
#7514 changes what the tuned lookup returns on gfx1250 (96-CU OPUS rows,
the strict id's kid check) and, in `_gemm_a16w16`, sends an OPUS row whose
operands OPUS cannot read to Triton or torch. The fast path asks the same
lookup with the same (gfx, cu_num) key and runs only hipBLASLt rows, so it
declines every OPUS row and the custom op makes those choices.
op_tests/test_tuned_gemm_eager.py gains check_gfx1250_opus: with the device
key stubbed to a 96-CU gfx1250 and the OPUS and Triton backends stubbed,
the real lookup gives #7514's OPUS rows for two Kimi-K2 shapes; each call
reaches the custom op, the fast path and the op ask the lookup with the
same key, and the op runs OPUS with that row, or Triton when B is not
K-contiguous. Keying the fast path's lookup by the runtime arch or by the
256-CU table, or dropping the layout fallback, makes it fail.
Brings in 1243b4b, the merge of main with a3d7388 (#7514), and its
check that the BF16 fast path declines gfx1250 OPUS rows to the custom op.
No conflict; main did not change the a8w8 or quant paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds 63 tuned OPUS a16w16 rows for 12 Kimi-K2 BF16 GEMM shapes on gfx1250 96-CU partitions. It registers the gfx1250 a16w16 OPUS kernels for 96 CUs so that those rows resolve. It also makes the tuned-row lookup check an OPUS row under the device's exact arch, so a
gfx1250-strictdevice skips rows its dispatch would reject. The Gluon configs for the same shapes are in #6595.Motivation
On a gfx1250 96-CU partition,
tuned_gemmserves these shapes with non-persistent Gluon. The only 96-CU tuned rows for them onmainare 27 FlyDSL rows, none of them for the TP4 shapes. OPUS could not run on 96 CUs at all:KERNEL_REGISTRY["a16w16"]["gfx1250"]only had a 256-CU table, so an OPUS row's kernel ID did not resolve and the lookup skipped the row.Registering the kernels is not enough on its own. Without a tuned row, OPUS falls back to a heuristic kernel, which is 1.23x to 6.05x slower than the tuned kernel at these points.
Changes
csrc/opus_gemm/opus_gemm_common.py: registers the gfx1250 a16w16 kernel list for 96 CUs as well as 256, with the same 717 kernels. The default compile set gets a matching(gfx1250, 96)entry, and the OPUS JIT build now compiles the kernels that 96-CU rows name.aiter/tuned_gemm.py:get_GEMM_A16W16_tuned_configresolves an OPUS row's kernel under the device's exact arch, which is the arch dispatch uses, instead of the foldedgfx1250. On non-strict devices the two are the same.aiter/configs/model_configs/kimik2_bf16_tuned_gemm.csv: 63 OPUS rows forgfx1250,cu_num=96, bf16 input and output, no bias. No existing row changes.op_tests/test_opus_a16w16_policy_parity.py: the pre-PR codegen map is now keyed by(arch, cu_num, M, N, K, outdtype).op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py: addsTestGfx1250StrictOpusRow.Impact: only non-strict gfx1250 devices that report 96 CUs select the new rows. Non-strict 256-CU devices and other architectures select the same kernels as on
main. Ongfx1250-strictdevices, every gfx1250 OPUS row now falls back to Triton. Onmain, those devices selected the row and then failed at launch withValueError.Performance
Measured on 9 Nov on one gfx1250 (MI450X) GPU in a 96-CU DPX partition, with current
mainand this PR merged (1eab5ae + af05baa). At each of the 63 points, these two kernels were timed in the same process, interleaved:resolve_a16w16_heuristic_candidatepicks, with no split-K, and it is whatgemm_a16w16_opuslaunches without a row. It is kid 3 or 4 at M = 4-16, and kid 6 or 7 at M >= 128. It needs this PR's 96-CU registration.tuned_gemmresolves in the merged tree, launched the waytuned_gemmlaunches it.Each kernel ran in a CUDA graph of at least 32 launches that rotates through at least 1 GiB of weight copies, so weights come from HBM. Each time is the median of 7 interleaved rounds, each the median of 10 graph replays. The spread across rounds was at most 3.6%, and under 3% for 122 of the 126 timings.
Every row is faster than untuned OPUS. The 12 rows at M = 4, 8 and 16 are 1.23x to 2.62x faster (geomean 1.72x). The 51 rows at M >= 128 are 1.81x to 6.05x faster (geomean 4.09x). Through the padded-M lookup, the M = 4, 8 and 16 rows serve every M from 3 to 16.
All 63 rows
Testing
mainand this PR merged, on a 96-CU partition (the Performance tables):get_GEMM_A16W16_configto their OPUS row's kernel and split-K.get_kernel_instance("gfx1250", "a16w16", kid, cu_num=96)to a kernel with the row'skernelName.test_a16w16_tuned_config_lookup: the 5 existing tests andTestGfx1250StrictOpusRowpass.TestGfx1250FlydslCandidateserrors because FlyDSL isn't installed, the same as without this PR.test_gfx1250_strict_alias: 6/6.test_opus_a16w16_policy_parity: 19/19.test_config_shape_collision: 31/31.Documentation
No documentation change is needed. This PR adds tuned rows, registers an existing kernel list for another CU count and fixes a lookup check. No API changes.
Dependencies
Independent of #6595; the two PRs touch different files. Where both cover the same point, the OPUS row in this PR takes precedence over the Gluon config in #6595.
Breaking Changes
None for K-contiguous inputs. For non-K-contiguous A or B at these points, see the PR-specific question below.
PR Self-Review
Reviewed revision
b01264d
Behavior and intent
On a non-strict gfx1250 device with 96 CUs, bf16 GEMMs at the 12 shapes now run the tuned OPUS kernel at the rows' M values and the M values that pad to them. This applies only to GEMMs with bf16 output, no bias, no scaleAB and no bpreshuffle. Before, these points ran non-persistent Gluon. To make this possible, the PR registers the gfx1250 OPUS kernels for 96 CUs, which previously only had a 256-CU table.
The PR also fixes the strict lookup. A
gfx1250-strictdevice reuses the gfx1250 rows. The lookup used to check an OPUS row under the foldedgfx1250arch, but dispatch usesgfx1250-strict, which accepts no OPUS kernel, so the row was returned and then failed at launch. The lookup now checks the row under the same arch as dispatch, so the row is skipped and the GEMM uses Triton.No point that
mainserves with FlyDSL changes.Validation and unverified scope
Validated:
mainand this PR merged. Each tuned row was timed against untuned OPUS in the same process.tuned_gemmresolves every point to its OPUS row.unverified:
gfx1250-strictdevice; the fix was only checked at the function level.PR-specific question
Which boundaries select the new rows:
gfx1250withcu_num == 96. Agfx1250-strictdevice looks up the same rows but skips every OPUS row, because no OPUS kernel resolves undergfx1250-strict.bias,scaleABandbpreshuffleall False. The lookup key includes all of these.What stops unsupported inputs: the lookup only returns an OPUS row that dispatch on the same device will accept. It resolves the kernel ID for the device's exact arch and CU count, checks that the kernel name matches, and builds a launch plan for this shape and split-K. If any step fails, it falls back to the next padded row or to Gluon.
Gap: tensor strides. The lookup key has no stride information, and
opus_gemmpasses A and B to the launcher unchanged. The launcher requires both to be K-contiguous and raisesNotImplementedErrorotherwise. For example,A = torch.randn(512, 4).Twith B of shape (4096, 512) now raises, wheremainran Gluon. Existing 256-CU OPUS rows already behave this way. Kimi-K2 serving uses the TN layout (K-contiguous activations, (N, K) weights), so it doesn't hit this. This PR does not fix it.Changed op tests
op_tests/test_opus_a16w16_policy_parity.py, changedtest_shipped_tuned_selection_diff_is_exhaustiveand_pre_pr_codegen_tuned_map:cu_num.cu_numto the key fixes this. It is the CI check that every new 96-CU row resolves.op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py, newTestGfx1250StrictOpusRow:gfx1250selects the row, and thatgfx1250-strictskips it and falls back to Triton.tuned_gemm.pyfix. No existing test covers how OPUS rows resolve under the strict arch.