perf(gpu/pool,tiles): adapter-aware 4 KiB pool packing, reactive spares, and budget-bounded tiled fallback #281
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Androtim--MiniVI!281
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/281/head"
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?
@Androtim on GitHub · 2026-12-01 09:40 UTC · original
Androtim:perf/pillar3-adapter-pool-small-and-tiled-vram→main· +175 −55 · 7 files · 2 commits · merged 2026-12-01 11:19 UTCSummary
Pillar #3 structural VRAM efficiency & headroom-reactive pooling improvements, rebased onto
eb9dc68d(main):crates/victory-gpu/src/pool.rs, launcher/script defaults):D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT(4 KiB) by default on non-AMD GPUs (VICTORY_POOL_SMALL=0kill-switch) while keeping 64 KiB alignment by default on AMD drivers where 4 KiB placed textures have caused GPU page faults (VICTORY_POOL_SMALL=1overrides).VICTORY_POOL_SMALL=0overrides fromapps/victory/src/play.rs,scripts/verify-world.ps1, andscripts/play-minivi.ps1.crates/victory-gpu/src/pool.rs):budget - usedheadroom ((headroom / 4) / 64 MiBclamped to[2, 64]blocks, dropping to0below512 MiBfree headroom or>= 90%budget) so 8 GiB GPUs shed excess empty blocks early while 16-24+ GiB GPUs retain warm spare capacity.crates/victory-gpu/src/tiles.rs,crates/victory-gpu/src/resource.rs):tiles::free_room()(heaps - given) and credit it alongsidepool::texture_room()inresource::room(),resource::weighed(), andresource::room_terms().VICTORY_LEVELS_RECLAIM=0kill-switch) when levels-on-demand is active.resource::block_room(...)for texture uploads (must_grow = false) while preserving guaranteed growth for GPU card writes (must_grow = true).VICTORY_HELD_LEVELSactive for non-tiled textures even whenlevels_on_demandis enabled.scripts/analyze-world-run.py):"the texture queue's room: <used> MB in use ... of a budget of <budget> MB): room|no room"as fallback in-world accounting whenroomremainstrueand detailed no-roomcard accounting:dumps are not triggered.Paired Plain
--release60s-PlayParityA/B (series-x, 1440p DLSS Quality, NO--features diagnostics, RTX 4060 Ti 8 GB / i7-13700F)main(eb9dc68d)f0f8afa8)16.5 fps(60.6 ms)16.2 fps(61.7 ms)-0.3 fps(+1.1 ms)2.9 fps7.5 fps+4.6 fps30.9 ms31.7 ms+0.8 ms(streaming1.9xtextures)12.5 ms11.8 ms-0.7 ms6,803 / 6,727 MB6,086 / 6,660 MB-717 MB(574 MBunder budget)64 MB0 MB-64 MB(PASS)room=falseratio100.0%(no_room=42,500)0.0%(no_room=0)-100.0 pp(PASS)46(2,944 MB,447 MBfree)34(2,176 MB,252 MBfree)-12blocks (-768 MB)38,71573,370+34,655(+89.5%)final_waitingtextures15,1341,064-14,070(-93.0%, PASS)mapped()rate (longest)4.45 ms/s(47.0 ms)5.08 ms/s(17.6 ms)+0.63 ms/s(-62.5%peak stall)0(untranslated=6)0(untranslated=6)(Note: on
ff6e5925before#278, this branch also gained+1.9 fps(13.9 -> 15.8 fps),-803 MBVRAM, androom_false=0.0%; an isolated A/B withVICTORY_LEVELS_ON_DEMAND=1vs default0confirmed keepinglevels_on_demand=0by default yields higher FPS (15.8vs14.35 fps) and lower VRAM (6,030vs6,243 MB) on 8 GiB cards alongside 4 KiB pool packing.)90s
--features diagnosticsVisual & Alignment Verificationwhere_the_card_readsreported0past the end of the pieceerrors across64,290uploaded textures (on=true amd=false).0crashes,0no host textureerrors,6,211 / 6,731 MB(over=0 MB),lit=24/24,luma=60.93,near_black=0.02%,magenta=0.0%; inspected both outdoor shoreline/architecture and interior lighting PNGs directly confirming crisp full-resolution textures and clean lighting.Checks
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy(317 files ok)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked pool::(19 passed, 1 ignored)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked tiles:: -- --test-threads=1(10 passed, 1 ignored)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked resource:: -- --test-threads=1(34 passed)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory --locked play::(16 passed)clippy --workspace --all-targets --locked -- -D warnings(default +--features diagnostics)PR check and mergeshandles merges).@Androtim on GitHub · 2026-12-01 10:03 UTC · original · edited 2026-12-01 11:03 UTC
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Logic, safety, and unit tests look solid, and CI is passing. Because this PR changes D3D12 placed-texture alignment defaults, launcher/script defaults, VRAM budget accounting, and pool spare retention, it should get a local real-GPU smoke test before merging.
What was checked
crates/victory-gpu/src/pool.rs,apps/victory/src/play.rs,scripts/play-minivi.ps1,scripts/verify-world.ps1):small_placement_fordefaults totrueon non-AMD GPUs andfalseon AMD viacrate::indirect::amd(device), while honoring explicitVICTORY_POOL_SMALL=0|1overrides andab::pickunderdiagnostics. Removing the hardcodedVICTORY_POOL_SMALL=0entries fromplay.rsand the helper scripts lets the adapter-aware default take effect.crates/victory-gpu/src/pool.rs):spares()drops to0at>= 90%budget or< 512 MiBfree headroom (or under pressure), and scales((headroom / 4) / BLOCK).clamp(SPARE, SPARE_KEPT)below85%whenkeepis true. Arithmetic usessaturating_subandu128comparisons, avoiding underflow/overflow. (Minor doc nit: the doc comment abovepool::room()still describes the old staticSPARE_KEPTrule.)crates/victory-gpu/src/resource.rs,crates/victory-gpu/src/tiles.rs):resource::has_block_room()fromresource::block_room()letsTiled::give_lockedgate non-card-write tile heap growth without mutatingpool::note_full.basecalculation inresource::hostedwithtiled.is_none()ensuresVICTORY_HELD_LEVELSstays active for non-tiled textures without shiftinghost.baseon tiled textures whenVICTORY_LEVELS_ON_DEMAND=1.tiles::free_room()(STATS[3].saturating_sub(STATS[2])) inresource::room(),weighed(), androom_terms()and defaultingtiles::reclaim()to on (VICTORY_LEVELS_RECLAIM=0disables) are consistent with the existing pool accounting.scripts/analyze-world-run.py):QUEUE_ROOM_REcleanly falls back to"the texture queue's room: ..."lines when healthy runs never emit detailed no-roomcard accounting:dumps.Local GPU verification recommended
Verify on a real GPU (ideally both non-AMD and AMD if available) that 4 KiB placed-texture packing and the reactive spare/budget limits produce no device loss, placement boundary faults, or VRAM regressions.
Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-12-01 10:16 UTC · original
Addressed all four minivi-triage items in
b7cf2f16:land::tests::landings_beside_the_title_and_its_refreshes_lose_nothing(␀xc0000005 under CI test runner, unrelated to pool.rs/ iles.rs/esource.rs); verified
land::passes locally (7 passed, 1 ignored with --test-threads=1) and pushed to re-run CI.esource::has_block_room (no pool::note_full mutation from the tiled allocator), and evaluate it once in give_locked outside POOL only when held-only levels request growth.
esource::held_only() callers audited:**
esource::held_only() || crate::tiles::wanted().
esource.rs::want_level early-returns on host.base == 0, and hosted() keeps ase = 0 when iled.is_some().
esource.rs::placed_bytes_from scopes mapped-byte checks to the slot's viewed mip chain (irst..tail) while Tiled::uploaded_on reads all mapped levels independently via held_levels_of.
The default plain --release path (VICTORY_LEVELS_ON_DEMAND=0) and pool.rs / play.rs behavior are unchanged from the verified 0f8afa8 A/B run (-717 MB VRAM, over=0 MB,
oom_false=0.0%, -93.0% inal_waiting). Local gates on
b7cf2f16passed: xtask policy, pool:: (19 passed, 1 ignored), iles:: -- --test-threads=1 (11 passed, 1 ignored),esource:: -- --test-threads=1 (34 passed), land:: -- --test-threads=1 (7 passed, 1 ignored), play:: (16 passed), dual workspace clippy --all-targets -- -D warnings. Not self-merged.
@Androtim on GitHub · 2026-12-01 11:19 UTC · original
Architect & Strict-Gate Review (
b7cf2f16, CI passing,minivi-triageverified, zero newVICTORY_*opt-in toggles):Landmark Pillar #3 VRAM & streaming win with dynamic headroom-reactive policy (8 GB to 16–24+ GB GPUs):
6,803/6,727 MB (over=64 MB)->6,086/6,660 MB (over=0 MB)(-717 MB,574 MBunder budget; pool46 -> 34blocks,-768 MB)room_false100.0% -> 0.0%(no_room_so_far: 42,500 -> 0), peakmapped()stall47.0 -> 17.6 ms(-62.5%)uploaded38,715 -> 73,370(+89.5%),final_waiting15,134 -> 1,064(-93.0%)min_fps2.9 -> 7.5 fps(+4.6 fps),mean_fps14.49 -> 14.52,p10_fps7.90 -> 8.04,copyback12.5 -> 11.8 ms(-0.7 ms; slight+0.8 mspreparingduring 60s warmup comes from uploading1.9xtextures; onff6e5925this also gained+1.9 fps)--features diagnostics90s late in-world PNGs directly verified crisp and clean (lit=24/24,near_black=0.02%,magenta=0.0%),0crashes/DRED,untranslated = 6 -> 6VICTORY_POOL_SMALL=0kill-switch) and stays 64 KiB on AMD;spares()scales dynamically from live DXGI headroom ([2, 64]blocks,0below512 MiB/>= 90%).Squash-merging into
main.