Repository navigation
[Fix] Add gfx1250 K3 lm_head M128 tuning with strict TDM fallback - #8674
ZLkanyo009 wants to merge 3 commits into
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
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. |
|
@valar-cop review |
| # TDM launches only on exact gfx1250; borrowed rows must not | ||
| # replace a strict device's existing fallback. | ||
| if ( | ||
| borrowed_rows |
There was a problem hiding this comment.
key on runtime gfx instead of borrowed_rows? strict tdm row would raise instead of fallback, #8729 already does this
| False, | ||
| self.SPLIT_K, | ||
| ) | ||
| def test_strict_id_skips_borrowed_opus_row(self): |
There was a problem hiding this comment.
why drop the ValueError assert? looks like a AITER_AOT_REPLAY=1 env diff, maybe skipIf instead of removing
|
Hi @ZLkanyo009 please resolve the conflicts and comments |
Kimi K3 TP1
lm_headat M128/N163840/K7168 has no gfx1250 BF16 model-table row on the preparation base. Add the measured TDM configuration, keeping BF16 input, weights and output. The selector also skips borrowed TDM rows ongfx1250-strict, where the current TDM wrapper cannot launch, so that device retains its existing fallback.The preparation base is main
7f1f7d159e2c2fd0a7aa3a8e47c6d2d23fb7416c. This changes one model CSV row, the borrowed-row guard and CPU regression tests. The row uses tile 128×256×128, 2 stages, 4×4 waves, split-K 1, no bias and no interleave. Measurement cells stay blank. Main's native spelling is:The dev spelling contains
_i0_ptdm, which this main parser does not recognize. Only the persisted name is adapted to main's existing parser; no kernel implementation or external PR is imported. The exact main candidate has now passed the public correctness checks below. The dev integration is tracked separately in #8635; its accepted source is not a substitute for main validation.Local CPU validation completed using the actual main selector, name parser and TDM shape validator, with scalar table/device adapters: the new name parses and round-trips; M65/112/113/127/128 satisfy the shape contract; all 44 regression subcases pass. The 20 borrowed-TDM strict subcases fail against the original main selector and pass after this change. Ordinary gfx1250 selection, non-TDM borrowed rows and exact strict fallback rows are preserved. The added repository tests are in
op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py; the actual native no-device run also passes those three added methods (44 source-defined subcases), with no skips. It verifies all 33 native BF16 table inputs, 14 normal/strict/neighbor lookups, 14 scalar-padding comparisons and ten public compile-or-reuse calls on this exact candidate.Historical performance motivation, not a result from this main candidate: on dev parent
a3005ac8with the fixed 1120 image and FlyDSL 0.5.3, a same-process seven-round comparison measured 450.207 → 259.321 µs, or 667.798 → 1159.365 TFLOPS (+73.61% throughput). The median paired latency reduction was 42.44%. Both arms used BF16 throughout; one 2.348 GB weight was reused for 16 graph calls, so this is not a cold-weight result. The baseline was the public Triton path and the candidate was the complete explicit FlyDSL call. Device timing excludes Python dispatch.The exact main candidate
15c0cee462954da1dc945b74413a3db7f63d1dc9passed 30 public cases and 90 full-output checks on gfx1250/CU256 with NUMA0, fixed native1120 image and FlyDSL 0.5.3. Coverage is M65/112/113/127/128, full N163840/K7168, three saved input pairs, out/allocating forms, eager execution and two independently NaN-poisoned graph replays. All 1,607,270,400 compared elements passed rtol=atol 0.01 with zero mismatches; maximum absolute error was 2.0, so this is not bit-exact equality. The saved CPU-FP64-derived references retain their original a3005 data provenance. The run exited 0, its container was removed, and no new matching GPU faults appeared in the retained log interval. No timing was collected.The frozen main parent selects the complete Triton backend at these M values; the candidate selects the named FlyDSL backend. A separate paired experiment now compares those two complete backends in the same candidate-source process, with full N163840/K7168 and BF16 inputs, weights and outputs. This isolates the selected backends; it is not two branch executions, default-public dispatch timing or model/E2E timing.
Latencies are pooled medians of 14 samples per arm; reductions are medians of seven within-round ABBA comparisons, so they need not equal the ratio of the displayed medians. Each graph contains 16 complete calls with a warm activation and one reused 2.348 GB weight. There is no independent cold-weight rotation or measured cache-cold guarantee. Three warmup replays, seven interleaved AB/BA rounds and seven A/A null rounds precede or accompany the seven paired rounds; Python dispatch, data loading and reference checks are outside GPU event timing.
All five runs passed 110 full-output checks over 1,964,441,600 elements using the three saved input pairs, eager calls, NaN-poisoned graph replays and post-timing checks. Zero mismatches were observed under rtol=atol 0.01. Every run exited 0 and its exact container was removed; no new matching faults appeared in the retained intervals. These are exact-M observations, not an exhaustive bucket or FP16 performance claim.
The original complete unittest module failed on both the pinned main parent and production candidate in the same no-device environment: parent 15 methods, one failure and eight subcase errors; candidate 18 methods, one failure and ten subcase errors. Those failures were traced to two stale test expectations: the OPUS test required a lower-level strict-dispatch rejection, and the legacy wrapper test mocked only the older launcher despite TDM names calling the TDM launcher. These original failures remain recorded.
Test-only follow-up
f38e8112117393736946639bc3aa53ab1ebe70d0aligns those two tests with the existing contracts. It keeps the real strict selector/fallback assertion and checks TDM routing, transposed weight shape/stride/storage, output, complete launch arguments and early strict rejection; the other 16 test methods are unchanged and no skips were added. The exact committed test bytes passed the complete native no-device module in an isolated source/cache copy: 18 methods, zero failures, zero errors and zero skips. All 8,951 source files were bound before and after that run, the container exited 0 and was removed, and no GPU or AOT stage ran. This follow-up changes only the test file; production files and table contents are byte-identical to measured commit15c0cee462954da1dc945b74413a3db7f63d1dc9. The GPU results above remain attributed to that production commit.Style-only follow-up
c135d2f3b9f178c6b05c2707fe97d0669d6e0276applies Black's requested formatting to one test call. The complete test module AST is unchanged fromf38e8112117393736946639bc3aa53ab1ebe70d0, and production/table bytes remain unchanged. The new Black CI check passes; the native 18-method result remains attributed to the test-equivalentf38e811run.Public correctness, the bounded main backend comparison and the complete native unittest module are validated for the scopes above. This PR is ready for review. No model/E2E gain or strict-device GPU execution/support is claimed.
Related: https://github.com/wuhuikx/LLM-Booster/issues/710