Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f17beb4
Studio: route AMD integrated GPUs to the Vulkan llama.cpp prebuilt
danielhanchen Sep 6, 2026
d1b246c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2026
604bddd
Studio: build the Vulkan ICD search path per call, not at import
danielhanchen Sep 6, 2026
da37175
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2026
0df97a8
Studio: five review fixes for the AMD integrated-GPU Vulkan route
danielhanchen Sep 6, 2026
126a16b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2026
29384df
Studio: judge the Vulkan route and the migration on evidence, not on …
danielhanchen Sep 6, 2026
70e8bad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2026
c5fe4e5
Studio: move the pin contracts to the namespace the flip introduced
danielhanchen Sep 7, 2026
5cfd7af
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 7, 2026
ed0118b
studio: address the Vulkan default review
danielhanchen Sep 7, 2026
0e6df01
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 7, 2026
acd30c1
studio: reject 32-bit ICDs, and say when a migration was not applied
danielhanchen Sep 7, 2026
b684b16
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 7, 2026
81ef165
studio: decline the Vulkan preference under a Vulkan device mask, and…
danielhanchen Sep 7, 2026
4e8e88d
studio: tighten the comments added by the Vulkan routing change
danielhanchen Sep 7, 2026
c12846f
Studio: read the Vulkan force lists first, and re-pair whisper after …
danielhanchen Sep 7, 2026
de12aed
studio: recover the ROCm arch, validate the ICD target, and keep CPU …
danielhanchen Sep 7, 2026
c5b2f3d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 7, 2026
15c47ec
studio: re-pair whisper when an update can move the backend, and neve…
danielhanchen Sep 7, 2026
cd77e25
studio: tighten the comments added by this PR
danielhanchen Sep 7, 2026
4fd355c
Studio: apply a backend migration with the arch the offer was made with
danielhanchen Sep 7, 2026
a0a0e22
Studio: let the backend picker recover the arch the update check does
danielhanchen Sep 7, 2026
b9e94fe
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 7, 2026
b8cda58
Studio: honour the Vulkan loader's driver filters before preferring V…
danielhanchen Sep 7, 2026
688c337
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 7, 2026
e3cbdab
Say what the ROCm to Vulkan migration buys, in the banner that offers it
danielhanchen Sep 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions studio/backend/routes/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -8288,6 +8288,7 @@ def _record_serving_alias() -> None:
# "<path>:LABEL" is read too, after the bare path used today.
from utils.openai_auto_switch_settings import (
resolve_override_for_load,
stored_gpu_index_kind,
)

# The candidate order above, kept in one place so the panel
Expand All @@ -8301,10 +8302,11 @@ def _record_serving_alias() -> None:
)
saved_gpu_ids = load_kwargs.get("gpu_ids")
if saved_gpu_ids and not await _override_gpu_ids_still_resolve(
saved_gpu_ids
saved_gpu_ids, stored_gpu_index_kind(override)
):
# Stale pin (GPU removed, another host): drop the one dead
# field rather than 400 the whole load.
# Stale pin (GPU removed, another host, or a backend change that
# moved these ids into a different index space): drop the one
# dead field rather than 400 the whole load.
load_kwargs.pop("gpu_ids", None)
logger.warning(
"Dropping saved gpu_ids %s for %s: not available here.",
Expand Down Expand Up @@ -11379,13 +11381,24 @@ def _classify_diffusion_gguf(config: ModelConfig) -> Optional[bool]:
return True if name_says_diffusion else None


async def _override_gpu_ids_still_resolve(gpu_ids: List[int]) -> bool:
async def _override_gpu_ids_still_resolve(
gpu_ids: List[int], stored_index_kind: str = "physical"
) -> bool:
"""Whether a per-model GPU pin is usable on this machine right now.

normalize_model_override cannot know the device list, so it stores whatever
was valid where the config was written. This is the load-time reconciliation
for the device-availability rules, which are the ones that go stale.

``stored_index_kind`` is the namespace those ids were written in, and it is checked
before availability because the two failures look nothing alike: an id that no longer
exists is caught below, while an id that still exists in the OTHER index space pins a
different device and every availability check passes. A Vulkan build numbers devices by
compact ggml ordinal and a CUDA/ROCm build by physical id, and a host moves between them
-- an AMD integrated GPU is routed to the Vulkan prebuilt by preference. Mirrors
reconcileGpuSelection in the UI (hooks/gpu-selection.ts), which drops the pin on the
same mismatch.

Deliberately not exhaustive: model-dependent rules (a Vulkan diffusion GGUF
refuses gpu_ids outright) need a ModelConfig this has no reason to build.
The caller's retry-without-the-pin covers those, and covers rules added
Expand All @@ -11406,6 +11419,8 @@ def _device_and_resolution() -> tuple[object, bool, list]:
)

device, is_vulkan, resolved = await asyncio.to_thread(_device_and_resolution)
if stored_index_kind != ("vulkan" if is_vulkan else "physical"):
return False
if device == DeviceType.XPU and not is_vulkan:
# Rejected outright on XPU.
return False
Expand Down
14 changes: 14 additions & 0 deletions studio/backend/routes/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ class LlamaUpdateStatusResponse(BaseModel):
update_size_bytes: Optional[int] = Field(
None, description = "Download size of the prebuilt Update would fetch, in bytes."
)
backend_migration_available: bool = Field(
False,
description = (
"True when the install recorded an AUTOMATIC backend choice and detection "
"now resolves elsewhere, so Update would move it. Independent of "
"update_available: the release can be current while the backend has drifted."
),
)
from_backend: Optional[str] = Field(
None, description = "Installed backend, when a migration is available."
)
to_backend: Optional[str] = Field(
None, description = "Backend a re-applied automatic selection would install."
)
whisper: Optional[WhisperSubStatus] = Field(
None, description = "Whisper piggyback sub-status; None when the probe is unavailable."
)
Expand Down
4 changes: 4 additions & 0 deletions studio/backend/routes/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,9 @@ class ModelOverridePayload(BaseModel):
gpu_layers: Optional[int] = Field(default = None, ge = -1, le = 1024)
n_cpu_moe: Optional[int] = Field(default = None, ge = 0, le = 1024)
gpu_ids: Optional[list[int]] = Field(default = None, max_length = MAX_GPU_IDS)
# Which index space gpu_ids is in. Absent means physical, the only thing a client
# written before this field could have meant.
gpu_index_kind: Optional[Literal["physical", "vulkan"]] = None
# An all-default save carries no fields, like a forget; None keeps the legacy contract.
remove: Optional[bool] = None
# Fill in, don't replace: the backfill reads the map once then writes each model.
Expand Down Expand Up @@ -1801,6 +1804,7 @@ def update_openai_auto_switch_override(
gpu_layers = payload.gpu_layers,
n_cpu_moe = payload.n_cpu_moe,
gpu_ids = payload.gpu_ids,
gpu_index_kind = payload.gpu_index_kind,
fill_absent_fields = payload.fill_absent_fields,
)
# A repo cached outside the active HF cache is keyed here by its repo id
Expand Down
9 changes: 8 additions & 1 deletion studio/backend/tests/test_combined_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ def _patch_llama_installer(
# Only intercept the installer invocation: importing routes.inference inside
# the worker can Popen unrelated host probes (ldconfig etc).
def _popen(cmd, **kw):
is_installer = any("install_llama_prebuilt" in str(part) for part in cmd)
parts = [str(part) for part in cmd]
# The read-only resolvers run the same script; faking them would answer the
# status poll's backend-drift probe with an install's canned output.
is_installer = any("install_llama_prebuilt" in part for part in parts) and not any(
part.startswith("--resolve-") for part in parts
)
return _FakeInstallerPopen(
cmd,
returncode = returncode if is_installer else 0,
Expand Down Expand Up @@ -157,6 +162,7 @@ def _clean_state(monkeypatch, tmp_path):
wfresh.reset_caches()
upd._reset_job_for_tests()
upd._resolve_memo.clear()
upd._backends_memo.clear()
wupd._resolve_memo.clear()
monkeypatch.setattr(freshness, "_cache_dir", lambda: tmp_path / ".llama_cache")
monkeypatch.setattr(wfresh, "_cache_dir", lambda: tmp_path / ".whisper_cache")
Expand All @@ -175,6 +181,7 @@ def _clean_state(monkeypatch, tmp_path):
wfresh.reset_caches()
upd._reset_job_for_tests()
upd._resolve_memo.clear()
upd._backends_memo.clear()
wupd._resolve_memo.clear()


Expand Down
Loading
Loading