Skip to content

[Config] [Perf] Use non-temporal B loads in twelve Kimi-K3 decode BF16 GEMM rows on gfx950 - #8915

Merged
yifehuan merged 1 commit into
mainfrom
perf/kimik3-bf16-decode-rows-bnt
Dec 2, 2026
Merged

yifehuan merged 1 commit into
mainfrom
perf/kimik3-bf16-decode-rows-bnt

Conversation

@jhinpan

@jhinpan jhinpan commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Twelve rows of aiter/configs/model_configs/kimik3_bf16_tuned_gemm.csv name the same tile with _bnt, the non-temporal B loads of #7546: 6016 x 7168 and 6288 x 7168 at 1, 2, 4, 8, 16 and 32 rows (gfx950, 256 compute units, BF16 to BF16, no bias).

  • Gain: 3.6 to 8.2 % less time per launch, by the tuner's method on MI355X.
  • Who: tgemm.mm callers of these shapes with 1 to 32 rows. In SGLang main that is the merged Kimi-K3 input projection (6288 x 7168). SGLang's call for 6016 x 7168 copies only the tile from the row, so those six rows change nothing there yet.
  • Cost: a caller that launches the same weights again while they are in the last-level cache can get slower (+7.7 % and about +12 % measured).

Motivation

Changes

One file, 12 lines, no kernel, policy or test file: kernelName gets _bnt; solidx (its index in the tuner catalog of main 8b6b4b4), us, err_ratio, tflops and bw are those of the _bnt kernel.

Caller M After
tgemm.mm, either shape 1 to 32 the row's tile with _bnt
tgemm.mm, either shape 33 and up no change
Direct gemm_a16w16() call with the ten tile fields of a row all no change

An AOT cache from before this change lacks the seven new kernels. tgemm.mm compiles them at first use. A run-only process (FLYDSL_RUNTIME_RUN_ONLY=1) raises RuntimeError for the 12 rows until the prebuild runs again.

The SGLang path, with file and line in SGLang main 884b0b9eaa9e

All lines are in python/sglang/srt/models/kimi_k3.py unless a file is named.

  • 6288 x 7168. The number 6288 is not written in SGLang source. It results from a merge of weights at load time. _merge_kda_inproj_weights_hip (line 2401) concatenates fused_qkvg_proj, f_a_proj and b_proj and pads the rows to a multiple of 8 (lines 2416 to 2419; the pad is line 375).
    • fused_qkvg_proj: 6144 rows at TP 8 (line 194, "(6144, 7168) ... KDA fused qkvg"; it is 4 x head_dim x num_heads / TP by lines 2034 and 2082 to 2098).
    • f_a_proj: 128 rows (lines 2078 and 2109 to 2111: "f_a (128, replicated)").
    • b_proj: 12 rows per rank (line 2077: "b (12/rank)"; line 2106: "TP8 shards K3's 96 beta rows").
    • 6144 + 128 + 12 = 6284, padded to 6288.
  • The call. For 1 to 256 rows (lines 2634 to 2636; the limit is SGLANG_ROCM_K3_FUSE_KDA_INPROJ_MAX_TOKENS, python/sglang/srt/environ.py line 1288) the model calls self.fused_qkvg_proj.quant_method.apply(self._qkvgbfa_layer, hidden_states, None) (lines 2641 to 2643). That is UnquantizedLinearMethod.apply, which ends in tgemm.mm(x, layer.weight, bias, otype=x.dtype) (python/sglang/srt/layers/quantization/unquant.py line 1157).
  • The branches before that line do not take this shape with the default settings, as I read them: the TLX path is off by default (environ.py line 1131); the hipBLASLt list has no (6288, 7168) (unquant_hip.py lines 19 to 21); the Triton path needs K of at most 2048 or a registered shape (unquant.py lines 147 to 150 and 181 to 205).
  • The merge is on by default on ROCm (SGLANG_ROCM_K3_FUSE_KDA_INPROJ, environ.py line 1287) when the conditions of _may_fuse_kda_inproj hold (line 2437).
  • 6016 x 7168 is the merged MoE front (line 195). I found no call in SGLang main that sends it through tgemm.mm. Under AITER it asks for fp32 output and takes a16w16_into (unquant_hip.py line 81), which copies ten fields: block_m, block_n, block_k, stages, split_k, m_waves, n_waves, k_waves, group_m, use_half_tile_interleaved (lines 47 and 48). It does not copy b_non_temporal. So for SGLang main the six rows of 6016 x 7168 change nothing until that call also copies b_non_temporal.
  • The rows of 6288 x 7168 came with [Triton/Gluon] [Config] k3 gfx950 tuning bf16 tp8 shapes #6019 ("k3 gfx950 tuning bf16 tp8 shapes": M = 8, 16, 32) and [Config] small-M shapes for Kimi-K3 BF16 GEMMs for gfx950 #5903 ("small-M shapes for Kimi-K3 BF16 GEMMs for gfx950": M = 1, 2, 4). The rows of 6016 x 7168 came with [HIP] [FlyDSL] Refactor gfx950 A16W16 GEMM with centralized policy selection and tuning #5145.
AOT pre-compilation: what the replay builds, and the run-only check

python -m aiter.aot.flydsl.gemm replays every row through aiter.tuned_gemm.gemm_a16w16. The kernel binary depends on the tile and its options, not on M, N or K.

  • I ran the replay of the 35 rows of the two shapes (34 name a FlyDSL kernel) on a CPU without a device, on main 8b6b4b4 and on this branch, and again on main 4122ef5 and its merge with this commit: 26 and 26 entries each time, with the same binaries. 19 are common and byte-identical. 7 are only on main (the seven tiles without _bnt), 7 only on this branch (the same tiles with _bnt).
  • Over all 33 BF16 tables, six of the seven old kernels stay in a full prebuild, because 1 to 16 other rows name each of them. One is no longer named by any row: t32x64x128x5_ks2_w1x4x1. I did not run the replay of the full tables.
  • python -m aiter.aot.flydsl.gemm --check with the rows of this branch on a cache that was built from the rows of main: 22 ok, 12 failed, at 8b6b4b4 and at 4122ef5. The 12 are the edited rows: RuntimeError: FLYDSL_RUNTIME_RUN_ONLY=1 but no usable AOT cache.
  • The direct ten-field call has another cache key (15 key items against the 18 of tgemm.mm: no b_non_temporal, k_stagger, bpreshuffle). It matches no entry of the replay, on main and on this branch alike.

Performance (if applicable)

One idle MI355X. The tuner's method (run_perftest(run_flydsl_gemm_bf16, ...), 10 warm-up and 101 timed eager launches), median of 3 runs. Microseconds; K = 7168.

Hardware Workload/configuration Before After Change
MI355X 1 x 6016 16.31 15.40 -5.6 %
2 x 6016 16.39 15.53 -5.3 %
4 x 6016 16.46 15.70 -4.6 %
8 x 6016 16.62 16.02 -3.6 %
16 x 6016 17.93 17.20 -4.1 %
32 x 6016 18.30 16.93 -7.5 %
1 x 6288 16.78 15.63 -6.8 %
2 x 6288 16.96 15.57 -8.2 %
4 x 6288 17.00 15.68 -7.7 %
8 x 6288 17.33 16.27 -6.1 %
16 x 6288 18.34 17.46 -4.8 %
32 x 6288 20.41 19.68 -3.6 %
  • 1 to 16 x 6288: one session (the second), this method only, on main 8b6b4b4 with the other seven rows changed. Those seven: main b4d0133, repeated in the second session (3.2 to 9.4 %; per row up to 2.8 points from the first).
  • Per kernel launch. I have no serving number.

Cost with warm weights (one weight tensor, launched again while in the 256 MiB last-level cache):

Row Before After Change
32 x 6288 16.53 17.79 +7.7 %
16 x 6016 14.64, 14.46 16.33, 16.31 +11.5 %, +12.8 %
32 x 6016 15.42, 15.24 14.82, 14.82 -3.9 %, -2.8 %

32 x 6288: through tgemm.mm, back to back in a graph. 6016: direct call with the row's tile, eager, two sessions. Not measured in this state: 1, 2, 4, 8 x 6016 and 1, 2, 4, 8, 16 x 6288.

The runs of the 12 rows (microseconds), software, sessions

MI355X (gfx950, 256 compute units), PyTorch 2.11.0+rocm10.0.0, HIP runtime 7.15.26333, FlyDSL 0.5.3. Every timed launch has its own copy of input, weight and output. Three runs per kernel, the two kernels alternate. Session A is the first session: main b4d0133. Session B is the second: main 8b6b4b4 with the seven rows of session A changed.

M x N x K Tile Kernel of the row today _bnt us in the table before Session
1 x 6016 x 7168 t16x32x256x4_ks1_w1x1x2 16.58, 16.30, 16.31 15.40, 15.35, 15.44 16.3630 A
2 x 6016 x 7168 t16x32x128x5_ks1_w1x2x1 16.39, 16.44, 16.39 15.69, 15.44, 15.53 16.3068 A
4 x 6016 x 7168 t16x32x128x7_ks1_w1x2x1 16.57, 16.46, 16.43 15.81, 15.70, 15.67 16.1489 A
8 x 6016 x 7168 t16x32x256x4_ks1_w1x1x2 16.72, 16.62, 16.60 16.08, 15.98, 16.02 16.6913 A
16 x 6016 x 7168 t16x32x256x4_ks1_w1x2x1 17.95, 17.93, 17.93 17.24, 17.05, 17.20 17.7605 A
32 x 6016 x 7168 t32x96x64x5_ks4_w2x2x1 18.45, 18.21, 18.30 16.96, 16.87, 16.93 19.1205 A
1 x 6288 x 7168 t16x32x128x5_ks1_w1x2x1 16.95, 16.78, 16.76 15.83, 15.63, 15.63 17.5296 B
2 x 6288 x 7168 t16x32x128x6_ks1_w1x2x1 17.07, 16.96, 16.96 15.67, 15.57, 15.46 17.6137 B
4 x 6288 x 7168 t16x32x128x6_ks1_w1x2x1 17.12, 17.00, 16.99 15.68, 15.72, 15.67 17.5516 B
8 x 6288 x 7168 t16x32x128x5_ks1_w1x2x1 17.39, 17.27, 17.33 16.18, 16.27, 16.31 17.3436 B
16 x 6288 x 7168 t16x32x128x5_ks1_w1x2x1 18.39, 18.29, 18.34 17.41, 17.49, 17.46 18.4307 B
32 x 6288 x 7168 t32x64x128x5_ks2_w1x4x1 20.48, 20.41, 20.41 19.76, 19.66, 19.68 20.3562 A
  • The three runs of one kernel differ by at most 1.7 % in session A and 1.4 % in session B.
  • In every row the slowest _bnt run is below the fastest run of the old kernel: by at least 3.1 % in session A, by 4.4 to 7.6 % in session B.
  • The rule for the five rows of session B was fixed before the session: a row is in this change only when its three _bnt runs are all below the three runs of the row's kernel, the _bnt median is at most 0.98 of that kernel's median, and the err_ratio of _bnt is at most 0.05. All five met it.
  • The five rows of session B have one session and this method only.
K-stagger variants and the repeat of the seven rows, tuner's method (second session)

Microseconds, median of 3 runs, the six kernels of a tile alternate in one process. In brackets: the ratio to _bnt.

M x N x K Tile plain _bnt _stg1 _stg1_bnt _stg3 _stg3_bnt
32 x 6288 x 7168 t32x64x128x5_ks2_w1x4x1 20.54 (1.033) 19.89 20.45 (1.028) 19.76 (0.993) 20.46 (1.029) 19.66 (0.989)
32 x 6016 x 7168 t32x96x64x5_ks4_w2x2x1 18.59 (1.104) 16.84 18.63 (1.106) 17.21 (1.022) 18.57 (1.102) 17.14 (1.018)
16 x 6016 x 7168 t16x32x256x4_ks1_w1x2x1 17.80 (1.037) 17.16 18.31 (1.067) 17.34 (1.010) 18.11 (1.055) 17.51 (1.020)
8 x 6016 x 7168 t16x32x256x4_ks1_w1x1x2 16.91 (1.058) 15.98 17.23 (1.078) 16.21 (1.014) 17.05 (1.066) 16.25 (1.017)
4 x 6016 x 7168 t16x32x128x7_ks1_w1x2x1 16.16 (1.038) 15.57 16.47 (1.058) 16.07 (1.032) 16.38 (1.052) 16.01 (1.028)
2 x 6016 x 7168 t16x32x128x5_ks1_w1x2x1 16.27 (1.053) 15.45 16.34 (1.057) 15.76 (1.020) 16.11 (1.042) 15.76 (1.019)
1 x 6016 x 7168 t16x32x256x4_ks1_w1x1x2 16.45 (1.092) 15.06 16.72 (1.110) 15.17 (1.007) 16.54 (1.098) 15.46 (1.027)
  • Plain against _bnt in this table is the repeat of the seven rows of the first session: _bnt is 3.2 to 9.4 % faster, and its three runs are below the three plain runs in all seven tiles.
  • In six tiles every stagger variant is slower than _bnt (0.7 to 11.0 %).
  • At 32 x 6288 x 7168 _stg3_bnt is 1.1 % faster than _bnt, and its three runs (19.77, 19.57, 19.66) are all below the three _bnt runs (19.95, 19.78, 19.89). The closest two runs are 0.06 % apart. _stg1_bnt is 0.7 % faster by the median, and its runs overlap those of _bnt. The three runs of each of these kernels differ by 0.8 to 1.3 % (up to 3.0 % elsewhere in this session), so one session does not settle a difference of 1 %. No row gets a stagger variant; a second session can settle it.
Method 2: back-to-back launches in a graph (the seven rows of the first session)

One process per tree and round, 3 rounds, the two trees alternate. Per case a captured HIP graph of 184 back-to-back launches, 30 replays; the launches cycle over cold weight copies (up to 8 GB). Microseconds per launch, median over all replays. Every output is checked against an fp32 reference before it is timed. main b4d0133.

The cases build the kernels that tgemm.mm builds from the old and from the new row (the same kernel names). The path differs per shape:

  • 6016 x 7168: both sides called gemm_a16w16() directly with the ten tile fields of the row and BF16 output; the second side built the tile with b_non_temporal on. Not through tgemm.mm.
  • 6288 x 7168: through tgemm.mm; the row on the second side named the _bnt kernel of this pull request.
M x N x K Path Before After Ratio Per-round ratio
1 x 6016 x 7168 direct 16.59 us 15.28 us 0.921 0.927, 0.921, 0.920
2 x 6016 x 7168 direct 17.76 us 16.62 us 0.936 0.939, 0.937, 0.934
4 x 6016 x 7168 direct 17.31 us 16.48 us 0.952 0.926, 0.951, 0.952
8 x 6016 x 7168 direct 17.87 us 16.45 us 0.921 0.953, 0.931, 0.898
16 x 6016 x 7168 direct 19.04 us 17.76 us 0.933 0.998, 0.916, 0.914
24 x 6016 x 7168 (row M = 32) direct 18.69 us 17.17 us 0.919 0.920, 0.926, 0.925
32 x 6016 x 7168 direct 18.98 us 17.29 us 0.911 0.947, 0.887, 0.902
32 x 6288 x 7168 tgemm.mm 21.16 us 19.60 us 0.926 0.937, 0.920, 0.958
  • Precision: 19 control cases with the same kernel on both sides read 0.963 to 1.011, 18 of them 0.988 to 1.011.
  • The two methods agree in sign for every row. They differ in size (3.6 to 7.5 % eager, 4.8 to 8.9 % back to back); I did not find the reason.
  • The five rows of 6288 x 7168 below 32 were not measured by this method.
  • The warm-weight numbers: 32 x 6288 x 7168 by this method with one weight tensor, through tgemm.mm. The two rows of 6016 x 7168: eager, direct call with the row's tile and BF16 output, one weight tensor, two sessions.

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

MI355X only. No test changes: only table rows change.

op_tests/test_gemm_a16w16.py -t normal -d bf16 -o bf16 -mnk <shapes> launches these rows through tgemm.mm. It logs tgemm err above its 0.05 mark for six of nine shapes: 0.053 to 0.108 on main, 0.051 to 0.108 with this change; the other three read 0. Per shape this change reads from 0.006 below main to 0.0006 above. The inputs are not seeded: two runs of one kernel differ by up to 0.003. So this change does not cause it. The mark is a log line; every run ended with exit 0. Cause and all numbers: the block below.

On a GPU:

  • That test, nine shapes: main 8b6b4b4 and a tree with seven of the rows.
  • That test, 16 shapes (the nine, the other five rows, two unchanged shapes): the tree of this commit. Every lookup selects the expected kernel. The five rows read 0; they have no GPU run on main.
  • test_flydsl_hgemm.py, test_gemm_a16w16.py, test_graph_alloc.py (defaults): pass on the tree with seven rows, not run on the tree of this commit. They select none of the 12 rows.
Why tgemm err reads 0.05 to 0.11 for six shapes, and all three columns
  • tgemm err is the share of output elements for which torch.isclose(torch, tgemm.mm, rtol=1e-2, atol=1e-2) is false (checkAllclose in aiter/test_common.py). Above 0.05 the function logs failed! and returns the share. The test stores it in its table and goes on. It stops only at a NaN, an Inf, or a difference above half of the largest output.
  • The inputs of the test are not seeded, so the share differs from run to run.
  • The six shapes select a tile that splits K (ks2, ks4) or has two K waves (w1x1x2). On gfx950 with BF16 output each K part converts its sum to BF16 before the parts are added (aiter/ops/flydsl/kernels/gemm_a16w16_gfx950.py: lines 847, 893 and 931, and the packed atomic add of line 531). The test compares that with a result that was rounded once.
  • A model of this on a CPU (fp32 partial sums, each rounded to BF16, then added) reads 0.054 for two parts and 0.107 for four, like the test. It is a model: it does not run the kernel.
  • The tuner sees the same effect with its wider bound (5e-2 for BF16 output): the rows of these tiles carry err_ratio 0.0053 to 0.0134, on main too. The tiles with ks1 and one K wave read 0 by both.
  • The asm kernels that the same test launches for 6016 x 7168 (..._splitk_clean) read 0.052 to 0.055 against torch on every shape.
M x N x K Tile main Tree with seven rows (_bnt) Tree with 12 rows (_bnt)
1 x 6016 x 7168 t16x32x256x4_ks1_w1x1x2 0.0573 0.0544 0.0514
2 x 6016 x 7168 t16x32x128x5_ks1_w1x2x1 0 0 0
4 x 6016 x 7168 t16x32x128x7_ks1_w1x2x1 0 0 0
8 x 6016 x 7168 t16x32x256x4_ks1_w1x1x2 0.0551 0.0531 0.0541
16 x 6016 x 7168 t16x32x256x4_ks1_w1x2x1 0 0 0
24 x 6016 x 7168 t32x96x64x5_ks4_w2x2x1 0.1079 0.1059 0.1085
32 x 6016 x 7168 t32x96x64x5_ks4_w2x2x1 0.1077 0.1059 0.1078
24 x 6288 x 7168 t32x64x128x5_ks2_w1x4x1 0.0534 0.0533 0.0538
32 x 6288 x 7168 t32x64x128x5_ks2_w1x4x1 0.0541 0.0540 0.0545
1, 2, 4, 8, 16 x 6288 x 7168 t16x32x128x5 or x6, ks1_w1x2x1 not run not run (old kernel) 0
48 x 6288 x 7168 (not changed) t48x64x128x3_ks2_w1x4x1 not run not run 0.0540
48 x 6016 x 7168 (not changed) t64x96x64x7_ks4_w2x2x1 not run not run 0.1070

Two runs of the same _bnt kernel (the two trees) differ by up to 0.0030. On the tree with 12 rows the share is at most 0.0006 above main (four shapes) and up to 0.0060 below it (two shapes). On the tree with seven rows it is below main in all six.

Checks on a CPU (no GPU), on main 8b6b4b4 and on this branch; repeated on main 4122ef5
  • 11 modules of op_tests/tuning_tests (test_a16w16_tuned_config_lookup, test_csv_validation, test_config_shape_collision, test_dispatch_verification, test_asm_splitk_guard, test_tuner_infra, test_compare_logic, test_mp_tuner_logic, test_a6w6_tuning, test_mixed_mxfp_tuning, test_arch_resolution): 250 tests pass, 8 skipped, the same on both trees. On main 4122ef5 and on its merge with this commit these modules hold 264 tests ([HIP] [FlyDSL] [CI] [Perf] gfx950 small-M BF16 ring GEMM policies (rg lm_head, rk DSpark FC) in the hgemm catalog, tuner and tgemm path #8675 added 14): 254 pass, 8 are skipped, and 2 of the new ones need a device. The same on both trees.
  • The lookup get_GEMM_A16W16_tuned_config for M = 1 to 48 of both shapes: on this branch M = 1 to 32 select the edited rows; M = 33 to 48 select the rows of main.
  • tgemm.mm on CPU tensors up to the launch (the launch is a stand-in), M = 1 to 48, both shapes: it builds the _bnt kernel for M = 1 to 32 and the kernel of main for M = 33 to 48.
  • SGLang's _a16w16_flydsl_launch, as written in SGLang main 884b0b9eaa9e, against both trees for M = 1 to 48 of both shapes: the ten fields are identical in all 96 cases, and so is the kernel that gemm_a16w16() builds from them, for BF16 and for fp32 output.
  • The solidx and splitK of the 12 rows equal the tuner catalog (get_flydsl_bf16_catalog) of main 8b6b4b4, the catalog of the sessions: 12 of 12. On main 4122ef5 a process with a GPU also gets the ring candidates of [HIP] [FlyDSL] [CI] [Perf] gfx950 small-M BF16 ring GEMM policies (rg lm_head, rk DSpark FC) in the hgemm catalog, tuner and tgemm path #8675, 33 to 36 per key. They sort before these names, so the index there is 12 higher (M = 1 to 16) or 15 higher (M = 32); I computed that without a GPU. splitK does not change. No launch reads solidx of a FlyDSL row.
  • The AOT replay and the --check run: the block under "Changes".
  • The diff has no trailing whitespace and no non-ASCII character. black and ruff do not apply: no Python file changes.
  • On main 4122ef5 and on its merge with this commit: the lookup, the tgemm.mm stand-in and the ten-field check give the same 96 results; the 26 kernel binaries of the replay are byte-identical to those of 8b6b4b4; tests/test_flydsl_aot_replay.py and the other CPU tests that read the tables pass or fail alike on both trees (the failures need a device). The merge has no conflict.

Documentation

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

The change is tuned-table rows.

Dependencies

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

Breaking Changes

No interface change. Two risks (above): the cost with warm weights (such a caller needs its own table, AITER_CONFIG_GEMM_BF16) and a run-only process with an old AOT cache.

PR Self-Review

Reviewed revision

27c1801

Behavior and intent

For 1 to 32 rows of the two shapes, tgemm.mm on gfx950 builds the tuned tile with non-temporal B loads. The rows were tuned before the option existed.

Validation and unverified scope

op_tests/test_gemm_a16w16.py -t normal -d bf16 -o bf16 on 16 shapes ran on the tree of this commit (exit 0); the rest is under "Performance" and "Testing". Unverified: any GPU run on main 4122ef5 (the GPU runs are on 8b6b4b4); other gfx950 hardware with 256 compute units; serving; a re-tune; the three test files on the tree of this commit; the full-table AOT prebuild; nine rows with warm weights.

PR-specific question

The 12 keys of the diff; they serve M = 1 to 32 of the two shapes. Unrelated shapes: the diff is these 12 lines, no other BF16 table holds these keys, the lookup returns the rows of main for M = 33 to 48, and the table tests pass.

Changed op tests

None.

…ws on gfx950

The rows of 6016 x 7168 and of 6288 x 7168 at 1, 2, 4, 8, 16 and 32 rows
name the same tile with _bnt. They are older than the option (#5145,
#6019 and #5903; the option is #7546), so the tuner never raced it for
them. A decode step reads the weights of every layer once, and the tuner
measures that: run_perftest gives every timed launch its own copy of the
tensors.

MI355X, one GPU, FlyDSL 0.5.3, the tuner's method (10 warm-up and 101
timed eager launches), 3 runs per kernel, the two kernels alternate,
median, microseconds, row today -> _bnt:
   1 x 6016 x 7168   16.31 -> 15.40
   2 x 6016 x 7168   16.39 -> 15.53
   4 x 6016 x 7168   16.46 -> 15.70
   8 x 6016 x 7168   16.62 -> 16.02
  16 x 6016 x 7168   17.93 -> 17.20
  32 x 6016 x 7168   18.30 -> 16.93
   1 x 6288 x 7168   16.78 -> 15.63
   2 x 6288 x 7168   16.96 -> 15.57
   4 x 6288 x 7168   17.00 -> 15.68
   8 x 6288 x 7168   17.33 -> 16.27
  16 x 6288 x 7168   18.34 -> 17.46
  32 x 6288 x 7168   20.41 -> 19.68
That is 3.6 % to 8.2 % less time per launch. The six rows of 6016 x 7168
and the row of 32 x 6288 x 7168 were measured on main b4d0133. The
other five rows were measured in a second session, on main 8b6b4b4
with those seven rows changed. solidx is the index of the new name in
the tuner catalog; us, err_ratio, tflops and bw are the _bnt
measurements.

tgemm.mm selects these rows for 1 to 32 rows of both shapes. A caller
that launches one weight tensor back to back while it fits the
last-level cache can get slower. Measured with one weight tensor: +7.7 %
for 32 x 6288 x 7168, +11.5 % and +12.8 % for 16 x 6016 x 7168, -3.9 %
and -2.8 % for 32 x 6016 x 7168. The other nine rows were not measured
in that state.

Signed-off-by: Jin Pan <[email protected]>
@jhinpan
jhinpan requested a review from a team November 30, 2026 08:01
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 8915 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@github-actions github-actions Bot changed the title [Perf] Use non-temporal B loads in twelve Kimi-K3 decode BF16 GEMM rows on gfx950 [Config] [Perf] Use non-temporal B loads in twelve Kimi-K3 decode BF16 GEMM rows on gfx950 Nov 30, 2026
@aiter-bot

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 27c1801978f0 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

For 1 to 32 rows of the two shapes, `tgemm.mm` on gfx950 builds the tuned tile with non-temporal B loads. The rows were tuned before the option existed.

Validation and unverified scope

`op_tests/test_gemm_a16w16.py -t normal -d bf16 -o bf16` on 16 shapes ran on the tree of this commit (exit 0); the rest is under "Performance" and "Testing". Unverified: any GPU run on `main` 4122ef5186e2 (the GPU runs are on 8b6b4b44169f); other gfx950 hardware with 256 compute units; serving; a re-tune; the three test files on the tree of this commit; the full-table AOT prebuild; nine rows with warm weights.

PR-specific question

The 12 keys of the diff; they serve M = 1 to 32 of the two shapes. Unrelated shapes: the diff is these 12 lines, no other BF16 table holds these keys, the lookup returns the rows of `main` for M = 33 to 48, and the table tests pass.

Changed op tests

None.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

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

@yifehuan yifehuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@yifehuan
yifehuan merged commit da53451 into main Dec 2, 2026
53 checks passed
@yifehuan
yifehuan deleted the perf/kimik3-bf16-decode-rows-bnt branch December 2, 2026 03:47
whx-sjtu added a commit to whx-sjtu/aiter that referenced this pull request Dec 2, 2026
Conflict: aiter/configs/model_configs/kimik3_bf16_tuned_gemm.csv, MoE front
6016x7168 at M = 1..32, where main (ROCm#8915) retuned all six rows with
non-temporal B loads and this branch had replaced M = 8 and M = 32. Main's
rows kept for that block (its own table times them at 16.02 / 16.93 us
against this branch's 16.04 / 18.03 us); every other row of this branch
kept. No duplicate (gfx, cu_num, M, N, K, bias, dtype, outdtype, scaleAB,
bpreshuffle) key in the file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AndreasKaratzas added a commit to AndreasKaratzas/aiter that referenced this pull request Dec 3, 2026
Conflicts:
- gemm_a16w16_gfx950.py vs ROCm#8929: keep this branch's 4-argument
  write_cshuffle_vec_to_global (main's out_buf/is_split_k only serve the
  atomic split-K store this branch removes) and use main's int64 C offset
  at all three C stores, including store_c_vec of the slice-K combine and
  split-K reducers, which main does not have.
- test_flydsl_hgemm.py: add 31777x67712x512 ft k_waves=2, a C past 2^31
  elements through store_c_vec. It fails with an illegal memory access
  when store_c_vec uses an int32 offset.
- kimik3 table vs ROCm#8915: 11 of the 12 _bnt rows take main's row; the 8
  without split-K/slice-K as is, 1x6016, 8x6016 and 32x6016 after
  re-timing under the fp32 reduction. 32x6288x7168 keeps this branch's
  ks4 row (tuner time tied, faster with warm weights).

Co-authored-by: Claude <[email protected]>
Signed-off-by: Andreas Karatzas <[email protected]>
gbyu-amd pushed a commit that referenced this pull request Dec 3, 2026
…4098)

(cherry picked from commit b34b6b8)

Rebase onto main 12-03: kimik3_bf16_tuned_gemm.csv conflicted with main's gfx950 row updates (#8317 / #8245 / #8915). Replayed by row key: the 32 gfx1250 rows this commit adds are inserted; its 15 gfx950 edits were number formatting only (a CSV round-trip) and are left as main has them. Same rows as the PR head 3b64098.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants