Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Installer: Vulkan llama.cpp for ROCm GPUs without a bundle or hipcc; keep Strix wheels below ROCm 7.13 (#14662)

Daniel Han8b0427ea8bc2
diff --git a/install.sh b/install.sh
index 3ceb5bb0221..1d70757e820 100755
--- a/install.sh
+++ b/install.sh
@@ -4807,6 +4807,13 @@ _amd_prefer_discrete_gfx() {
case "${3:-}:$_apdg_sel" in
torch:gfx1150|torch:gfx1151|torch:gfx1152) _apdg_strix=1 ;;
esac
+ # Strix defers only to a generic rocm7.13+ index (AMD's Strix fixes); otherwise it keeps its wheels.
+ if [ -n "$_apdg_strix" ]; then
+ case "${_torch_index_leaf:-}" in
+ rocm[0-9]*.[0-9]*) _rocm_leaf_below "$_torch_index_leaf" 7 13 && _apdg_strix="" ;;
+ *) _apdg_strix="" ;;
+ esac
+ fi
# A readable HSA override spoofs every agent, the dGPU included: keep the Strix wheels.
if [ -n "$_apdg_strix" ] && [ -n "${HSA_OVERRIDE_GFX_VERSION:-}" ] && \
[ -n "$(_hsa_override_gfx_arch "$HSA_OVERRIDE_GFX_VERSION" 2>/dev/null)" ]; then
@@ -6001,7 +6008,7 @@ get_torch_index_url() {
echo "[WARN] This is expected on this GPU; repairing rocminfo/amd-smi or setting UNSLOTH_ROCM_GFX_ARCH will not give it ROCm PyTorch." >&2
# Torch ends here, llama.cpp does not. `export` is load-bearing: a bare assignment never reaches the re-run (the #8458 mistake).
if [ "$_amd_unsup_gfx" = gfx1153 ]; then
- echo "[INFO] GGUF chat keeps the llama.cpp HIP build on this GPU (gfx1153 has one); no Vulkan switch is needed." >&2
+ echo "[INFO] GGUF chat still uses this GPU: a llama.cpp ROCm build when one covers gfx1153 or hipcc can build it, otherwise the Vulkan build." >&2
else
echo "[INFO] GGUF chat can still use this GPU through Vulkan: export UNSLOTH_LLAMA_CPP_BACKEND=vulkan and re-run this installer (it selects the llama.cpp bundle at install time)." >&2
fi
@@ -6079,7 +6086,7 @@ get_torch_index_url() {
echo "[WARN] AMD GPU detected ($_amd_unsup_all) -- Unsloth has no ROCm PyTorch wheels for that arch, installing CPU PyTorch." >&2
echo "[WARN] The ROCm PyTorch wheels carry no kernels for it: they would install, then fail on the first GPU operation." >&2
if [ "$_amd_unsup_all" = gfx1153 ]; then
- echo "[INFO] GGUF chat keeps the llama.cpp HIP build on this GPU (gfx1153 has one); no Vulkan switch is needed." >&2
+ echo "[INFO] GGUF chat still uses this GPU: a llama.cpp ROCm build when one covers gfx1153 or hipcc can build it, otherwise the Vulkan build." >&2
else
echo "[INFO] GGUF chat can still use this GPU through Vulkan: export UNSLOTH_LLAMA_CPP_BACKEND=vulkan and re-run this installer (it selects the llama.cpp bundle at install time)." >&2
fi
@@ -7784,7 +7791,7 @@ case "$TORCH_INDEX_URL" in
substep "AMD GPU detected ($_unsup_disp_gfx) -- Unsloth has no ROCm PyTorch wheels for that arch, installing CPU PyTorch." "$C_WARN"
substep "Installing the ROCm/HIP SDK will not give this GPU ROCm PyTorch." "$C_WARN"
if [ "$_unsup_disp_gfx" = gfx1153 ]; then
- substep "GGUF chat keeps the llama.cpp HIP build on this GPU (gfx1153 has one); no Vulkan switch is needed."
+ substep "GGUF chat still uses this GPU: a llama.cpp ROCm build when one covers gfx1153 or hipcc can build it, otherwise the Vulkan build."
else
substep "GGUF chat can still use this GPU through Vulkan: export UNSLOTH_LLAMA_CPP_BACKEND=vulkan and re-run this installer." "$C_WARN"
substep "That variable selects the llama.cpp bundle at install time, so setting it afterwards has no effect until you install or update again." "$C_WARN"
diff --git a/studio/backend/tests/test_install_resolve_prebuilt.py b/studio/backend/tests/test_install_resolve_prebuilt.py
index 81482d2e509..29abe3d78c1 100644
--- a/studio/backend/tests/test_install_resolve_prebuilt.py
+++ b/studio/backend/tests/test_install_resolve_prebuilt.py
@@ -4298,11 +4298,17 @@ def _linux_rocm_and_vulkan_bundle():
)
-def test_linux_rdna1_plan_installs_the_vulkan_bundle_not_a_source_build(linux_no_rocm_env):
+def test_linux_rdna1_plan_installs_the_vulkan_bundle_not_a_source_build(
+ linux_no_rocm_env, monkeypatch
+):
bundle = _linux_rocm_and_vulkan_bundle()
host = _linux_amd("gfx1010")
- # Unrouted, the ROCm branch finds no bundle and the caller source-builds HIP.
+ # Unrouted, the ROCm branch finds no bundle: with hipcc the caller source-builds HIP,
+ # without it (that build would end CPU-only) the Vulkan bundle is taken.
+ monkeypatch.setattr(ilp, "_hipcc_available", lambda: True)
assert ilp._linux_published_attempts(host, bundle) == []
+ monkeypatch.setattr(ilp, "_hipcc_available", lambda: False)
+ assert [a.install_kind for a in ilp._linux_published_attempts(host, bundle)] == ["linux-vulkan"]
routed, *_ = ilp._route_to_vulkan_prebuilt(host, FORK, "pin", force_cpu = False)
kinds = [a.install_kind for a in ilp._linux_published_attempts(routed, bundle)]
assert kinds == ["linux-vulkan", "linux-cpu"]
diff --git a/studio/install_llama_prebuilt.py b/studio/install_llama_prebuilt.py
index 6bf3639dcc1..9180fd81d19 100644
--- a/studio/install_llama_prebuilt.py
+++ b/studio/install_llama_prebuilt.py
@@ -7405,6 +7405,29 @@ def resolve_install_attempts(
return requested_tag, plan.llama_tag, plan.attempts, plan.approved_checksums
+def _hipcc_available() -> bool:
+ """hipcc where setup.sh's HIP source build looks: PATH, /opt/rocm/bin, /opt/rocm-*/bin."""
+ return bool(
+ shutil.which("hipcc")
+ or os.access("/opt/rocm/bin/hipcc", os.X_OK)
+ or glob.glob("/opt/rocm-*/bin/hipcc")
+ )
+
+
+def _uncovered_rocm_gpu_takes_vulkan(host: HostInfo) -> bool:
+ """No hipcc means a CPU-only source build; Vulkan ignores HIP masks and would reach an NVIDIA card."""
+ return (
+ host.is_linux
+ and host.is_x86_64
+ and not host.has_physical_nvidia
+ # Following ROCm torch clears has_physical_nvidia but keeps the card's evidence.
+ and not (host.nvidia_smi or host.physical_compute_caps or host.driver_cuda_version)
+ and not _hip_visible_device_mask_set()
+ and not _vulkan_visible_device_mask_set()
+ and not _hipcc_available()
+ )
+
+
def _linux_published_attempts(host: HostInfo, bundle: PublishedReleaseBundle) -> list[AssetChoice]:
"""Build the install attempts for a fork Linux host from a manifest-described
bundle: CUDA, per-gfx ROCm, Vulkan, or CPU. Same selection the upstream filename
@@ -7433,6 +7456,14 @@ def _linux_published_attempts(host: HostInfo, bundle: PublishedReleaseBundle) ->
published_rocm = published_rocm_choice_for_host(bundle, host, "linux-rocm")
if published_rocm is not None:
attempts.append(published_rocm)
+ elif _uncovered_rocm_gpu_takes_vulkan(host):
+ vulkan_choice = published_asset_choice_for_kind(bundle, "linux-vulkan", host = host)
+ if vulkan_choice is not None:
+ log(
+ f"no ROCm prebuilt covers {_active_rocm_gfx_target(host) or 'this AMD GPU'} "
+ "and hipcc is not installed -- using the Vulkan prebuilt"
+ )
+ attempts.append(vulkan_choice)
else:
# Same condition as direct_upstream_release_plan and resolve_upstream_asset_choice,
# which all three must state; this is the normal published-bundle branch. Reaching here
diff --git a/studio/install_python_stack.py b/studio/install_python_stack.py
index 4ea128d6ca7..4c862bff8cd 100644
--- a/studio/install_python_stack.py
+++ b/studio/install_python_stack.py
@@ -3662,15 +3662,15 @@ def _runtime_gfx_target(
if gfx_devices
else None
)
- # Strix defers only where the discrete card's wheel can be installed and will run: a ROCm
- # version with a generic tag (unreadable or pre-6.0 has none, so nothing would install) and
- # no HSA override (which spoofs every agent, the dGPU included). Otherwise it keeps its own
- # per-arch index, as before.
+ # Strix defers only to a generic tag at the per-arch floor (7.13, AMD's Strix fixes) with no HSA
+ # override (it spoofs every agent); below it the generic wheel would leave the APU broken.
_strix_rocm = _detect_rocm_version() if runtime_gfx in _STRIX_APU_GFX else None
+ _strix_tag = _automatic_generic_pytorch_rocm_tag(_strix_rocm) if _strix_rocm else None
_strix_first = (
runtime_gfx in _STRIX_APU_GFX
- and _strix_rocm is not None
- and _generic_pytorch_rocm_tag(_strix_rocm) is not None
+ and _strix_tag is not None
+ and next((k for k, t in _ROCM_TORCH_INDEX.items() if t == _strix_tag), (0, 0))
+ >= _ROCM_ARCH_INDEX_FLOOR
and _hsa_override_gfx_arch(os.environ.get("HSA_OVERRIDE_GFX_VERSION")) is None
)
if (runtime_gfx in _SHADOWING_INTEGRATED_GFX or _strix_first) and not _visible_devices_pinned():
diff --git a/studio/setup.sh b/studio/setup.sh
index bfab9877578..0edd7f91fa9 100755
--- a/studio/setup.sh
+++ b/studio/setup.sh
@@ -4691,14 +4691,13 @@ EOF
fi
fi
if [ "$_setup_unsup_gfx" = gfx1153 ]; then
- substep "GGUF chat keeps the llama.cpp HIP build on this GPU (gfx1153 has one); no Vulkan switch is needed."
+ substep "GGUF chat still uses this GPU: a llama.cpp ROCm build when one covers gfx1153 or hipcc can build it, otherwise the Vulkan build."
else
substep "GGUF chat can still use this GPU through Vulkan: export UNSLOTH_LLAMA_CPP_BACKEND=vulkan,"
substep "then re-run the installer. It picks the llama.cpp bundle at install time, so setting"
substep "it afterwards has no effect until you install or update again."
fi
- # gfx1153 keeps its llama.cpp HIP bundle: forward the arch, which a runtime-less probe
- # cannot read. RDNA 1 / Polaris have none, so they stay unforwarded.
+ # Forward gfx1153, which a runtime-less probe cannot read. RDNA 1 / Polaris stay unforwarded.
if [ "$_setup_unsup_gfx" = gfx1153 ] && [ -z "$_setup_gfx" ]; then
_setup_gfx=gfx1153
fi
diff --git a/tests/studio/install/test_linux_amd_strix_dgpu_gfx1153.py b/tests/studio/install/test_linux_amd_strix_dgpu_gfx1153.py
index 524a8d3d91a..c3d218ef592 100644
--- a/tests/studio/install/test_linux_amd_strix_dgpu_gfx1153.py
+++ b/tests/studio/install/test_linux_amd_strix_dgpu_gfx1153.py
@@ -51,7 +51,11 @@ def _reset_probe(monkeypatch):
stack_mod._invalidate_torch_runtime_probe()
-def _sh_routing_leaf(arches, env = ""):
+def _sh_routing_leaf(
+ arches,
+ env = "",
+ leaf = "rocm7.1",
+):
"""install.sh's routing block on a rocminfo stub; the index leaf it leaves selected."""
source = _INSTALL_SH.read_text(encoding = "utf-8")
start = source.find('case "$_torch_index_leaf" in\n rocm[0-9]*)')
@@ -63,8 +67,8 @@ def _sh_routing_leaf(arches, env = ""):
+ "\n"
+ rocm_support._gpu_record_helpers(source)
+ "\n"
- + 'TORCH_INDEX_URL="https://download.pytorch.org/whl/rocm7.1"\n'
- + '_torch_index_leaf="rocm7.1"\n'
+ + f'TORCH_INDEX_URL="https://download.pytorch.org/whl/{leaf}"\n'
+ + f'_torch_index_leaf="{leaf}"\n'
+ "_torch_index_pinned=false\nSKIP_TORCH=false\n_amd_gpu_radeon=false\n"
+ "_gfx_rocm64_target=false\n"
+ "unset HSA_OVERRIDE_GFX_VERSION HIP_VISIBLE_DEVICES ROCR_VISIBLE_DEVICES\n"
@@ -86,6 +90,23 @@ def _sh_routing_leaf(arches, env = ""):
# ── Strix APU + discrete card ───────────────────────────────────────────────
+def _generic_tag_with_strix_fixes(monkeypatch):
+ """A generic rocm7.13 tag (none is published yet), the only one a leading Strix defers to."""
+ monkeypatch.setitem(stack_mod._ROCM_TORCH_INDEX, (7, 13), "rocm7.13")
+
+
+ "devices", [("gfx1151", "gfx1100"), ("gfx1151", "gfx1201"), ("gfx1150", "gfx1101")]
+)
[email protected]("rocm_version", [(6, 4), (7, 1), (7, 2)])
+def test_python_a_leading_strix_keeps_its_index_below_the_fix_floor(devices, rocm_version):
+ # Below rocm7.13 deferring traded a working APU for the dGPU (#13931).
+ calls = routing._run_install(gfx_devices = devices, rocm_version = rocm_version)
+ assert f"repo.amd.com/rocm/whl/{devices[0]}" in calls, calls
+ assert "installing for" not in routing._run_install.printed
+
+
@pytest.mark.parametrize(
"devices,expected",
[
@@ -94,22 +115,15 @@ def _sh_routing_leaf(arches, env = ""):
(("gfx1150", "gfx1101"), "gfx1101"),
],
)
-def test_python_target_skips_a_leading_strix_apu(devices, expected):
- calls = routing._run_install(gfx_devices = devices, rocm_version = (7, 1))
+def test_python_a_leading_strix_defers_once_the_generic_tag_has_its_fixes(
+ devices, expected, _generic_tag_with_strix_fixes
+):
+ calls = routing._run_install(gfx_devices = devices, rocm_version = (7, 13))
assert _STRIX_INDEX not in calls and "whl/gfx1150" not in calls, calls
+ assert "download.pytorch.org/whl/rocm7.13" in calls, calls
assert f"installing for {expected}" in routing._run_install.printed
-def test_python_strix_plus_rdna3_installs_the_generic_wheel():
- calls = routing._run_install(gfx_devices = ("gfx1151", "gfx1100"), rocm_version = (7, 1))
- assert "download.pytorch.org/whl/rocm7.1" in calls, calls
-
-
-def test_python_strix_plus_rdna4_installs_the_rdna4_family():
- calls = routing._run_install(gfx_devices = ("gfx1151", "gfx1201"), rocm_version = (7, 1))
- assert "repo.amd.com/rocm/whl/gfx120X-all" in calls, calls
-
-
@pytest.mark.parametrize(
"devices,env",
[
@@ -125,15 +139,23 @@ def test_python_lone_or_selected_strix_keeps_its_index(devices, env):
@_POSIX
@pytest.mark.parametrize(
- "arches,env,expected",
+ "arches,expected",
[
- (("gfx1151", "gfx1100"), "", "rocm7.1"),
- (("gfx1151", "gfx1201"), "", "gfx120x-all"),
- (("gfx1152", "gfx1102"), "", "rocm7.1"),
+ (("gfx1151", "gfx1100"), "gfx1151"),
+ (("gfx1151", "gfx1201"), "gfx1151"),
+ (("gfx1152", "gfx1102"), "gfx1152"),
],
)
-def test_install_sh_skips_a_leading_strix_apu(arches, env, expected):
- assert _sh_routing_leaf(arches, env) == expected
+def test_install_sh_a_leading_strix_keeps_its_index_below_the_fix_floor(arches, expected):
+ assert _sh_routing_leaf(arches) == expected
+
+
+@_POSIX
+ "arches", [("gfx1151", "gfx1100"), ("gfx1151", "gfx1201"), ("gfx1152", "gfx1102")]
+)
+def test_install_sh_a_leading_strix_defers_on_a_generic_index_with_its_fixes(arches):
+ assert _sh_routing_leaf(arches, leaf = "rocm7.13") == "rocm7.13"
@_POSIX
@@ -355,14 +377,24 @@ def test_python_strix_keeps_its_index_under_an_hsa_override(devices):
assert "gfx120X-all" not in calls and "whl/rocm7.1" not in calls, calls
-def test_python_inferred_install_uses_the_deferred_discrete_card():
+def test_python_inferred_strix_keeps_its_index_below_the_fix_floor():
calls = routing._run_install(
gfx_devices = ("gfx1151", "gfx1201"),
inferred = "gfx1151",
rocm_version = (7, 1),
rocm_gpu_visible = False,
)
- assert "repo.amd.com/rocm/whl/gfx120X-all" in calls and _STRIX_INDEX not in calls, calls
+ assert _STRIX_INDEX in calls and "gfx120X-all" not in calls, calls
+
+
+def test_python_inferred_install_uses_the_deferred_discrete_card(_generic_tag_with_strix_fixes):
+ calls = routing._run_install(
+ gfx_devices = ("gfx1151", "gfx1201"),
+ inferred = "gfx1151",
+ rocm_version = (7, 13),
+ rocm_gpu_visible = False,
+ )
+ assert _STRIX_INDEX not in calls, calls
@pytest.mark.parametrize(
@@ -393,11 +425,17 @@ def test_python_versionless_gfx950_ahead_of_an_apu_keeps_the_generic_fallback():
@_POSIX
[email protected]("hsa,expected", [("", "gfx1201"), ("11.5.1", "gfx1151")])
-def test_install_sh_strix_keeps_its_index_under_an_hsa_override(hsa, expected):
+ "hsa,leaf,expected",
+ [("", "rocm7.13", "gfx1201"), ("11.5.1", "rocm7.13", "gfx1151"), ("", "rocm7.2", "gfx1151")],
+)
+def test_install_sh_strix_keeps_its_index_under_an_hsa_override(hsa, leaf, expected):
source = _INSTALL_SH.read_text(encoding = "utf-8")
script = (
- rocm_support._gpu_record_helpers(source)
+ rocm_support._extract_sh_function_body(source, "_rocm_leaf_below")
+ + "\n"
+ + rocm_support._gpu_record_helpers(source)
+ + f"\n_torch_index_leaf={leaf}\n"
+ "\nunset HIP_VISIBLE_DEVICES ROCR_VISIBLE_DEVICES CUDA_VISIBLE_DEVICES\n"
+ (
f"export HSA_OVERRIDE_GFX_VERSION={hsa}\n"
@@ -463,15 +501,15 @@ def test_install_sh_final_summary_keeps_the_inferred_gfx1153():
_RX7900 = "03:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 [Radeon RX 7900 XTX]"
-def test_python_inferred_strix_defers_to_a_generic_only_dgpu():
- # gfx942 has no AMD per-arch index: the generic route installs for it, not the Strix wheel.
+def test_python_inferred_strix_defers_to_a_generic_only_dgpu(_generic_tag_with_strix_fixes):
+ # gfx942 has no AMD per-arch index: once the generic tag carries the Strix fixes, it serves both.
calls = routing._run_install(
gfx_devices = ("gfx1151", "gfx942"),
inferred = "gfx1151",
- rocm_version = (7, 1),
+ rocm_version = (7, 13),
rocm_gpu_visible = False,
)
- assert "download.pytorch.org/whl/rocm7.1" in calls and _STRIX_INDEX not in calls, calls
+ assert "download.pytorch.org/whl/rocm7.13" in calls and _STRIX_INDEX not in calls, calls
@pytest.mark.parametrize(
@@ -510,14 +548,17 @@ def test_install_sh_gfx1153_keeps_its_hip_guidance(arches, vulkan):
url, err = guards._run_sh_get_torch_index_url(arches, rocm_tag = "rocm7.2")
assert url.endswith("/cpu"), (url, err)
assert ("UNSLOTH_LLAMA_CPP_BACKEND=vulkan" in err) is vulkan, err
- assert ("llama.cpp HIP build" in err) is (not vulkan), err
+ assert ("a llama.cpp ROCm build when one covers gfx1153" in err) is (not vulkan), err
def test_setup_sh_gfx1153_keeps_its_hip_guidance():
source = (PACKAGE_ROOT / "studio" / "setup.sh").read_text(encoding = "utf-8")
block = source[source.index('step "gpu" "AMD GPU detected ($_setup_unsup_gfx)') :]
block = block[: block.index('elif [ -n "$_setup_mkt" ]')]
- assert 'if [ "$_setup_unsup_gfx" = gfx1153 ]' in block and "llama.cpp HIP build" in block
+ assert (
+ 'if [ "$_setup_unsup_gfx" = gfx1153 ]' in block
+ and "a llama.cpp ROCm build when one covers gfx1153" in block
+ )
def _setup_unsupported_lookup(gpu_name, lspci_lines, tmp_path):
@@ -629,9 +670,8 @@ def test_install_sh_lspci_gfx1153_is_only_the_fallback(tmp_path, lines, expected
],
)
def test_setup_sh_forwards_an_inferred_gfx1153_to_llama_cpp(unsup, setup_gfx, expected):
- # The forwarding below the summary passes _setup_gfx as --rocm-gfx; gfx1153 keeps a HIP bundle.
source = (PACKAGE_ROOT / "studio" / "setup.sh").read_text(encoding = "utf-8")
- start = source.index(" # gfx1153 keeps its llama.cpp HIP bundle")
+ start = source.index(" # Forward gfx1153, which a runtime-less probe cannot read")
end = source.index(" fi\n", start) + len(" fi\n")
script = (
"step() { :; }\n"
diff --git a/tests/studio/install/test_selection_logic.py b/tests/studio/install/test_selection_logic.py
index 74fa49cfd61..a012f0588ae 100644
--- a/tests/studio/install/test_selection_logic.py
+++ b/tests/studio/install/test_selection_logic.py
@@ -5075,3 +5075,130 @@ class TestForkOnlyPrebuilts:
)
attempts = INSTALL_LLAMA_PREBUILT._linux_published_attempts(_host, release)
assert [a.name for a in attempts][:1] == [f"app-{self.TAG}-linux-arm64-vulkan.tar.gz"]
+
+
+class TestLinuxUncoveredRocmGpuTakesVulkan:
+ """Linux gfx1153 (no ROCm bundle): Vulkan without hipcc, the HIP source build with it."""
+
+ TAG = "b11798-mix-f8a7950"
+ ROCM = f"app-{TAG}-linux-x64-rocm-gfx110X.tar.gz"
+ VULKAN = f"app-{TAG}-linux-x64-vulkan.tar.gz"
+ CPU = f"app-{TAG}-linux-x64-cpu.tar.gz"
+
+ def _release(self):
+ return make_release(
+ [
+ make_cpu_artifact(
+ self.ROCM,
+ install_kind = "linux-rocm",
+ rank = 1000,
+ gfx_target = "gfx110X",
+ mapped_targets = ["gfx1100", "gfx1101", "gfx1102", "gfx1103"],
+ ),
+ make_cpu_artifact(self.VULKAN, install_kind = "linux-vulkan", rank = 1000),
+ make_cpu_artifact(self.CPU, install_kind = "linux-cpu", rank = 1000),
+ ],
+ release_tag = self.TAG,
+ upstream_tag = "b11798",
+ )
+
+ def _host(self, gfx, **overrides):
+ defaults = dict(
+ machine = "x86_64",
+ nvidia_smi = None,
+ driver_cuda_version = None,
+ compute_caps = [],
+ has_physical_nvidia = False,
+ has_usable_nvidia = False,
+ has_rocm = True,
+ rocm_gfx_target = gfx,
+ rocm_gfx_targets = [gfx],
+ )
+ defaults.update(overrides)
+ return make_host(**defaults)
+
+ def _resolve(
+ self,
+ gfx,
+ backend = None,
+ **host_overrides,
+ ):
+ route = INSTALL_LLAMA_PREBUILT.route_backend_request(
+ backend = backend,
+ published_repo = INSTALL_LLAMA_PREBUILT.DEFAULT_PUBLISHED_REPO,
+ published_release_tag = self.TAG,
+ host = self._host(gfx, **host_overrides),
+ )
+ attempts = INSTALL_LLAMA_PREBUILT._linux_published_attempts(route.host, self._release())
+ if backend is not None:
+ attempts = INSTALL_LLAMA_PREBUILT._backend_only_attempts(attempts, backend)
+ if not attempts:
+ # What the installer raises for an empty Linux plan: setup.sh then source-builds.
+ raise PrebuiltFallback("no compatible Linux prebuilt asset was found")
+ return apply_approved_hashes(attempts, make_checksums([self.ROCM, self.VULKAN, self.CPU]))
+
+ @pytest.fixture(autouse = True)
+ def _clean(self, monkeypatch):
+ for var in (
+ "HIP_VISIBLE_DEVICES",
+ "ROCR_VISIBLE_DEVICES",
+ "CUDA_VISIBLE_DEVICES",
+ "GGML_VK_VISIBLE_DEVICES",
+ "UNSLOTH_ROCM_GFX_ARCH",
+ "UNSLOTH_LLAMA_CPP_BACKEND",
+ "UNSLOTH_FORCE_VULKAN",
+ ):
+ monkeypatch.delenv(var, raising = False)
+ monkeypatch.setenv("UNSLOTH_VULKAN_DEVICE_PROBE", "0")
+ monkeypatch.setattr(INSTALL_LLAMA_PREBUILT, "_rocm_torch_preferred", lambda: False)
+ monkeypatch.setattr(
+ INSTALL_LLAMA_PREBUILT, "_hipcc_available", lambda: False, raising = False
+ )
+ monkeypatch.setattr(
+ INSTALL_LLAMA_PREBUILT,
+ "github_release_assets",
+ lambda repo, tag: pytest.fail("listed an upstream release"),
+ )
+
+ @pytest.mark.parametrize("gfx", ["gfx1153", "gfx1152"])
+ def test_an_uncovered_gpu_without_hipcc_takes_the_vulkan_bundle(self, gfx):
+ assert [c.name for c in self._resolve(gfx)] == [self.VULKAN]
+
+ def test_with_hipcc_the_source_build_stays(self, monkeypatch):
+ monkeypatch.setattr(INSTALL_LLAMA_PREBUILT, "_hipcc_available", lambda: True)
+ with pytest.raises(PrebuiltFallback):
+ self._resolve("gfx1153")
+
+ def test_a_covered_gpu_keeps_its_rocm_bundle(self):
+ assert [c.name for c in self._resolve("gfx1100")] == [self.ROCM]
+
+ def test_an_explicit_hip_backend_is_not_rerouted(self):
+ with pytest.raises(PrebuiltFallback):
+ self._resolve("gfx1153", backend = "rocm")
+
+ @pytest.mark.parametrize(
+ "mask_env", ["HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES", "GGML_VK_VISIBLE_DEVICES"]
+ )
+ def test_a_mask_keeps_the_source_build(self, monkeypatch, mask_env):
+ # Vulkan ignores the HIP masks, and a Vulkan mask's ordinals are unknowable here.
+ monkeypatch.setenv(mask_env, "0")
+ with pytest.raises(PrebuiltFallback):
+ self._resolve("gfx1153")
+
+ def test_rocm_torch_beside_an_nvidia_card_keeps_the_source_build(self, monkeypatch):
+ monkeypatch.setattr(INSTALL_LLAMA_PREBUILT, "_rocm_torch_preferred", lambda: True)
+ with pytest.raises(PrebuiltFallback):
+ self._resolve(
+ "gfx1152",
+ nvidia_smi = "/usr/bin/nvidia-smi",
+ driver_cuda_version = (12, 8),
+ compute_caps = ["89"],
+ physical_compute_caps = ["89"],
+ has_physical_nvidia = True,
+ has_usable_nvidia = True,
+ )
+
+ def test_beside_an_nvidia_card_the_source_build_stays(self):
+ # Vulkan would reach the NVIDIA card too; the masked-NVIDIA rules stay as they are.
+ with pytest.raises(PrebuiltFallback):
+ self._resolve("gfx1153", has_physical_nvidia = True)
diff --git a/tests/studio/install/test_setup_sh_gfx1153_lspci_peer.py b/tests/studio/install/test_setup_sh_gfx1153_lspci_peer.py
index c90b4a29379..4bd08f02196 100644
--- a/tests/studio/install/test_setup_sh_gfx1153_lspci_peer.py
+++ b/tests/studio/install/test_setup_sh_gfx1153_lspci_peer.py
@@ -5,7 +5,7 @@
peer when lspci prints the Krackan die name shared with Krackan Point ("Krackan [Radeon 840M /
860M Graphics]"), so a runtime-less lone gfx1153 host gets no "gfx1153" from
_setup_unsupported_gfx_any and setup.sh forwards no --rocm-gfx gfx1153 to
-install_llama_prebuilt.py (whose gfx1153 HIP bundle exists). install.sh (_infer_linux_amd_gfx_arch)
+install_llama_prebuilt.py (which picks a covering ROCm bundle, else Vulkan without hipcc). install.sh (_infer_linux_amd_gfx_arch)
and install_python_stack.py both skip that line beside a Krackan Point 2 CPU; setup.sh must too.
Same gap in the marketing-name block (_setup_mkt names the K2, lspci Krackan line = "peer").