Repository navigation
[Config] [Perf] Tune Kimi K3 TP1 f_b E8M0 GEMM on gfx1250 - #8561
ZLkanyo009 wants to merge 1 commit into
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
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 |
|
Superseded as the review entry for this tuning batch by #8729 (head Please use the consolidated PR for review of this batch. This source PR remains open for provenance; no merge or closure is performed here, and the two should not be merged independently. |
Summary
Add one Kimi K3 KDA
f_b_projE8M0 tuning row for full-TP1 M128/N12288/K128 on gfx1250. The row selects existing FlyDSL kernel 164 instead of the current untuned fallback, kernel 222. A same-host ABBA comparison in the 1120 image reduced median complete backend-call time from 3.052600 to 2.567825 microseconds.The installed main-based PR head
a30c2382806ddb230215e4d9ea58bfee981566b1now passes real public-API routing and correctness at seven M values in both output forms, plus a separate complete-backend ABBA at M128: 3.074600 to 2.590900 microseconds, 1.186692x. Both paired directions were faster. The 1120 measurements remain separate historical evidence. Consolidated results: https://github.com/wuhuikx/LLM-Booster/issues/710#issuecomment-7127358888Motivation
The complete default tuning-table family in preparation main
526972dad8f015fe735b4655708675b11d7c852bhas no N12288/K128 row at any M. The native fallback selects a 128x512x128 tile at M128. The measured candidate uses a 64x512x128 tile and was faster in both directions of one same-host ABBA round.Changes
kimik3_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv, preserving all 301 existing rows and the 14-column schema. The eight dense rows in [Config] [Perf] Tune eight Kimi K3 TP1 dense E8M0 GEMM rows on gfx1250 #8557 are outside this patch.(gfx1250, 256, 128, 12288, 128, 128x128)with kernel 164,flydsl_mxfp8_128_bpreshuffle_wmma_t64x512x128_mw1_nw4_nb2_sk1_cm1_cn1: four waves, two buffers, split-K1, cluster1x1, no A preshuffle or fused split-K.usto the median of the two candidate-record medians. Derivetflops=156.81and logicalbw=1843.96using the existing tuner formulas;bwis not measured HBM traffic. Preserve the actual candidate mismatch maximum,errRatio=0.0003153483266942203.Performance (if applicable)
Hardware: one gfx1250 GPU, 256 CUs, NUMA balancing disabled during execution. Workload: full-TP1 M128/N12288/K128, FP8 E4M3 operands, E8M0 A1x128/W128x128 scales, 16x16-preshuffled weights and BF16 output. No matrix partition across GPUs.
Historical native1120 measurements, retained separately from the installed PR-head results below.
The aggregate call-time reduction is 15.88%. Each of the four records has 20 HIP-event samples; each graph contains ten complete backend calls. The recipe uses ten warmup calls and warm operands. Quantization, shuffling, reference computation and profiling are excluded. There is one same-host ABBA round and no across-run confidence interval. The earlier separate-machine AB result is not pooled here.
Measured versions:
rocm/fw-bringup:gfx1250-atom-k3-20261120, local image IDsha256:82967ce7dc2b3857f30bc7e0e659a66d3a4a1dd041e046575e3fe5fc14534a78, AITER226aa69a751fe7ce7ff356eeb594a0916a491798, ATOM8eed545250668b7d1d18e9043e829eefc9232f47. Torch was2.11.0+rocm10.1.0a20260811-bkc.20260820; HIP was7.16.26315.Testing
The four measured records passed full-output finite checks, eager execution and NaN-poisoned graph replay for two random-seed cases and zero-A, against a reference from FP32-dequantized operands. The fixed policy was
rtol=0.01,atol=0.01, allowing a mismatch ratio up to 0.05. The candidate's actual maximum ratio was 0.0003153483266942203; this is not bitwise equality or a model-accuracy result.The original local CPU/source checks verified the accepted raw timing medians, 19 measured-source pins, pinned-main source Git blobs, unique merged keys, kernel ID/name/geometry and shape support. The exact patch passed
git apply --check --whitespace=error-alland a scratch application with byte-for-byte output comparison. A source padding model with the real Python row-walk function confirmed the M65–128 lookup range across M1–32768. Those initial source checks did not execute the compiled padding helper, import the installed public operator or run GPU code; the subsequent actual installation and GPU checks are described below.Actual main-based PR validation — 2026-11-24 UTC
Installed the complete, separate source tree at PR head
a30c2382806ddb230215e4d9ea58bfee981566b1, then imported the actual publicoperator. The default latency merge used the canonical table and all four
matching model tables: 4,214 unique full keys, one new f_b row, with no
AITER_CONFIG_*override, AOT replay/import substitute or forced provider.FlyDSL was 0.5.3; Torch was
2.11.0+rocm10.1.0a20260811-bkc.20260820and HIPwas
7.16.26315, on gfx1250 with NUMA balancing 0 during the GPU runs.The no-device CPU stage checked all seven points with a separately compiled
padding-source helper. The GPU stage then checked the actual Python/JIT
padding API and
aiter.gemm_a8w8_blockscale_bpreshuffle; those are distinctpieces of evidence. The GPU stages ran at 10:11–10:13 UTC. Independent review
completed at 2026-11-24T10:25:01.904469Z, with 560 checks of exported bytes,
installed source, plan/runner binding, default merge, routes, numerical output
and owned cleanup.
M64/65/112/113/127/128/129 ×
out=and allocating × eager and NaN-poisonedgraph replay completed: seven shapes, 14 public-form cases and 28 full-output
numerical records. Both eager and capture observed the following configurations
at the real FlyDSL bridge; the observer forwarded the original call unchanged.
kernelNameonly:flydsl_mxfp8_128_bpreshuffle_wmma_t64x1024x128_mw1_nw4_nb2_sk1_cm1_cn1kernelId="164"andflydsl_mxfp8_128_bpreshuffle_wmma_t64x512x128_mw1_nw4_nb2_sk1_cm1_cn1kernelNameonly:flydsl_mxfp8_128_bpreshuffle_wmma_t256x256x128_mw2_nw2_nb2_sk1_cm1_cn1The two fallback observations contain no numeric kernel ID; none is inferred
for this runtime result. M64/M129 remained on their fallback paths. The actual
padding pairs
(gl0, gl1)were(64,64),(80,128),(112,128),(128,128),(128,128),(128,128),(144,256)in the order above. The padding helper'sreturned M for a synthetic lookup is not itself evidence of a tuned table row;
the real bridge configuration establishes the executed selection.
This correctness run uses seed 723 and BF16 output, with a reference computed
from FP32-dequantized operands and rounded to BF16. All outputs were finite.
With
rtol=0.01,atol=0.01, mismatch-ratio limit 0.05, the largest actualratio was 0.00028170072115384613 (M65) and the largest absolute error was 32.
The caller-owned output identity and absence of allocating-output aliasing
with inputs were checked. Graph outputs were filled with NaN after capture
and checked after replay. This run did not repeat the historical two-seed and
zero-A performance protocol.
This is correctness and dispatch validation only. No event timing or
kernel profile was collected. The
us,tflops,bwanderrRatiovaluesobserved inside the selected CSV row remain historical metadata, not new
measurements. The other 59 affected M values, other output dtypes, alternative
providers, newer upstream revisions and model execution remain unvalidated.
The numerical policy allows a small mismatch ratio; this is not bitwise
equality. The GPU containers were removed and original NUMA balancing 1 was
restored after owned GPU use ended; experiment outputs were retained.
Complete-backend performance on the installed PR head
The same complete independent installation at head
a30c2382806ddb230215e4d9ea58bfee981566b1and preparation base526972dad8f015fe735b4655708675b11d7c852bcompleted the performance run at2026-11-24 10:58:58–10:59:05 UTC. FlyDSL 0.5.3 and the Torch/HIP versions
above were unchanged. The actual main fallback was resolved again; its runtime
argument contained only the kernel name. The candidate used the full ID164 row.
Both arguments went through the real complete FlyDSL bridge. This does not
claim that the candidate installation's default public dispatcher selects the
old fallback; candidate default routing was validated separately above.
Each of four records contains 20 HIP-event samples of a graph with ten complete
calls, with seed 723 and the same full dimensions/scales/output type. All eight
full-output eager/NaN-poisoned graph checks passed; maximum mismatch ratio was
0.0002536773681640625 under the unchanged 0.01/0.01/0.05 policy. The repeated
same-input graph output equality assertion also passed. Quantization, shuffle,
reference checks and warmup are outside event samples; no profiler was used.
This remains one ABBA round, without an across-run confidence interval or
serving/model-accuracy claim. CSV timing/quality fields retain their original
native1120 provenance; no source or table was changed for this new measurement.
The first timing attempt stopped before any event sample: 8192 synchronized
graph replays took 0.282628463 seconds, below the required 0.5-second warmup target.
Its failure and original outputs were retained and its owned container removed.
A new attempt changed only the warmup replay ceiling to 32768 plus package hash
bindings, after independent CPU boundary checks. The 0.5-second target, 2-second
upper bound, minimum 10 replays, numerical checks and 20×10 timing stayed fixed.
The successful four records used 14287–16840 replays and 0.500014–0.500032 seconds each.
Independent review completed at 2026-11-24T11:01:08.341462Z, with 55 checks:
14 original exported files, archive/plan/runner/installation hashes, all raw
samples and recomputed medians, actual Docker command/mounts, actual device and
boot, start-to-export kernel journal and exact owned cleanup. The container was
removed, device holders were empty, and NUMA balancing 0 was restored to its
original 1. No GPU-relevant journal matches occurred in the retained window.
Result SHA256:
78a6d64cab2b2c03b6f51530974522dbf6a581770376314bd091f79e6f60718f.Documentation
Dependencies
Breaking Changes
None. Existing public API and CSV schema are unchanged. The new row changes native kernel selection for the matching M65–128 range described above.
PR Self-Review
Reviewed revision
a30c2382806ddb230215e4d9ea58bfee981566b1Behavior and intent
The default latency merge combines the canonical table and all four matching model tables. Its 4213 existing distinct full keys become 4214. The new key has no exact or same-N/K predecessor, so no existing row is overwritten or masked.
The key contains no model name. Another native caller with the same device/shape/weight-scale key can select it too. The key also does not distinguish output dtype; the measured result covers BF16 only. Existing gfx1250-family fallback may reuse family rows when a strict architecture has none. Explicit configuration overrides, power selection and allocating-form external providers can change the effective selection.
At the matching N/K, adding the first row also removes the no-N/K shortcut: other M values walk the padding lookup before falling back. They do not select the M128 row outside M65–128. This is a lookup-path change, not a claim of measured latency neutrality at those other M values.
Validation and unverified scope
Reviewed and GPU-tested head:
a30c2382806ddb230215e4d9ea58bfee981566b1, based on526972dad8f015fe735b4655708675b11d7c852b. Upstream main at original PR publication wasd42dd80180f48c3e851cd0ad17b16d7c60848868; this update does not recheck latest upstream or claim validation after rebasing. The seven-point public-routing/correctness checks and the separate installed-head performance comparison are complete for this exact revision. The PR is ready for reviewer assessment; it is not merged or human-approved. Black, Ruff, Repository Dependency and Aiter Test Gate passed on this head; standard GPU jobs were skipped, so no GPU CI pass is claimed.The exact installed-head checks passed as documented above: seven M boundaries, both public API forms, all eager/poisoned-graph outputs, normal default merge and real Python/JIT padding. The separate complete-backend ABBA passed at M128 with 1.186692x speedup. Commands were
python run_public_dispatch.py --binding <exact-head-binding.json> --phase cpu-preflight --output <new-cpu.json>, then--phase gpufor each of the two prepared subsets; performance usedpython run_fb_timing.py --binding <existing-public-binding.json> --phase gpu --stage-seconds 180 --output <new-abba.json>. These are retained standalone validation runners, not repository test targets. Hardware was one gfx1250 GPU with 256 CUs, NUMA balancing 0, BF16 output, FlyDSL 0.5.3 and the recorded Torch/HIP versions.Unverified: the other 59 affected M values and their performance, other output dtypes/providers, later upstream or rebased heads, GSM8K and model/serving performance. This limited single-round benchmark has no across-run confidence interval. Actual standard/GPU CI jobs were skipped. The PR has not been human-approved or merged.
Main retains ID164, its full name and effective geometry, and the M128 native fallback remains ID222. Both kernels satisfy the current pure source shape check at M128; the candidate also satisfies it at M65–127. The existing generic two-buffer minimum-K exception permits K128. This establishes source compatibility. The actual GPU cases below additionally establish routing and numerical behavior for the seven tested M values on this exact head; they do not establish equivalence of codegen or performance with 1120.
The generic WMMA kernel, wrapper, catalogue, JIT and public-dispatch files differ from measured 1120. In particular, main's generic launch uses compile-time cluster geometry and a different launch signature; measured 1120 carries runtime cluster arguments and generic fused-split-K support. The tested candidate uses cluster1x1/split-K1, but identical name and geometry do not establish identical codegen or performance. The unchanged compute-kernel source is irrelevant to this generic WMMA candidate.
Main separates the public API:
out=calls the native implementation, while the allocating form goes through the provider registry. Both real forms reached the native FlyDSL bridge in the tested default environment, with the recorded candidate/fallback configuration, and completed eager plus graph checks. Normal default merge and the actual Python/JIT padded-M API were also exercised. These observations do not force or guarantee the same provider under other environments. The separate same-installation full-backend ABBA now validates M128 performance on this main-based implementation. Numerical coverage of the other 59 affected M values, performance at those neighbors, and any revised/rebased head remain unvalidated. No full retune of unrelated shapes is implied.M128 is a synthetic microbenchmark point, not a demonstrated serving graph bucket. No GSM8K, PP/DP8+EP8 model execution, FP16 accuracy, serving latency or end-to-end gain is established.
PR-specific question
The bot asks: "Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?"
The one new key is
(gfx1250, 256, 128, 12288, 128, 128x128), using columns(gfx, cu_num, M, N, K, w_scale_block). It selects existing generic FlyDSL ID164, split-K1, for full TP1 inputs and the tested BF16 output. The key has no model-name or output-dtype field, so any matching caller can consume it; only the tested native default provider and BF16 output are covered here.The existing padded lookup selects this key for M65–128: M65–112 through gl1, M113–127 through gl0, and M128 exactly. The real installed public tests exercised M64/65/112/113/127/128/129 in both forms, observing ID164 at the five inner representatives and original kernelName-only fallback at 64/129. The other 59 affected M values remain numerically unverified; only M128 was timed.
Byte-level patch/application checks confirm all 301 existing model rows are preserved. Source review of the canonical table and all four model tables, followed by the actual default pandas merge, confirms 4214 unique keys and no duplicate or masking key for the new row. Other N/K keys keep their existing configurations, and at this N/K no M outside 65–128 selects the new row. Adding the first N/K row does cause those other M values to perform a padding walk before falling back, so unchanged fallback choice is not a claim of measured latency neutrality. No selection algorithm, fallback kernel, provider or output dtype was changed by this CSV-only patch.
Changed op tests
None.