mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #695] [CLOSED] hip: the tuning table's arch gate accepts the RDNA4 sibling (gfx1200 <-> gfx1201) #2771
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2771
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/695
Author: @bsorensen110
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:fix/hipblaslt-tuning-arch-family📝 Commits (3)
1a66647hip: the tuning table's arch gate accepts the RDNA4 sibling (gfx1200 <-> gfx1201)88791fcRefactor architecture check for tuning compatibility57fe0f5tests: the tuning-header gate's test builds on Windows, and RDNA1/RDNA2 stays rejected (#695)📊 Changes
3 files changed (+126 additions, -1 deletions)
View changed files
📝
CMakeLists.txt(+6 -0)📝
src/prefill/hipblaslt_tuning.hpp(+13 -1)➕
tests/prefill/tuning_header_arch_family_test.cpp(+107 -0)📄 Description
Summary
TuningTable::load()compares the tuning table's architecture to the runtime's with strict equality (arch != expected_arch). A card that reports its RDNA4 sibling — which happens routinely underHSA_OVERRIDE_GFX_VERSION— rejects its own calibration at startup and loses the tuned prefill route wholesale:This patch makes the header gate family-wide (
gfx1200↔gfx1201, and symmetricallygfx1100/1101/1102), matching the scope of the gate that actually protects correctness — the per-solution check insrc/prefill/gemm.cu. The hipBLASLt version gate is untouched; cross-family pairs stay rejected. Adds a host-only unit test (synthetic tables, no model, no GPU): RED on the strict gate, GREEN on the family gate.The symptom (live service)
Radeon AI PRO R9700 (gfx1201), Linux, ROCm nightly 10.2.0a (hipBLASLt 100500), engine 0.1.38, profile
tools/hip/gfx1201-hipblaslt-100500.txt(32 rows). Engine startup log:The card is a gfx1201 (
rocminfo:Name: gfx1201, "AMD Radeon AI PRO R9700"), yet the engine seesgfx1200.Root cause
The engine runs with
HSA_OVERRIDE_GFX_VERSION=12.0.0(the llama.cpp-documented override practice, set in this machine's systemd user environment). A minimalhipGetDevicePropertiesprobe on the live card:--offload-archgcnArchNameHSA_OVERRIDE_GFX_VERSION=12.0.0HSA_OVERRIDE_GFX_VERSION=12.0.1So the runtime arch string is environment-dependent, not card-dependent. The strict gate then traps nightly users in a corner:
gfx1200-hipblaslt-100202.txttable is rejected by the version gate on a 100500 runtime (measured:tuning table rejected: hipBLASLt version mismatch: file=100202 runtime=100500);Net effect: no tuned route at all, with a startup line that reads like a config error.
Why the header gate is the wrong place for strict equality
The header check is a coarse guard; the real safety net is per-solution and per-shape, in
resolve_hipblaslt_algo()(src/prefill/gemm.cu):hipblaslt_ext::getAlgosFromIndex()— the table'ssolution_idmust exist in the running library's index;hipblaslt_ext::matmulIsAlgoSupported()— the algo must support the actual geometry/beta;lt_launches/fallbacks, reported bySTRATA_HIPBLASLT_VERBOSE=1).A family-wide header gate therefore cannot make a wrong kernel run: every row is validated against the live library before its first launch. The family scope is also what ROCm itself uses —
rocminfoon this card listsamdgcn-amd-amdhsa--gfx12-genericalongside--gfx1201.The change
9 lines in
src/prefill/hipblaslt_tuning.hpp(header gate comparesarch.substr(0, 5)), plus a host-only test and its CTest registration. No kernel, tuner, table format, or version-gate changes.Evidence
1. Header gate matrix (
tests/prefill/tuning_header_arch_family_test.cpp, 10 cases, synthetic tables):Base:
10 cases, 3 failures(the sibling rows). Patched:10 cases, 0 failures. Version gate and cross-family rejections are unchanged.2. Production Gemm probe (
build-hip/hip_prefill_hipblaslt_gemm,STRATA_HIPBLASLT_VERBOSE=1), same binary, same table (gfx1201/100500):tuning enabled (32 rows, gfx1201, version 100500)tuning enabled (32 rows, gfx1200, version 100500)solution 110416/135699 unavailable …)This is the honest nuance: the patch removes the wholesale startup rejection, and the per-solution gate then decides. Under the 12.0.0 override the gfx1201 solution IDs do not resolve in the library's gfx1200 view, so every call falls back to hipBLASEx — identical performance to today, no regression, and the diagnostics change from one misleading "architecture mismatch … using hipBLASEx" line to explicit per-shape fallback records.
3. Live service (engine
dafa4bf79a64272b, source fingerprinta2a2d19670350e0f, v0.1.38): after the patch the engine starts withprefill gemm: hipBLASLt tuning enabled (32 rows, gfx1200, version 100500), service healthy, arithmetic/recall/streaming checks pass. With verbose on, the running engine shows the per-shapeLt fallback; solution … unavailablerecords for every projection geometry — safe degradation, exactly as the probe predicts.4. What this does not fix (measured, labelled as such): tuned performance under
HSA_OVERRIDE_GFX_VERSION=12.0.0on a gfx1201 card. The solution IDs are scoped to the family view the library is given; under 12.0.0 the gfx1201 IDs don't resolve. For an R9700 the override is unnecessary (native gfx1201 works: 4 launches / 0 fallbacks); if an override is wanted,12.0.1keeps the card reporting gfx1201 (probe above). A docs note indocs/AMD_HIP.mdrecommending12.0.1(not12.0.0) for gfx1201 cards would complement this patch — I did not include it here to keep the diff minimal.Test plan
tuning_header_arch_family_test: RED onorigin/main(3 failures), GREEN with the patch (0 failures)Reproduction
Environment: AMD Radeon AI PRO R9700 (gfx1201), CachyOS/Arch, ROCm nightly 10.2.0a20260914 (hipBLASLt 100500, HIP runtime 71726391), Strata 0.1.38.
🤖 Generated with Hermes Agent
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.