[AIROCMLIR-888] Implement per-problem narrowing in the quick-tuning DB#2361
[AIROCMLIR-888] Implement per-problem narrowing in the quick-tuning DB#2361mirza-halilcevic wants to merge 24 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restructures Rock’s quick-tuning “DB” into a curated QuickTuningDb with optional per-problem narrowing (via a problem-key hash) and a configurable cap (ROCMLIR_QUICK_TUNING_LIST_MAX) to reduce compile-time spent sweeping large perfconfig lists.
Changes:
- Introduces
QuickTuningDb+ runtime problem-key hashing (xxh3_64) to optionally narrow perfconfig sweeps to a per-problem subset. - Threads an optional
problemKeyHashthrough quick-tuning plumbing so both compile-time selection and tuning sweeps can benefit. - Migrates the perfconfig data into per-(arch, op, dtype) auto-generated
.incshards, and adds C++/Python goldens + DB invariant tests.
Reviewed changes
Copilot reviewed 121 out of 122 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| mlir/utils/performance/tests/test_quickTuningGen.py | Adds pytest goldens for problem-key formatting, bool-cast behavior at ingest, and pinned xxh3_64 hashes. |
| mlir/unittests/Dialect/Rock/ParamLookupTableTests.cpp | Removes legacy ParamLookupTable fallback-policy tests (superseded by QuickTuningDb tests). |
| mlir/unittests/Dialect/Rock/CMakeLists.txt | Switches unit tests to QuickTuningDbTests.cpp and adds MLIRParser for parsing MLIR test snippets. |
| mlir/unittests/Dialect/Rock/QuickTuningDbTests.cpp | Adds gtests for DB invariants, resolveKey fallback policy, and problem-key hash goldens. |
| mlir/lib/Dialect/Rock/Tuning/RockTuningImpl.cpp | Threads problemKeyHash into quick tuning range creation so tuning sweeps can narrow lists too. |
| mlir/lib/Dialect/Rock/Tuning/GridwiseGemmParams.cpp | Populates PopulateParamsInfo::problemKeyHash from the op (when computable). |
| mlir/lib/Dialect/Rock/Tuning/GridwiseGemmGemmParams.cpp | Switches GemmGemm quick-tuning lookup to QuickTuningDb and computes optional problem hash. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb.cpp | Implements key resolution + lookup (including per-problem selection + list cap). |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningProblemKey.cpp | Implements op→problem-key string formatting and xxh3_64 hashing to match Python generator. |
| mlir/lib/Dialect/Rock/Tuning/CMakeLists.txt | Replaces ParamLookupTable sources with QuickTuningDb sources; generates QuickTuningDb.inc by globbing/sorting per-key .inc files. |
| mlir/lib/Dialect/Rock/Tuning/ParamLookupTable.cpp | Removes legacy ParamLookupTable implementation. |
| mlir/include/mlir/Dialect/Rock/Tuning/QuickTuningDb.h | Adds the public QuickTuningDb API (lookup/resolveKey/problem hashing + invariants for tests). |
| mlir/include/mlir/Dialect/Rock/Tuning/ParamLookupTable.h | Removes legacy ParamLookupTable API. |
| mlir/include/mlir/Dialect/Rock/Tuning/QuickTuningPerfconfigs.inc | Removes the previous monolithic quick-tuning perfconfig include. |
| mlir/include/mlir/Dialect/Rock/Tuning/GridwiseGemmParams.h | Switches tuning parameter plumbing to QuickTuningDb and adds problemKeyHash to PopulateParamsInfo. |
| mlir/include/mlir/Dialect/Rock/Tuning/GridwiseGemmGemmParams.h | Switches GemmGemm tuning to QuickTuningDb. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1000AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1000ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1000ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1000ConvFp8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1000ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1000GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1000GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1000GemmFp8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1000GemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1100ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1100ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1100ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1100GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1100GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1100GemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1101AttentionBf16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1101AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1101AttentionI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1103AttentionBf16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1103AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1103AttentionI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1103ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1103ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1103ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1103GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1103GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1103GemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1150AttentionBf16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1150AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1150AttentionI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1150ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1150ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1150ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1150GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1150GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1150GemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1151ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1151ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1151ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1151GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1151GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1151GemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1152AttentionBf16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1152AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1152AttentionI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1152ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1152ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1152ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1152GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1152GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1152GemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1201AttentionBf16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1201AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1201AttentionI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1201ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1201ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1201ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1201GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1201GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx1201GemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx900AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx900AttentionF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx900ConvFp8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx900GemmFp8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908AttentionBf16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908AttentionF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908AttentionI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx908GemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aAttentionBf16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aAttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aAttentionF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aAttentionI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aGemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aGemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx90aGemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942AttentionBf16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942AttentionF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942AttentionI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942GemmI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950AttentionBf16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950AttentionF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950AttentionF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950AttentionI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950ConvF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950ConvF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950ConvI8.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950GemmF16.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950GemmF32.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950GemmFp4.inc | Auto-generated per-key set-cover shard. |
| mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx950GemmI8.inc | Auto-generated per-key set-cover shard. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #2361 +/- ##
===========================================
+ Coverage 82.57% 82.66% +0.09%
===========================================
Files 120 119 -1
Lines 42852 43025 +173
Branches 7110 7152 +42
===========================================
+ Hits 35381 35563 +182
- Misses 4815 4823 +8
+ Partials 2656 2639 -17
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Verdict: APPROVE -- submitted as COMMENT (automated reviews are advisory) · Findings: 0 (0 Critical, 0 Major, 0 Minor)
Scope
Reworks the quick-tuning database: renames ParamLookupTable → QuickTuningDb (class → namespace), splits the monolithic QuickTuningPerfconfigs.inc into per-(arch,op,dtype) .inc files globbed+sorted by CMake, adds a per-problem narrowing path (xxh3_64 problem-key hashing mirrored between quickTuningGen.py and QuickTuningProblemKey.cpp), and caps results via ROCMLIR_QUICK_TUNING_LIST_MAX (default 30). Consumer wiring threads an optional problemKeyHash through PopulateParams* and RockTuningImpl. Bulk of the diff is migrated/auto-generated data plus the rename.
Findings
No blocking issues found. The one prior inline comment (Copilot: std::mismatch 3-iterator overload reading past itKey/prevKey end) is already addressed — QuickTuningDb.cpp now uses the bounded 4-iterator overload at both call sites.
Notes
- Non-accel fallback now restricted to
gfx1*.getRelativesforcesarchPrefix="gfx1"andf32when!isAccel(QuickTuningDb.cpp), whereas the oldParamLookupTableused a 3-chargfxprefix (any family). This is intentional and covered byResolveKeyTest.NonAccelRestrictsToGfx1Family, but it is a behavior change: a non-accel f32 query on a non-MFMA gfx9 part (e.g. gfx900, which has no*GemmF32/*ConvF32data here) now resolves to agfx1*entry rather than the nearest gfx9 sibling. Worth a sanity check that no supported flow regresses; configs remain valid (vetted byparamsProbablyValid), so worst case is sub-optimal, not incorrect. - Conv problem-key for grouped/asymmetric cases.
makeConvKeyencodes C asin[ci]*in[gi], K asfil[k]*fil[g], and padding aspad[0]/pad[2]only. Goldens only exercise G=1 and symmetric padding=1; when problem maps are populated in the follow-up, extend goldens to G>1 / asymmetric padding to confirm byte-parity with the PythonC/PaddingH/PaddingWcolumns. No current effect since the migrated data carries no problem maps (all queries take the full set-cover path). - Minor/non-blocking:
lookup()callsnormalizeArchand thenresolveEntrynormalizes again (idempotent);pip_requirements.txtcorrectly gainspulp/xxhash; new files carry the correctPart of the MLIR ProjectSPDX header.
CI status
No genuine CI failures. Jenkins, C/C++ premerge, Python format/lint, and Python performance script tests all pass; many hardware jobs are still pending. The failing review check is this auto-review pipeline's own job and is expected.
Motivation
Quick-tuning compile time was dominated by the size of the perfconfig list we swept for each kernel. We previously sent the entire per-(arch, op, dtype) set-cover at every kernel, even when the problem at hand was already represented in our tuning campaigns and a much smaller subset would have sufficed.
This PR addresses that on two fronts:
ROCMLIR_QUICK_TUNING_LIST_MAX(default 30). The set-cover is already sorted by descending coverage count, so head-truncating preserves the configs that win on the most problems; statistically the right tradeoff when we have no problem-specific signal.The branch also lands a few quality-of-life cleanups around the quick-tuning plumbing that were prerequisites for the per-problem mapping.
The existing quick-tune lists were migrated to the new per-key
.incformat in this PR; the migration carries the set-covers only and does not include problem maps. Regenerating the lists with problem maps populated will land in a follow-up. Until then, all entries take the unknown-problem path (full set-cover, capped toROCMLIR_QUICK_TUNING_LIST_MAX).Technical Details
Quick-tuning DB layout
.incfile per(arch, op, dtype)key (mlir/lib/Dialect/Rock/Tuning/QuickTuningDb/Gfx942ConvF16.inc, etc.). The previous monolithicQuickTuningPerfconfigs.incis gone. CMake globs the per-key files in sorted order and generates a singleQuickTuningDb.incthat the lookup TU includes twice (once withQUICK_TUNING_DB_ARRAYSto emit the static arrays, once withQUICK_TUNING_DB_ENTRIESto emit the table initializer). Sorted filenames ↔ sorted snake_case keys, which is the precondition the binary-search lookup relies on.ParamLookupTable→QuickTuningDb, restructured from a class into a namespace. The semantics (lookup-by-key with arch-family fallback) are now closer to a curated database than a generic param table, and the new name reflects that. Private helpers moved into anonymous namespaces in the cpp.quickTuningGen.pyauto-detects op type from the input.debugheaders (Chipcolumn for arch, dataframe columns for op). One invocation now handles a mixed bag of gemm/conv/attention runs without per-op flags.The problem map
Each table entry has the shape:
A
ProblemRefis a (hash, offset, count) triple. To answer "what configs should we sweep for this problem?" we:(arch, op, dtype, isAccel)via binary-search with arch-family fallback (e.g.gfx940 → gfx942,bf16 → f16).problemMapfor the hash. On hit, takeindices[offset .. offset+count)and gather those positions out ofsetCover. On miss, fall back to the full set-cover.ROCMLIR_QUICK_TUNING_LIST_MAX(default 30).The flat-
indiceslayout means a single.inccarries one set-cover plus a compact per-problem index ribbon; no duplicated config strings, no per-problem allocations.Problem keys
The on-disk hashes are
xxh3_64of a'_'-joined column tuple. Python is the authoritative producer (quickTuningGen.py:make_problem_key/hash_problem_key); C++ rebuilds the same byte sequence at runtime so the hashes line up:intat DataFrame ingest, so the wire format is0/1(wasTrue/False). C++ mirrors this inQuickTuningProblemKey.cpp.*_COLUMNSconstants in the generator (GEMM_COLUMNS,CONV_COLUMNS,ATTENTION_COLUMNS).mlir/utils/performance/tests/test_quickTuningGen.pyandmlir/unittests/Dialect/Rock/QuickTuningDbTests.cpp. Drift on either side fails both suites.Wiring on the consumer side
PopulateParamsInfocarries an optionalproblemKeyHash, populated viaQuickTuningDb::computeProblemKeyHash(op)(returnsFailureOr<uint64_t>).PopulateParams,PopulateParamsXDL,PopulateParamsWmma, andPopulateParamsGemmGemmthread the hash intoQuickTuningDb::lookup.RockTuningImpl::createGemmTuningRangeQuickdoes the same in the tuning sweep, so tuning runs also benefit from the narrowing.Test Plan
QuickTuningDbTestscovers DB invariants (sorted by key, per-entry problem maps sorted by hash),resolveKeyfallback policy (exact / older-relative / younger-relative / equidistant tiebreak / non-accel →gfx1*+f32/bf16→f16), and per-op problem-key goldens for gemm/conv/attention.test_quickTuningGen.pycoversmake_problem_keyformat, the bool-cast at ingest, and golden hashes shared with the C++ side.Test Result
Submission Checklist