mem-probe: the line says VRAM used of the budget, not just the card's size #2793
Closed
github-bot
wants to merge 1 commit from
github-bot/gh-2793 into main
AGit
pull from: github-bot/gh-2793
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2793
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2793"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@fiestorra on GitHub · 2026-11-30 21:30 UTC · original
fiestorra:mem-probe-vram-budget→main· +14 −3 · 1 files · 1 commits · closed without mergingmem-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.
@OreoFR on GitHub · 2026-11-30 21:33 UTC · original
Verified by OreoFR on macOS 27.2.1, Apple M5, head
17667177a, main0b6e0e3bc. Read-only review:runtime/shims/d3d12_vulkan_device.cppis only built on Windows (gta6rt_d3d12_com), so the Mac can't compile or run this change.READ IN CODE
read_vram_budget(const VulkanDeviceInfo&)is declared at line 3663 and defined at line 21738 of the PR's file, and is already used at lines 6446, 21778 and 30735.leonida::VramBudget(runtime/src/memory_figures.h:31) hasavailable,local_usageandlocal_budget, so this is a new print only.read_vram_budgetreturns{}(available == false) whenmemory_budget,get_instance_procorinstanceis missing, so the part stays empty. It queriesvkGetPhysicalDeviceMemoryProperties2on the physical device, which needs no external sync, so calling it from the probe lambda without taking a lock is fine.vrampart is at most about 40 characters (; VRAM %.1f/%.1f GB), it fits inchar[96], andtextgrows from 512 to 768.snprintftruncates in any case.%sis the last conversion andvramthe last argument, so the order matches. Nothing in the repo parses the end of the[rt] mem-probeline afterpipeline notes. Only theLEONIDA_MEM_PROBEREADME row describes the line, and it does not list every field.ASSUMED
/W4and that the numbers match your table. A Windows build or a run is needed for both.Nit: the README's
LEONIDA_MEM_PROBErow could mention the newVRAM used/budgetpart, but that's optional.AI-assisted: Claude Code
@KelboLive on GitHub · 2026-12-01 05:40 UTC · original · reviewed
The pair is the right one: both numbers come from the same
vkGetPhysicalDeviceMemoryProperties2budget 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 = falseand no suffix (no0/0), and used > budget is printed raw (23.5/22.8) with no division to blow up.Two real gaps:
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.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_textshows+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.@merzleckeier on GitHub · 2026-12-01 12:44 UTC · original
Measured the budget-suffix path on AMD and NVIDIA with
17667177a+6c7f6b60c. I ran the exact suffix formatting against the project budget helper. A synthetic case with two device-local heaps and one host heap printedVRAM 6.5/7.5 GB. With no device-local budget or no budget result it emitted an empty suffix. WithVK_EXT_memory_budgetenabled on both live Vulkan devices, the helper returned local budgets of 10630 MiB (RADV) and 9221 MiB (NVIDIA), which formatted as 10.4 and 9.0 respectively. This exercised the device query and suffix formatting in an isolated native harness. The full runtime sampler was outside this run.AI-assisted with OpenAI Codex.
@aslan2142 on GitHub · 2026-12-01 16:46 UTC · original
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 (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed