Repository navigation
fix(studio): reject Vulkan diffusion gpu_ids before Phase 1 teardown - #7415
danielhanchen merged 9 commits into
Conversation
Classify local GGUF paths (and cached HF downloads when available) for diffusion before _kill_process() so unsupported gpu_ids requests return 400 without tearing down the active model. Fixes unslothai#7205.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1b2427773
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if _cached_gguf and Path(_cached_gguf).is_file(): | ||
| self._reject_vulkan_diffusion_gpu_ids_before_teardown( | ||
| _cached_gguf, | ||
| model_identifier, | ||
| ) |
There was a problem hiding this comment.
Don't skip pre-teardown download for partial GGUF caches
When a Vulkan load with gpu_ids finds only a cached main/shard-1 GGUF, this branch just classifies that file and leaves _preflight_model_path as None; Phase 2 then calls _download_gguf only after _kill_process(). resolve_local_gguf_path() does not prove the variant is complete, so with a partial split cache, missing shard, disk-space error, or offline hub failure the existing server is torn down before the load fails. The preflight should either verify/reuse a complete cached load target or still run _download_gguf before Phase 1 for incomplete caches.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and reproduced on the commit this was posted against (c1b2427). With resolve_local_gguf_path() returning a cached shard-1 file and _download_gguf raising (missing shard / ENOSPC / offline hub), the observed order was KILL -> DOWNLOAD, so the healthy server was gone before the load failed.
That cached-path shortcut was reverted in 5e06a84, so the hf_repo preflight now always runs _download_gguf before Phase 1. Re-running the same three failure modes on head gives DOWNLOAD only, with _kill_process never called. _download_gguf resolves the full split set (gguf_extra_shards / _cached_complete_candidate / split_needs_refetch), so completeness really is proven pre-teardown, and Phase 2 reuses _preflight_model_path.
Locked in with a behavioral regression test in c9867a4: it patches resolve_local_gguf_path to return an on-disk shard-1 and asserts the call order is exactly ['download']. It fails on c1b2427 with ['kill', 'download'] and passes on head.
…light Reverts the cached-path shortcut so partial split caches still run _download_gguf before Phase 1 teardown. Header-only classification from resolve_local_gguf_path() does not prove the variant is complete.
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
The one red check here, The job's own classifier says so: it failed with This branch touches two files, Separately, this PR was replicated onto a staging repo and run there across Ubuntu, macOS 14 and Windows: all three green, plus the full check set at 45 passed with 2 skipped. |
|
Checked the platform matrix on this one, since a new hardware path must not disturb the old ones. Every new branch is gated on
So CUDA, ROCm, Metal and CPU-only callers reach none of it, and the only behaviour change lands on the exact configuration the issue describes. The one genuinely new statement is the local-path preflight. It is a character-for-character duplicate of the check that already sat further down ( The red |
|
Cross-platform staging run on this PR came back clean: 16 of 16 green across Ubuntu, macOS and Windows. One job ( |
Resolves the overlap with two Vulkan changes that landed on main after this branch last synced: unslothai#7415 (reject Vulkan diffusion gpu_ids before Phase 1 teardown) and unslothai#7476 (report Vulkan GPUs in system UI). llama_cpp.py: take main's shared _VULKAN_DIFFUSION_GPU_IDS_ERROR constant and its local-GGUF pre-teardown branch, which this branch did not have, and keep this branch's gpu_ids_are_vulkan_ordinals qualification plus its CPU-only-build pin rejection. The missing-file check stays under main's original gate so a bad local path is still reported before the running server is torn down, while only the diffusion rejection carries the ordinal qualification. use-system.ts: fold this branch's gguf_devices field and its gpu_ids doc comment into main's SystemGpuInfo interface, keeping main's inference_gpu. test_gguf_load_cache_reuse.py: the _no_gguf_gpu_ids stub now returns the (ids, are_vulkan_ordinals) tuple this branch's resolver returns.
… onto #7476) (#7498) * Vulkan GPUs: real device names and selectable ordinals Rebases the durable half of #7356 onto the inference_gpu transport #7476 landed on main. Those two PRs solve an overlapping problem and disagree on the data model, so merging #7356 as-is would ship two parallel Vulkan device concepts with different index semantics. This keeps main's transport and adds what #7356 had that #7476 does not. - _vulkan_probe.py emits a 5th column, ggml's device description, sanitized for the tab protocol and UTF-8 safe. Reader tolerates 4- or 5-column output so an older probe still parses. - llama_cpp gains _run_vulkan_probe (shared parse) and vulkan_device_inventory (names + is_igpu + real totals). - get_vulkan_inference_gpu_info reports the real name and an explicit is_igpu instead of "Vulkan<i>" and a total == 0 guess. - index_kind becomes "vulkan", not "relative", and gpu_ids picks are supported on Vulkan builds once the probe enumerated ordinals. The XPU ban no longer applies to them: a Vulkan pick is a ggml ordinal, not a torch-xpu index, so it works on an Intel host too. - Frontend picker reads the Vulkan inventory as the pickable set. Memory deliberately still comes from _get_gpu_memory, not the inventory. That path applies _apply_igpu_host_reserve_mib and zeroes a shared total; budgeting an APU off its raw shared total would hand out the whole machine's RAM with no OS headroom. Identity is joined onto it by ordinal, so a probe failure degrades to Vulkan<i> names with the memory readings intact. Dropped from #7356 as superseded: validate_vulkan_gpu_ids (main's resolve_requested_gpu_ids already rejects duplicates and _resolve_gguf_gpu_ids_for_request already probes for existence), the gguf_devices transport, and the iGPU budget fallback in 7161989, which main's aggregateGpuMemoryTotalGb handles better by counting a shared pool once. Also keeps #7356's removal of the late diffusion raise, so the graceful gpu_ids drop stays reachable for a GGUF only classified as diffusion after download. #7415's real guard, _reject_vulkan_diffusion_gpu_ids_before_ teardown, is untouched. Verified on Windows + Strix Halo: backend Vulkan/GPU-selection suites at the same 4 pre-existing failures as main, tests/studio 1671 passed with no new failures, frontend typecheck clean. Hardware confirmation of the underlying behavior is on #7356 from @Bebiv24 (RX 9070 XT + RX 480). Co-authored-by: LeoBorcherding <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: LeoBorcherding <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Summary
Fixes #7205.
When loading a DiffusionGemma GGUF with explicit
gpu_idson a Vulkan llama.cpp build,LlamaCppBackend.load_modelused to run Phase 1 (_kill_process()) before it could read the GGUF header and reject the unsupported combination. That tore down the active model and then returned 400.This PR classifies diffusion GGUFs before Phase 1 teardown:
gguf_path: read the header via_gguf_path_is_diffusionbefore killing the serverresolve_local_gguf_pathfirst; download only when uncached (existing behavior)_VULKAN_DIFFUSION_GPU_IDS_ERRORand_reject_vulkan_diffusion_gpu_ids_before_teardown()Test plan
test_local_vulkan_diffusion_preflight_runs_before_teardowntest_local_vulkan_diffusion_rejection_keeps_active_server