[pr-performance][memory] Reduce texture heap granularity and reclaim more under host pressure #345
Loading…
Reference in a new issue
No description provided.
Delete branch "MuoM1ng/Darner:codex/darner-texture-pressure"
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?
Contributor role (optional)
What it changes
On v2026.12.03.02, the device-local texture pools allocate 64 MiB heaps. A heap can only be returned after its last piece leaves. This means a few long-lived allocations can retain mostly empty heaps.
This ports the texture heap and host pressure changes from VIctory-NVIDIA
#4890. On PCs with under 24 GiB of RAM, the general device-local texture pool prefers 16 MiB heaps. The separate small-placement pool prefers at most 8 MiB heaps. Larger textures retain the original on-card size range, so shrinking the preferred heap does not send those textures to shared memory. Parking limits and diagnostics charge the actual heap size. Texture eviction starts earlier under host pressure and the staging pools retain fewer idle buffers. The sampled-slot check can pick up evicted textures sooner when they come back into use. Existing loose-window hits can return under the shared lock.DARNER_TEXTURE_BLOCK_MBsets the preferred device-local heap size from 4 to 64 MiB.DARNER_SAMPLED_IDLE_MSsets the sampled-eviction idle floor outside emergency trimming.How it was tested
2714164onv2026.12.03.02and mainf3840d7.cargo check --offline --locked --profile diag -p darner --features diagnostics.cargo xtask policychecked 555 files.cargo test --offline --locked --profile diag -p darner-gpu --features diagnostics --librun passed 79 tests with 3 ignored benchmarks. The filters covered pools, texture sampling and eviction, and frame generation.Checklist
main.docs/asset-policy.md.Checked for overlap
Independent Windows build, gate, and code-read review of
e1d5be8af011(full heade1d5be8af011b511c66d591468a8c8728839e666), based onmainf3840d73d3504c30218debfbc8795b9225447317. Not run in-game.Environment
x86_64-pc-windows-msvc), MSVC 19.44.35230.Measured results
cargo clippy --workspace --all-targets --locked -- -D warnings): PASS.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings): PASS.cargo xtask policy: PASS (asset policy: 555 files ok).cargo test --locked -p darner-gpu --lib pool::: PASS (60 passed; 0 failed; 3 ignored).cargo test --locked -p darner-gpu --lib sampled::: PASS (7 passed; 0 failed; 0 ignored).cargo test --locked -p darner-gpu --lib texture_eviction_marks_follow_host_pressure: PASS (1 passed; 0 failed; 0 ignored).cargo test --locked -p darner-gpu --lib shadow::: PASS (110 passed; 0 failed; 10 ignored).cargo test --workspace --locked) and gameplay were not run in this review.Code-read audit
texture_block_sizecaches the 4–64 MiB setting once, uses the small-host default only when no valid override is supplied, and caps the separate placement pool at 8 MiB.Ripe::card_texture_blockkeeps allocations outside the chosen block's supported range on the original 64 MiB path (crates/darner-gpu/src/pool.rs:34-44, 406-417).take_headroomsubtracts the requested size atomically, and parked heaps remain 64 MiB (pool.rs:1218-1228, 1491-1516, 2630-2650, 2942-2966).pool.rs:67-80, 288-300; crates/darner-gpu/src/resource.rs:5701-5745, 5814-5825).DARNER_WINDOW_TAKE=1path skips the preliminary read lock so it can choose the longer existing window under the write lock (crates/darner-gpu/src/sampled.rs:233-246; crates/darner-gpu/src/shadow.rs:12891-12933).CHANGES NEEDED — P2: With
DARNER_TEX_PARK=1, first-upload admission callspark_has_room(reserve)(crates/darner-gpu/src/draw.rs:4936). The new allocation path can create a smaller card heap and charges its actual size (pool.rs:2634-2650), butpark_has_roomstill requiresCARD_HEADROOM >= BLOCK(64 MiB) before considering card growth (pool.rs:1426-1433). If only the selected 4–16 MiB heap's headroom is available and parked/shared memory and existing holes cannot fit the texture, admission rejects the upload even though the card allocation path can accept it. Please make the admission check account for the selected heap size and cover the less-than-64-MiB headroom case with a test.The PR also changes default heap and host-pressure behavior, but its description says live gameplay A/B was not measured.
CONTRIBUTING.mdrequires an A/B result for default behavior changes; that evidence is still needed before this can pass review. No runtime/gameplay evidence was collected here.AI-assisted: yes (GitHub Copilot, Auto mode).
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.