Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
Engine package for the RX 6000 series (gfx1030 / gfx1031): build variant, package choice, setup note, tests
Niko12213985c5077771
diff --git a/packaging/build_hip_linux.sh b/packaging/build_hip_linux.shindex 068d355dc..0729f6074 100644--- a/packaging/build_hip_linux.sh+++ b/packaging/build_hip_linux.sh@@ -4,7 +4,7 @@# Run on a Linux box that has ROCm (TheRock Python wheels are enough); the tester packages were built in an Ubuntu 22.04 chroot# (glibc 2.35) so they run on every distribution since. All settings are environment variables:#-# VARIANT=rx9070 rx9070 (gfx1200 gfx1201) | rx7900 (gfx1100 gfx1101 gfx1102) | halo (gfx1151) | igpu (gfx1103 gfx1150) | a name + ARCHS=+# VARIANT=rx9070 rx9070 (gfx1200 gfx1201) | rx7900 (gfx1100 gfx1101 gfx1102) | rx6000 (gfx1030 gfx1031) | halo (gfx1151) | igpu (gfx1103 gfx1150) | a name + ARCHS=# ARCHS="gfx1200;gfx1201" the code objects (default: the variant's)# SRC=<this checkout> the Strata source (default: the checkout this script is in)# LLAMA=<llama.cpp checkout> at the pinned commit (setup.py LLAMA_CPP_COMMIT); mtmd and ggml come from it@@ -17,7 +17,7 @@# Both readers get RUNPATH $ORIGIN (tools/vision/CMakeLists.txt), and every bundled library is patched to $ORIGIN, so the# component folder runs from anywhere with nothing from the environment (packaging/binary_deps.py checks it).set -u-V=${VARIANT:?VARIANT=rx9070|rx7900|halo|igpu|<name> with ARCHS=}+V=${VARIANT:?VARIANT=rx9070|rx7900|rx6000|halo|igpu|<name> with ARCHS=}SRC=${SRC:-$(cd "$(dirname "$0")/.." && pwd)}LLAMA=${LLAMA:?LLAMA=<llama.cpp checkout at the pinned commit>}HP=${HP:?HP=<ROCm devel root>}@@ -30,10 +30,12 @@ JOBS=${JOBS:-16}case "$V" inrx9070) ARCHS=${ARCHS:-gfx1200;gfx1201} ;;rx7900) ARCHS=${ARCHS:-gfx1100;gfx1101;gfx1102} ;;+ rx6000) ARCHS=${ARCHS:-gfx1030;gfx1031} ;; # RDNA2: no WMMA (plain kernels), no hipBLASLt kernels; built, not tested on a real RX 6000 cardhalo) ARCHS=${ARCHS:-gfx1151} ;;igpu) ARCHS=${ARCHS:-gfx1103;gfx1150} ;;*) ARCHS=${ARCHS:?ARCHS=gfx...} ;;esac+NOTE_EXTRA=""; [ "$V" = rx6000 ] && NOTE_EXTRA=" (built, not tested on a real RX 6000 card)"ARCHLIST=${ARCHS//;/ }DATAARCH=${ARCHS//;/,}mkdir -p "$OUT"; S=$OUT/build.status@@ -95,7 +97,7 @@ st "tuning tables rc=$?: $(tail -n 1 "$OUT/stage_tuning.log")"rm -rf "$OUT/components"; mkdir -p "$OUT/components/engine"ARCHARGS=""; for a in $ARCHLIST; do ARCHARGS="$ARCHARGS --arch $a"; donepython3 packaging/package_engine.py --src "$STAGE" --backend hip --version "$PKGVER" --out "$OUT/components/engine" $ARCHARGS \- --variant "$V" --build-id "$COMMIT+rocm" --tree --notes "AMD $V build: engine, CPU picture reader, GPU picture reader" > "$OUT/package.log" 2>&1+ --variant "$V" --build-id "$COMMIT+rocm" --tree --notes "AMD $V build: engine, CPU picture reader, GPU picture reader${NOTE_EXTRA:-}" > "$OUT/package.log" 2>&1st "packaged rc=$?"cat "$OUT/package.log" >> "$S"st "BUILD-DONE"diff --git a/setup.py b/setup.pyindex 27a369441..8522b9ad0 100644--- a/setup.py+++ b/setup.py@@ -3060,6 +3060,27 @@ def is_strix_halo(g) -> bool:return isinstance(g, dict) and gfx_arch_is(g.get("arch"), STRIX_HALO_ARCH)+RDNA2_ARCHS = ("gfx1030", "gfx1031") # RX 6800 / 6900 / 6950 series and RX 6700 XT: the cards of the ready-made RX 6000 engine package+++def is_rdna2(g) -> bool:+ """A discrete RX 6000 card the ready-made RX 6000 engine package covers (gfx1030 / gfx1031); never an RX 7000 / 9000 or an APU."""+ return isinstance(g, dict) and any(gfx_arch_is(g.get("arch"), a) for a in RDNA2_ARCHS)+++RDNA2_PACKAGE_NOTE = ("RX 6000 series (RDNA2, {arch}): Strata has a ready-made engine package for these cards, built, not tested on a real "+ "RX 6000 card. It runs plain kernels (this chip has no matrix cores, so the RX 7000 / RX 9000 prompt paths stay off) "+ "and plain hipBLAS (no hipBLASLt tuning table for it). If something goes wrong, open an issue with the end of "+ "strata-<model>.log: docs/AMD_HIP.md, \"RDNA2\".")+++def rdna2_notes(gpu) -> list[str]:+ """What setup tells the owner of an RX 6000 card (gfx1030 / gfx1031); nothing for any other card."""+ if not is_rdna2(gpu):+ return []+ return [" " + RDNA2_PACKAGE_NOTE.format(arch=str(gpu.get("arch")).split(":")[0])]++def is_uma_apu(g) -> bool:"""A unified-memory AMD APU whose "VRAM" is a BIOS carve-out plus shared system memory: Strix Halo (gfx1151), andthe opt-in gfx1150 (Strix Point) / gfx1103 (Phoenix / Hawk Point) iGPUs. Everything else is a discrete card."""@@ -6720,6 +6741,9 @@ def control_engine_step(gpu, vision):found = EC.resolve(full=False)eng, meta = Path(found.root), {"version": found.version, "backend": found.backend, "source": "local"}ok(f"engine component: {found.version} ({found.platform}-{found.backend}) in {eng}")+ if found.backend == "hip" and is_rdna2(gpu) and any(a in RDNA2_ARCHS for a in found.hip_archs):+ for line in rdna2_notes(gpu): # the RX 6000 package: built, not tested on a real card+ say(line)except EC.EngineMissing as e:plain = getattr(e, "plain_notice", None) or getattr(e, "driver_notice", None)if os.environ.get("STRATA_NEED_ENGINE") == "1" and os.environ.get("STRATA_ALLOW_NO_ENGINE") != "1":@@ -7667,6 +7691,8 @@ def main() -> int:if gpu.get("uma"):for line in igpu_notes(gpu, ram_gb()):(warn if line.startswith("!") else say)(line.lstrip("!"))+ for line in rdna2_notes(gpu):+ say(line)else:if not found:fail("no NVIDIA GPU found (nvidia-smi did not answer)",diff --git a/strata_control/engine_component.py b/strata_control/engine_component.pyindex 38f7e901d..78dbe3e93 100644--- a/strata_control/engine_component.py+++ b/strata_control/engine_component.py@@ -638,9 +638,10 @@ def hip_family(arch: str) -> str:return next((name for name, archs in HIP_FAMILIES if arch in archs), arch)-#: AMD architectures no ready-made engine package of this release covers (the packages: RX 9000, RX 7000 + Ryzen AI Max): the RX 6000 series.-#: Setup and a source build can still target them (docs/AMD_HIP.md); the app's one-click engine cannot.-NO_PACKAGE_HIP = {"gfx1030": "RX 6000", "gfx1031": "RX 6000"}+#: AMD architectures no ready-made engine package of this release covers. Empty since 0.2.2: the RX 6000 series (gfx1030 / gfx1031) has+#: its own package (Linux `rx6000`, Windows `rdna2`; built, not tested on a real RX 6000 card). The mechanism stays for the next card family+#: that has none: a family in this table gets the plain "no ready-made engine" line instead of "Ask for the X build".+NO_PACKAGE_HIP: dict[str, str] = {}NO_PACKAGE_SENTENCE = ("This release has no ready-made Strata engine for the AMD {0} series. Strata can only run on it with an engine built for ""that card (docs/AMD_HIP.md, \"RDNA2\").")@@ -651,6 +652,13 @@ def no_package_note(archs) -> str | None:return NO_PACKAGE_SENTENCE.format(" and ".join(families)) if families else None+def hip_preference(archs) -> int:+ """Tie-break between two AMD engine packages of one version that both cover a PC (a computer with an RX 7900 beside an RX 6800): the+ RX 6000 package (gfx103x code only) never wins over another family's, so adding it changed nothing for a PC that was served before."""+ archs = [str(a) for a in archs or ()]+ return 0 if archs and all(a.startswith("gfx103") for a in archs) else 1++def arch_notice(built: tuple[str, ...], here: list[str]) -> str:"""The plain sentence for an AMD engine that has code for other cards than this computer's (a tester build for another card)."""if here and all(a in NO_PACKAGE_HIP for a in here): # asking for "the RX 6000 build" would send the person to one that does not exist@@ -759,7 +767,8 @@ def resolve(root: Path | None = None, *, backend: str | None = None, target: strif item.root.name == pin:return item# newest version first; with equal versions the build for the newer driver (the CUDA 13 build beside the CUDA 12 one)- return max(usable, key=lambda item: (_version_key(item.version), _version_key(item.min_driver.get("nvidia", "0"))))+ return max(usable, key=lambda item: (_version_key(item.version), _version_key(item.min_driver.get("nvidia", "0")),+ hip_preference(item.hip_archs)))#: A run config can name its engine as "component:strata-engine" instead of a path: the server then asks thediff --git a/strata_control/feed.py b/strata_control/feed.pyindex 8497f7f51..5e7493635 100644--- a/strata_control/feed.py+++ b/strata_control/feed.py@@ -375,5 +375,6 @@ def select_engine(packages, hardware: dict) -> tuple[EnginePackage | None, list[fitting.append(pkg)if not fitting:return None, reasons- best = max(fitting, key=lambda p: (version_key(p.version), ec._version_key(p.min_driver.get("nvidia", "0"))))+ best = max(fitting, key=lambda p: (version_key(p.version), ec._version_key(p.min_driver.get("nvidia", "0")),+ ec.hip_preference(p.archs) if p.backend == "hip" else 1))return best, reasonsdiff --git a/tests/terminal/test_engine_component.py b/tests/terminal/test_engine_component.pyindex 24caae89a..d67ef211c 100644--- a/tests/terminal/test_engine_component.py+++ b/tests/terminal/test_engine_component.py@@ -323,6 +323,44 @@ class WrongCardFamily(unittest.TestCase):self.assertEqual(ec.resolve(self.root, backend="hip", runtime="1").backend, "hip")+class Rx6000Package(unittest.TestCase):+ """0.2.2: the RX 6000 package (gfx1030 / gfx1031) is the one an RX 6000 card finds, and no other card family finds it."""++ def setUp(self):+ self.dir = tempfile.TemporaryDirectory()+ self.root = Path(self.dir.name)+ self.addCleanup(self.dir.cleanup)++ def kfd(self, *versions):+ nodes = Path(self.dir.name) / "kfd"+ for i, ver in enumerate(versions):+ node = nodes / str(i)+ node.mkdir(parents=True)+ (node / "properties").write_text(f"cpu_cores_count 0{chr(10)}simd_count 80{chr(10)}gfx_target_version {ver}{chr(10)}", encoding="utf-8")+ return str(nodes)++ def test_the_kfd_topology_names_rdna2_cards(self):+ self.assertEqual(ec.hip_archs_present(self.kfd(100300, 100301, 110000, 120001)), ["gfx1030", "gfx1031", "gfx1100", "gfx1201"])++ def test_an_rx6000_card_finds_the_rx6000_package_and_an_rx7000_card_does_not(self):+ make_package(self.root, backend="hip", archs=("gfx1030", "gfx1031"))+ with mock.patch.object(ec, "hip_archs_present", return_value=["gfx1030"]):+ self.assertEqual(ec.resolve(self.root, backend="hip", runtime="1").hip_archs, ("gfx1030", "gfx1031"))+ self.assertIsNone(ec.status(self.root, backend="hip")["notice"])+ with mock.patch.object(ec, "hip_archs_present", return_value=["gfx1100"]):+ with self.assertRaises(ec.EngineMissing) as caught:+ ec.resolve(self.root, backend="hip", runtime="1")+ self.assertTrue(str(caught.exception).startswith("This build of Strata is for AMD RX 6000 cards."), str(caught.exception))+ self.assertIn("Ask for the RX 7000 build.", str(caught.exception))++ def test_the_rx9000_package_on_an_rx6000_card_names_a_build_that_exists(self):+ make_package(self.root, backend="hip", archs=("gfx1200", "gfx1201"))+ with mock.patch.object(ec, "hip_archs_present", return_value=["gfx1030"]):+ with self.assertRaises(ec.EngineMissing) as caught:+ ec.resolve(self.root, backend="hip", runtime="1")+ self.assertIn("Ask for the RX 6000 build.", str(caught.exception))++class NeverAcquires(unittest.TestCase):"""The lookup, the status report and the CLI work with the network and process creation unavailable."""diff --git a/tests/terminal/test_release_matrix.py b/tests/terminal/test_release_matrix.pyindex a0548e1ab..a074fbfce 100644--- a/tests/terminal/test_release_matrix.py+++ b/tests/terminal/test_release_matrix.py@@ -32,11 +32,13 @@ RELEASE = [pkg("windows-x86_64", "cuda", "cuda12", SM_OLD, "576.02"),pkg("windows-x86_64", "hip", "rx9070", ("gfx1200", "gfx1201")),pkg("windows-x86_64", "hip", "rdna3", ("gfx1100", "gfx1101", "gfx1102", "gfx1151")),+ pkg("windows-x86_64", "hip", "rdna2", ("gfx1030", "gfx1031")),pkg("linux-x86_64", "cuda", "cuda13", SM_NEW, "580.65"),pkg("linux-x86_64", "cuda", "cuda12", SM_OLD, "575.51"),pkg("linux-x86_64", "hip", "rx9070", ("gfx1200", "gfx1201")),pkg("linux-x86_64", "hip", "rx7900", ("gfx1100", "gfx1101", "gfx1102")),pkg("linux-x86_64", "hip", "halo", ("gfx1151",)),+ pkg("linux-x86_64", "hip", "rx6000", ("gfx1030", "gfx1031")),pkg("macos-arm64", "metal", "", ("apple-gpu",)),]@@ -56,11 +58,13 @@ class ReleaseSelection(unittest.TestCase):self.pick(pc("windows-x86_64", "cuda", "576.02", ["sm_61"]))[0], # GTX 1080 on an older driverself.pick(pc("windows-x86_64", "hip", gfx=["gfx1201"]))[0], # RX 9070self.pick(pc("windows-x86_64", "hip", gfx=["gfx1100"]))[0], # RX 7900 XTX+ self.pick(pc("windows-x86_64", "hip", gfx=["gfx1030"]))[0], # RX 6800 XTself.pick(pc("linux-x86_64", "cuda", "615.71", ["sm_86"]))[0], # RTX 3060self.pick(pc("linux-x86_64", "cuda", "575.51", ["sm_60"]))[0], # Tesla P100self.pick(pc("linux-x86_64", "hip", gfx=["gfx1201"]))[0], # Radeon AI PRO R9700self.pick(pc("linux-x86_64", "hip", gfx=["gfx1100"]))[0], # RX 7900 XTXself.pick(pc("linux-x86_64", "hip", gfx=["gfx1151"]))[0], # Ryzen AI Max (Strix Halo)+ self.pick(pc("linux-x86_64", "hip", gfx=["gfx1031"]))[0], # RX 6700 XTself.pick(pc("macos-arm64", "metal"))[0],}self.assertEqual(chosen, {(p["platform"], p["backend"], p["variant"]) for p in RELEASE})@@ -111,7 +115,7 @@ class ReleaseSelection(unittest.TestCase):def test_other_unified_memory_radeons_get_no_engine_and_the_plain_family_line(self):from strata_control import engine_component as ecfor platform in ("windows-x86_64", "linux-x86_64"):- for gfx in ("gfx1103", "gfx1150", "gfx1152", "gfx1030"):+ for gfx in ("gfx1103", "gfx1150", "gfx1152", "gfx1032"):got, why = self.pick(pc(platform, "hip", gfx=[gfx]))self.assertIsNone(got, f"{gfx} on {platform}")self.assertTrue(any(gfx in r for r in why))@@ -120,21 +124,42 @@ class ReleaseSelection(unittest.TestCase):self.assertEqual(ec.arch_notice(("gfx1151",), ["gfx1201"]),"This build of Strata is for AMD Ryzen AI Max cards. This computer has an AMD RX 9000 card (gfx1201). Ask for the RX 9000 build.")- def test_rx6000_has_no_ready_made_package_and_the_notice_says_so_instead_of_naming_a_build_that_does_not_exist(self):- """#3203: an RX 6800 XT (gfx1030) is in none of the release's engine packages on either OS; the line must not say "Ask for the RX 6000 build"."""+ def test_rx6000_has_its_own_package_and_only_gfx103x_cards_get_it(self):+ """0.2.2: gfx1030 / gfx1031 are in the RX 6000 package (Linux rx6000, Windows rdna2) and in no other; no RX 7000 / 9000 card gets it."""from strata_control import engine_component as ec+ want = {"windows-x86_64": "rdna2", "linux-x86_64": "rx6000"}+ for platform, variant in want.items():+ for gfx in ("gfx1030", "gfx1031"):+ self.assertEqual(self.pick(pc(platform, "hip", gfx=[gfx]))[0], (platform, "hip", variant), (platform, gfx))+ for gfx in ("gfx1100", "gfx1101", "gfx1102", "gfx1151", "gfx1200", "gfx1201"):+ got = self.pick(pc(platform, "hip", gfx=[gfx]))[0]+ self.assertNotEqual(got[2] if got else None, variant, (platform, gfx))+ self.assertEqual(ec.NO_PACKAGE_HIP, {}, "every card family setup supports has a package; the table is for the next family without one")covered = {a for p in RELEASE if p["backend"] == "hip" for a in p["archs"]}- for gfx in ec.NO_PACKAGE_HIP:- self.assertNotIn(gfx, covered, f"{gfx} is in a package now: drop it from NO_PACKAGE_HIP")+ self.assertTrue({"gfx1030", "gfx1031"} <= covered)+ # the plain family line now names a build that exists+ self.assertIn("Ask for the RX 6000 build.", ec.arch_notice(("gfx1200", "gfx1201"), ["gfx1030"]))+ self.assertIsNone(ec.no_package_note(["gfx1030", "gfx1031"]))++ def test_a_pc_with_an_rx7000_beside_an_rx6000_keeps_the_package_it_always_got(self):+ """Before the RX 6000 package a PC with both cards got the RX 7000 one: the new package must not win that tie, in any feed order."""+ for platform, old, new in (("windows-x86_64", "rdna3", "rdna2"), ("linux-x86_64", "rx7900", "rx6000")):+ hardware = pc(platform, "hip", gfx=["gfx1030", "gfx1100"])+ for order in (RELEASE, list(reversed(RELEASE))):+ best, _ = feedmod.select_engine([feedmod._engine_package(p) for p in order], hardware)+ self.assertEqual(best.variant, old, (platform, new))+ # a Radeon AI PRO (gfx1201) beside an RX 6800 keeps rx9070 toofor platform in ("windows-x86_64", "linux-x86_64"):- self.assertIsNone(self.pick(pc(platform, "hip", gfx=["gfx1030"]))[0])- text = ec.arch_notice(("gfx1200", "gfx1201"), ["gfx1030"])- self.assertIn("This computer has an AMD RX 6000 card (gfx1030).", text)- self.assertIn("no ready-made Strata engine for the AMD RX 6000 series", text)- self.assertNotIn("Ask for", text)- self.assertIsNone(ec.no_package_note(["gfx1201", "gfx1100"]))- # a PC with an RX 9000 card next to the RX 6000 one is told the ordinary way (a build exists for one of them)- self.assertIn("Ask for the", ec.arch_notice(("gfx1100",), ["gfx1201", "gfx1030"]))+ for order in (RELEASE, list(reversed(RELEASE))):+ best, _ = feedmod.select_engine([feedmod._engine_package(p) for p in order], pc(platform, "hip", gfx=["gfx1201", "gfx1030"]))+ self.assertEqual(best.variant, "rx9070")++ def test_installed_packages_are_chosen_the_same_way(self):+ from strata_control import engine_component as ec+ self.assertEqual(ec.hip_preference(("gfx1030", "gfx1031")), 0)+ self.assertEqual(ec.hip_preference(("gfx1100", "gfx1101", "gfx1102")), 1)+ self.assertEqual(ec.hip_preference(("gfx1030", "gfx1100")), 1)+ self.assertEqual(ec.hip_preference(()), 1)def test_the_platform_decides_first(self):self.assertIsNone(self.pick(pc("macos-arm64", "cuda", "590.10", ["sm_86"]))[0])diff --git a/tools/test_setup_amd.py b/tools/test_setup_amd.pyindex 3e1001b8d..bc03d5119 100644--- a/tools/test_setup_amd.py+++ b/tools/test_setup_amd.py@@ -80,6 +80,41 @@ class KfdDetection(unittest.TestCase):self.assertIsNone(setup.amd_problem({"arch": "gfx1031"}))+class Rx6000Detection(KfdDetection):+ """0.2.2: the RX 6000 engine package (gfx1030 / gfx1031). Setup names the cards, says the package is built and not tested on a real+ RX 6000 card, and says it for these two architectures only."""++ def test_rx6000_cards_by_gfx_target_version(self):+ fake_sysfs(self.root, [+ (100300, 80, 128, "AMD Radeon RX 6900 XT", 16 << 30), # gfx1030+ (100301, 40, 129, None, 12 << 30), # gfx1031 (RX 6700 XT), no product name+ (100302, 28, 130, None, 8 << 30), # gfx1032 (RX 6600): not in the package+ ])+ g = setup.amd_gpus(str(self.root))+ self.assertEqual([x["arch"] for x in g], ["gfx1030", "gfx1031", "gfx1032"])+ self.assertEqual(g[1]["name"], setup.AMD_NAMES["gfx1031"])+ self.assertEqual([setup.is_rdna2(x) for x in g], [True, True, False])+ self.assertIsNone(setup.amd_problem(g[0]))+ self.assertIsNone(setup.amd_problem(g[1]))++ def test_the_note_is_for_gfx103x_only(self):+ for arch in ("gfx1030", "gfx1031", "gfx1030:sramecc-:xnack-"):+ lines = setup.rdna2_notes({"arch": arch})+ self.assertEqual(len(lines), 1, arch)+ self.assertIn("built, not tested on a real RX 6000 card", lines[0])+ self.assertIn(arch.split(":")[0], lines[0])+ for arch in ("gfx1100", "gfx1101", "gfx1102", "gfx1200", "gfx1201", "gfx1151", "gfx1032", "gfx103", "gfx10300", "", None):+ self.assertEqual(setup.rdna2_notes({"arch": arch}), [], arch)+ self.assertEqual(setup.rdna2_notes(None), [])+ self.assertFalse(setup.is_rdna2({"arch": "gfx1030x"}))++ def test_windows_ids_and_names(self):+ for device, arch in ((0x73BF, "gfx1030"), (0x73AF, "gfx1030"), (0x73A5, "gfx1030"), (0x73DF, "gfx1031")):+ self.assertEqual(setup.win_amd_arch(device, ""), arch)+ self.assertEqual(setup.win_amd_arch(None, "AMD Radeon RX 6900 XT"), "gfx1030")+ self.assertEqual(setup.win_amd_arch(0x744C, "AMD Radeon RX 7900 XTX"), "gfx1100") # an RX 7000 card is not RDNA2++class GpuLists(unittest.TestCase):"""--gpus with AMD cards: every chosen card must be supported; the first is the main one."""AMD = [{"index": 0, "name": "AMD Radeon RX 9070 XT", "vram_gb": 16.0, "arch": "gfx1201"},