leonida-gpu: LEONIDA_VRAM_BUDGET_MB sets the card's budget in place of the system's #2765

Closed
ajussak wants to merge 2 commits from upstream-pr/2765 into main
ajussak commented 2026-11-30 16:46:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ajussak on 2026-11-30T16:46:31Z.


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_MB sets the budget
the runtime works to instead: Host::video_memory hands it to every decision on the card's memory (the
texture 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-msvc under 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) and
    resource::tests::texture_floor_scales_with_vram_budget. The three failures are watch::
    (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 on main without this change.
  • A run with LEONIDA_VRAM_BUDGET_MB=7000 on an RTX 3060 Ti 8 GB (NVIDIA 620.73.4, GE-Proton11-14): no
    Xid, the card held about 600 MB more.
  • d3d12/docs/switches.md regenerated with tools/d3d12_switches.py; --check passes. The page also
    lists the three names main added since it was last made (LEONIDA_CAPTURE_SHOWN,
    LEONIDA_FG_RESET_STALE, LEONIDA_TIMELINE_STALL_MS).

Notes

Rebased onto main at 35e75b7a9; no other change. Independent of the Linux launcher work: nothing here
touches scripts/, and the variable is read where the card's budget is decided, so the two merge in either
order.

Item: LEONIDA-GPU-VRAM-BUDGET-MB, claimed in
#2570.
AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5569642885 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765). Originally posted by [ajussak](https://github.com/ajussak) on 2026-11-30T16:46:31Z. --- ### 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_MB` sets the budget the runtime works to instead: `Host::video_memory` hands it to every decision on the card's memory (the texture 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-msvc` under 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) and `resource::tests::texture_floor_scales_with_vram_budget`. The three failures are `watch::` (`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 on `main` without this change. - A run with `LEONIDA_VRAM_BUDGET_MB=7000` on an RTX 3060 Ti 8 GB (NVIDIA 620.73.4, GE-Proton11-14): no Xid, the card held about 600 MB more. - `d3d12/docs/switches.md` regenerated with `tools/d3d12_switches.py`; `--check` passes. The page also lists the three names `main` added since it was last made (`LEONIDA_CAPTURE_SHOWN`, `LEONIDA_FG_RESET_STALE`, `LEONIDA_TIMELINE_STALL_MS`). ### Notes Rebased onto `main` at `35e75b7a9`; no other change. Independent of the Linux launcher work: nothing here touches `scripts/`, and the variable is read where the card's budget is decided, so the two merge in either order. Item: `LEONIDA-GPU-VRAM-BUDGET-MB`, claimed in [#2570](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7285198755). AI-assisted (Claude Code).
Kal0s-design commented 2026-11-30 20:28:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-11-30T20:28:21Z.


Native Windows check of bd0114806 (on its base 35e75b7a9). Windows 11, MSVC x64, Rust 1.98.1, hardware GPU, cargo test -p leonida-gpu --lib, native rather than xwin/Wine.

  • 572 passed, 0 failed, 52 ignored. The three 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, including a_fixed_card_budget_is_a_size_in_mb, texture_floor_scales_with_vram_budget and budget_capped_keep_evicts_before_vram_pressure.
  • Red as a run isn't possible here: against the base without the change the new test doesn't build (fixed_card_budget is new, E0425).
  • Heads-up: this branch no longer merges cleanly into current main (d8ca18240). git merge conflicts in d3d12/docs/switches.md only. Since that page is generated, regenerating it with tools/d3d12_switches.py after merging main should be enough.

Not covered: a run with LEONIDA_VRAM_BUDGET_MB in the title (native Windows wasn't the case it's for).

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7290973442 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#issuecomment-7290973442). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-30T20:28:21Z. --- **Native Windows check** of `bd0114806` (on its base `35e75b7a9`). Windows 11, MSVC x64, Rust 1.98.1, hardware GPU, `cargo test -p leonida-gpu --lib`, native rather than xwin/Wine. - 572 passed, **0 failed**, 52 ignored. The three `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, including `a_fixed_card_budget_is_a_size_in_mb`, `texture_floor_scales_with_vram_budget` and `budget_capped_keep_evicts_before_vram_pressure`. - Red as a run isn't possible here: against the base without the change the new test doesn't build (`fixed_card_budget` is new, E0425). - Heads-up: this branch no longer merges cleanly into current `main` (`d8ca18240`). `git merge` conflicts in `d3d12/docs/switches.md` only. Since that page is generated, regenerating it with `tools/d3d12_switches.py` after merging `main` should be enough. Not covered: a run with `LEONIDA_VRAM_BUDGET_MB` in the title (native Windows wasn't the case it's for). AI-assisted: yes
ajussak commented 2026-11-30 20:57:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ajussak on 2026-11-30T20:57:11Z.


Thanks — that closes the two things I could not check here: the three watch:: failures are Wine-only, and resource:: is green on plain MSVC.

The conflict you flagged is handled: rebased onto d8ca18240 and, as you suggested, d3d12/docs/switches.md regenerated with tools/d3d12_switches.py (--check passes). It also picks up LEONIDA_FRAME_TIMES, LEONIDA_MERGE_CARD_COPIES, LEONIDA_MERGE_PC_COPIES, LEONIDA_PIPELINE_AWAIT_FIRST and the LEONIDA_AB column of LEONIDA_HOST_RDNA and LEONIDA_NAN_EXACT, which main added 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7291701592 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#issuecomment-7291701592). Originally posted by [ajussak](https://github.com/ajussak) on 2026-11-30T20:57:11Z. --- Thanks — that closes the two things I could not check here: the three `watch::` failures are Wine-only, and `resource::` is green on plain MSVC. The conflict you flagged is handled: rebased onto `d8ca18240` and, as you suggested, `d3d12/docs/switches.md` regenerated with `tools/d3d12_switches.py` (`--check` passes). It also picks up `LEONIDA_FRAME_TIMES`, `LEONIDA_MERGE_CARD_COPIES`, `LEONIDA_MERGE_PC_COPIES`, `LEONIDA_PIPELINE_AWAIT_FIRST` and the `LEONIDA_AB` column of `LEONIDA_HOST_RDNA` and `LEONIDA_NAN_EXACT`, which `main` added 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.
fiestorra commented 2026-12-01 02:23:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T02:23:39Z.


The code is fine and its test passes; the docs table is what conflicts, and the branch is carrying commits main does not have - so it needs a rebase before it can be merged.

Measured on main d920d850d:

git merge-tree --write-tree origin/main <head>
  CONFLICT (content): Merge conflict in d3d12/docs/switches.md

And the tree pieces:

d3d12/docs/switches.md
  merge-base (eec86d0fa): 7cb7061
  main (d920d850d):       86e60d6
  this head:              e5b8f5c

git rev-list --count eec86d0fa..origin/main   ->  0

0 commits from the merge base to main while the file differs at both ends means the merge base is not behind main - the branch contains commits main does not have, and switches.md is 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:

cargo test -p leonida-gpu --lib fixed_card_budget
  ok. 1 passed; 0 failed; 636 filtered out

So fixed_card_budget(setting: Option<&str>) -> Option<u64> lands and answers: mb << 20 for a whole number of MB in 256..=1 << 20, None otherwise 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, where heapBudget was 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7298566001 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#issuecomment-7298566001). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T02:23:39Z. --- **The code is fine and its test passes; the docs table is what conflicts, and the branch is carrying commits `main` does not have - so it needs a rebase before it can be merged.** **Measured on `main` `d920d850d`:** ``` git merge-tree --write-tree origin/main <head> CONFLICT (content): Merge conflict in d3d12/docs/switches.md ``` **And the tree pieces:** ``` d3d12/docs/switches.md merge-base (eec86d0fa): 7cb7061 main (d920d850d): 86e60d6 this head: e5b8f5c git rev-list --count eec86d0fa..origin/main -> 0 ``` **`0` commits from the merge base to `main` while the file differs at both ends means the merge base is not behind `main` - the branch contains commits `main` does not have, and `switches.md` is 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:** ``` cargo test -p leonida-gpu --lib fixed_card_budget ok. 1 passed; 0 failed; 636 filtered out ``` **So `fixed_card_budget(setting: Option<&str>) -> Option<u64>` lands and answers**: **`mb << 20` for a whole number of MB in `256..=1 << 20`, `None` otherwise 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`, where `heapBudget` was 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.
ajussak commented 2026-12-01 02:40:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ajussak on 2026-12-01T02:40:05Z.


Thanks for the trace. The conflict is the generated page, and that is the only thing in this branch that moves: d3d12/docs/switches.md comes from the sources (tools/d3d12_switches.py), and main has 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 --check passes afterwards.

Rebased onto 90c514437 and pushed (94c3507): cargo xwin test -p leonida-gpu resource:: under Wine, 21 passed; the PR is mergeable again. The page's diff is now LEONIDA_VRAM_BUDGET_MB plus what main changed in it since it was last made (LEONIDA_WC_SUBRANGE_NO_BACK, the source cells of LEONIDA_TAKE_BLOCKS and LEONIDA_WC_NO_BACK).

One correction on the merge base: rev-list --count eec86d0fa..origin/main returning 0 only means your origin/main was at eec86d0fa. A PR branch being ahead of main is 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_budget reporting 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7298865943 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#issuecomment-7298865943). Originally posted by [ajussak](https://github.com/ajussak) on 2026-12-01T02:40:05Z. --- Thanks for the trace. The conflict is the generated page, and that is the only thing in this branch that moves: `d3d12/docs/switches.md` comes from the sources (`tools/d3d12_switches.py`), and `main` has 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 `--check` passes afterwards. Rebased onto `90c514437` and pushed (`94c3507`): `cargo xwin test -p leonida-gpu resource::` under Wine, 21 passed; the PR is mergeable again. The page's diff is now `LEONIDA_VRAM_BUDGET_MB` plus what `main` changed in it since it was last made (`LEONIDA_WC_SUBRANGE_NO_BACK`, the source cells of `LEONIDA_TAKE_BLOCKS` and `LEONIDA_WC_NO_BACK`). One correction on the merge base: `rev-list --count eec86d0fa..origin/main` returning `0` only means your `origin/main` was at `eec86d0fa`. A PR branch being ahead of `main` is 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_budget` reporting 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 commented 2026-12-01 04:48:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T04:48:57Z.


finding: this now conflicts with main, and the merge that did it landed ten minutes ago.

gh pr view 2765 --json mergeable,mergeStateStatus   ->  CONFLICTING DIRTY

git merge-tree --write-tree origin/main <head>
  CONFLICT (content): Merge conflict in d3d12/crates/leonida-gpu/src/resource.rs
  CONFLICT (content): Merge conflict in d3d12/docs/switches.md

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 in docs/switches.md - I noted that when I verified this pull request, along with the fact that the code half applied cleanly and fixed_card_budget passed its test.

So this needs one rebase and the two conflicts are probably in different functions: resource.rs gained a VRAM target/reserve path, and this adds fixed_card_budget beside it. switches.md conflicts the way that table always does.

What I verified before the conflict, so it is on record (main 90c514437, the code half only):

cargo test -p leonida-gpu --lib fixed_card_budget
  ok. 1 passed; 0 failed; 636 filtered out

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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7301129267 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#issuecomment-7301129267). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T04:48:57Z. --- finding: **this now conflicts with `main`, and the merge that did it landed ten minutes ago.** ``` gh pr view 2765 --json mergeable,mergeStateStatus -> CONFLICTING DIRTY git merge-tree --write-tree origin/main <head> CONFLICT (content): Merge conflict in d3d12/crates/leonida-gpu/src/resource.rs CONFLICT (content): Merge conflict in d3d12/docs/switches.md ``` **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 in `docs/switches.md`** - **I noted that when I verified this pull request, along with the fact that the code half applied cleanly and `fixed_card_budget` passed its test.** **So this needs one rebase and the two conflicts are probably in different functions**: **`resource.rs` gained a VRAM target/reserve path, and this adds `fixed_card_budget` beside it.** **`switches.md` conflicts the way that table always does.** **What I verified before the conflict, so it is on record** (`main` `90c514437`, the code half only): ``` cargo test -p leonida-gpu --lib fixed_card_budget ok. 1 passed; 0 failed; 636 filtered out ``` **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 commented 2026-12-01 05:22:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T05:22:29Z.

Review: COMMENTED


Verified on this machine (RTX 4070 Ti SUPER, 621.01): system own budget 15,293 MB; with LEONIDA_VRAM_BUDGET_MB=7000 the runtime's Host::video_memory()[0] is 7000 while the system query and video_memory_groups stay 15,293; 256 gives 256, 20000 gives 20000, and 0/abc keep 15,293. It lands only in the runtime accessor (host.rs:13645-13665) — no SetVideoMemoryReservation — so Windows still enforces its own budget, which is the right shape for a Wine/Proton measure. 590/0 lib tests, switches --check clean.

Three things:

  1. The wiring is untested: ignoring the fixed value in video_memory (fixed.unwrap_or(own.Budget) -> own.Budget) leaves all 590 tests green; only the parser is covered. A small effective_budget(own, setting) helper tested directly would fix that without fighting the process-global OnceLock.
  2. Warn when fixed > own.Budget. Both numbers are in hand at the first call; on Windows the runtime's own guards will then allow over-commit, and room's comment records that paging past the budget ended runs 20/24. Clamping would defeat the Wine use — a warning is the right compromise.
  3. Say what happens below the current usage. With fixed < own.CurrentUsage the card is permanently over budget: vram_keep evicts, room (with no texture budget) refuses, and if LEONIDA_TEXTURE_BUDGET_MB is also set, room allows exactly what vram_keep then 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6125601593 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#pullrequestreview-6125601593). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T05:22:29Z. **Review:** COMMENTED --- Verified on this machine (RTX 4070 Ti SUPER, 621.01): system own budget 15,293 MB; with `LEONIDA_VRAM_BUDGET_MB=7000` the runtime's `Host::video_memory()[0]` is **7000** while the system query and `video_memory_groups` stay **15,293**; `256` gives 256, `20000` gives 20000, and `0`/`abc` keep 15,293. It lands only in the runtime accessor (`host.rs:13645-13665`) — no `SetVideoMemoryReservation` — so Windows still enforces its own budget, which is the right shape for a Wine/Proton measure. 590/0 lib tests, switches `--check` clean. Three things: 1. **The wiring is untested**: ignoring the fixed value in `video_memory` (`fixed.unwrap_or(own.Budget)` -> `own.Budget`) leaves all 590 tests green; only the parser is covered. A small `effective_budget(own, setting)` helper tested directly would fix that without fighting the process-global `OnceLock`. 2. **Warn when `fixed > own.Budget`.** Both numbers are in hand at the first call; on Windows the runtime's own guards will then allow over-commit, and `room`'s comment records that paging past the budget ended runs 20/24. Clamping would defeat the Wine use — a warning is the right compromise. 3. **Say what happens below the current usage.** With `fixed < own.CurrentUsage` the card is permanently over budget: `vram_keep` evicts, `room` (with no texture budget) refuses, and if `LEONIDA_TEXTURE_BUDGET_MB` is also set, `room` allows exactly what `vram_keep` then 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.
ajussak commented 2026-12-01 11:06:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ajussak on 2026-12-01T11:06:48Z.


Point 3, measured below the current usage: the ceiling holds and nothing faults.

LEONIDA_VRAM_BUDGET_MB=4000 on 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.

budget_mb=4000  system_mb=6967
the card: 3999 MB in use of a budget of 4000 MB      <- peak over 2 min 18 s at that spot

Never above 4 000 MB, no VK_ERROR_OUT_OF_DEVICE_MEMORY, no Xid in 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:

  • room refuses and vram_keep evicts, 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.
  • The evictions do not churn: host copies stay flat (666 alive, 1 180 MB at the end) with 148 pipelines still being made. LEONIDA_TEXTURE_BUDGET_MB was unset in both runs, so the "room allows what vram_keep then evicts" path you describe is not the one exercised here.
  • Cost: 7.5-10.9 fps, 9 208 draws/frame, against 11.6-14.0 fps at the launcher's own 6 400 MB (peak 5 441 MB of a 6 978 MB system budget). The second run reused the same prefix and its pipeline cache, so part of that gap is the cache and not the budget.

Unrelated to this switch: thread 'leonida-pipelines-*' has overflowed its stack appears in both runs (5 workers at 4 000 MB, 6 at 6 400 MB).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7309186341 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#issuecomment-7309186341). Originally posted by [ajussak](https://github.com/ajussak) on 2026-12-01T11:06:48Z. --- **Point 3, measured below the current usage: the ceiling holds and nothing faults.** `LEONIDA_VRAM_BUDGET_MB=4000` on 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. ``` budget_mb=4000 system_mb=6967 the card: 3999 MB in use of a budget of 4000 MB <- peak over 2 min 18 s at that spot ``` Never above 4 000 MB, no `VK_ERROR_OUT_OF_DEVICE_MEMORY`, no `Xid` in 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: - `room` refuses and `vram_keep` evicts, 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`. - The evictions do not churn: host copies stay flat (666 alive, 1 180 MB at the end) with 148 pipelines still being made. `LEONIDA_TEXTURE_BUDGET_MB` was unset in both runs, so the "`room` allows what `vram_keep` then evicts" path you describe is not the one exercised here. - Cost: 7.5-10.9 fps, 9 208 draws/frame, against 11.6-14.0 fps at the launcher's own 6 400 MB (peak 5 441 MB of a 6 978 MB system budget). The second run reused the same prefix and its pipeline cache, so part of that gap is the cache and not the budget. Unrelated to this switch: `thread 'leonida-pipelines-*' has overflowed its stack` appears in both runs (5 workers at 4 000 MB, 6 at 6 400 MB).
ajussak commented 2026-12-01 11:27:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ajussak on 2026-12-01T11:27:08Z.


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 main and has no LEONIDA_VRAM_BUDGET_MB in it - so those numbers are the system's own budget, not this switch's:

the card: 4849 MB in use of a budget of 5576 MB        <- the panel read VRAM 4.7/5.6 GB
12.6 fps, 79.2 ms/frame, 10 888 draws/frame

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:

  • 6 x a texture already on the card is brought up to date although the card has no room for new ones
  • 1 x textures picked by index: the card has no room for more; they wait
  • host copies 694 alive 1 239 MB; 27 993 title textures with no host copy (11 868 MB)

So 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_keep and room the 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 1 still in flight. The controlled check is the same spot and the same build with LEONIDA_VRAM_BUDGET_MB=4000 and then with the system's budget: if the head is missing in both, the switch is not the cause.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7309661698 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#issuecomment-7309661698). Originally posted by [ajussak](https://github.com/ajussak) on 2026-12-01T11:27:08Z. --- **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 `main` and has no `LEONIDA_VRAM_BUDGET_MB` in it - so those numbers are the system's own budget, not this switch's: ``` the card: 4849 MB in use of a budget of 5576 MB <- the panel read VRAM 4.7/5.6 GB 12.6 fps, 79.2 ms/frame, 10 888 draws/frame ``` 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: - 6 x `a texture already on the card is brought up to date although the card has no room for new ones` - 1 x `textures picked by index: the card has no room for more; they wait` - host copies 694 alive 1 239 MB; 27 993 title textures with no host copy (11 868 MB) So 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_keep` and `room` the 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 1` still in flight. The controlled check is the same spot and the same build with `LEONIDA_VRAM_BUDGET_MB=4000` and then with the system's budget: if the head is missing in both, the switch is not the cause.
ammonium231 commented 2026-12-02 03:36:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-12-02T03:36:29Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7334055086 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#issuecomment-7334055086). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-12-02T03:36:29Z. --- 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.
MoonEyes commented 2026-12-02 12:18:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:18:40Z.


Closing: this pull request no longer applies to current main (merge conflict in d3d12/docs/switches.md), and open pull requests that have fallen out of step with main are being closed so the list stays workable. If you still want this change, rebase it on current main and reopen it (or open a new pull request); it will be looked at again.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345150063 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2765#issuecomment-7345150063). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:18:40Z. --- Closing: this pull request no longer applies to current `main` (merge conflict in `d3d12/docs/switches.md`), and open pull requests that have fallen out of step with `main` are being closed so the list stays workable. If you still want this change, rebase it on current `main` and reopen it (or open a new pull request); it will be looked at again. AI-assisted (Claude Code).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2765
No description provided.