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 (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446)
Niko1221cd49a498c816
diff --git a/setup.py b/setup.pyindex c8aba719c..a8898796b 100644--- a/setup.py+++ b/setup.py@@ -1338,18 +1338,32 @@ def rocm_version(root):return None+def rocm_dev_missing(sysroot: Path) -> list:+ """#446: the HIP development files the engine's build needs that a system ROCm lacks (a runtime-only install has+ hipcc and libhipblas but not these, and cmake's enable_language(HIP) then fails on the hip-lang package)."""+ lang = "cmake/hip-lang/hip-lang-config.cmake" # where CMake's HIP support looks for it+ need = {"lib/" + lang: [sysroot / d / lang for d in ("lib", "lib64", "lib/x86_64-unknown-linux-gnu")],+ "include/hip/hip_runtime.h": [sysroot / "include" / "hip" / "hip_runtime.h"]}+ return [name for name, paths in need.items() if not any(p.is_file() for p in paths)]++def rocm_root(archs):"""ROCm for compiling and running the HIP engine for `archs` (one arch or a list: the cards of a layer split):- (root, library folders). A system ROCm 7 with hipcc and hipBLAS, else AMD's TheRock wheels (ROCM_VERSION, from the- card family's index) installed into .venv."""+ (root, library folders). A system ROCm 7 with hipcc, hipBLAS and the HIP development files (#446), else AMD's+ TheRock wheels (ROCM_VERSION, from the card family's index) installed into .venv."""archs = [archs] if isinstance(archs, str) else list(archs)sysroot = Path(os.environ.get("ROCM_PATH") or "/opt/rocm")if (sysroot / "bin" / "hipcc").exists() and list((sysroot / "lib").glob("libhipblas.so*")):ver = rocm_version(sysroot)- if ver is None or ver >= ROCM_SYSTEM_MIN:+ missing = rocm_dev_missing(sysroot)+ if (ver is None or ver >= ROCM_SYSTEM_MIN) and not missing:return sysroot, [str(sysroot / "lib")]- warn(f"the ROCm in {sysroot} is {ver[0]}.{ver[1]}; Strata needs {ROCM_SYSTEM_MIN[0]}.{ROCM_SYSTEM_MIN[1]} or "- "newer: using AMD's wheels in .venv instead")+ if ver is not None and ver < ROCM_SYSTEM_MIN:+ warn(f"the ROCm in {sysroot} is {ver[0]}.{ver[1]}; Strata needs {ROCM_SYSTEM_MIN[0]}.{ROCM_SYSTEM_MIN[1]} "+ "or newer: using AMD's wheels in .venv instead")+ else: # #446: a runtime-only ROCm (no -dev packages): cmake would fail+ warn(f"the ROCm in {sysroot} has no HIP development files ({', '.join(missing)}): using AMD's wheels in "+ ".venv instead (or install them, e.g. AMD's amdrocm-core-dev package for your ROCm and card)")indexes = list(dict.fromkeys(rocm_index(a) for a in archs))if len(indexes) > 1: # TheRock's wheels hold one GPU family's librariesfail(f"cards of two GPU families ({', '.join(archs)}) need a system ROCm 7 (in /opt/rocm): AMD's Python "diff --git a/tools/test_setup_amd.py b/tools/test_setup_amd.pyindex fdca0eb41..940169b99 100644--- a/tools/test_setup_amd.py+++ b/tools/test_setup_amd.py@@ -117,6 +117,40 @@ class GpuLists(unittest.TestCase):else:setup.os.environ["ROCM_PATH"] = old+ def test_runtime_only_system_rocm_falls_back_to_the_wheels(self):+ """#446: a system ROCm 7 with hipcc and libhipblas but no HIP development files (no hip-lang CMake package, no+ hip_runtime.h) is not used for the build: a warning says what is missing and the wheels path follows (here+ it stops at the two-family check, which only the wheels path makes); with the files it is used as before."""+ said = []+ setup.say = lambda msg="": said.append(msg) # tearDown puts the real one back+ with tempfile.TemporaryDirectory() as d:+ sysroot = Path(d)+ for rel, text in (("bin/hipcc", ""), ("lib/libhipblas.so.3", ""),+ ("include/rocm-core/rocm_version.h",+ "#define ROCM_VERSION_MAJOR 7\n#define ROCM_VERSION_MINOR 14\n")):+ (sysroot / rel).parent.mkdir(parents=True, exist_ok=True)+ (sysroot / rel).write_text(text)+ with mock.patch.dict(setup.os.environ, {"ROCM_PATH": d}):+ with self.assertRaises(SystemExit):+ setup.rocm_root(["gfx1100", "gfx1201"])+ self.assertIn(f"the ROCm in {sysroot} has no HIP development files (lib/cmake/hip-lang/hip-lang-"+ "config.cmake, include/hip/hip_runtime.h): using AMD's wheels", "\n".join(said))+ self.assertIn("two GPU families", "\n".join(said))+ for lib in ("lib64", "lib"): # either place CMake looks+ with self.subTest(lib=lib):+ cfg = sysroot / lib / "cmake/hip-lang/hip-lang-config.cmake"+ cfg.parent.mkdir(parents=True, exist_ok=True)+ cfg.write_text("")+ said.clear()+ with self.assertRaises(SystemExit):+ setup.rocm_root(["gfx1100", "gfx1201"])+ self.assertIn("(include/hip/hip_runtime.h)", "\n".join(said))+ (sysroot / "include/hip").mkdir(parents=True, exist_ok=True)+ (sysroot / "include/hip/hip_runtime.h").write_text("")+ self.assertEqual(setup.rocm_root(["gfx1100", "gfx1201"]), (sysroot, [str(sysroot / "lib")]))+ cfg.unlink()+ (sysroot / "include/hip/hip_runtime.h").unlink()+def test_build_for_every_arch(self):"""build_engine_hip compiles for the set of the chosen cards' archs and records it in BUILD.json."""calls = {}