Repository navigation
[Config] [Perf] Tune eight Kimi K3 TP1 dense E8M0 GEMM rows on gfx1250 - #8557
ZLkanyo009 wants to merge 1 commit into
Conversation
Use eight accepted full-TP1 dense measurements from the pinned 1120 image. Current-main runtime and model validation remain pending. Signed-off-by: Ling Zhang <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
DRAFT — evaluation pausedPR Self-ReviewRevision This pull request is a draft, so readiness evaluation is paused and no verdict applies. Evaluation resumes when it is marked ready for review and the required CI completes. |
|
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. |
|
Advisory review with the repo's Verdict:
|
|
This PR's rows were folded into #8729 ("Consolidate Kimi K3 TP1 GEMM tuning on gfx1250", still open), as noted in your earlier comment. Please close this PR so the same |
|
@aiter-bot review |
|
aiter-bot — the box reviews one PR at a time and is 31 deep right now (roughly 8.9 h of work ahead). This request was not queued: a job that waits more than 24 h is cancelled silently, so saying no now is better than losing it later. Re-comment |
Current CI failure under investigation
On unchanged head
1b113f7573aea787611ca94e779ff9e311cc206b, Aiter Test run45390829461 has a failed MI35X shard7. At the 2026-11-24T15:01:21Z checkpoint, six shards had passed, shard4 was still running, and no final run conclusion was available. The exact failed file isop_tests/test_flydsl_hgemm.py: gfx950 BF16 M19/N120/K1088, split-K9, stagger1, non-temporal=True. A changed-input graph replay failed a zero-tolerance comparison in 1/2280 elements, with maximum absolute difference0.015625 (one BF16 ULP at the logged magnitude).The failing invocation had already passed two relaxed comparisons and three exact dirty-output K-coverage checks. The neighboring non-temporal=False graph case passed, but that single observation does not establish a cause. The kernel converts partial sums to BF16 before BF16 atomic addition; rounding/order is a plausible mechanism, not a demonstrated explanation of this failure. No atomic order or partial sums were captured, and no same-environment base/head reproduction has run.
CPU arithmetic counterexample (independently checked): The permitted
{-2,-1,0,1,2}/8inputs do not by themselves guarantee equality between a BF16 split-K reduction and one final BF16 conversion of the FP32 reference. A constructed M19/N120/K1088 example uses bias-8/64and post-negation partials[-50,-50,-50,-50,-50,-1,+13,0,0]/64. Each partial is exactly representable in BF16. Before negation, every partial-addition order stays inside the exactly representable[-21,243]/64grid and returns230/64.After negation, one serial atomic order reaches
-258/64, then adds-1/64. In an explicit BF16 round-to-nearest, ties-to-even model,-259/64rounds to-260/64; adding+13/64leaves-247/64 = -3.859375. FP32 summation followed by one BF16 conversion gives-246/64 = -3.84375. Moving the+13/64partial first gives the reference. The saved A/W factors use the allowed input set in the actual eight128-element/one64-element partition layout; only one output differs in the full19x120 embedding. An independent rational BF16-grid calculation reconstructed the full output and verified the example. Enumeration of1512 distinct partial-value sequences gives1296 exact and216 one-ULP modeled results; these are mathematical counts, not GPU frequencies or probabilities.This is a constructed counterexample, not the recovered seed0 input or a GPU replay of the failing job. Generated ISA, actual rounding settings, atomic arrival order and the role of graph/NT/stagger were not observed. Source confirms zero-based FP32 partials, output-dtype conversion, typed packed atomic addition and separate bias initialization; it does not validate hardware lowering. A second constructed example shows partial-cast precision loss even before atomic order matters. This evidence rejects the input set's claimed mathematical guarantee under the stated model, but does not establish the observed CI root cause or exclude a loading/protocol/compiler/hardware problem. No production test or tolerance was changed. Future exact-coverage input design should prove its intermediate bound;
|biasUnits| + sum(abs(productUnits)) <= 256is one sufficient condition for the1/64 lattice. Repeating unchanged CI is not a fix for that mathematical premise.The PR still changes only eight gfx1250 MXFP8 CSV rows. The six related gfx950 test/wrapper/kernel/helper/graph-allocation files are byte-identical between preparation base526972d and this head. This explicit gfx950 A16W16 test does not select a kernel from the changed CSV; no direct source/dispatch connection to the row changes is established. Equal source is not proof of a pre-existing or unrelated failure. The failure log is retained; no assertion was weakened, no kernel/test source was changed, and no CI rerun was requested. The earlier gfx1250 correctness/performance results below keep their original scope. Required CI is not currently green, so human-review readiness is not claimed.
Additional M32768 validation: complete with a bounded reference; original failure retained
Both additional M32768 shapes now pass the real public API and a separate complete-backend ABBA on the unchanged installed review head 1b113f7. The original validation attempt reported an HSA memory fault. The new a2 checker limits each reference GEMM to at most 8192 rows and 1024 columns; the tested candidate still processes the full M32768/N/K. The PR was marked ready at 12:09:34 UTC after these results, with this limitation disclosed; the subsequent CI failure is tracked above. The original fault's root cause remains unconfirmed.
The existing M8192 rows already select these candidates for M32768 through the actual Python/JIT padded lookup. No PR source, CSV row, installed dependency, candidate input/output allocation, full K reduction, numerical threshold or formal timing protocol changed for a2. The reference still uses FP32 matmul followed by BF16 rounding and FP32 comparison, with rtol/atol 0.01/0.01 and a global mismatch-ratio limit of 0.05. Host phase logging was added outside formal timing, with no additional explicit GPU synchronize calls; the additional blocks naturally increase existing item() synchronizations. This is a changed-reference workaround experiment, not a proven root-cause fix.
On the same complete installation and FlyDSL 0.5.3, both out= and allocating public forms passed eager and NaN-poisoned graph checks for both shapes: eight full-output public checks. The separate ABBA runs add sixteen full-output checks and 160 formal event samples, each sample covering ten complete backend calls. All 68 original exported files from the four stages were independently accepted, including actual source/route, Docker identity, complete phase logs and exact owned cleanup. Per-chunk tensor metadata verifies the full output stride and nonzero storage offsets; gate_up includes source element indices above 2^31. The maximum mismatch ratios were 0.007366203900539514 for gate_up and 0.015584898846490043 for down, with max absolute errors 128 and 256.
Both paired directions favor the candidate. Gate_up's pair ratios are 1.094829x and 1.096931x; down's are 1.088170x and 1.091536x. The down baseline includes its full split-K2 reduction; the candidate uses split-K1. These are explicitly supplied baseline/candidate configurations through the same real backend, not a claim that the old baseline is the candidate installation's public default. Each shape has one ABBA round; no cross-run confidence interval, model/E2E benefit or later-upstream validation is claimed. Actual GPU container windows were 12:00:09–12:00:15 UTC and 12:02:26–12:02:40 for gate_up public/timing, then 12:03:55–12:04:00 and 12:05:36–12:05:47 for down, on 2026-11-24. All four exited successfully and were removed; device contexts were empty and NUMA balancing restored at their recorded cleanup times.
Original a1 failure and remaining uncertainty
At 2026-11-24T11:33:43.186778Z, the first out= eager correctness path for full gate_up reported HSA_STATUS_ERROR_MEMORY_FAULT, fault address 0x1420000, in a Cijk_Alik_Bljk_S_B_Bias_HA...MT32x32x16... kernel. The 32768-workgroup grid is compatible with a 32768x1024 FP32 reference block. All 66 column blocks had that grid, so the failing block is unknown. The candidate call preceded the checker; the empty forms list did not prove that the candidate never ran. Neither this log nor source inspection establishes candidate corruption, a BLAS defect or a hardware cause.
That exact task was explicitly stopped and removed at 11:34:55 UTC. Its 18 original files remain preserved, export SHA256 66c00ee22e98637bd1672f393691f04667881652fcf951e7a29ec13e60e4697f. It yielded no accepted new correctness form or timing sample. The PR was returned to draft before a2 preparation. The a2 packet then passed focused author and independent CPU checks, followed by the actual GPU results above; no reset, driver maintenance, unchanged retry loop or extra GPU diagnostic was performed. The successful a2 results demonstrate the changed checker's completed validation in these runs; they do not explain the original fault or prove general hardware recovery. The earlier 16 public cases and eight timing rows below retain their original scope.
Summary
Select faster existing FlyDSL compute kernels for eight Kimi K3 full-TP1 dense FFN shapes on gfx1250. The change replaces five
gate_uprows and threedownrows in the existing E8M0 blockscale model table. It does not add a kernel or alter dispatch code.Related work: https://github.com/wuhuikx/LLM-Booster/issues/710
Motivation
The current rows select slower kernels in the measured 1120 environment. For example, full-TP1
downat M16384/N7168/K33792 takes 1629.463339 µs with the current selection and 1330.099702 µs with the candidate. The two paired directions favor the candidate.Changes
kimik3_a8w8_blockscale_mxscale_bpreshuffle_tuned_gemm.csv; preserve the other 293 rows, schema, order and keys from main526972dad8f015fe735b4655708675b11d7c852b.gate_upM1024/2048/4096/8192/16384 and kernel 1088 fordownM4096/8192/16384. Both are existing 256×256×128 compute WMMA kernels, split-K1, cluster4×4; buffers are four and two respectively.downM1024/M2048 unchanged because the measured comparisons do not support a kernel change.usfrom the accepted candidate measurements and recalculate the table'stflopsand logicalbwfields. Record the actual maximum mismatch ratio inerrRatio.Performance (if applicable)
Installed review head, 2026-11-24
A new complete-backend ABBA run on the actual installed head
1b113f7573aea787611ca94e779ff9e311cc206breproduced a gain for all eight selections. This uses the implementation from preparation base526972dad8f015fe735b4655708675b11d7c852b, with FlyDSL 0.5.3 on the 1120 base image. It is separate from the original 1120-image measurements below and is not a benchmark of a later upstream main revision.The original baseline and candidate row dictionaries were explicitly passed to the same real FlyDSL bridge in this installed implementation. This measures complete backend calls, including the baseline down M8192 split-K2 reduction. It does not claim that the old baseline was the public default of the candidate installation; the separate 16-case public-operator verification below establishes candidate integration. No model table or AITER_CONFIG override was changed for timing.
Each row ran one ABBA sequence with fixed seed723, the same full-output reference and numerical policy, approximately 0.5 seconds of synchronized warmup per record, and 20 HIP-event samples of a graph containing ten complete calls. Both paired directions favor the candidate for every row. The smallest gain, down M8192 at 1.018529x, remains a small single-round result without an across-run confidence interval.
All 32 records / 640 timing samples and 64 full-output eager/poisoned-graph checks passed independent review. The run finished at 09:41:21 UTC after about 42 seconds; all 14 exported evidence files were checked against original size/SHA, and the owned container/device handles were released with original NUMA restored. Review SHA256:
8cec194041f519dacc538b5d0d137ee47aeaa43d4b2a80d395cea6e80487fea8. These standalone gains do not establish PP/DP/EP, GSM8K or end-to-end improvement.Original 1120 measurements, 2026-11-23
Measured on one gfx1250 GPU with 256 CUs, full TP1 dimensions, FP8 operands, E8M0 A1×128/W128×128 scales and BF16 output. No matrix partition across GPUs. Results below are 1120-image measurements made on 2026-11-23, not benchmarks of current main.
Each row has one fresh ABBA round. Each record has 20 HIP-event samples of a graph containing ten complete backend calls; the table uses the median of the two per-record medians. Both paired directions favor the candidate. Operands are warm, with the calibrated approximately 0.5-second warmup. Timing excludes quantization, shuffle, reference computation and profiling. It includes the complete backend call.
These are measured before/after pairs, not comparisons to old CSV latency fields. There is no across-run confidence interval; the down M8192 result is a small one-round gain. The
bwcolumn is logical byte throughput, not measured HBM traffic or percentage of peak bandwidth.Measurement versions: image
rocm/fw-bringup:gfx1250-atom-k3-20261120, local image IDsha256:82967ce7dc2b3857f30bc7e0e659a66d3a4a1dd041e046575e3fe5fc14534a78, AITER226aa69a751fe7ce7ff356eeb594a0916a491798, ATOM8eed545250668b7d1d18e9043e829eefc9232f47.Public result record: https://github.com/wuhuikx/LLM-Booster/issues/710#issuecomment-7120867380
Testing
This configuration-only change targets gfx1250. No op test or kernel implementation changes are included. Actual installed review-head GPU routing and numerical checks passed on 2026-11-24, as detailed below. The paired backend performance run also passed; the newer MI35X standard CI has the specific failure reported above, and no MI250X/MI300X result is claimed.
The measured candidates passed full-output finite checks and eager/NaN-poisoned graph replay against FP32-dequantized operands with a BF16-cast reference. The fixed policy is
rtol=0.01,atol=0.01, with at most 5% mismatched elements. Actual maximum ratios are about 0.00731–0.00739 for gate_up and 0.01558–0.01569 for down. This is not bitwise equality or a model-accuracy test.Documentation
Dependencies
Breaking Changes
None. Public API and CSV schema are unchanged.
PR Self-Review
Reviewed revision
1b113f7573aea787611ca94e779ff9e311cc206bBehavior and intent
The default latency configuration merge reaches these eight model rows. Their original keys and row values match the tested 1120 baseline. The candidates keep split-K1 and select existing compute kernels with favorable paired microbenchmark results.
Preparation base is main
526972dad8f015fe735b4655708675b11d7c852b. Upstream advanced after preparation; the source and runtime validation cover that base and the exact head above. The current selections are slower in the paired complete-backend measurements; for example, installed-head down M16384 changes from 1547.787523 to 1276.580358 microseconds. The default merged table will select the measured existing kernel instead.Validation and unverified scope
CPU source checks on the pinned main revision confirm the 14-column schema, all eight unchanged baseline rows, current catalogue ID/name/geometry and shape support. The canonical table plus all four matching model tables contain 4213 distinct normalized keys; none of the eight changed keys is duplicated or masked. The compute-kernel implementation is byte-identical to the measured image. The wrapper and public routing code have changed; the source comparison alone does not establish runtime equivalence.
A separate local validator applies the exact unified patch, checks unchanged rows, and executes the current-main exact selector and public buffered/native Python branch with CPU tensor/backend stand-ins. These are CPU checks, not GPU dispatch evidence. They do not run pandas merge, compiled padded-M lookup or the allocating-form provider registry.
Actual review-head runtime verification — 2026-11-24
The complete source at head
1b113f7573aea787611ca94e779ff9e311cc206bwas installed in an isolated environment on the 1120 base image, with FlyDSL 0.5.3, Torch2.11.0+rocm10.1.0a20260811-bkc.20260820, HIP7.16.26315, and the pinned CK source. This is a new installation of the reviewed branch; it is separate from the historical 1120 performance measurements above. The base image was not changed. CK source was populated from the pinned archive while its Git submodule remained uninitialized; that state is recorded explicitly.Normal import and the real default pandas merge passed with all 4213 keys and the eight changed rows. No
AITER_CONFIG_*override, AOT import/replay mode, table stand-in or forced provider was used. The actual publicaiter.gemm_a8w8_blockscale_bpreshuffleoperator then passed 16 cases × two forms = 32 form/case combinations, covering all eight changed shapes and each M−1 neighbor, both explicitout=and allocating forms. All 64 full-output eager/NaN-poisoned graph checks passed the fixed numerical policy above; maximum mismatch ratio was 0.015686937740870883. Actual bridge observations selected IDs 1088/1068 with the expected dimensions and geometry. The real Python padded lookup and separately built AITER JIT helper agreed for all 16 cases.Commands used the retained task-local validation runners with owner-bound source/installation receipts:
python -u -B run_public_dispatch.py --binding <exact-head-binding.json> --output <new-result.json> --phase cpu-preflight, followed by--phase gpufor the two explicitly selected subsets. The separate complete-backend ABBA runner uses the same installed source and fixed baseline/candidate row dictionaries, as described in Performance. These commands identify the recorded validation, rather than a new repository test target.The two direct GPU units ran at 09:22:37–09:22:50 UTC and 09:24:31–09:24:44 UTC on one gfx1250 GPU with 256 CUs. There was no performance timing in these units. Forty-two exported files were independently checked against original size/SHA256, including complete results, actual Docker command/configuration and cleanup. Both owned containers were removed, device holders were empty at cleanup, and NUMA balancing was restored from 0 to its original 1. Retained kernel-journal windows cover each actual start through cleanup and contain no GPU-relevant error matches. Independent completed review SHA256:
64a64d4669af56814e6336177b3991d19910833a8c27cb425b4bdf4a7a3fc88e.The earlier GitHub checkpoint before the standard run had eleven successes and 42 skips, with Black, Ruff, Repository Dependency and Aiter Test Gate successful while actual standard/GPU jobs were skipped. That historical state is superseded by the current MI35X shard7 failure described at the start of this PR; it is not a current GPU CI pass. No repeat run has been requested to hide the failure.
Paired complete-backend performance has now passed for all eight selections, with no slower paired direction in this run. The small single-round gains retain the uncertainty stated above. The completed runtime checks validate this exact branch head on preparation base
526972d; no later rebased tree is claimed. A full retune of unrelated shapes is not required. Applicable review requirements remain to be completed.Remaining unverified: PP-stage0, DP8/EP8 model execution, GSM8K accuracy, serving latency, end-to-end gains, later upstream revisions and every nonexact-M neighbor. Explicit
AITER_CONFIG_*table overrides, power overlays and external routing providers can bypass the default selections assessed here.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 normalized key is
(gfx, cu_num, M, N, K, w_scale_block). All eight changed keys usegfx1250,256, and128x128. Five have N67584/K7168 and M1024/2048/4096/8192/16384; three have N7168/K33792 and M4096/8192/16384. The public tests used FP8 inputs, E8M0 block scales and BF16 outputs. The global merge does not include a model-name or output-dtype key, so these rows can apply to any matching workload, not only a model named Kimi K3; other output types are not validated here.The default lookup first tries the exact M, then the existing gl0/gl1 padded-M rules. Consequently, nonexact M values which already selected one of these eight keys consume its new configuration too; this is not limited to eight exact input M values. All eight M−1 neighbors were verified through the real Python/JIT helper and both public forms. No claim is made that these sixteen tests cover every neighbor.
The source delta changes eight existing rows without adding/removing keys or changing the selector. A byte-level patch validator confirms the other 293 model rows are preserved. Source inspection and the actual default pandas merge confirm the same 4213-key family set, no duplicate/masking key among the eight, and the expected row values. Therefore inputs whose existing lookup selects any other key retain that key's previous configuration; fallback selection and other N/K/architecture/CU keys are unchanged. The standalone public runtime checks establish the changed rows' dispatch; the paired performance tests explicitly compare old and new full backend configurations. The logical CSV
bwand limited single-round timing are not used to claim unchanged model accuracy or measured HBM behavior.Changed op tests
None.