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++
Fix #3418: the app finds the engine's strata-device in the component folder, so a single Radeon is numbered the way HIP numbers it (an iGPU on ordinal 0 no longer makes GPU 0 the wrong card)
Niko1221642425bf2ee1
diff --git a/setup.py b/setup.pyindex 0ccfb424c..0cce69cc6 100644--- a/setup.py+++ b/setup.py@@ -3624,16 +3624,36 @@ def engine_env(eng: Path) -> dict:return env+def hip_probe_path() -> Path:+ """Where the installed engine's `strata-device` is: engine/ beside setup.py (a checkout), else the HIP engine package in the+ component folder (the app and `strata update` keep it there, #3418: with only engine/ looked at, the app numbered the cards in+ display-adapter order and an iGPU on HIP ordinal 0 made "GPU 0" the wrong card)."""+ name = "strata-device.exe" if WIN else "strata-device"+ own = ROOT / "engine" / name+ if own.exists():+ return own+ try:+ from strata_control import engine_component as EC+ found = EC.resolve(backend="hip", full=False)+ return Path(found.root) / name+ except Exception: # noqa: BLE001 - no component, a damaged one: the old answer+ return own++def hip_devices(probe: Path | None = None, text: str | None = None) -> list[dict] | None:"""The GPUs the HIP runtime enumerates, numbered as HIP_VISIBLE_DEVICES numbers them, from the installed engine's`strata-device --list-devices`; None when there is no HIP engine here or it does not answer. text: its output(tests)."""if text is None:- probe = probe or ROOT / "engine" / ("strata-device.exe" if WIN else "strata-device")- try:- hip_engine = json.loads((probe.parent / "BUILD.json").read_text(encoding="utf-8")).get("backend") == "hip"- except (OSError, ValueError):- hip_engine = False+ probe = probe or hip_probe_path()+ hip_engine = False+ for record in ("BUILD.json", "engine-component.json"): # a checkout's build record, or a component's manifest+ try:+ hip_engine = json.loads((probe.parent / record).read_text(encoding="utf-8-sig")).get("backend") == "hip"+ except (OSError, ValueError, AttributeError):+ continue+ if hip_engine:+ breakif not probe.exists() or not hip_engine:return Nonetry:diff --git a/tools/test_setup_amd.py b/tools/test_setup_amd.pyindex bc03d5119..7198d65c7 100644--- a/tools/test_setup_amd.py+++ b/tools/test_setup_amd.py@@ -341,6 +341,35 @@ class WindowsDetection(unittest.TestCase):mock.patch.object(setup, "amd_gpus_windows", lambda adapters=None, registry=None: ["display"]):self.assertEqual(setup.amd_gpus(), ["hip"])+ def test_probe_in_the_component_folder(self):+ """#3418: the app keeps the engine in the component folder, not in control/engine; the cards must be numbered by the+ HIP runtime there too (an iGPU on ordinal 0 made the display-order "GPU 0" the wrong card)."""+ from strata_control import engine_component as EC+ name = "strata-device.exe" if setup.WIN else "strata-device"+ with tempfile.TemporaryDirectory() as d:+ root, comp = Path(d) / "control", Path(d) / "components" / "0.2-hip"+ root.mkdir()+ comp.mkdir(parents=True)+ (comp / name).write_text("x")+ (comp / "engine-component.json").write_text('{"backend": "hip"}') # no BUILD.json in this package+ found = mock.Mock(root=comp)+ with mock.patch.object(setup, "ROOT", root), mock.patch.object(EC, "resolve", return_value=found) as res:+ self.assertEqual(setup.hip_probe_path(), comp / name)+ self.assertEqual(res.call_args.kwargs["backend"], "hip")+ ran = mock.Mock(returncode=0, stdout=self.LIST)+ with mock.patch.object(setup.subprocess, "run", return_value=ran) as run, \+ mock.patch.object(setup, "hip_runtime_beside_exe", lambda *a: None):+ cards = setup.hip_devices()+ self.assertEqual(run.call_args.args[0][0], str(comp / name))+ self.assertEqual([c["index"] for c in cards], [0, 1, 2])+ (root / "engine").mkdir()+ (root / "engine" / name).write_text("x")+ with mock.patch.object(setup, "ROOT", root), mock.patch.object(EC, "resolve", side_effect=AssertionError):+ self.assertEqual(setup.hip_probe_path(), root / "engine" / name) # a checkout's own engine wins+ with mock.patch.object(setup, "ROOT", Path(d) / "none"), \+ mock.patch.object(EC, "resolve", side_effect=EC.EngineMissing("none")):+ self.assertFalse(setup.hip_probe_path().exists()) # no engine anywhere: no probe+def test_no_hip_engine_no_probe(self):with tempfile.TemporaryDirectory() as d:eng = Path(d)