Skip to content

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++

setup: the engine's own programs run with its rocm/bin on PATH (#2372: strata --families on Windows AMD showed hipblas.dll / libhipblaslt.dll not found and Qwen3.6 was refused)

Niko1221093108c2e0d1
diff --git a/setup.py b/setup.py
index c886e2a87..8943c5049 100644
--- a/setup.py
+++ b/setup.py
@@ -2658,6 +2658,17 @@ def amd_gpus_windows(adapters=None, registry=None) -> list[dict]:
return found
+def engine_env(eng: Path) -> dict:
+ """The environment for running an installed engine's own programs (`strata --families`, `strata-device
+ --list-devices`): the ready-made Windows HIP engine keeps hipblas.dll / libhipblaslt.dll in its rocm/bin, which the
+ loader finds through PATH only (#2372: a launch without it shows a "not found" dialog per DLL and prints nothing)."""
+ env = dict(os.environ)
+ dirs = [str(d) for d in hip_lib_dirs(eng)]
+ if dirs:
+ env["PATH"] = os.pathsep.join(dirs + [env.get("PATH", "")])
+ return env
+
+
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
@@ -2672,10 +2683,8 @@ def hip_devices(probe: Path | None = None, text: str | None = None) -> list[dict
return None
try:
hip_runtime_beside_exe(probe.parent) # #468 #461: not the driver's System32 copy
- env = dict(os.environ) # the ready-made engine's ROCm DLLs (rocm/bin beside it)
- env["PATH"] = os.pathsep.join([str(d) for d in hip_lib_dirs(probe.parent)] + [env.get("PATH", "")])
r = subprocess.run([str(probe), "--list-devices"], capture_output=True, text=True, timeout=120,
- cwd=str(probe.parent), env=env)
+ cwd=str(probe.parent), env=engine_env(probe.parent))
except (OSError, subprocess.TimeoutExpired):
return None
if r.returncode != 0:
@@ -5516,7 +5525,8 @@ def engine_step(a, gpu, hip, amd, cuda_tk, vision):
def engine_families(eng: Path) -> set:
"""The model families an engine runs (`strata --families`; an engine from before it: Flash-Next's only)."""
try:
- text = subprocess.run([str(eng / EXE), "--families"], capture_output=True, text=True, timeout=60).stdout
+ text = subprocess.run([str(eng / EXE), "--families"], capture_output=True, text=True, timeout=60,
+ env=engine_env(eng)).stdout # #2372: with the engine's rocm/bin on PATH
except (OSError, subprocess.SubprocessError):
return {"qwen4exp"}
names = set(text.split())
diff --git a/tools/test_setup_amd.py b/tools/test_setup_amd.py
index 1bc1fbf58..6c0253e45 100644
--- a/tools/test_setup_amd.py
+++ b/tools/test_setup_amd.py
@@ -509,6 +509,60 @@ class DeviceAccess(unittest.TestCase):
self.assertIn("another program (or an engine that is still exiting)", src)
+class EngineLaunchEnv(unittest.TestCase):
+ """#2372: every engine program setup runs gets the ready-made HIP engine's rocm/bin on PATH, or Windows shows a
+ "hipblas.dll not found" dialog per DLL and `strata --families` prints nothing (setup then said the engine does
+ not run Qwen3.6)."""
+
+ def engine(self, tmp: Path) -> Path:
+ eng = tmp / "engine"
+ (eng / "rocm" / "bin").mkdir(parents=True)
+ (eng / "BUILD.json").write_text('{"backend": "hip", "lib_dirs": ["rocm/bin"]}', encoding="utf-8")
+ return eng
+
+ def test_engine_env_puts_rocm_bin_first(self):
+ with tempfile.TemporaryDirectory() as t:
+ eng = self.engine(Path(t))
+ with mock.patch.dict("os.environ", {"PATH": "C:\\Windows"}):
+ env = setup.engine_env(eng)
+ self.assertEqual(env["PATH"].split(setup.os.pathsep)[0], str(eng / "rocm" / "bin"))
+ self.assertTrue(env["PATH"].endswith("C:\\Windows"))
+
+ def test_engine_without_lib_dirs_keeps_the_environment(self):
+ with tempfile.TemporaryDirectory() as t:
+ with mock.patch.dict("os.environ", {"PATH": "/usr/bin"}):
+ self.assertEqual(setup.engine_env(Path(t))["PATH"], "/usr/bin")
+
+ def test_families_probe_runs_with_that_env(self):
+ seen = {}
+
+ def fake_run(cmd, **kw):
+ seen["cmd"], seen["env"] = cmd, kw.get("env")
+ return mock.Mock(stdout="qwen4exp qwen35moe\n")
+ with tempfile.TemporaryDirectory() as t:
+ eng = self.engine(Path(t))
+ with mock.patch.object(setup.subprocess, "run", fake_run):
+ names = setup.engine_families(eng)
+ self.assertEqual(names, {"qwen4exp", "qwen35moe"})
+ self.assertEqual(seen["cmd"][1], "--families")
+ self.assertEqual(seen["env"]["PATH"].split(setup.os.pathsep)[0], str(eng / "rocm" / "bin"))
+
+ def test_device_probe_runs_with_that_env(self):
+ seen = {}
+
+ def fake_run(cmd, **kw):
+ seen["env"] = kw.get("env")
+ return mock.Mock(returncode=0, stdout="device 0: AMD Radeon RX 7900 XT\n arch gfx1100, 20.0 GiB, wave32\n")
+ with tempfile.TemporaryDirectory() as t:
+ eng = self.engine(Path(t))
+ probe = eng / ("strata-device.exe" if setup.WIN else "strata-device")
+ probe.write_text("x")
+ with mock.patch.object(setup.subprocess, "run", fake_run), mock.patch.object(setup, "hip_runtime_beside_exe", lambda d: None):
+ found = setup.hip_devices(probe)
+ self.assertEqual(found[0]["arch"], "gfx1100")
+ self.assertEqual(seen["env"]["PATH"].split(setup.os.pathsep)[0], str(eng / "rocm" / "bin"))
+
+
class TdrPointer(unittest.TestCase):
def test_setup_points_windows_gfx12_to_the_entry(self):
src = Path(setup.__file__).read_text(encoding="utf-8")