Repository navigation
Unsloth Studio (AMD): leave an iGPU out of the Train page VRAM total and the default GPU pick (blocks dual R9700 testing) - #14039
LeoBorcherding wants to merge 39 commits into
Conversation
…and the default GPU pick On a host with discrete cards plus an iGPU (2x R9700 + Ryzen 9950X gfx1036), the Train page summed the iGPU's shared system RAM into VRAM (100 GiB) and the chat GPU picker ticked it by default. A shared/unified-memory GPU, or one the installed PyTorch has no kernels for (now flagged as no_torch_kernels in /api/system), is left out of the default total and starts unticked when a discrete card is present. An untouched picker sends that default to /load; ticking the iGPU by hand still works.
# Conflicts: # studio/frontend/src/hooks/gpu-vram.ts # studio/frontend/src/hooks/use-system.ts
|
The Main's frontend has not changed since its last green bundle check, so the few hundred bytes that cross the line come from the GPU selection changes here ( |
|
Pushed At Scope note: this changes what the UI counts and pre-ticks. Training's own Related: #8847 and #7307 (iGPU beside a Radeon card), #12650 (the Vulkan side of the same ranking). None of them is fixed by this alone. @codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Ran it on real hardware: 2x Radeon AI PRO R9700 + Ryzen 9 9950X iGPU (gfx1036), Windows 11, Adrenalin 26.9.2, torch 2.11.0+rocm7.14. I took the live device rows from the backend's
The |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ 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". |
# Conflicts: # studio/frontend/scripts/check-bundle-budget.ts
# Conflicts: # studio/frontend/scripts/check-bundle-budget.ts
|
Pushed @codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ 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". |
… About, not the system RAM it can borrow (unslothai#14317) Settings > About listed a Windows ROCm iGPU as `AMD Radeon(TM) Graphics · 36 GiB`. Only about 2 GiB of that is the iGPU's own memory. The rest is system RAM it can borrow, and every GPU can borrow system RAM, so listing it on that row makes the iGPU read like a 36 GiB card next to the 32 GiB R9700s. ## Fix - `/api/system/hardware` now passes `shared_memory`, `unified_memory` and `shared_memory_host_backed_gb` on each `gpus` row. - About shows the iGPU's own memory and marks it: `AMD Radeon(TM) Graphics · 2 GiB (integrated)`. The split uses the same `deviceSharedMemorySplitGb` as Settings > System. - An integrated GPU with no separate VRAM (NVIDIA GB10 / Jetson, where the whole total is host memory) keeps its total, e.g. `120 GiB (integrated)`. - Discrete cards and responses from older backends are unchanged. - New `settings.about.gpuIntegrated` string, translated in all 14 locales. - Bundle budget raised by this change: 474 B raw / 97 B transfer against `e326020`. ## Tests (measured at `c36c64e`, Windows 11, Node 24.15.0) - New `about-igpu-shared-memory.test.ts` uses the real rows from a 2x R9700 + Ryzen 9 9950X iGPU host (iGPU: 36.23 GiB total, 34.26 GiB host-backed). It checks the 2 GiB iGPU row, the discrete cards, the no-carve-out total, the older-row fallback, and that the route forwards the fields. It fails on main. - Related suites pass 22/22, backend `test_export_capability` and `test_system_vulkan_gpu_info` pass 32, and `tsc -b` is clean. I haven't taken a screenshot of the tab, and I haven't seen an Intel iGPU row. The backend has no shared-memory flag for XPU, so an Intel iGPU still shows its plain total. Related: unslothai#14039 (iGPU left out of the Train page total), unslothai#14040 (Live monitor VRAM), unslothai#13421. ## Before / after Settings > About on two isolated Studio installs (merge base `4b8447f` vs head), both fed the same `/api/system/hardware` GPU rows from the 2x R9700 + Ryzen 9 9950X iGPU host above. The iGPU row goes from `36 GiB` to `2 GiB (integrated)`; the discrete R9700 rows are unchanged.  On a real Strix Halo (Radeon 8060S, Windows 11, gfx1151) the backend reports 76.79 GiB total with 76.46 GiB host-backed: About reads `77 GiB` at the merge base and `0.3 GiB (integrated)` at the head. --------- Co-authored-by: Daniel Han <[email protected]>
# Conflicts: # studio/backend/utils/hardware/hardware.py # studio/frontend/scripts/check-bundle-budget.ts # studio/frontend/src/features/chat/api/chat-adapter.ts # studio/frontend/src/features/chat/hooks/use-chat-model-runtime.ts # studio/frontend/src/features/chat/shared-composer.tsx # studio/frontend/src/features/model-picker/components/model-config-page.tsx # studio/frontend/src/hooks/gpu-selection.ts # studio/frontend/src/hooks/use-gpu-info.ts
# Conflicts: # studio/frontend/scripts/check-bundle-budget.ts
A null /api/system fetch left the cache cold, so the reconcile returned no default pick and /load went out without gpu_ids. Also re-point two compare GPU-discovery contract markers at main's trimmed comment.
A successful /api/system response with an unavailable Vulkan inventory left no pinnable ids, so Automatic still loaded without gpu_ids.
Falling back to the kernel-less devices sized Train fit badges against VRAM training skips (unslothai#8792).
|
Pushed |
# Conflicts: # studio/frontend/scripts/check-bundle-budget.ts
Automatic on a mixed host sent the GGUF picker's discrete-only default to vLLM, SGLang and transformers loads too, turning a one-GPU default into tensor parallel over every discrete card. Those engines keep their own default device again.
Only a GGUF gets Automatic's default pick now, so an unpinned vLLM, SGLang or transformers load waited on GPU discovery (up to two 15 s fetches on a cold host) for nothing.
It may still be DiffusionGemma, whose /load rejects gpu_ids, so only a confirmed non-diffusion GGUF gets the default pick.
The training total drops a card torch can't run even when it's alone, which defaultGpuIds does not, so it isn't a mirror of it.
|
Pushed
Each of these has a test. CI is clean at |
…ckers /api/system marks ROCm rows the installed llama.cpp prebuilt has no kernels for (no_llama_kernels), from the same mapped_targets check the GGUF load already skips them by. The GGUF picker drops those rows and the diffusion/engine picker drops no_torch_kernels rows, so an iGPU nothing can run is no longer offered. A shared-memory GPU that llama.cpp can run stays offered, unticked by default.
/api/inference/status falls back to the resident slot, so a GGUF resident made an Automatic vLLM, SGLang or transformers pick wait on GPU discovery it never uses.
The host-RAM shortfall preflight read the ungated GPU probe, so an iGPU the installed llama.cpp has no kernels for (total 0) voided the check for the whole host. It now reads the same gated probe the launch uses. GPU fit capacity (Hub and recommended-model badges, the picker budgets) summed every device, so a dual R9700 host read 100 GiB with an unusable 36 GiB iGPU. The GGUF view now counts only cards llama.cpp can run and the torch view only cards torch can run; RAM math still sees every device.
Training's auto-select adds a shared-memory GPU torch supports once the discrete card alone is too small, so the discrete-only default total under-counted it. The torch view's memoryTotalGb already counts exactly the GPUs torch can run, so the Run preview and Train picker read it again and the separate default total is gone.
|
Pushed
Codex is clean at |
# Conflicts: # studio/backend/main.py
|
Pushed |
# Conflicts: # studio/frontend/src/hooks/use-gpu-info.ts # studio/frontend/src/hooks/use-system.ts
There was a problem hiding this comment.
Reviewed and tested at 9a8cafbc39, then pushed 5ca5e53071 with the fix below, on an M5 Mac with no GPU path exercised.
One failure from this PR, fixed in 58f8d85: tests/studio/test_model_picker_contracts.py::test_vulkan_inference_devices_are_the_pickable_set failed at 9a8cafb and passed at base 81803c7. a6f1308 added d.no_llama_kernels !== true to pinnable and d.no_torch_kernels !== true to diffusionPinnable in use-gpu-info.ts, but the contract still asserted the old lines. That was the red in Repo tests (CPU, studio). The contract now names both guards. 5ca5e53 also merges main at fd3bbb2 to clear a conflict in use-gpu-info.ts and use-system.ts.
What ran at 5ca5e53071:
- frontend
npm test: 16,942 pass, 0 fail; tsc --noEmit: clean;- the three touched contract files: 225 pass;
- backend
test_rocm_no_llama_kernels_flag,test_rocm_no_torch_kernels_flagandtest_llama_cpp_placement: 643 pass.
Other reds at 9a8cafb:
- Repo tests (CPU, rest-2) is
test_source_read_encodingflaggingtests/test_fused_label_smoothing.py:176, a file this PR does not touch. - Chat UI Tests on Windows ended with exit 143, which looks like the lane getting killed. I have not traced it.
These are unit and contract tests on a Mac. The hardware run is the 2x R9700 + gfx1036 one at 9a8cafb in the body's "Where it ran"; 5ca5e53 changes a test and merges main, so that run still stands for the picker code.
Codex is clean at 5ca5e53071 on the mirror (LeoBorcherding/unsloth#505).
On a Windows PC with two Radeon AI PRO R9700 cards (32 GiB each, gfx1201) and a Ryzen 9 9950X, the integrated "AMD Radeon(TM) Graphics" (gfx1036) reports 36 GiB, because that memory is shared system RAM:
Until this is fixed, a dual-R9700 run and its memory split can't be trusted on a desktop CPU with integrated graphics.
Before / after on the real box
2x Radeon AI PRO R9700 + Ryzen 9 9950X iGPU, Windows 11. Separate Unsloth Studio installs on that machine, main at the merge base (
77ecead) and this PR, all reading the same live device rows.Train page, Run preview (PR at
75529ff). The iGPU's shared system RAM gets counted as a third card: 100 GiB before, 64 GiB after.Chat, Run settings > GPUs, nothing picked yet (PR at
a6f1308, on Unsloth Studio's own llama.cpp prebuilt, which covers gfx1200/gfx1201). Before, the iGPU (GPU 2) is offered and switched on next to both R9700s. After, it isn't offered at all: that prebuilt can't run gfx1036, so the load would skip it anyway.Model hub, a 70B safetensors model (before at
75529ff, whose Hub fit math is main's; after at04658f7). Its 4-bit estimate is ~64.9 GB. Before, the fit counted the iGPU's 36 GiB and said "Likely fits"; after, it's priced on the two R9700s' 63.72 GiB and says "Over VRAM budget". The VRAM tile drops the unusable iGPU too: "66 GiB VRAM + 34 GiB shared" -> "64 GiB VRAM".Why
memoryTotalGb, which summed every GPU ROCm reports, including one PyTorch can't run._rocm_arch_gate_keep, frommapped_targetsinUNSLOTH_PREBUILT_INFO.json), and training skips one PyTorch has no kernels for ([Bug] AMD: training auto-selection picks a gfx1036 iGPU the torch wheel has no kernels for — "CUDA error: invalid kernel file" #8792). The UI never read either signal, nor theshared_memory/unified_memorymarks on the iGPU.Fix
/api/systemnow carryno_torch_kernels: truefor a GPU the installed PyTorch can't run (the samerocm_gpu_ids_without_torch_kernels()training uses) andno_llama_kernels: truefor one the installed llama.cpp prebuilt can't run (the samemapped_targetscheck the GGUF load uses). Both fail open when coverage is unknown, e.g. a source-built llama.cpp with no install marker.no_llama_kernelsGPU, and the diffusion / engine picker, which runs on PyTorch, no longer offers ano_torch_kernelsone. A pick saved before a card was flagged drops it instead of failing the load. A shared-memory GPU llama.cpp can run stays offered but starts unticked beside a discrete card (that default is what/loadsends). With no discrete card (an APU alone, Apple, a single iGPU) nothing changes.memoryTotalGb,maxDeviceMemoryGb,deviceCount, which the Hub and recommended-model fit badges, picker budgets and VRAM tiles read) now counts only cards the view's engine can run: the GGUF view dropsno_llama_kernelscards, the PyTorch view dropsno_torch_kernelscards. The Train page's VRAM row and model fit badges read the PyTorch view, which is the set training's auto-select draws from (it adds a shared-memory GPU PyTorch can run once the discrete card alone is too small). RAM math still sees every device, since a shared pool is host RAM either way.(2, 35926 MiB free, total 0)on this box, and its "total 0 means unknown ceiling" exit silenced the warning for the whole host. It now reads the same gated probe the launch uses (GPU 0 and 1 only). A lone APU llama.cpp can run still reports total 0 and keeps today's behaviour.Tradeoff: in the chat GPU picker, a Strix Halo APU next to a dGPU also starts unticked, so a model that doesn't fit the dGPU spills to CPU unless the APU is ticked by hand.
Same root cause as #12650 on the Vulkan path.
Tests
Hardware is pinned in every test; none read the host's GPUs.
studio/backend/tests/test_rocm_no_torch_kernels_flag.py: the flag is set only on an uncovered card. Fails on main, passes here.studio/backend/tests/test_rocm_no_llama_kernels_flag.py: the llama.cpp flag is set only on an uncovered card, and fails open on unknown targets, non-physical rows and a failed probe.studio/frontend/tests/igpu-default-selection.test.ts: GPU capacity per engine view (99.95 to 63.72 GiB with the flagged iGPU; a shared-memory GPU PyTorch can run still counts for training), default ids, Automatic vs manual picks, and each picker dropping only the cards its own engine can't run (those two fail without the fix).studio/backend/tests/test_llama_cpp_placement.py::test_the_route_precheck_ignores_a_gpu_llama_server_cannot_run: the warning still fires with an uncovered iGPU on the host; fails without the fix.Where it ran (measured at
9a8cafb)mapped_targetsgfx1200, gfx1201)/api/systemmarks the iGPUno_torch_kernels: trueandno_llama_kernels: truelive; both R9700s are clean in the PyTorch and llama.cpp views. In the app: Train VRAM 64 GiB, Hub tile 64 GiB with the 70B at Over VRAM budget, chat picker lists GPU 0 and 1 only. A Qwen3.8-27B Q4_0 load at 256K context withgpu_ids [0,1]ran on ROCm0 and ROCm1 only (6.9 + 7.7 GiB of weights, 8 GiB of KV each) and generated text.test_llama_cpp_placement.py, the system GPU suites), the GPU/VRAM frontend suites 241/241,tscclean. The full frontend suite fails the same 27 files as main at81803c7, none of them GPU code.The screenshots above are from earlier heads (Train at
75529ff, picker ata6f1308, Hub at04658f7). The re-run at9a8cafbmatched each of them, so they weren't replaced.Not run in the app: the host-RAM warning. Firing it needs a GGUF bigger than 64 GiB of VRAM plus 62 GiB of RAM, so it's covered by the real probe on that box and a unit test.