Repository navigation
[Bug] AMD: Unsloth Studio / Desktop VRAM tile reads Unknown when an unreadable shared iGPU sits beside discrete cards that report usage - #17523
Conversation
…GPU is unreadable On a host with discrete cards plus an integrated GPU that has no usage counter, resolveGpuVramUsedGb returned null, so Settings > Live monitor read "Unknown / 65.7 GiB VRAM + 34.3 GiB shared" even though both discrete cards reported. Sum the readable devices when every unreadable one shares host memory and at least one discrete card is present; a host aggregate still wins.
…of folding it into VRAM used Summing only the readable cards still paired that usage with the iGPU's capacity, so its whole shared pool read as free. Move the iGPU to the display's shared group instead, so used, free and capacity cover the same cards and the iGPU gets the existing shared-RAM line.
An unreadable shared iGPU now sits under Shared with system RAM, but it has no free reading, so the VRAM tile and the floating monitor printed a dangling 'Estimated available: Unknown'. Keep the label and drop the estimate line when nothing reports free memory.
Codex Review Summary: ✅ CompletedThis 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. |
|
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". |
…ix Halo carve-out change [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ffe99a72f
ℹ️ 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".
| const rest = devices.filter((device) => !hasSharedMemoryHeadroom(device)); | ||
| const unread = rest.filter((device) => !Number.isFinite(device.vram_used_gb)); | ||
| return unread.length > 0 && | ||
| unread.every(sharesHostMemoryDevice) && |
There was a problem hiding this comment.
Preserve dedicated APU memory when parking unreadable devices
On a Linux ROCm host with no usage aggregate, an APU can have unified_memory: true and shared_memory_host_backed_gb: 0, the measured dedicated-carve-out case covered by unified-memory-apu-totals.test.ts. If its usage counter is unavailable beside a readable discrete card, this predicate parks it because sharesHostMemoryDevice checks only the flags, ignoring the measured split. Removing it from usageDevices then makes Settings lose real dedicated capacity: a 64 GiB APU plus a 16 GiB card becomes a 16 GiB VRAM tile, with the APU incorrectly classified as shared system RAM. Retain devices whose measured host-backed portion is zero.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e07b17f: an unreadable device is parked as shared RAM only when its host-backed split is not measured as zero, so a dedicated carve-out APU stays on the VRAM tile. Test added.
…n the VRAM tile [skip ci]
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e07b17f50c
ℹ️ 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".
| // A measured zero host-backed split is a dedicated carve-out (Linux ROCm APU), not shared RAM. | ||
| function parkableSharedDevice(device: GpuDevice): boolean { | ||
| return ( | ||
| sharesHostMemoryDevice(device) && device.shared_memory_host_backed_gb !== 0 |
There was a problem hiding this comment.
Preserve large carve-outs with nonzero host-backed memory
When an unreadable Windows ROCm Strix Halo APU sits beside a readable discrete GPU and there is no host aggregate, this predicate also accepts APUs with substantial measured dedicated memory. A fresh reproduction using the 107.92 GiB total / 12.1 GiB host-backed fixture from strix-halo-memory-display.test.ts plus a 24 GiB card makes gpuMemoryDisplay park the APU, so Settings loses its 95.82 GiB carve-out and reports 24 GiB instead of 119.82 GiB. Besides protecting measured-zero splits, retain devices recognized as carve-outs by carveOutVramGb rather than classifying them entirely as shared system RAM.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 59e6c82: parking now uses the carve-out rule (dedicated >= shared stays VRAM), so the 107.92 / 12.1 GiB Strix Halo beside a 24 GiB card reads 119.82 GiB. Test added.
…, never a carve-out APU [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
…nitor (unslothai#17508) With a GGUF model loaded, the live monitor (floating and Settings > System) splits the memory bars per model. With an AMD Ryzen AI NPU model loaded (FastFlowLM through Unsloth Studio's private Lemonade server) there was no breakdown, and no sign of the NPU at all. - For a resident NPU model, `/api/inference/status` reports `resident_mib` as the RSS of lemond's process tree, floored at the catalog size, with `resident_on_gpu: false`. The Loaded models label gains an NPU case. - An NPU card in both monitors, shown only when `/api/npu/status` reports a supported XDNA 2 NPU: device, driver, and the resident model with its size in system RAM. - On Windows, `/api/system` adds `npu_load_percent`, read from the GPU Engine counters for the NPU's adapter LUID (DEVPKEY_GPU_LUID), the source Task Manager's NPU graph uses. Linux has no counter (amdxdna exposes no busy file; fdinfo busy time arrives in kernel 7.4), so the card shows no load there rather than 0%. Tests: new backend tests (process-tree RSS, catalog floor, unloaded NPU, 9 for the load reading) and frontend tests for the label, the card and its strings in all 25 locales. Typecheck is clean. Run on Windows 11, Ryzen 9 9950X, two R9700, no NPU: the LUID-to-counter lookup returned a real R9700's load. Not run on a Ryzen AI NPU. ## Screenshots NPU spoofed: fake Lemonade/FastFlowLM on a Windows 11 PC with no NPU; no speed numbers. Before | after: fork phase stack, phase 4 `49a3094` | phase 5 `db8d450`. Shot at `db8d450`; this PR's head has since moved to `2ed8460` (LUID lookup throttle and an import path, no visible change). Light mode, mint theme, glass on, same on both sides. Before | after: Settings > System > Live monitor gets an NPU tile with the device, driver and the resident model's size in system RAM. The VRAM tile change is unslothai#17523.  Before | after: the floating Live monitor gets an NPU row with the resident model.  ## Real NPU and before/after evidence Run on a real XDNA 2 NPU (Ryzen AI Max+ 395, Windows 11, NPU driver 32.0.20102.4480, Lemonade 2026.44.1, FastFlowLM 1.0.12), with Studio's own NPU backend loading `qwen3:0.6b` and generating (11 runs, about 104 tok/s): | reading | this PR | independent GPU Engine counter read | |---|---|---| | NPU load while generating, max / median | 98.8% / 94.4% | 99.3% / 97.9% | | model loaded, idle | 0.0% | | | after unload | 0.0% | | | resident size | 2021 MiB, `resident_on_gpu: false` (catalog floor 619 MiB) | | | resident size after unload | null | | The NPU's DEVPKEY_GPU_LUID is one of the adapter LUIDs Windows lists under GPU Adapter Memory, and the merge base has no NPU reading at all. On Linux (same hardware, amdxdna 2.25) the NPU is detected and the load reads null, as intended. Before (merge base) | after (this PR), Chromium. NPU responses spoofed per side with what each side's backend returns for a resident FastFlowLM model; hardware fields are the real box's. Floating live monitor: an NPU row with the load and the resident model's size in system RAM.  Settings > System > Live monitor: an NPU tile with the device, driver, load and resident model.  --------- Co-authored-by: oobabooga <[email protected]> Co-authored-by: Daniel Han <[email protected]> Co-authored-by: Daniel Han <[email protected]>
On a Windows host with 2x Radeon AI PRO R9700 plus the CPU's integrated Radeon Graphics, Settings > System > Live monitor reads "Unknown / 65.7 GiB VRAM + 34.3 GiB shared".
/api/systemreports realvram_used_gbfor both R9700s (21.75, 1.97), but the iGPU's is null and there's no host aggregate, soresolveGpuVramUsedGbreturns null for the whole tile.gpuMemoryDisplaynow moves a shared device with no usage counter into the shared group when every discrete card reports usage and there's no host aggregate. The tile then reads 23.7 / 63.7 GiB with free taken from the same cards, and the iGPU shows on the existing "Shared with system RAM" line. A host aggregate, an unreadable discrete card, or an APU on its own behave as before. It doesn't touch #17509's carve-out logic and merges cleanly with it.Tests
vram-tile-unreadable-igpu.test.tsuses the reporter's device list: it fails on main and passes here. The existinggpu-memory-display,rocm-windows-vram-aggregateandgpu-vram-splitsuites still pass, and so do #17509's tests on a merge with it.Tested on Windows 11, Ryzen 9 9950X + 2x R9700 + integrated Radeon Graphics: frontend unit tests and typecheck. Not checked in the running app.
Screenshots
NPU spoofed: fake Lemonade/FastFlowLM on a Windows 11 PC with no NPU; no speed numbers. Before | after: fork phase stack, phase 4
49a3094| phase 5db8d450. Shot atdb8d450; this PR's head has since moved to80154bb(06a0c5dand80154bbdrop the "Estimated available: Unknown" line still visible in these shots). Light mode, mint theme, glass on, same on both sides.Before | after, 2x R9700 plus an unreadable iGPU: the VRAM tile reads "16.4 GiB / 63.7 GiB" instead of "Unknown", with the iGPU on a "Shared with system RAM" line. The NPU tile is #17508.

Before | after: the floating monitor moves the iGPU under "Shared with system RAM" next to the two R9700s. The NPU row is #17508.

Before / after (Studio built from merge base and from this branch)
/api/system'sgpublock stubbed with the reporter's 2x R9700 + unreadable iGPU reading; everything else is the real server. The VRAM tile goes from "Unknown / 65.7 GiB VRAM + 34.3 GiB shared" to "23.7 GiB / 63.7 GiB, 40 GiB free, Shared with system RAM".Floating monitor: the iGPU moves under "Shared with system RAM" beside the two R9700 rows.
