From 4ed8eb02fa07612031fb546b50e6bca811db357c Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Mon, 19 Oct 2026 21:37:42 +0200 Subject: [PATCH] hipBLASLt tuning table on by default on Strix Halo (gfx1151) only, the owner's choice; opt-in elsewhere --- docs/AMD_HIP.md | 6 ++++-- strata_control/hipblaslt_tuning.py | 5 ++++- tests/terminal/test_hipblaslt_tuning.py | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md index a48e78b9..d2ed4fb0 100644 --- a/docs/AMD_HIP.md +++ b/docs/AMD_HIP.md @@ -104,8 +104,10 @@ What was run on real hardware: is for that version (a table calibrated for it on an R9700 read prompts about 1% faster and decode 2% slower, so none is shipped). The engine start picks the table for the card and uses it only when the package's hipBLASLt version is the table's; otherwise it logs why and the dense matrix products stay on plain hipBLAS. **A table changes which GEMM algorithm runs the prompt, so the rounding differs: the - answers are not bit-identical to plain hipBLAS** (first-token KL 0.016 on an R9700, see below). Packaged engines therefore do not use the table - unless you ask: `STRATA_HIPBLASLT_TABLE=on` (or `"hipblaslt_table": true` in the run config) uses it, `off` never does, and the start log + answers are not bit-identical to plain hipBLAS** (first-token KL 0.016 on an R9700, see below). Packaged engines therefore use the table by + default only on Strix Halo (gfx1151), where a community A/B measured prompts 2.11x faster with it (251 to 529 tokens/s); every other card + uses it only when you ask: `STRATA_HIPBLASLT_TABLE=on` (or `"hipblaslt_table": true` in the run config) uses it, `off` never does (on Strix + Halo too), and the start log says which table was taken or why none was (`hipBLASLt tuning table: ...`). A `STRATA_HIPBLASLT_TUNING` you set yourself is always kept. A source build is unchanged (see [Tuning table](#tuning-table)). Testers on Strix Halo and RX 7000 cards: please send that log line and a prompt-speed run with `on` and `off`. diff --git a/strata_control/hipblaslt_tuning.py b/strata_control/hipblaslt_tuning.py index e185e390..a6f61313 100644 --- a/strata_control/hipblaslt_tuning.py +++ b/strata_control/hipblaslt_tuning.py @@ -31,6 +31,9 @@ SWITCH = "STRATA_HIPBLASLT_TABLE" # on | auto | off #: A default that changes bits needs the owner's decision, so the packages carry their tables and the switch ("on") uses them, but "auto" is #: off until that decision. Flipping this one constant turns the tables on for every package that carries one. AUTO_USES_TABLE = False +#: The owner's decision (2026-10-19): "auto" uses the table on these architectures only. gfx1151 (Strix Halo): a community A/B measured +#: 251 -> 529 prompt tok/s (2.11x) with the table; on gfx1201 the gain was ~1% and decode lost ~2% (notes-021-hip.md), so it stays opt-in there. +AUTO_ARCHS = ("gfx1151",) ENGINE_VAR = "STRATA_HIPBLASLT_TUNING" # what the engine reads: the path of one table TABLE_DIR = "tuning" # inside an engine package HEADER = "STRATA_HIPBLASLT_TUNING_V1" @@ -205,7 +208,7 @@ def resolve(folder, archs_present, *, environ=None, cfg: dict | None = None) -> continue if not header_ok(path, arch, version): return Decision(None, f"hipBLASLt tuning table: {path.name} is not used, its header does not match its name; plain hipBLAS", "warn") - if mode(environ, cfg) == "auto" and not AUTO_USES_TABLE: + if mode(environ, cfg) == "auto" and not (AUTO_USES_TABLE or arch in AUTO_ARCHS): return Decision(None, f"hipBLASLt tuning table: {path.name} is in this package and not used by default (faster prompts, but answers can differ " f"in the last digits); {SWITCH}=on uses it") return Decision(path, f"hipBLASLt tuning table: {path.name} (faster prompts; {SWITCH}=off turns it off)") diff --git a/tests/terminal/test_hipblaslt_tuning.py b/tests/terminal/test_hipblaslt_tuning.py index 9beaadd4..787b6d68 100644 --- a/tests/terminal/test_hipblaslt_tuning.py +++ b/tests/terminal/test_hipblaslt_tuning.py @@ -139,9 +139,19 @@ class Decision(TempDir): self.assertEqual(d.path, pkg / "tuning" / "gfx1201-hipblaslt-100500.txt") self.assertIsNone(ht.resolve(pkg, ["gfx1201"], environ={ht.SWITCH: "off"}).path) - def test_the_default_is_off_until_the_owner_decides(self): - """A table changes the bits of the prompt's dense GEMMs (notes-021-hip.md); this fails on purpose when someone flips the default.""" + def test_the_default_is_the_owners_decision(self): + """A table changes the bits of the prompt's dense GEMMs (notes-021-hip.md); the owner chose: on by default for Strix Halo only.""" self.assertFalse(ht.AUTO_USES_TABLE) + self.assertEqual(ht.AUTO_ARCHS, ("gfx1151",)) + + def test_auto_uses_the_table_on_strix_halo_only(self): + for arch, used in (("gfx1151", True), ("gfx1201", False), ("gfx1100", False)): + root = self.root / arch + root.mkdir() + pkg = fake_package(root, tables=((arch, 100500),)) + d = ht.resolve(pkg, [arch], environ=AUTO) + self.assertEqual(d.path is not None, used, (arch, d.message)) + self.assertIsNone(ht.resolve(pkg, [arch], environ={ht.SWITCH: "off"}).path) def test_a_table_the_person_set_is_never_replaced(self): pkg = fake_package(self.root)