gpu: shrink texture pool blocks and tighten host-pressure VRAM eviction #4891
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4891
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4890"
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?
@topangag on GitHub · 2026-12-01 13:03 UTC · original
topangag:pr/vram-pressure-and-texture-blocks→main· +183 −30 · 4 files · 2 commits · closed without mergingWhat it changes
Reduces steady-state VRAM footprint, texture-pool internal fragmentation, shared GPU spillover, and host-commit pressure on 16 GB RAM / 12 GB VRAM systems without sacrificing frame rate:
crates/victory-gpu/src/pool.rs):VICTORY_TEXTURE_BLOCK_MB(4..=64MiB; defaults to16 MiBwhensmall_host_ram()is active and8 MiBfor theSMALLpool, preserving64 MiBelsewhere).cut(),take_from_with_growth(),texture(),Pool::bytes(), andCensus.byteswhile keepingtexture_spares()anchored toBLOCKso spare counts do not multiply on 16 GB hosts.host_spares = (0, 1)) and clampstexture_limitto1when(pressure || host_low) && ahead() == 0.crates/victory-gpu/src/resource.rs,crates/victory-gpu/src/sampled.rs):slot_evict()thresholds (host_pressuredcaps high/low watermarks at70%/60%;host_criticalcaps at60%/50%with a512 MiBeviction step) so VRAM spillover does not stall host commit recovery.VICTORY_SAMPLED_IDLE_MS(default20_000ms, range4_000..=120_000) to protect recently active scene textures from premature thrashing.HELD_SWEEP_EVERY = 2) and ensureson_presentwakes wheneverany_held_textures() || EVICTED_ANY.crates/victory-gpu/src/shadow.rs):VICTORY_WINDOWS_BAR_PERCENT(50..=92, default80) intowindow_mapped_for().LOOSE.read()fast path fortails()/any && fine()lookups before taking the write lock.How it was tested
15,544.2 MiBusable, system-managedC:\pagefile.sys)12,227 MiBtotal, Resizable BAR, Tiled Resources Tier 4)5fabb46evsaf7e50c0, identical cache & fixed input replay):1080to1440, DLSS Quality, Frame Generation Off, Ray Tracing Off (VICTORY_HW_RT=0), 30 FPS cap, DualSense input profileVICTORY_WINDOW_GROW=1,VICTORY_WINDOWS_BAR_MB=1024,VICTORY_WINDOWS_BAR_PERCENT=80,VICTORY_CARD_WINDOWS_MB=0,VICTORY_PHYSICAL_FILE=1,VICTORY_CARD_CPU_FILE=1,VICTORY_PROCESS_MEMORY=0,VICTORY_TEXTURE_BLOCK_MB=16,VICTORY_RIPE_BLOCKS=0,VICTORY_SPARE_BLOCKS=2,VICTORY_LIST_LAZY=1,VICTORY_LIST_POOL_IDLE_S=15,VICTORY_ALLOCATOR_TRIM=1,VICTORY_ALLOCATOR_TRIM_S=45,VICTORY_POOL_STATS=1,VICTORY_SAMPLED_EVICT=1,VICTORY_SAMPLED_IDLE_MS=20000,VICTORY_SLOT_EVICT_PERCENT=70,VICTORY_SLOT_EVICT_LOW_PERCENT=60,VICTORY_SLOT_EVICT_MB=512,VICTORY_SHADER_CODE_ON_DISK=1,VICTORY_LIBRARY_KEEP_MB=0,VICTORY_DSTORAGE_BUFFER_BUDGET=96origin/main5fabb46e, 210s run,duration reached):TEXTURES,VICTORY_POOL_STATS=1, withVICTORY_POOL_SMALLoff soSMALLheld 0 blocks; see #3766 for combined census across both pools):3,200 MB(50 × 64 MiB),1,459 MBfree fragmentation8,170.7 MiB, Steady avg (≥120s)8,073.9 MiB, End8,150.2 MiB5,435.0 MiB, Steady avg3,144.4 MiB, End3,120.4 MiB(Total GPU steady avg11,218.3 MiB)23,538.2 MiB, End22,770.0 MiB; System commit delta+30,718.7 MiB; Lowest available physical RAM64 MiB2,767textures recreated (out of27,932evicted)15.1–17.4 fps(avg16.2 fps)af7e50c0, 210s run,duration reached):TEXTURES,VICTORY_POOL_STATS=1, withVICTORY_POOL_SMALLoff / 0SMALLblocks):2,720 MB(170 × 16 MiB,-480 MB/ -15.0%),1,105 MBfree fragmentation (-354 MB/ -24.3%)7,708.6 MiB(-462.1 MiB), Steady avg7,605.6 MiB(-468.3 MiB), End7,673.9 MiB(-476.3 MiB)4,946.0 MiB(-489.0 MiB), Steady avg3,013.2 MiB(-131.2 MiB), Total GPU steady avg10,618.8 MiB(-599.5 MiB)22,855.8 MiB(-682.4 MiB), End22,240.8 MiB(-529.2 MiB); System commit delta+30,218.3 MiB(-500.4 MiB); Lowest available physical RAM138 MiB(+74 MiB)2,038textures recreated (out of26,677evicted,-26.3%)16.5–17.4 fps(avg17.0 fps,+0.8 fps)cargo testpassed for the crates it touches: yesfa740fd3:cargo test --locked -p victory-gpu --lib -- pool:: sampled:: window_mapped_default slot_plan_for_queue→ 39 passed, 0 failed (includingsmaller_texture_blocks_cut_and_count_actual_bytesandsweep_cadence_returns_to_normal_when_only_cold_evicted_slots_remain).--all-features) onfa740fd3: 0 warnings/errors in the 4 touched files.check= Clippy, Clippy--all-features, full workspacecargo test) verified green (7m54s) in fork PR topangag/VIctory-NVIDIA#2 onaf7e50c0and re-triggered onfa740fd3, on top of upstream CI baseline fixes (#4708 Clippy fixes + #4143victory-hlealias validation fix).Checked for overlap
VICTORY_TEXTURE_BLOCK_MBpool blocks, host-commit pressure coupling inslot_evict,VICTORY_SAMPLED_IDLE_MS, orVICTORY_WINDOWS_BAR_PERCENT).@Aniseto on GitHub · 2026-12-01 13:08 UTC · original
Ran the
pool::/sampled::/window_mapped_default/slot_plan_for_queueselection ataf7e50c0on an NVIDIA Blackwell desktop part with 16 GB of VRAM.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own
CARGO_TARGET_DIR, no local patches.All 38 executed tests pass here, including
smaller_texture_blocks_cut_and_count_actual_bytes. The wider selection also picks up three ignored tests; the description's 38/0 used the same filter. This adapter has 16 GB of VRAM and 64 GB of host RAM, but the 16 GB RAM / 12 GB VRAM scenario the PR targets was not reproduced, and no title run was done.Not tested: the full workspace suite, a retail title, VRAM spillover or host-commit measurements, Wine, AMD adapters, release profile, game data.
AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
@andrewpozdnakov7-jpg on GitHub · 2026-12-01 13:13 UTC · original
One readback-cadence case on
af7e50c0.EVICTED_ANYis cleared only whenconsume_readbackremoves the last entry fromEVICTED. If even one evicted slot belongs to a scene the player never revisits, it stays in the map. Thenon_presentkeeps selecting the two-frame cadence even whenany_held_textures()is false and no new slots are evicted. Each sweep reads the marks back and clears the GPU buffer. The usual cadence in that case was 30 frames.Could we keep the faster cadence tied to recent evictions or held textures and leave the normal sweep to discover cold slots if they are sampled much later? A short check that the cadence returns to 30 with one evicted slot left unread would cover the case.
@ -812,3 +848,3 @@they hold {} MB",c.blocks,mb(c.blocks * BLOCK),mb(c.bytes),@tyr0nsur on GitHub · 2026-12-01 13:17 UTC · original
This improves the byte count for the regular pool, but the benchmark's
VICTORY_POOL_STATSline still takesc.blocks,c.bytesandc.freefromTEXTURESalone (line 839). The patch also changesSMALLto 8 MiB blocks, so some of the pool-size and fragmentation change is outside that line.On Windows at
af7e50c0, a synthetic placement withVICTORY_TEXTURE_BLOCK_MB=16, small alignment enabled and no ahead blocks produced one regular block and one small block. The census used here increased by 16 MiB.memory()[0], which sums both pools, increased by 24 MiB overall.Could the 3,200 → 2,720 MiB row say “regular texture pool”, or include both pools' block bytes and free bytes? The dedicated/shared DXGI figures remain separate measurements. #3766 is relevant to the combined census.
@topangag on GitHub · 2026-12-01 13:32 UTC · original
Thanks @Aniseto for independently verifying the test suite on
af7e50c0, and great catch @andrewpozdnakov7-jpg!You're right: pinning
on_presentto the 2-frame cadence whenever any cold entry remains inEVICTEDwould keep readbacks at 2 frames indefinitely if a previously evicted slot is never sampled again.Updated in
fa740fd3:LAST_EVICTED_FRAME), and only use the 2-frame fast cadence whileany_held_textures()is true or within a short recent-eviction window (60frames) whileEVICTED_ANYis set.on_presentreturns to the normal 30-frameSWEEP_EVERYcadence, which still discovers and wakes cold evicted slots if they are sampled later.sweep_cadence_returns_to_normal_when_only_cold_evicted_slots_remain) verifying the cadence returns to 30 frames when one evicted slot remains unread past the recent-eviction window (39 passed; 0 failedlocally; Fork CI re-running ontopangag/VIctory-NVIDIA#2).@ -812,3 +848,3 @@they hold {} MB",c.blocks,mb(c.blocks * BLOCK),mb(c.bytes),@topangag on GitHub · 2026-12-01 13:32 UTC · original
Good catch, thank you! In our 210s A/B run
VICTORY_POOL_SMALLwas off (soSMALLheld 0 blocks in both runs), which is whyTEXTURESaccounted for the full texture pool in that measurement, while theSMALL8 MiB change only applies when small-alignment pooling is enabled.I've updated the PR description to label the
3,200 MB -> 2,720 MBrow explicitly as the regular texture pool (TEXTURES,VICTORY_POOL_STATS=1, withVICTORY_POOL_SMALLoff) and noted #3766 for combined census reporting across both pools.@cloph-dsp on GitHub · 2026-12-01 14:00 UTC · original
Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree.
Base
5fabb46eaf6ed8771321787f8871051abde69b9b, headfa740fd36f0d8d307227e02c0b660e4330ab1495, 4 files +183/-30 (pool.rs, resource.rs, sampled.rs, shadow.rs).Both new test names are absent on the base:
→ no match, exit 1 for each. (The other two tests in the diff,
host_budget_survives_four_hundred_allocation_cyclesandspeculative_staging_deferral_leaves_required_growth_available, already exist on the base — those hunks only adjust the fixture budgets.)git diff --check "5fabb46e..fa740fd3"→ no output, exit 0.Result, each:
running 1 test,test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1162 filtered out; finished in 0.00s.Both drive
Pool/sweep_cadencefrom local statics with synthetic sizes; no device opened, GPU/driver N/A. No game data.@Aniseto on GitHub · 2026-12-01 17:15 UTC · original
This is a new response on the same thread as my report at
af7e50c0(#4891); the head moved tofa740fd3, so I am not editing that comment.Ran the new cadence test and the texture-block test at
fa740fd3on an NVIDIA Blackwell desktop part with 16 GB of VRAM.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own
CARGO_TARGET_DIR, no local patches.Both tests pass here: the new one that checks the 2-frame readback cadence returns to the normal 30 frames when only cold evicted slots remain, and the one from the earlier head for actual texture-block bytes. The description's 8 GB A/B and the title runs were not repeated; no title was run.
Not tested: the full workspace suite, a retail title, VRAM spill or readback cadence on this adapter, Wine, AMD adapters, release profile, game data.
AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
@trustno1-coder on GitHub · 2026-12-01 18:29 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed