Repository navigation
AMD: Multi-GPU RX 9070 XT w/ RX 480 - GGUF OOM Labels & GPU Memory Controls - #7356
LeoBorcherding wants to merge 26 commits into
Conversation
…r-visible devices On a Vulkan llama.cpp build, llama-server can drive cards the torch backend cannot see (e.g. a pre-ROCm RX 480 next to a ROCm-only RX 9070 XT on Windows). Studio previously built its GPU list only from torch/ROCm, so such cards were invisible: TIGHT/OOM labels budgeted against half the real VRAM and the unslothai#6414 GPU Memory controls could not offer the second card. Backend: - _vulkan_probe.py prints a 5th column with ggml's device description. - LlamaCppBackend gains _run_vulkan_probe (shared parse, 4/5-column tolerant), vulkan_device_inventory (names + real totals for the UI), and validate_vulkan_gpu_ids (picks validated in ggml Vulkan ordinal space). - /api/system reports gguf_devices (the llama-server inventory, Vulkan builds) alongside the torch view, and gguf_gpu_ids_supported becomes true when the inventory is available: probe, picker, and --device Vulkan<i> pin all share one index space, so the old unconditional 400 on Vulkan picks is replaced with ordinal validation in /load and /validate. - The inventory rides its own 60s cache: /api/system pollers (floating monitor, Resources tab) keep expiring the 10s GPU cache, and the probe spawns a subprocess. Model loads keep their own fresh probe. Frontend: - GpuInfo gains ggufMemoryTotalGb (sum of llama-server-visible discrete VRAM, falling back to the torch total). GGUF fit surfaces (hub fit labels, variant expanders, fits-on-device filters) budget against it; training and safetensors estimates stay on the torch total, which training truly has. - The GPU picker lists gguf_devices (both cards, names, per-card VRAM) and allows picks on Vulkan builds. Tests: probe 5-column parse, inventory, ordinal validation, and the /api/system merge (torch view preserved, inventory surfaced and cached across GPU-cache refreshes, support flag).
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48dfa33e58
ℹ️ 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".
- recommended-fit: only GGUF rows budget against the llama-server total; safetensors/MLX rows load through torch, which can't use Vulkan-only cards. - use-gpu-info: a reported llama-server inventory is authoritative even at zero discrete VRAM (all-iGPU case counts as system RAM, not torch dGPU VRAM); only a missing inventory falls back to the torch total. - Training guard: a Vulkan build's gpu_ids (ggml ordinals) are dropped before the physical-index free-VRAM sizing, so the load is guarded as unpinned instead of resolving the wrong card or skipping protection. - Persisted picks: remember the pick index space (physical vs vulkan) in localStorage; reconcilePersistedGpuIds clears saved picks after a backend swap flips the space, where a bare-number membership check would let a pick land on a different physical card. - _vulkan_probe: the name lookup binds in its own best-effort block so a ggml-base without ggml_backend_dev_description can't disable iGPU detection, and stdout is reconfigured to UTF-8 (reader decodes to match) so non-ASCII device names can't kill the probe on cp1252 consoles. Tests: guard drops/keeps gpu_ids by backend kind (test_chat_load_during_training).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40c1464d41
ℹ️ 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".
a12578f to
40c1464
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79eace774d
ℹ️ 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".
…keep fresh live picks Codex round-3 follow-ups on the Vulkan llama.cpp GPU-selection path: - can_load_chat_during_training: add worst_case_gpu_count so a Vulkan pick (ggml ordinals with no physical mapping) is sized against the N most- constrained visible cards instead of falling back to the whole-pool check, which could OK a load that lands on a busy selected card and OOMs training. - /load and /validate: reject gpu_ids for diffusion GGUFs on a Vulkan build with a 400 -- the diffusion runner cannot map ggml Vulkan ordinals. - reconcilePersistedGpuIds: gate the index-space-change clear behind a new fromPersisted flag so a freshly picked live Vulkan selection is not nulled for the whole first post-swap session. Persisted PerModelConfig restores pass fromPersisted:true; live store reads (send path, unload-restore) do not.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d65536268f
ℹ️ 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".
The pre-download /load and /validate Vulkan gates rejected gpu_ids whenever _classify_diffusion_gguf was not False, but None is the ordinary first-load case for an uncached Hub GGUF (no local header to classify yet). That 400'd first-time remote GGUF loads and made the new Vulkan GPU picker unusable unless the model was already cached. Reject only a CONFIRMED diffusion GGUF (is True) at the gates. For the rare uncached model that turns out to be diffusion after download, add a spawn-time backstop in load_model: on a Vulkan build, drop the unmappable gpu_ids pin before _start_diffusion_server (ggml Vulkan ordinals cannot be forwarded as the runner's CUDA/DG token) so it serves on the default device instead of the wrong card. Regression tests cover the relaxed gate and the spawn backstop.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9afb8011c
ℹ️ 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".
applyPerModelConfigToRuntime runs synchronously on model selection, which can happen before any GPU hook has fetched /api/system. On a cold cache reconcilePersistedGpuIds can't tell whether the saved ids belong to the current llama.cpp backend's index space (physical CUDA/ROCm ids vs ggml Vulkan ordinals), so it passes them through. That value then launders into the store and the later load path reconciles it as a live pick (fromPersisted false), which never clears it -- a saved physical [1] gets sent as Vulkan ordinal 1 and pins the wrong card. When the pick is applied cold, warm the cache and re-reconcile with fromPersisted, overwriting only if the user has not replaced the pick since.
test_compare_load_uses_each_models_gpu_config asserted the exact single-arg
call reconcilePersistedGpuIds(ownConfig.selectedGpuIds); the per-model (persisted)
path now passes { fromPersisted: true } to drop a pick saved under the other
llama.cpp backend's GPU index space. Match the new call and assert the flag.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d13f25a76
ℹ️ 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".
Codex round on the fromPersisted marker: it was set on call sites that also
carry fresh, current-space picks, and the cold-cache revalidation raced the
load path.
- applyPerModelConfigToRuntime now takes { fromPersisted } (default false =
live). Only a config actually restored from storage passes true.
- chat-page load-on-selection passes fromPersisted only for the
rememberedConfigFor fallback, not an explicit selection.config (fresh Run
settings / picker edit). Prevents a freshly selected Vulkan ordinal from being
cleared and loaded on all GPUs.
- shared-composer compare pane gates fromPersisted on (!config && ownRemembered),
so an explicit sel.config pane pick stays live.
- Cold-cache race: instead of leaking the raw persisted ids into the store
(where the load path snapshots and sends them before the async revalidation
runs), park the pick at null (all GPUs, safe) and fill in the validated pick
once the cache warms. The load snapshot can no longer send a wrong-space pin.
Contract test updated + a regression guard for the storage-only invalidation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c85e763029
ℹ️ 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".
The fromPersisted-by-call-site marker kept getting misapplied because those sites carry both storage restores and fresh live edits, and the cold-cache park/revalidate raced the load path. Replace it with per-value provenance: each GPU pick carries the index space it was made under, and reconcile drops it only when that stamp no longer matches the backend. - use-gpu-info: currentGpuIndexKind() (from /api/system gguf_devices); drop the session-global gpuIndexSpaceChanged marker machinery. - PerModelConfig gains selectedGpuIdsIndexKind (persisted); the runtime store gains selectedGpuIdsKind, stamped wherever a pick is set (live picker = current kind, load echo = current kind, config apply = the config's stamp). - reconcilePersistedGpuIds(ids, savedKind): drop when savedKind != current kind (both known); unstamped picks default to physical (pre-Vulkan). - Run settings stamps the current kind when the user edits the GPU picker, so an edited pick is never treated as a stale cross-space restore; an unedited stored pick keeps its saved kind. - No more park-null / async revalidate / fromPersisted: a same-backend refresh keeps the saved subset (kinds match), a cross-space pin is dropped, and the load snapshot carries the stamp so it can't send a wrong-space pin. Fixes the three Codex findings (cold-cache saved-pick loss, model-generation race, unedited run-settings treated as live). Contract tests updated; typecheck + build + tests/studio contracts green.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bdee5c7f8
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 715b20561f
ℹ️ 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".
… budget - gpuFieldsSignature now folds selectedGpuIdsIndexKind into the pick, so when the reactive fallback stamps a cold-hydrated active pick after the GPU cache warms, an open Run-settings panel remounts and re-snapshots with the new stamp instead of reloading/saving it as a legacy physical pick. - /api/system reports gguf_backend_is_vulkan so the frontend can tell an empty gguf_devices on a Vulkan build (probe failed/masked, budget unknown) from a non-Vulkan build. Empty Vulkan inventory now budgets GGUF at 0 instead of the torch VRAM total, which on a mixed host would let fit checks pass against VRAM /load cannot place.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5d1646989
ℹ️ 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".
|
Pushed a small fix to the diffusion path. The graceful "drop the unmappable Vulkan pin and serve on the default device" backstop in Removed the dead raise so the drop is reached, and tightened Verified: full backend suite plus the frontend |
… pin stamp Addresses two Codex P2s on the Vulkan GPU-pin machinery: - use-gpu-info caches /api/system forever, so after an in-session llama.cpp backend swap (update/rebuild) currentGpuIndexKind() kept reporting the pre-swap index space until a full reload, stranding physical pins on a now-Vulkan backend (or dropping Vulkan pins after a swap back). Add invalidateGpuInfoCache() and call it on llama.cpp update success, beside the existing refreshHardwareInfo(). - A /status hydration (or eager picker edit) that beats the first /api/system fetch stamped a live pick's index kind null; currentRuntimePerModelConfig then serialized it as an unstamped (legacy physical) pick, dropping a real Vulkan selection on the next reconcile. Add warmSelectedGpuIdsKind() to warm the cache and backfill the kind at the two cold-capable stamp sites (setSelectedGpuIds, the /status hydration).
|
Pushed follow-ups addressing the two remaining P2s from the last review (commit
The diffusion dead-raise P2 was already handled by @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81333e166d
ℹ️ 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".
| // flips the gpu_ids index space. Drop the separate /api/system GPU | ||
| // cache too so currentGpuIndexKind()/the next reconcile re-probe the | ||
| // new space instead of stranding pins stamped under the old one. | ||
| invalidateGpuInfoCache(); |
There was a problem hiding this comment.
Invalidate the cache on every completed llama update
When another tab misses the running window, it observes the persisted success through surfaceIfAvailable, which only calls notifyReloadIfNeeded; likewise, a chained update whose llama phase lands but whose later whisper phase fails reaches the error branch with reload_required. Neither path executes this invalidation, so a backend swap leaves that tab's physical/Vulkan index kind cached and subsequent loads can retain a pin in the wrong index space. Centralize the refresh/invalidation for terminal jobs whose llama phase required a reload rather than limiting it to the polling success branch.
Useful? React with 👍 / 👎.
| export function invalidateGpuInfoCache(): void { | ||
| cachedSystem = null; | ||
| systemPromise = null; |
There was a problem hiding this comment.
Clear the server-side GPU caches after a backend swap
If the next load occurs shortly after an update, clearing only this module cache is insufficient: /api/system can still return main.py's pre-swap _system_gpu_cache for 10 seconds (and its Vulkan inventory for 60 seconds). fetchSystemOnce then caches that stale response indefinitely, so reconciliation still sees the old index kind and can send a physical pin as an existing Vulkan ordinal, selecting the wrong card. The update completion path needs to invalidate the backend caches or request an uncached system snapshot.
Useful? React with 👍 / 👎.
| export function invalidateGpuInfoCache(): void { | ||
| cachedSystem = null; | ||
| systemPromise = null; |
There was a problem hiding this comment.
Notify mounted GPU hooks when invalidating the cache
On an in-session backend swap, this function only clears module variables; already-mounted useGpuInfo, useGpuDevices, and useCurrentGpuIndexKind instances retain their state because their effects run only once and there is no listener or generation subscription. Even if a later load-boundary call refetches /api/system, an open Hub or GPU settings surface continues showing the old VRAM budget/device list and index kind until it unmounts or the page reloads. Invalidation should trigger a refetch and publish the result to mounted consumers.
Useful? React with 👍 / 👎.
| const savedKind: GpuIndexKind | null = | ||
| config.selectedGpuIds == null | ||
| ? null | ||
| : (config.selectedGpuIdsIndexKind ?? "physical"); |
There was a problem hiding this comment.
Preserve the GPU index stamp when applying presets
On a Vulkan host with an explicit GPU selection, applying a chat preset calls applyPresetLoadConfig, which copies store.selectedGpuIds into a PerModelConfig but omits selectedGpuIdsIndexKind. This fallback consequently labels the live Vulkan ordinals as physical; once /api/system is warm, reconcilePersistedGpuIds sees a cross-space mismatch and clears the selection, so the next load unexpectedly uses all GPUs. The preset path must carry store.selectedGpuIdsKind alongside the retained IDs.
Useful? React with 👍 / 👎.
| function systemGpuIndexKind( | ||
| data: SystemInfoResponse | null, | ||
| ): GpuIndexKind | null { | ||
| if (!data) return null; | ||
| return (data.gpu?.gguf_devices ?? []).length ? "vulkan" : "physical"; |
There was a problem hiding this comment.
Derive the index kind from the Vulkan backend flag
When a Vulkan build's device probe transiently fails, /api/system deliberately returns gguf_backend_is_vulkan: true with an empty gguf_devices list, but this function classifies that response as physical. A running Vulkan model hydrated from /status can then have its live ordinal selection backfilled and persisted with the physical stamp, causing it to be discarded or misinterpreted when the probe later recovers. Use the authoritative backend flag for the index space; inventory emptiness only means the ordinal set is currently unverifiable.
Useful? React with 👍 / 👎.
The iGPU exclusion in ggufMemoryTotalGb is right when llama-server is masked to an iGPU beside a dGPU torch can see, but it also catches the plain APU case: a Strix Halo or 890M box on a Vulkan build enumerates one integrated device and nothing else, so the budget collapses to 0 and the Hub renders "0 GiB" on a machine llama-server reports 91 GiB for. Fit still resolves via system RAM, so this is a labelling and fit-surface defect rather than a wrong load, but it reads as OOM on every GGUF row. Fall back to the torch total when the inventory is all-iGPU and torch sees no device beyond the ones probed. The device-count check is what keeps the masked-beside-a-dGPU host on 0, which is the case the exclusion exists for. Tests: the shape was uncovered (the existing cases are all is_igpu False). Added a backend test that an iGPU-only inventory is surfaced with its real total and keeps picks supported, and a source contract guard on the frontend rule, matching how the other frontend fixes here are pinned. Verified: frontend typecheck clean (same 5 pre-existing missing-module errors as main, none new), 211 passed across the vulkan probe, gguf devices, gpu memory mode, chat-load and model-picker contract suites.
|
Went through this on a Strix Halo box (Radeon 8060S). That machine runs the ROCm llama.cpp prebuilt, so What I could check held up:
The iGPU-only case renders 0 GiBPushed a fix. The iGPU exclusion in
The fix falls back to the torch total when the inventory is all-iGPU and torch sees no device beyond the ones probed. That second condition is what keeps the masked-beside-a-dGPU host on the conservative 0, so the case the exclusion exists for is unchanged. Worth noting AMD's lemonade takes the opposite approach here and never zeroes: it reports iGPU TestsThe new Rest of the PR looks good to me. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71619891e0
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function invalidateGpuInfoCache(): void { | ||
| cachedSystem = null; | ||
| systemPromise = null; |
There was a problem hiding this comment.
Prevent invalidated fetches from restoring stale GPU data
If /api/system is already in flight when a llama.cpp backend swap calls this function, clearing systemPromise does not cancel or invalidate that request. A post-swap read can start a fresh request, but the older request may resolve afterward and unconditionally overwrite cachedSystem at line 100 with the pre-swap physical/Vulkan inventory; because successful snapshots are cached indefinitely, subsequent GPU reconciliation can then use the wrong index space until another update or page reload. Track a cache generation or otherwise ignore completions from promises invalidated here.
Useful? React with 👍 / 👎.
| ggufMemoryTotalGb: ggufDevices.length | ||
| ? ggufIgpuOnly && devices.length <= ggufDevices.length | ||
| ? memoryTotalGb |
There was a problem hiding this comment.
Avoid identifying an APU by device counts alone
When Vulkan is masked to a single iGPU while torch sees a different single dGPU, both arrays have length 1, so this condition incorrectly substitutes the torch dGPU's total for the Vulkan GGUF budget. This is exactly the mixed masked topology the preceding comments intend to keep at zero: llama-server cannot use that dGPU, yet Hub fit filters and GGUF variant labels will count its VRAM and can advertise models as fitting. Matching list lengths does not establish that the inventories describe the same device, so the torch fallback needs a stronger identity/topology check.
Useful? React with 👍 / 👎.
…an-6414 # Conflicts: # studio/frontend/src/features/chat/hooks/use-chat-model-runtime.ts
Addresses the Codex review on 81333e1/7161989: - P1 centralize invalidation: move refreshHardwareInfo + invalidateGpuInfoCache into notifyReloadIfNeeded so every reload-required terminal path (poll, surfaceIfAvailable, apply stale-click, chained-update error) re-probes, not just polling success. - P1 stale backend cache: /api/system gains ?refresh=1 (force_refresh) to bypass the 10s GPU and 60s Vulkan-inventory caches; invalidateGpuInfoCache refetches with it so a post-swap read can't re-cache the pre-swap inventory. - P2 stale in-flight write: cache generation counter; a fetch that started before an invalidation drops its now-stale snapshot instead of overwriting the cache. - P2 notify mounted hooks: useGpuInfo/useGpuDevices/useCurrentGpuIndexKind share a subscription so an invalidation repaints open Hub / GPU settings surfaces. - P2 index kind from flag: systemGpuIndexKind uses gguf_backend_is_vulkan, so an empty inventory on a Vulkan build is vulkan (not misread as physical). - P2 preset stamp: applyPresetLoadConfig carries selectedGpuIdsIndexKind so a Vulkan pick isn't cleared as a cross-space physical pick. - P2 APU identity: replace the device-count guard with a normalized-name identity check so a masked-iGPU-beside-a-dGPU host stays on the conservative 0. Merged latest main (resolved use-chat-model-runtime: kept the kind-aware reconcile alongside main's pendingLoadConfig branching).
|
Re-reviewed after the Codex follow-up commit. Everything still passes here: 217 passed across the vulkan probe, gguf devices, gpu memory mode, chat-load and model-picker contract suites, and frontend typecheck is clean (same five pre-existing missing-module errors as main, none new). Replacing my device-count guard with the normalized-name identity check is a straight improvement, and it closed a hole I had left. My The rest of the follow-up looks right to me. One thing to check on the identity join
// ggml-vulkan.cpp
snprintf(description, description_size, "%s", props.deviceName.data());On this Strix Halo box under the AMD proprietary driver the two sides agree exactly, so the guard fires as intended: Both normalize to Linux is the open question. Mesa RADV does not report the same string as the ROCm name for the same GPU, and llama.cpp's own device dedup exists specifically because of it: // Check if there are two physical devices corresponding to the same GPU
// This handles the case where the same GPU appears with different drivers
// (e.g., RADV + AMDVLK on Linux)If the RADV string does not normalize to the ROCm one, Worth either loosening the comparison to containment in either direction, or falling back to the count check when no torch device name matches any probed name. Not a blocker for the Windows path, but it would be good to confirm on a Linux APU before this lands, otherwise the fix silently does nothing on half the affected hosts. |
|
@Bebiv24 thanks for testing this on the actual hardware, that is the validation this needed. Both cards showing with real names and the fit labels budgeting past 16GB is exactly the outcome the PR was aiming at. The I tried to merge main in and stopped, because this is no longer a conflict resolution. #7476 ("report Vulkan GPUs in system UI") landed on main and independently implements an overlapping feature, end to end:
Four of those six files are ones this PR also rewrites, and the two designs disagree on the data model rather than on formatting. Merging mechanically would ship two parallel Vulkan device concepts with different index semantics, which is the exact class of bug the pin-space commits here spent several rounds fixing. Which design winsThis PR is the stronger one on capability, and I would not want to lose it:
@Bebiv24's screenshots show the difference concretely: real card names and a working Tensor Parallelism toggle, neither of which #7476 gives you. One place main is ahead: Suggested pathRebase this onto #7476's I did not push a merge since that is a design call rather than a resolution, and it is your PR. Happy to do the rebase if you would rather I took it. The Python 3.10-3.13 CI failures resolve on their own with the rebase, they are the |
|
Opened #7498 with the rebase onto #7476's What carried over: the probe's 5th column for ggml's real device description, What did not, and why:
One thing worth flagging that I got wrong first time: I initially took the memory numbers from The per-model pick stamping, chat runtime store and preset-config work here is not in #7498. It is follow-on and easier to land once the index space is settled in one place, so it is worth keeping this branch around for that rather than discarding it. Separately, before anything from here gets reused: @Bebiv24 your test is what made the case for keeping the richer design rather than settling for #7476's |
b6ea3ac to
cc18949
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Force-pushed this branch to strip the committed junk. Heads up that the last two commit SHAs changed, so re-pull before doing anything further on it: What was removed: 708 files under Nothing of yours was touched. I rewrote only the two commits that carried the junk in their trees, Old tip was The root cause is fixed separately in #7499: |
… 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>


Problem
On a Vulkan llama.cpp build, llama-server can drive GPUs the torch backend cannot see. A user report (dual AMD on Windows: RX 9070 XT on ROCm + RX 480, which is too old for ROCm, via the Vulkan prebuilt) shows llama-server using both cards for inference while Studio behaves as if only one exists:
Root cause:
/api/systembuilds its device list from torch/ROCm (get_backend_visible_gpu_info), and every fit label sums VRAM over that list. The report suggested pulling fromllama-server --list-devices; this PR does the equivalent through the ggml Vulkan probe Studio already ships, so no extra server spawn is needed.Backend
_vulkan_probe.pyprints a 5th column: ggml's device description (ggml_backend_dev_description), sanitized for the tab protocol.LlamaCppBackendgains_run_vulkan_probe(shared parse, tolerant of 4- or 5-column output),vulkan_device_inventory(names + real totals for the UI), andvalidate_vulkan_gpu_ids./api/systemreportsgguf_deviceson Vulkan builds: the llama-server inventory in ggml Vulkan ordinal space, alongside the unchanged torch view indevices. The inventory rides its own 60s cache so/api/systempollers don't respawn the probe subprocess every 10s GPU-cache expiry; model loads keep their own fresh probe.gpu_idspicks on Vulkan builds are now supported instead of hard-400ing: the probe, the picker, and the existing--device Vulkan<i>pin all share one index space, so/loadand/validatevalidate picks against the probed ordinals. XPU behavior is unchanged.Frontend
GpuInfogainsggufMemoryTotalGb: the sum of llama-server-visible discrete VRAM (iGPUs excluded, their memory is the system RAM already budgeted separately), falling back to the torch total on non-Vulkan builds. All GGUF fit surfaces (hub fit labels, GGUF variant expanders, fits-on-device filters) budget against it.Tensor parallelism is intentionally untouched; whether row-split TP is worthwhile on a mixed-generation pair is a separate question from device visibility.
Tests
/api/systemmerge: torch view preserved, inventory surfaced, support flag semantics, and no re-probe across GPU-cache refreshes.Verified live on a ROCm host:
devicesunchanged,gguf_devicesempty, picks still supported. The mixed-GPU Vulkan path is covered by the synthetic-probe tests; I don't have a pre-ROCm card to reproduce the reporter's exact hardware.