Repository navigation
Conversation
… size The probe prints the runtime's own allocations and the driver's numbers for the card, but not the two that decide whether an allocation survives: VK_EXT_memory_budget's heapUsage and heapBudget over the device-local heaps. read_vram_budget already reads them and memory_figures already has the struct, so this is the print. On the RTX 4090 here it reads 'VRAM 1.4/22.8 GB' at start and 'VRAM 6.8/22.8 GB' once the title is up; when the extension or the device does not report it the part is empty rather than 0/0, measured by forcing the guard off. The gap matters because the budget is 23370 MiB on a 24138 MiB heap, and it is the budget a title that settles at 7.7 GB already exceeds on an 8 GB card.
|
Verified by OreoFR on macOS 27.2.1, Apple M5, head READ IN CODE
ASSUMED
Nit: the README's AI-assisted: Claude Code |
KelboLive
left a comment
There was a problem hiding this comment.
The pair is the right one: both numbers come from the same vkGetPhysicalDeviceMemoryProperties2 budget struct and are summed over the same DEVICE_LOCAL heaps (runtime/src/vulkan_memory_budget.h:19-43), and it is the reader the runtime's own "does a local allocation survive" gate already uses (d3d12_vulkan_device.cpp:6446-6450), so used and budget are comparable. On this machine the reader reports 301 of 15293 MiB against a 16 GB card, as the PR says.
Edge cases hold: no extension, no device or a zero local budget means available = false and no suffix (no 0/0), and used > budget is printed raw (23.5/22.8) with no division to blow up.
Two real gaps:
- Nothing tests the line.
describelives only in the shim and no runtime test prints it — the prebuiltd3d12_vram_budget_test,title_hud_testanddev_overlay_testall pass regardless of what this suffix says, so a swapped pair, a wrong scale or a droppedavailableguard would go unnoticed (your control was a manual run). Extracting avram_suffix(const VramBudget&)(or a formatter inmemory_figures.h) and testing available / unavailable / zero-budget / over-budget would make it a regression test rather than a checked-by-eye line. - The line still reads
VRAM 6.8/22.8 GBwithout the word "budget", which is exactly the confusion the PR sets out to end — a reader takes 22.8 for the card's size.VRAM 6.8 of 22.8 GB budgetis enough;vram_text(memory_figures.h:45-49) already has a wording you could reuse, though it adds+sharedandn/a.
Scoping note: the suffix is local-only while vram_text shows +shared; the used/budget pair stays comparable, but if the title spills into shared heaps the displayed "used" understates total GPU memory — worth stating. Also, LEONIDA_VRAM_BUDGET_MB (#2765) is not in this tree yet; if it lands, decide whether this line shows the override or the driver's live budget, since they will differ.
|
Measured the budget-suffix path on AMD and NVIDIA with AI-assisted with OpenAI Codex. |
|
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime ( |
mem-probeprints the runtime's allocations and the card's numbers, but not the pair that decides whether an allocation survives:VK_EXT_memory_budget'sheapUsageandheapBudget. This adds them to the line.Why it matters, and why the card's size is the wrong number: on this machine,
VkMemoryHeap.size, device-localheapBudget, device-localThe budget is 768 MiB under the heap, and the run went 687 MiB past the budget. On the 8 GB class the gap is the whole bug: the title settles at 7.7 GB, which is already over that card's budget before the story's burst arrives - so "GPU usage reaches 7 GB" was reading the honest number and comparing it against the wrong ceiling.
What changed, in
runtime/shims/d3d12_vulkan_device.cpp, 14 lines:read_vram_budget(d.info)- it already exists, andmemory_figures::VramBudgetalready haslocal_usageandlocal_budget, so this is the print, not new machinery;textgoes from 512 to 768 bytes, since the line grows by up to 24;0/0, when there is nothing to report (available == false: no extension, no device, or no device-local budget) - the same rulevram_textfollows;memory_figures.his not included by this file, so the two numbers are formatted here with the samedouble(x) / (1ull << 30)shape rather than pullingvram_textin.Measured, on the RTX 4090 / driver 621.24 /
maind8ca18240plus this diff, Release, real run:The last line is the control: with
budget.availableforced false the suffix disappears, so the empty case is the guard and not an accident of formatting, and the number tracks the run (1.4 → 6.8 as the title came up).What this does not do: it does not gate on the budget. It makes the number visible so the next report can say "18.2 of a 19.4 GB budget" - deciding what to do at 90% of it is a separate change, and the gate is in
runtime/shims/d3d12_vulkan_device.cpparound line 6447, which I did not touch.AI-assisted: yes - DeepSeek v4.1 (flash) wrote, built, ran and mutated it on the machine above. Suggested from #2607, where the burst that loses an 8 GB card's device finally had a number to compare against.
Written with an AI assistant.