D3D12.X: release empty tiled-texture VRAM pools #800
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!800
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/800/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?
@wayward-tail on GitHub · 2026-11-24 05:36 UTC · original
wayward-tail:pr/release-empty-vram-pools→main· +90 −7 · 2 files · 1 commits · closed without mergingTiled-texture pool heaps remain allocated after all their tiles become free. Release excess completely free heaps after cooling, keep one warm pool, and reuse vacated pool slots. This preserves the upstream idle-page sweep.
What is in it
Tested
e712b74e0157f9bfc3a4870d9683e048bcc54a95; Windows 11 Home build 26200, AMD Ryzen 7 8845HS, NVIDIA RTX 4060 Laptop GPU (driver 32.0.15.9282), Rust 1.100.0 MSVC, DXC 1.9.2609.5. Tests debug; title smoke release with symbols.XCL_ADAPTER=rtx 4060.cargo build --workspaceandcargo build --release -p xcl: succeeded.cargo test --workspace --no-fail-fast -- --test-threads=4: 701 passed, 1 failed, 41 ignored. The two wave64 skips below are included in Cargo's passed count.64b3f35: 700 passed, 1 failed, 41 ignored.gpu_clamp_and_omod_per_instructionfails atv_pk_add_i16 clampon unmodified main on this GPU.Regression run
Main:
This branch:
Not tested
XCL_SAMPLE_*game-data variables: unset, so those bodies were not exercised.AI use
@futurepro62 on GitHub · 2026-11-24 07:06 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
e712b74(on its base64b3f35).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 702 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.empty_tile_pools_are_released_after_cooling_and_slots_reused.Not tested
AI use
@iggyvilla on GitHub · 2026-11-24 07:34 UTC · original
Code read of head
e712b74(static read only; nothing built or run). Two points.1.
pools.len()is no longer the number of live heaps, and #640 / #782 read it as one.After this PR a released heap stays as a
Noneslot (vram.rs:463release_empty_pools, slot reused byinsert_pool,vram.rs:448), sopools.len()only ever grows to the high-water mark. The page budget in #640 (vram.rs:329) and #782 (vram.rs:319) isgit merge-treeof #782 with this PR is clean, so nothing flags it, but once a heap has been released andlen()has reachedcap,take_tilerunsevict_lru(unmaps and later re-uploads live textures) every time the free list andcoolingare empty, even if the live heap count is well under the budget. The count to use there isself.pools.iter().flatten().count()(or a smalllive_pools()helper next toinsert_pool). Whichever of these lands second should carry that change; worth a line in the description so it is not missed.2.
sweepnow does O(free tiles) work and allocates on every placement.bindcallsself.sweep(now)for every placement (vram.rs:397).release_empty_poolsreturns early only whenfree.len() < POOL_PAGESor one heap is live; otherwise it allocatesvec![0u32; pools.len()]and walks all offree(vram.rs:473on). With several live heaps and a few thousand free tiles that is a walk plus an allocation perCreatePlacedResourceX.sweep_idleright above it was changed in #490 specifically so that a placement does not look at every page. Per-heap free counters kept intake_tile/release_tiles, or running the release pass at most once perCOOL, would keep the placement path flat.Smaller: the heap is dropped once its tiles have sat in
coolingforCOOL(2 s); please say in the description that the 2 s wall-clockCOOLis accepted as the guard for destroying theID3D12Heaptoo, as it already is for reusing a tile.AI use: Claude Code, Claude Sonnet 5.5, read the diff and the code of #640 / #782 at the heads named above and drafted this comment; I checked each line reference.
@Jefter5549 on GitHub · 2026-11-24 15:46 UTC · original · edited 2026-11-24 20:28 UTC
Hardware verification on NVIDIA GeForce RTX 2060 SUPER (Turing 8 GB) at
6142deb(PR #800 merged with latestmain+ PR #1017; note: #1017 was later closed as invalid)Environment:
--release -p xcl)1. Invariants & Unit Verification:
cargo test -p xcl --lib empty_tile_pools: PASSED (empty_tile_pools_are_released_after_cooling_and_slots_reused).cargo test -p xcl --lib vram -- --test-threads=1: 12/12 PASSED (all arena, isolation, page boundary, and pool lifecycle tests pass cleanly).live >= 1): Kept at least one warm pool active under complete drain; no heap thrashing observed.COOL = 2s): Tiles in cooling are preserved until wall-clock expiry and GPU fence completion.free.retainpurges indices corresponding to dropped heaps.insert_poolreusesNoneslots first, preventing unbounded vector growth.2. Retail Title Smoke & Sustained Streaming Run:
Tested on a heavy retail title package with
XCL_NETWORK=0andXCL_ACTIVITY=1:60 presents / 2 s), 0 frame-event timeouts.mainwithout this PR, switching from loading screens to video streams repeatedly triggeredCreateHeap(0x4000000) refused (0x887A0005)as abandoned loading heaps exhausted 8 GB VRAM.CreateHeapfailures were 100% eliminated (0 heap refusals). Local video memory stayed stabilized at 7,295 MB across 3,000+ frames during steady-state loading screens.3. Edge Cases, Cross-PR Combinations & Downstream Interactions:
D3D12_RESOURCE_STATE_PREDICATIONis the valid state on compute command lists (whereasNON_PIXEL_SHADER_RESOURCEtriggers debug layer error 538). Subsequent cleanmainruns confirmed compute command list splits pass without #1017.pools.len()reflects the high-water mark rather than live count; downstream page-budget mechanisms (such as PR #640) readingpools.len()should checkpools.iter().flatten().count().target pages(reached 9.6 GB during intro transition). PR #800 forms the necessary foundation for heap release, which pairs effectively with PR #640's LRU eviction on 8 GB cards.AI use: Gemini 4 Neon assisted with test orchestration, telemetry analysis, and report preparation.
title_memory_budget_mbis 13,824 MB regardless of the adapter's memory #1337@DavidM1911 on GitHub · 2026-11-25 10:58 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@Prime1997 on GitHub · 2026-11-26 00:32 UTC · original
Closing because main already has this behaviour, from
5a515f03("reclaim empty 64 MiB VRAM pool heaps"). Incrates/xcl/src/hle/d3d12x/vram.rs,PoolHeapsreuses vacated slots (free_slots) and counts only live heaps.reclaim_empty_heaps()drops completely free, cooled pool heaps and keeps one spare warm by default (XCL_VRAM_KEEP_SPARE_POOLS). This branch also conflicts with main in vram.rs. #1142 (texture-only heap flags) is a separate change and is not affected.Compared at head
e712b74eagainst main08db802. Reviewed with Claude Code (Claude Opus 5.5); I checked the comparison before closing.Pull request closed