leonida-gpu: LEONIDA_VRAM_BUDGET_MB sets the card's budget in place of the system's #2765
Closed
github-bot
wants to merge 2 commits from
github-bot/gh-2765 into main
AGit
pull from: github-bot/gh-2765
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!2765
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2765"
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?
@ajussak on GitHub · 2026-11-30 16:46 UTC · original
ajussak:feat/vram-budget→main· +130 −4 · 4 files · 2 commits · closed without mergingWhat and why
Under Wine or Proton the budget DXGI reports for the card is what Vulkan reports as left to the process,
not what the card has free, and above the card's free memory NVIDIA's driver fails allocations instead of
moving them to the PC's memory as Windows does (GPU faults, Xid).
LEONIDA_VRAM_BUDGET_MBsets the budgetthe runtime works to instead:
Host::video_memoryhands it to every decision on the card's memory (thetexture queue's room, the card copies of title buffers, the staging per frame). Unset, empty or not a
number of MB: the system's, as before. The log says it once, with the system's budget beside it.
Tests
cargo xwin test -p leonida-gpu --target x86_64-pc-windows-msvcunder Wine 11.21, RTX 3060 Ti(NVIDIA 620.73.4): 569 passed, 3 failed, 52 ignored. The resource tests are 21/21, including
resource::tests::a_fixed_card_budget_is_a_size_in_mb(failing before, passing after) andresource::tests::texture_floor_scales_with_vram_budget. The three failures arewatch::(
holes_are_known_until_the_runtime_tells,no_mapping_is_lost_between_askers,what_is_left_alone_is_no_known_hole), the ones that fail under Wine onmainwithout this change.LEONIDA_VRAM_BUDGET_MB=7000on an RTX 3060 Ti 8 GB (NVIDIA 620.73.4, GE-Proton11-14): noXid, the card held about 600 MB more.
d3d12/docs/switches.mdregenerated withtools/d3d12_switches.py;--checkpasses. The page alsolists the three names
mainadded since it was last made (LEONIDA_CAPTURE_SHOWN,LEONIDA_FG_RESET_STALE,LEONIDA_TIMELINE_STALL_MS).Notes
Rebased onto
mainat35e75b7a9; no other change. Independent of the Linux launcher work: nothing heretouches
scripts/, and the variable is read where the card's budget is decided, so the two merge in eitherorder.
Item:
LEONIDA-GPU-VRAM-BUDGET-MB, claimed in#2570.
AI-assisted (Claude Code).
github-bot referenced this pull request2026-11-30 20:27:34 +00:00
@Kal0s-design on GitHub · 2026-11-30 20:28 UTC · original
Native Windows check of
bd0114806(on its base35e75b7a9). Windows 11, MSVC x64, Rust 1.98.1, hardware GPU,cargo test -p leonida-gpu --lib, native rather than xwin/Wine.watch::tests that fail in your Wine run (holes_are_known_until_the_runtime_tells,no_mapping_is_lost_between_askers,what_is_left_alone_is_no_known_hole) pass here, which supports your reading that they're Wine-only and not this change.resource::tests: 19 passed, includinga_fixed_card_budget_is_a_size_in_mb,texture_floor_scales_with_vram_budgetandbudget_capped_keep_evicts_before_vram_pressure.fixed_card_budgetis new, E0425).main(d8ca18240).git mergeconflicts ind3d12/docs/switches.mdonly. Since that page is generated, regenerating it withtools/d3d12_switches.pyafter mergingmainshould be enough.Not covered: a run with
LEONIDA_VRAM_BUDGET_MBin the title (native Windows wasn't the case it's for).AI-assisted: yes
bd01148063to5122c6acdc@ajussak on GitHub · 2026-11-30 20:57 UTC · original
Thanks — that closes the two things I could not check here: the three
watch::failures are Wine-only, andresource::is green on plain MSVC.The conflict you flagged is handled: rebased onto
d8ca18240and, as you suggested,d3d12/docs/switches.mdregenerated withtools/d3d12_switches.py(--checkpasses). It also picks upLEONIDA_FRAME_TIMES,LEONIDA_MERGE_CARD_COPIES,LEONIDA_MERGE_PC_COPIES,LEONIDA_PIPELINE_AWAIT_FIRSTand theLEONIDA_ABcolumn ofLEONIDA_HOST_RDNAandLEONIDA_NAN_EXACT, whichmainadded after the page was last made.cargo xwin test -p leonida-gpu resource::under Wine on the new base: 21 passed; the PR is mergeable again (5122c6a).Agreed on the last point: the one number I have for the title with the variable set is a Wine run (7,000 MB on an RTX 3060 Ti 8 GB, no Xid). A native Windows run is the case the variable was written for, if you or anyone can try it.
5122c6acdctof49a9eb5b4f49a9eb5b4tocba289aeff@fiestorra on GitHub · 2026-12-01 02:23 UTC · original
The code is fine and its test passes; the docs table is what conflicts, and the branch is carrying commits
maindoes not have - so it needs a rebase before it can be merged.Measured on
maind920d850d:And the tree pieces:
0commits from the merge base tomainwhile the file differs at both ends means the merge base is not behindmain- the branch contains commitsmaindoes not have, andswitches.mdis where they meet. That is a rebase, not a code problem.The code, applied on its own to
main, is clean and its test passes:So
fixed_card_budget(setting: Option<&str>) -> Option<u64>lands and answers:mb << 20for a whole number of MB in256..=1 << 20,Noneotherwise or unset - and the doc comment's claim that an unset value means the system's budget is the behaviour the test covers.What I could not verify: the part of the comment that matters most - "set above what the card has free, allocations fail rather than move to the PC's memory" - needs a title allocating against a constrained budget, which needs the game. I did test that shape once from the outside (
VK_EXT_memory_budget, whereheapBudgetwas 23,370 MiB on a 24,138 MiB heap), so the switch is aimed at something real; whether it behaves as described under Wine is not something this machine can show.AI-assisted: yes - DeepSeek v4.1 (flash), which applied the code alone after the full cherry-pick conflicted.
Written with an AI assistant.
cba289aeffto94c350753c@ajussak on GitHub · 2026-12-01 02:40 UTC · original
Thanks for the trace. The conflict is the generated page, and that is the only thing in this branch that moves:
d3d12/docs/switches.mdcomes from the sources (tools/d3d12_switches.py), andmainhas rewritten it four times in the last 59 commits, so it conflicts on every rebase. Regenerating it on the new base is the whole resolution, and--checkpasses afterwards.Rebased onto
90c514437and pushed (94c3507):cargo xwin test -p leonida-gpu resource::under Wine, 21 passed; the PR is mergeable again. The page's diff is nowLEONIDA_VRAM_BUDGET_MBplus whatmainchanged in it since it was last made (LEONIDA_WC_SUBRANGE_NO_BACK, the source cells ofLEONIDA_TAKE_BLOCKSandLEONIDA_WC_NO_BACK).One correction on the merge base:
rev-list --count eec86d0fa..origin/mainreturning0only means yourorigin/mainwas ateec86d0fa. A PR branch being ahead ofmainis normal; what blocks the merge is the page, and regenerating it clears it.On what you could not verify: yes, that is the gap.
VK_EXT_memory_budgetreporting a heap budget below the heap's size is exactly the shape the switch uses. A native Windows run that sets the variable against a title load would close it.@fiestorra on GitHub · 2026-12-01 04:48 UTC · original
finding: this now conflicts with
main, and the merge that did it landed ten minutes ago.The merge is #2589 (
5dd6d444f, "nv-vram-target-reserve-settle"), and it touched the same file this does:d3d12/crates/leonida-gpu/src/resource.rs, 165 lines added and 1 removed. Before it, the conflict was only indocs/switches.md- I noted that when I verified this pull request, along with the fact that the code half applied cleanly andfixed_card_budgetpassed its test.So this needs one rebase and the two conflicts are probably in different functions:
resource.rsgained a VRAM target/reserve path, and this addsfixed_card_budgetbeside it.switches.mdconflicts the way that table always does.What I verified before the conflict, so it is on record (
main90c514437, the code half only):And what I could not: "set above what the card has free, allocations fail rather than move to the PC's memory" needs a title allocating, which needs the game.
AI-assisted: yes - DeepSeek v4.1 (flash), which re-checked after a merge to that file.
Written with an AI assistant.
@KelboLive on GitHub · 2026-12-01 05:22 UTC · original · reviewed
Verified on this machine (RTX 4070 Ti SUPER, 621.01): system own budget 15,293 MB; with
LEONIDA_VRAM_BUDGET_MB=7000the runtime'sHost::video_memory()[0]is 7000 while the system query andvideo_memory_groupsstay 15,293;256gives 256,20000gives 20000, and0/abckeep 15,293. It lands only in the runtime accessor (host.rs:13645-13665) — noSetVideoMemoryReservation— so Windows still enforces its own budget, which is the right shape for a Wine/Proton measure. 590/0 lib tests, switches--checkclean.Three things:
video_memory(fixed.unwrap_or(own.Budget)->own.Budget) leaves all 590 tests green; only the parser is covered. A smalleffective_budget(own, setting)helper tested directly would fix that without fighting the process-globalOnceLock.fixed > own.Budget. Both numbers are in hand at the first call; on Windows the runtime's own guards will then allow over-commit, androom's comment records that paging past the budget ended runs 20/24. Clamping would defeat the Wine use — a warning is the right compromise.fixed < own.CurrentUsagethe card is permanently over budget:vram_keepevicts,room(with no texture budget) refuses, and ifLEONIDA_TEXTURE_BUDGET_MBis also set,roomallows exactly whatvram_keepthen evicts — a make/evict churn. The docs sentence should also say this is a Wine/Proton measure rather than a Windows tuning knob.Cosmetic: the F1 panel and the memory line now read the fixed budget while the "as the system counts it" line shows the real one, so a 7,000 MB budget on a 15,293 MB card reads oddly; the one-time log helps, but a note in the panel would too.
94c350753cto87f812f374@ajussak on GitHub · 2026-12-01 11:06 UTC · original
Point 3, measured below the current usage: the ceiling holds and nothing faults.
LEONIDA_VRAM_BUDGET_MB=4000on a card whose own budget reads 6 967 MB, through the Linux launcher (scripts/play-linux-proton.sh, GE-Proton11-14-viewtree), RTX 3060 Ti 8 192 MiB / driver 620.73.04, Fedora 45 kernel 7.3.4, 16 cores.Never above 4 000 MB, no
VK_ERROR_OUT_OF_DEVICE_MEMORY, noXidin dmesg, no fault of the title; I stopped it after those 2 min 18 s while it was still logging pipeline creation.What replaces an allocation past the ceiling, at the same spot:
roomrefuses andvram_keepevicts, and a draw that wants a texture the card cannot hold refreshes the copy already resident -a texture already on the card is brought up to date although the card has no room for new ones.LEONIDA_TEXTURE_BUDGET_MBwas unset in both runs, so the "roomallows whatvram_keepthen evicts" path you describe is not the one exercised here.Unrelated to this switch:
thread 'leonida-pipelines-*' has overflowed its stackappears in both runs (5 workers at 4 000 MB, 6 at 6 400 MB).87f812f374tof0aa16aab5@ajussak on GitHub · 2026-12-01 11:27 UTC · original
For the record: at 89% of the card's own budget the picture loses the avatar's head.
Seen in the run that checked the pipeline-worker supervisor, whose build comes from
mainand has noLEONIDA_VRAM_BUDGET_MBin it - so those numbers are the system's own budget, not this switch's:The avatar stands headless, its eyes and teeth floating above the collar, while the panel read
MESH TEXTURES 1 BACK 1,TEXTURES PENDING 0 MADE 25,QUEUE 0.0. The same seconds in the log:a texture already on the card is brought up to date although the card has no room for new onestextures picked by index: the card has no room for more; they waitSo this is not evidence that the switch makes the picture wrong - it was not in that build. What it does say is that a card held at its ceiling already drops something the title needs, and the frame shows it, so the switch is worth documenting as costing pixels as well as frame rate, with
vram_keepandroomthe path to read for it.Not attributed yet: a texture that could not be made resident, or a mesh path with
MESH TEXTURES 1 BACK 1still in flight. The controlled check is the same spot and the same build withLEONIDA_VRAM_BUDGET_MB=4000and then with the system's budget: if the head is missing in both, the switch is not the cause.f0aa16aab5to1c92f130ec@ammonium231 on GitHub · 2026-12-02 03:36 UTC · original
RTX 3090 / 621.47,
1c92f130emerged onto main393901a5b(merges clean): resource:: is 29 passed on main and 31 on the merge (0 failed), both new fixed-card-budget tests ok.@MoonEyes on GitHub · 2026-12-02 12:18 UTC · original
Closing: this pull request no longer applies to current
main(merge conflict ind3d12/docs/switches.md), and open pull requests that have fallen out of step withmainare being closed so the list stays workable. If you still want this change, rebase it on currentmainand reopen it (or open a new pull request); it will be looked at again.AI-assisted (Claude Code).
Pull request closed