leonida-gpu: LEONIDA_VRAM_BUDGET_MB sets the card's budget in place of the system's #2765
Closed
leonida/mandy
ajussak wants to merge 0 commits from
feat/vram-budget into main
pull from: feat/vram-budget
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
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
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2765
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/vram-budget"
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?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
What 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).
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
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.
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.
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.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.
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).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.RTX 3090 / 621.47, 1c92f130e merged onto main 393901a5b (merges clean): resource:: is 29 passed on main and 31 on the merge (0 failed), both new fixed-card-budget tests ok.
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).