Skip to content

Unsloth Studio (AMD): leave an iGPU out of the Train page VRAM total and the default GPU pick (blocks dual R9700 testing) - #14039

Open
LeoBorcherding wants to merge 39 commits into
unslothai:mainfrom
LeoBorcherding:fix/igpu-vram-total
Open

LeoBorcherding wants to merge 39 commits into
unslothai:mainfrom
LeoBorcherding:fix/igpu-vram-total

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • the Train page shows VRAM 100 GiB (32 + 32 + 36);
  • the chat run settings list GPU 2 (the iGPU) and tick it by default, even though the installed llama.cpp has no kernels for it and the load quietly skips it.

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.

Train page Run preview VRAM, before 100 GiB, after 64 GiB

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.

Chat GPU picker, before GPU 0-2 on, after only GPU 0 and 1 listed

Model hub, a 70B safetensors model (before at 75529ff, whose Hub fit math is main's; after at 04658f7). 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".

Model hub fit badge, before Likely fits, after Over VRAM budget

Why

  • The Train page VRAM row printed memoryTotalGb, which summed every GPU ROCm reports, including one PyTorch can't run.
  • The GPU picker treats "nothing picked" as "every GPU ticked".
  • The picker lists every GPU ROCm reports, whether or not the engine has code for it. The GGUF load already skips a GPU the installed llama.cpp prebuilt has no kernels for (_rocm_arch_gate_keep, from mapped_targets in UNSLOTH_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 the shared_memory / unified_memory marks on the iGPU.

Fix

  • Backend: ROCm rows in /api/system now carry no_torch_kernels: true for a GPU the installed PyTorch can't run (the same rocm_gpu_ids_without_torch_kernels() training uses) and no_llama_kernels: true for one the installed llama.cpp prebuilt can't run (the same mapped_targets check the GGUF load uses). Both fail open when coverage is unknown, e.g. a source-built llama.cpp with no install marker.
  • Frontend: the GGUF GPU picker no longer offers a no_llama_kernels GPU, and the diffusion / engine picker, which runs on PyTorch, no longer offers a no_torch_kernels one. 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 /load sends). With no discrete card (an APU alone, Apple, a single iGPU) nothing changes.
  • GPU capacity (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 drops no_llama_kernels cards, the PyTorch view drops no_torch_kernels cards. 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.
  • Host-RAM shortfall warning: it read the unfiltered GPU probe, which returns that iGPU as (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.
before after
Train page VRAM, 2x R9700 + iGPU 100 GiB 64 GiB
Chat GPU picker, iGPU llama.cpp can't run offered, ticked not offered
Chat GPU picker, shared-memory GPU llama.cpp can run offered, ticked offered, unticked
Hub fit, 70B safetensors (~64.9 GB at 4-bit) Likely fits (vs 100 GiB) Over VRAM budget (vs 63.72 GiB)
Host-RAM shortfall warning with this iGPU present never shown shown when the load won't fit
Single discrete card, or iGPU only unchanged unchanged

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)

machine what ran
2x R9700 + 9950X iGPU (gfx1036), Windows 11, Adrenalin 26.9.2, torch 2.11.0+rocm7.14, stock llama.cpp prebuilt (mapped_targets gfx1200, gfx1201) /api/system marks the iGPU no_torch_kernels: true and no_llama_kernels: true live; 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 with gpu_ids [0,1] ran on ROCm0 and ROCm1 only (6.9 + 7.7 GiB of weights, 8 GiB of KV each) and generated text.
Mac (no AMD GPU) Backend 650/650 (the new flag tests, test_llama_cpp_placement.py, the system GPU suites), the GPU/VRAM frontend suites 241/241, tsc clean. The full frontend suite fails the same 27 files as main at 81803c7, none of them GPU code.

The screenshots above are from earlier heads (Train at 75529ff, picker at a6f1308, Hub at 04658f7). The re-run at 9a8cafb matched 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.

…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
@danielhanchen

Copy link
Copy Markdown
Member

The Frontend build + bundle sanity failure comes from this PR:

over the startup budget: transfer 1997.8 KB > 1997.8 KB, raw 6642.0 KB > 6642.0 KB

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 (gpu-selection.ts, use-gpu-info.ts, use-system.ts and the two components). The budget leaves almost no headroom on purpose. If the growth is expected, raise transferBytes / rawBytes in studio/frontend/scripts/check-bundle-budget.ts in this PR, with an attribution line in the BUDGET comment block like the earlier raises.

@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Pushed 1f258dc: merged main (88afa84) and raised the bundle budget in check-bundle-budget.ts by this PR's growth, with an attribution line. Measured on the same machine and build: 460 B raw / 90 B transfer (6,840,406 -> 6,840,866 B raw, 2,059,667 -> 2,059,757 B transfer against 88afa84, chunk count 96).

At 1f258dc (Windows 11, Node 24.15.0): the touched and related frontend suites pass 35/35, test_rocm_no_torch_kernels_flag.py passes 3/3, and tsc -b is clean.

Scope note: this changes what the UI counts and pre-ticks. Training's own auto_select_gpu_ids is unchanged. It already skips cards without torch kernels and ranks a discrete card ahead of a ROCm APU, but it can still add a shared-memory iGPU when one card isn't enough.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-19T14:52:20.606656Z b762dd7 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

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 _get_cached_system_gpu_info (the data behind /api/system) on a build with this PR, then fed the same rows through main's frontend code (88afa84) and this PR's (1f258dc).

main 88afa84 this PR 1f258dc
iGPU row shared_memory: true, unified_memory: true, 36.23 GiB same, plus no_torch_kernels: true
Train page VRAM 99.95 GiB 63.72 GiB
GPUs ticked by default 0, 1, 2 0, 1

The no_torch_kernels path now fires on real hardware: the installed rocm7.14 wheel has no gfx1036 kernels, so this replaces the "mocked test only" line in the body. I haven't taken a screenshot, because the UI on this build needs a login I didn't set up.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

# Conflicts:
#	studio/frontend/scripts/check-bundle-budget.ts
# Conflicts:
#	studio/frontend/scripts/check-bundle-budget.ts
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Pushed b762dd7: merged main again (4ea4c75). Main had raised the bundle budget twice since 1f258dc, so I took its values and re-added this PR's growth on top: 457 B raw / 51 B transfer, measured against 4ea4c75 on the same machine and build. Bundle check passes locally, the touched suites pass 35/35, and tsc -b is clean.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 20, 2026
… 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.

![Settings > About GPU rows, before vs
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/14317/pr14317_pair_00-35b82b22eaf5.png)

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).
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Pushed 166ab0230c on top of a merge of main at 06314b97dd. The merge's only conflict was the bundle budget, re-measured on main's lower ceiling. Follow-up commits make the GPU device cache warm retry once when /api/system fails or Vulkan discovery is still pending, so an Automatic load still gets its default pick (no iGPU beside a discrete card) instead of going out without gpu_ids, and leave the default VRAM total at 0 when no GPU has torch kernels instead of counting cards training skips; tests added. Typecheck clean, frontend tests pass. Codex is clean at this head on the mirror (LeoBorcherding/unsloth#505).

# 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.
@LeoBorcherding

LeoBorcherding commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

Pushed 75529ffd20, a comment-only fix on top of 8120bef62e (the note on the default VRAM total overclaimed what training does with kernel-less GPUs). Codex is clean at this head on the mirror (LeoBorcherding/unsloth#505). Since the last update, the review rounds added:

  • a retry of the GPU device cache warm when /api/system fails or Vulkan discovery is still pending;
  • the Automatic default pick only for confirmed non-diffusion GGUF loads, so vLLM, SGLang, transformers, diffusion and unclassifiable GGUFs keep their own default device;
  • a 0 default VRAM total when no GPU has torch kernels;
  • a merge of main at 77ecead09a.

Each of these has a test.

CI is clean at 75529ffd20: 58 checks pass, 0 fail. The 3 Core zoo jobs were cancelled at the 35-minute job limit (job). They run unsloth-zoo's own suite, which this PR doesn't touch, and all 3 non-zoo Core jobs pass.

…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.
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Pushed a6f1308..f88914d since 75529ff:

  • a6f1308: the GPU pickers hide cards that the installed llama.cpp prebuilt or torch has no kernels for. On a 2x R9700 + gfx1036 iGPU box, the iGPU is no longer listed.
  • 77343cf: the chat GPU cache only warms for a resident GGUF when it's the current pick.
  • 04658f7: Hub and recommended fit badges, and the host-RAM warning, count only the GPUs each engine can run. An uncovered iGPU's total-0 row no longer skips the warning check.
  • 5bee79e: comment-only, aligned three GPU-capacity notes with the hiding change.
  • f88914d: the Train page sizes on every GPU torch can run, matching what training auto-selects. The separate default total is removed.

Codex is clean at f88914d on the mirror (LeoBorcherding/unsloth#505).

@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Pushed 9a8cafb: merged main at 81803c7. The only conflict was studio/backend/main.py, where main moved the gpu_ids probe into _gguf_pin_support. The ROCm no-kernels flag call now runs after it. I also shortened two comments in use-chat-model-runtime.ts. Codex is clean at 9a8cafb on the mirror (LeoBorcherding/unsloth#505).

# Conflicts:
#	studio/frontend/src/hooks/use-gpu-info.ts
#	studio/frontend/src/hooks/use-system.ts

@LeoBorcherding LeoBorcherding left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_flag and test_llama_cpp_placement: 643 pass.

Other reds at 9a8cafb:

  • Repo tests (CPU, rest-2) is test_source_read_encoding flagging tests/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).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants