gpu: auto-scale card buffer limits from local VRAM budget #42
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/42"
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?
Imported from fxceless/victory-fork. Originally posted by fever308 on 2026-11-24T20:48:29Z.
Summary
Evidence
16 MiBmin /512 MiBmax card-buffer limits regardless of local VRAM budget.After:
cargo test -p victory-gpu card_limits_scale_with_local_vram_budget: 1 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings(default and--all-features): clean.23,040 MiBbudget ->1 MiB / 5,760 MiB) and RTX 4080 16 GB (15,280 MiBbudget ->4 MiB / 2,048 MiB).Merge Danger
Door: two-way
Pure default-limit heuristic in
crates/victory-gpu/src/shadow.rs; explicitVICTORY_CARD_BUFFERS_MIN_MB/VICTORY_CARD_BUFFERS_MBoverrides remain unchanged.Blast Radius: Buffers
Higher-VRAM hosts promote more title memory buffers into card VRAM (up to 2x with shader-written "before" twins, still bounded by
card_for's 80% VRAM budget check).Imported from fxceless/victory-fork. Originally posted by viktoschi on 2026-11-24T21:05:01Z.
Tested this branch on the tier the new thresholds are written for: RTX 3090 (24 GB, driver 591.86), Windows 11, Rust 1.98.1 (the pinned toolchain),
fffafee.cargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo test --workspace --locked: 497 passed, 0 failed, 7 ignored (victory-gpu: 111 passed, 1 ignored; the GPU tests ran on the card)What the formula picks here: the adapter reports a local budget of 24,159,346,688 B (23,040 MiB, ~22.5 GiB), so
default_card_limits_mbtakes the>= 20 GiBtier and returns 1 MiB / 5,760 MiB instead of 16 / 512.One question on the thresholds: 22.5 GiB is what DXGI reports for a 24 GB card here, not 24 GiB, and
Budgetis dynamic — a 24 GB card with another title holding memory can drop below 20 GiB and land in the 16 GB tier. Is that intended, or should the tier be read from dedicated video memory rather than the budget?Imported from fxceless/victory-fork. Originally posted by fever308 on 2026-11-24T21:10:56Z.
@viktoschi Thank you for testing this on an RTX 3090 and reporting the exact numbers!
Using
DXGI_QUERY_VIDEO_MEMORY_INFO.Budgetrather than rawDedicatedVideoMemoryis intentional:Budgetreflects what WDDM is actually making available to this process, so if another GPU-heavy app is occupying VRAM and pushes a 24 GB card's available budget below 20 GiB, stepping down to the 16 GB tier (4 MiB/2,048 MiB) avoids overcommitting past the OS budget (especially since shader-written card buffers can take up to 2× with their "before" twins) and forcing paging to system RAM.For the exact same WDDM-headroom reason you noted (~22.5 GiB reported on a 24 GB card), I just pushed
de4ae61lowering the 12 GB -> 16 GB boundary from14 GiBto12 GiBso 16 GB cards (~13.5–15 GiB WDDM budget) don't fall back into the 12 GB tier under light desktop usage. ExplicitVICTORY_CARD_BUFFERS_MIN_MB/VICTORY_CARD_BUFFERS_MBoverrides remain available if someone wants a fixed cap independent of dynamic budget.Imported from fxceless/victory-fork. Originally posted by arminkhaleghirod on 2026-11-24T21:18:17Z.
Tested
fffafeeon an RTX 4080 16 GB, Windows 11, Series X profile, no env overrides. It logsvram_budget_mb=15280 card_buffers_min_mb=4 card_buffers_max_mb=2048, the 16 GB tier as intended. 5.5 min from boot into the opening cutscene. City renders, no device loss, 0.7–2.4 fps in the cutscene.Imported from fxceless/victory-fork. Originally posted by fever308 on 2026-11-24T21:22:03Z.
@arminkhaleghirod Thank you for testing on an RTX 4080 16 GB and sharing the live run log! Great to see
vram_budget_mb=15280hitting the4 MiB / 2048 MiBtier cleanly with no device loss into the cutscene.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.