Skip to content

Vulkan GPUs: real device names and selectable ordinals (rebase of #7356 onto #7476) - #7498

Merged
danielhanchen merged 2 commits into
mainfrom
vulkan-gpu-names-and-pins
Jul 27, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
vulkan-gpu-names-and-pins

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Rebases the durable half of #7356 onto the inference_gpu transport that #7476 landed on main. Supersedes #7356; credit for the original work and the design is @LeoBorcherding's, and the hardware confirmation is @Bebiv24's.

Why a rebase rather than a merge

#7356 and #7476 solve an overlapping problem and disagree on the data model, not on formatting. #7476 added get_vulkan_inference_gpu_info(), made _get_cached_system_gpu_info return a (training, inference) tuple, and wired inference_gpu through six frontend files. #7356 adds gguf_devices inside gpu_info and rewrites four of those same files. Merging both would ship two parallel Vulkan device concepts with different index semantics, which is the class of bug #7356 spent several rounds fixing.

So this keeps main's transport and adds only what #7356 has that #7476 does not:

#7476 (on main) this
device name Vulkan0, Vulkan1 ggml's real description, e.g. AMD Radeon RX 9070 XT
index_kind relative, unpinnable vulkan, pins via --device Vulkan<i>
gpu_ids picks not offered offered once the probe enumerated ordinals
iGPU detection inferred from total_mib == 0 explicit is_igpu from the ggml device type
XPU host Vulkan picks banned with torch-xpu allowed; a ggml ordinal is not a torch index

Memory stays on the fit-correct path

Identity comes from the inventory, but the numbers deliberately still come from _get_gpu_memory. 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: on my Strix Halo box the raw figure is 91 GiB. I had this wrong in the first pass and test_vulkan_igpu_info_uses_capped_free_budget caught it. Identity is joined on by ordinal, so a probe failure degrades to Vulkan<i> names with the memory readings intact, covered by a test.

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 ordinal existence. Shipping it would have been dead code.
  • the gguf_devices transport, replaced by inference_gpu.
  • the iGPU budget fallback I committed in 7161989. Main's aggregateGpuMemoryTotalGb counts a shared pool once, which is a better answer than falling back to the torch total.

Kept #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 actual guard, _reject_vulkan_diffusion_gpu_ids_before_teardown, is untouched.

Tests

Three added, plus three updated where they pinned the behavior this deliberately reverses (index_kind relative to vulkan, picks not supported to supported).

  • real names and the explicit iGPU flag surface, while the iGPU budget stays the capped 12 GiB rather than the raw 91 GiB
  • a failing inventory probe degrades to Vulkan<i> without losing the device list
  • source contract that the picker reads the Vulkan inventory and keeps the XPU ban on the torch fallback

Verification

Windows 11, Strix Halo (gfx1151). Backend Vulkan and GPU-selection suites sit at the same 4 pre-existing failures as main. tests/studio 1671 passed, no new failures against a clean main baseline (test_50_concurrent_probes_complete_without_deadlock fails 3/3 on main too on this host). Frontend typecheck clean, same 5 pre-existing missing-module errors as main.

Not carried over

The per-model GPU pick stamping, chat runtime store and preset-config parts of #7356 are follow-on and not in this PR. They can land on top of this once the index-space question is settled in one place. Also worth noting for whoever closes #7356: 0c4968b15 committed 708 junk files under studio/frontend/~/CLAUDE_CODE_TMPDIR/ (a Node compile cache) plus temp/, none of which are gitignored. They are not in this branch.

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]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@danielhanchen
danielhanchen merged commit 74295d9 into main Jul 27, 2026
54 checks passed
@danielhanchen
danielhanchen deleted the vulkan-gpu-names-and-pins branch July 27, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant