D3D12.X: port XCL_TEXTURE_SYSMEM (#3039) to amd-dev with L0 heap reclamation #3335
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3335"
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 ivall/xcl. Originally posted by iggyvilla on 2026-11-29T09:05:18Z.
Ports @treybertram06's opt-in
XCL_TEXTURE_SYSMEM=1(#3039, which targetsmainand does not apply toamd-dev) toamd-devf33df5a7. Off by default; needsXCL_TEXTURE_LEVEL_PAGES=1.New pages that
map_levelstakes for lazily mapped texture levels come from 64 MiB L0 system-memory pool heaps (custom, write-back, sampled by the GPU over PCIe) instead of local video memory; a page there hasSYS_TILE(bit 31) in its heap index. If an L0 heap cannot be made, local video memory is used. Pages already mapped at a title address keep their backing, so aliasing (an RT placed over a streamed page) is unchanged.vram.rs:SYS_TILE,texture_sysmem(),alloc_sys_pool_heap(),heap_in(),cool_in(),sys_pools/sys_poolonPages,bind_range_in(.., sys),SYS_TILEhandling indrain_fenced_tiles,flush_zero_tiles,map,release_tiles, the byte counts, and empty L0 heap reclamation next to the local one insweep_and_reclaim(per @thehollowedone's review on #3039; creation-order aliasing wording per @thehollowedone and @andrewDoing).a_system_memory_page_is_told_apart_and_cools_in_its_own_pool,cooled_system_memory_pool_heaps_are_reclaimed_independently.apply_backing; that function no longer exists onf33df5a7.Tested
32.0.21045.29003), Ryzen 7 5700X, Windows 11,rustc 1.100.0, debug test build onorigin/amd-devf33df5a7+ this commit.cargo test --lib system_memory: 2 passed (the GPU one ran, it did not skip).hle::d3d12x::vram::: 30 passed, 0 failed, 1 ignored.cargo test --lib hle::d3d12x:: -- --test-threads=1: the same 8 tests fail with and without this commit; no new failures.7c795f5e) the port ran 600 s world-load runs on this card up to 3,027 presents with no crash. Onf33df5a7only the 60 s smoke below was run (with the option off); the option's path is not soaked on this base.Regression run
Both 60 s runs with
scripts/smoke.ps1 -Seconds 60,XCL_PREPARE=0, on the same retail title and RX 6650 XT, afterxcl pso-precompile --usedhad warmed the compute pipeline cache (with a build that has all three ports of this series). Firstmaind8bd9a38, then this PR's head.XCL_TEXTURE_SYSMEMwas not set, so this run covers the off (no-change) path.Peak commit is 1.56x main's, past the 1.25x rule, but that is
amd-dev's, not this change's: the same 60 s run onamd-devf33df5a7without this commit peaks at 25,028 MB (1,429 frames). So everyamd-devPR will fail that one line of the check untilamd-devitself comes down.Not tested
cargo test --workspace, NVIDIA, RDNA3/RDNA4.AI use
amd-dev7c795f5e) was written and tested by Antigravity with Gemini 4 Neon (High). Its port tof33df5a7(the old patch no longer applied: the code moved) was done by Claude Code (Claude Sonnet 5.5, effort high), which also ran the tests below and wrote this text. The account owner did not write the code or this text.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:12:31Z.
Review (head
13500f30, diff read, not a merge-check; draft, baseamd-dev, conflicts with it):sweep_and_reclaim,vram.rs~1180-1218, and its test ~3598) isn't in #3039, the original on main (still open). Unless it goes into #3039 too, or into its own PR, main and amd-dev diverge on it.need_unmap_work(~2102) only look atpool.cooling, neversys_pool.cooling. Tiles freed into the L0 pool while no video-memory page is cooling get no probe, so their heaps are never reclaimed. Constant video-memory churn probably hides it.page_bytes_for(~2181) andpage_bytes(~2261) now leave L0 pages out, but no L0 total is added, so the memory report undercounts.bind_range_inwithsys=true). The debug layer wasn't run, and a render target placed over an L0 page inherits that backing.8ea8524fmade level pages the default, so "needsXCL_TEXTURE_LEVEL_PAGES=1" no longer holds.release_tests::the_last_release_drops_entries...,sparse::tests::a_gpu_write_into_a_gpu_view...) are in files this PR doesn't touch; amd-dev's own CI is red too.Fine: off by default, and with it off the behaviour is unchanged (no tagged tiles, so the
preferredfilter is a no-op). The bit-31 tag is handled consistently indrain_fenced_tiles,flush_zero_tiles,mapandrelease_tiles, and when no L0 heap can be made it falls back to video memory.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:49:42Z.
Triage (#1607) – head
13500f3This is a port of the vram.rs half of open #3039 (
XCL_TEXTURE_SYSMEM) toamd-dev, where #3039 does not apply. It also adds reclamation of empty L0 heaps.TEXTURE_SYSMEMis not onorigin/amd-devormainyet. It does not overlap #3112 (same author, sparse.rs pools underXCL_SPARSE_VRAM_CAP_MB). The large line overlap with #3111/#3361/#3099 comes from the amd-dev base, not from this commit. No problems found in the diff:SYS_TILE-tagged tiles are routed through cooling, fenced returns, zeroing, scratch heaps and reclaim, and the byte counts leave system-memory pages out. The PR conflicts withamd-dev.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by iggyvilla on 2026-12-02T03:54:13Z.
Closing as superseded by #3587 (
XCL_VRAM_BUDGET=1), which spills sampled texture pools to L0 dynamically under VRAM pressure rather than unconditionally.Pull request closed