D3D12.X: track SRV min-LOD clamp and evictable VRAM heap class #2731
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!2731
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2731"
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?
@O5-7 on GitHub · 2026-11-26 09:08 UTC · original
O5-7:vram/ws5-srv-clamp-and-heap-class→main· +932 −33 · 3 files · 3 commits · openWhat is in it
ResourceMinLODClamptracking, subresource tile unmap helper, per-group tile ownership, andTilePoolevictable vs pinned heap isolation). No default behaviour changes (XCL_TEXTURE_BUDGET_EVICTdefaults off, and automatic budget eviction is left for the follow-up PR).TRACKED_SRVSincrates/xcl/src/hle/d3d12x/vram.rs, wired fromdev_create_srv_xandcopy_console_slotsincrates/xcl/src/hle/d3d12x/real.rsand descriptor heap unregister incrates/xcl/src/hle/d3d12x/console_heap.rs), clearing stale slot bindings whenever an SRV slot is overwritten with null, buffer, RTAS, or non-placed resources, and raisingResourceMinLODClampon new SRVs toresident_min_mipwhenXCL_TEXTURE_BUDGET_EVICT=1.TilePool(heap_evictable: Vec<bool>) so evictable top-mip tiles (map_levelswithXCL_TEXTURE_BUDGET_EVICT=1) allocate into separate 64 MiB pool heaps from pinned packed-tail / flat allocations, enabling whole-heap reclamation once top mips are evicted; addPages::unmap_rangeand per-group tile tracking (Levels::group_tiles).Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release build (cargo build --release -p xcl).cargo test -p xcl --lib vram::tests -- --nocaptureon head2f2bb070: 23 passed, 0 failed, 1 ignored (churn_update_tile_mappings_timing), including GPU testgpu_unmap_top_mip_with_srv_min_lod_clamp_samples_resident_mipand 3 unit tests (clamp_srv_min_lod_raises_clamp_without_lowering_existing,evictable_heap_class_isolates_top_mips_so_empty_heaps_reclaim,tracked_srv_overwrite_with_null_or_non_placed_clears_slot_before_copy). (cargo test --workspace -- --test-threads=4: 1438 passed, 0 failed, 47 ignored on base PR commit81e34358.)Regression run
Not tested
9cc6a39ewere run, and#[ignore]hardware/oracle tests were skipped.evict_under_budget) is intentionally omitted here to keep this PR focused and reviewable;XCL_TEXTURE_BUDGET_EVICT=1only enables SRV tracking and evictable heap-class separation until the follow-up PR lands.AI use
TilePoolheap-class isolation, GPU/unit tests, and regression runs, reviewed and verified locally.@luckyteagirl on GitHub · 2026-11-26 09:37 UTC · original · reviewed
On
81e3435, the tracked slot is not cleared when an existing placed-texture SRV is overwritten with a null, buffer, or non-placed SRV. For example, write tracked A to slot S, replace S with a null SRV, thenCopyDescriptorsSimple(S, D). The native descriptors now contain the replacement, butby_slotstill associates S with A andcopy_srv_slotpropagates A to D. The non-placed case returns before removing the old entry too. This affects theXCL_TEXTURE_BUDGET_EVICT=1bookkeeping introduced here; the current PR does not yet implement the eviction rewrite, so I have not demonstrated a rendering failure.Could every actual SRV overwrite clear the previous slot record under the tracking lock before optionally recording the new placed texture? Tests for placed→null and placed→non-placed, followed by a descriptor copy, should verify neither slot retains A. This is exact-head source review only.
@thehollowedone on GitHub · 2026-11-26 10:35 UTC · original
Independent Windows check of #2731 head
81e3435, based onmainb49be18.Windows 11 build 26300, RTX 3080 Ti (12 GB, driver 621.35) as the active display adapter, rustc 1.99.1 MSVC, DXC/DXIL 1.8.2502.11. The focused test calls
D3D12CreateDevice(None)and does not log the selected adapter LUID, so I cannot assert the device identity from that test alone.XCL_TEXTURE_BUDGET_EVICTwas unset. The checkout was clean at the exact PR head.cargo build --offline --locked --workspace: passed.cargo test --offline --locked -p xcl --lib gpu_unmap_top_mip_with_srv_min_lod_clamp_samples_resident_mip -- --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored; no GPU skip. The test ran both red-before and green-after GPU readback assertions around the SRV clamp and top-mip unmap.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --quiet: 1,438 passed, 0 failed, 47 ignored across 37 test executables, with 25 printed GPUSKIPPEDnotices. Those skipped paths are not GPU coverage.This covers the focused clamp/unmap fixture and the workspace suite on this Windows host. It does not exercise the reported stale descriptor-slot overwrite path, automatic budget eviction (not in this PR), or a retail title run. I did not test AMD or Intel hardware.
AI use: Codex (GPT-6.2 Sol) inspected the test, ran the commands, and drafted this report.
@O5-7 on GitHub · 2026-11-26 12:04 UTC · original
@luckyteagirl Fixed in
2f2bb070:TrackedSrvs::tracknow always clears any existing binding forpc_srvbefore checkingresource == 0 || !is_placed.dev_create_srv_x, every overwrite path (null resource, buffer /buf_delta_nullview, RTAS early-return, or non-placed texture) now clears stale tracking onslot.pc_srvviatrack_srv/untrack_srv.tracked_srv_overwrite_with_null_or_non_placed_clears_slot_before_copyverifying placed->null + copy and placed->non-placed + copy retain no references to the previous texture.Re-verified
cargo test -p xcl --lib vram::tests(23 passed, 0 failed, 1 ignored) and 60 ssmoke.ps1on2f2bb070.@thehollowedone on GitHub · 2026-11-26 12:59 UTC · original
Independent Windows recheck of #2731 head
2f2bb070againstmainb49be18, following my older-head report. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti 12 GB (driver 621.35, active display adapter), rustc 1.99.1 MSVC, DXC 1.8.2502.11.XCL_D3D12_DIRpointed to signed D3D12 Agility 1.620.2 DLLs;XCL_TEXTURE_BUDGET_EVICTwas unset. The native test usesD3D12CreateDevice(None)without logging the adapter LUID, so I cannot independently identify its selected adapter.cargo build --offline --locked --workspace: passed.cargo test --offline --locked -p xcl --lib vram::tests -- --nocapture --test-threads=1: 23 passed, 0 failed, 1 ignored, noSKIPPEDlines. This includestracked_srv_overwrite_with_null_or_non_placed_clears_slot_before_copy,evictable_heap_class_isolates_top_mips_so_empty_heaps_reclaim, and the nativegpu_unmap_top_mip_with_srv_min_lod_clamp_samples_resident_mipreadback. The overwrite test exercises the tracking structure; it does not call the publicCreateShaderResourceViewhook.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=1: 1,438 passed, 1 failed, 47 ignored across 37 targets, with 25SKIPPEDdiagnostic lines included in Cargo's pass counts. The sole failure isconsole_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk(cached_only console_mesh hit: "DXIL not compiled yet"). The same test fails with the same error on untouchedmainb49be18using the exact filtered command and environment. The 4e2etests passed after the required workspace build. This is a test report, not a clean-suite or merge-readiness claim.One small diagnostic correction:
budget_evict_enabledlogs “evicting oldest top texture mips under local video memory budget” when the switch is on. The PR description says automatic budget eviction is deferred, so that line currently promises behavior this revision does not provide.Suggested log wording
Not tested: a live retail title with
XCL_TEXTURE_BUDGET_EVICT=1, actual budget-driven eviction, AMD or Intel GPUs. AI use: Codex (GPT-6.2 Sol) reviewed the current source, ran the commands, and drafted this report; I checked the counts and log wording before posting.@Prime1997 on GitHub · 2026-11-26 13:06 UTC · original · reviewed
Good within the reviewed scope; retain for integration. The SRV minimum-LOD clamp and heap-class bookkeeping are worth keeping as preparation.
Clean PR head
2f2bb070fafc8f9fca30d9ac81a3e5fe4f71fbe4, based directly on current mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.Targeted result: 4 passed, 0 failed, 0 ignored, 0 skipped. Each exact filter ran in a fresh process:
hle::d3d12x::vram::tests::the_tiles_of_a_texture_are_grouped_by_its_levelshle::d3d12x::vram::tests::clamp_srv_min_lod_raises_clamp_without_lowering_existinghle::d3d12x::vram::tests::evictable_heap_class_isolates_top_mips_so_empty_heaps_reclaimhle::d3d12x::vram::tests::tracked_srv_overwrite_with_null_or_non_placed_clears_slot_before_copyBuild:
cargo test --locked --offline -p xcl --lib --no-run --message-format=json --target-dir <isolated-target>. Run:<test-exe> <each-exact-filter-above> --exact --test-threads=1 --nocapture. Private executable/target paths are placeholders. Windows 11 Pro 26200, i5-10400, 32 GiB RAM, Rust 1.100.0 MSVC debug. These selected fixtures did not dispatch GPU work.Not tested: Four CPU tests passed. The change records metadata; it does not enable eviction or prove a reduction in VRAM use. No whole suite or retail smoke was run for this batch; this is not merge certification.
AI use: Codex (GPT-6) reviewed source, ran the selected tests and verified raw results. Optional temporary Discord for coordinating contributor work, testing and comparing results.
@Decodere on GitHub · 2026-11-26 13:10 UTC · original
Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2731 at
2f2bb070fafc8f9fca30d9ac81a3e5fe4f71fbe4(parent81e34358f79dc043458a62890535b8b8e5d33675; merge-baseorigin/mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Measurements and targeted test results only; not a full source review.Setup
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200rustc 1.100.0 (0ef1bc386 2026-11-09), DXC1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)title: 29640639viascripts/smoke.ps1 -Seconds 60(XCL_NETWORK=0 XCL_ACTIVITY=1, default flags, no input)Targeted RTX 4060 release unit tests (
2f2bb070)cargo test --release -p xcl --lib clamp_srv_min_lod_raises_clamp_without_lowering_existing -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, exit0).cargo test --release -p xcl --lib gpu_unmap_top_mip_with_srv_min_lod_clamp_samples_resident_mip -- --nocapture: 1 passed, 0 failed, 0 ignored (0.36 s, ran live on RTX 4060,0skipped, exit0).cargo test --release -p xcl --lib evictable_heap_class_isolates_top_mips_so_empty_heaps_reclaim -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, exit0).cargo test --release -p xcl --lib tracked_srv_overwrite_with_null_or_non_placed_clears_slot_before_copy -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, exit0).cargo test --release -p xcl --lib hle::d3d12x::vram:: -- --test-threads=4: 23 passed, 0 failed, 1 ignored (2.55 s,churn_update_tile_mappings_timingignored,0skipped, exit0).cargo test --release -p xcl --lib hle::d3d12x::console_heap:: -- --test-threads=4: 12 passed, 0 failed, 0 ignored (0.20 s,0skipped, exit0).cargo test --release -p xcl --lib hle::d3d12x::real:: -- --test-threads=4: 60 passed, 0 failed, 0 ignored (0.65 s,0skipped, exit0).Observations
gpu_unmap_top_mip_with_srv_min_lod_clamp_samples_resident_mip) plus all 95 targeted tests acrossvram::,console_heap::, andreal::passed cleanly in--releaseon exact head2f2bb070with0skips.exit: 0x0,1596frames shown,60 60 60steady-state presents per 2 s,0device removals,0crashes,14020 MBpeak commit vsorigin/mainb49be183's14018 MB/1518frames; steady-state VRAM6116 MBlocal /4683 MBnon-local at58.0 s).Paired 60 s RTX 4060 smoke (
b49be183vs2f2bb070)Merge-base
origin/main(b49be183):PR #2731 head (
2f2bb070):Limits of coverage
2f2bb070(only targetedvram::,console_heap::, andreal::release tests plus paired quiet 60 s smoke).gpu_unmap_top_mip_with_srv_min_lod_clamp_samples_resident_mip.RTX 4060) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host.AI use
Ran the targeted release unit tests and paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts and smoke blocks were taken directly from
cargo testandscripts/smoke.ps1outputs.@Prime1997 on GitHub · 2026-11-26 13:45 UTC · original · reviewed
Needs changes: stale SRV ownership survives a console UAV overwrite. At head
2f2bb070fafc8f9fca30d9ac81a3e5fe4f71fbe4, a test-only probe through the actualdev_create_uav_xandcopy_console_slotspaths reproduced the missing cleanup. A null texture UAV writes a null companion SRV, but tracking still associates both the source and copied slot with the old placed texture.The earlier four passing CPU tests remain valid; they did not cover this entry point. The new probe on unchanged runtime code produced 0 passed, 1 expected failure, 0 ignored, 0 skipped: both tracked slots retained
Some(0x2731)after actual fake-device descriptor writes and copy had completed, instead of becomingNone.I prepared an uncommitted local repair that clears old ownership immediately after actual companion SRV writes and on buffer/empty-view conversion. It preserves tracking when an unsupported image form leaves the companion descriptor unchanged. The same regression, an unchanged-descriptor ownership control and the original four tests then produced 6 passed, 0 failed, 0 ignored, 0 skipped. Complete local patch SHA256:
8eed2fa056b859db9df663015027af9654cc16db4a2ca8226101b5620b7aa947. These are results for the locally repaired tree, not a passing claim for unchanged upstream runtime code.The two production-path probes use owned fake device/descriptor storage; no driver receives the unsupported descriptor.
XCL_TEXTURE_BUDGET_EVICT=1,XCL_TRACE_FRAMEunset, one exact test per fresh process. Build:cargo test --locked --offline -p xcl --lib --no-run --message-format=json --target-dir <isolated-target>; run:<test-exe> <exact-name> --exact --test-threads=1 --nocapture.New exact filters:
hle::d3d12x::real::uav_tracking_probe::null_texture_uav_overwrite_clears_tracked_srv_before_console_copyandhle::d3d12x::real::uav_tracking_probe::unsupported_texture_uav_without_companion_preserves_tracked_srv_before_console_copy. The four retained filters are in my earlier report.This fixes stale old ownership, not complete new-companion registration, evictable-heap alias identity or an eviction policy. No visual corruption, VRAM saving, GPU behavior, full-suite or title result is claimed. Local changes remain separate from the installed build.
AI use: Codex (GPT-6) traced the entry/copy paths, prepared and cross-reviewed the local repair and inspected raw regression results. Optional temporary Discord for coordinating contributor work, testing and comparing results.
@Prime1997 on GitHub · 2026-11-26 15:13 UTC · original · reviewed
Separate issue from the companion-SRV overwrite: the pinned/evictable heap guarantee can fail when two resources alias the same guest-owned tile. Bind an evictable top mip first, then bind a pinned resource to that guest tile. The reuse path in
vram.rsincreases the existing mapping's user count without promoting its heap or excluding that heap from evictable allocation. When the evictable references are gone, the pinned reference can still prevent heap reclamation.This is source-traced. The existing heap-class test uses fresh disjoint tiles. Please add an alias case that verifies both binds retain physical tile identity, excludes the mixed heap from fully reclaimable accounting, and checks that the pinned value survives release of the evictable alias.
AI use: Codex (GPT-6) reviewed the pinned changes and verified the reported evidence. Optional temporary Discord for coordinating contributor work, testing, and comparing results.
@thehollowedone on GitHub · 2026-11-26 22:20 UTC · original
Follow-up to the pinned/evictable alias review on head
2f2bb070. I reproduced that specific heap-class gap and checked a small candidate repair.A test-only GPU fixture binds an evictable top tile, then a pinned resource to the same guest page. They retain one physical tile, but its heap remains classed evictable. A third, disjoint evictable tile then allocates in that heap. On unchanged runtime code the exact test failed 0 passed, 1 failed, 0 ignored, 0 skipped at
a heap containing a pinned alias cannot stay evictable. This is a classification failure; I did not observe a reclaimed live heap or pixel corruption.After a successful pinned bind, marking every heap touched by its mapped tiles as pinned makes the test pass. It keeps the existing tile mapping, including aliases, and prevents fresh evictable tiles from entering that heap. The class remains conservative until the heap slot is recycled. The test also unmaps/releases the evictable alias and verifies the pinned page still has the original tile with one user. On this local candidate,
cargo test --offline --locked -p xcl --lib hle::d3d12x::vram::tests:: -- --test-threads=1reported 24 passed, 0 failed, 1 ignored, 0 skipped.Candidate patch against
2f2bb070Environment: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35 active display adapter, Rust 1.99.1 MSVC debug. This fixture uses
D3D12CreateDevice(None)and does not record its selected adapter LUID, so I cannot independently prove the device identity. Not tested: full workspace suite, paired title smoke, actual budget eviction, AMD/Intel/Wine, or GPU pixel contents. This is a candidate for the author to integrate and verify, not a merge-readiness claim.AI use: Codex (GPT-6.2 Sol) wrote and ran the fixture, checked the candidate, and drafted this report.
@O5-7 on GitHub · 2026-11-27 12:25 UTC · original
Updated in
104265ea:CBV/UAV slot overwrite untracking (@Prime1997): Added untrack_srv(slot.pc_srv) in dev_create_cbv_x and in dev_create_uav_x whenever the slot/companion descriptor is overwritten (null/invalid views, buffer UAVs, or image companion SRV writes), while leaving TRACKED_SRVS untouched when uav_companion_srv returns None and skips rewriting slot.pc_srv. Covered by new production-path tests null_texture_uav_overwrite_clears_tracked_srv_before_console_copy and unsupported_texture_uav_without_companion_preserves_tracked_srv_before_console_copy.
Pinned alias heap demotion (@Prime1997, @thehollowedone): In Pages::bind_range, when a !evictable bind aliases an existing pages or extra_pages guest page, TilePool::mark_heap_pinned now demotes that heap out of heap_evictable so subsequent disjoint evictable allocations do not pack into a pinned-by-alias heap. Covered by gpu_pinned_alias_on_evictable_guest_page_demotes_heap_and_survives_release.
@thehollowedone on GitHub · 2026-11-27 12:37 UTC · original
Independent Windows check of #2731 head
104265ea, following the author’s pinned-alias and descriptor-overwrite changes. The checkout was clean. On Windows 11 build 26300 with an RTX 3080 Ti (NVIDIA 621.35), Ryzen 7 9800X3D, rustc 1.99.1 MSVC and DXC 1.8.2502.11:cargo build --locked --workspace: passed.cargo test --locked -p xcl --lib <filter> -- --nocapture --test-threads=1passed 1/0/0, no skip forgpu_pinned_alias_on_evictable_guest_page_demotes_heap_and_survives_release,null_texture_uav_overwrite_clears_tracked_srv_before_console_copy, andunsupported_texture_uav_without_companion_preserves_tracked_srv_before_console_copy. The GPU fixture callsD3D12CreateDevice(None)and does not log the chosen adapter LUID.cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --quiet: 1,441 passed, 1 failed, 47 ignored across 37 targets. There were 25 skip notices: 21 no native wave64, three refused per-lane cases, and one no heap windows. Skips are not GPU coverage.The sole suite failure was
gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, atcached_only console_mesh hit: "DXIL not compiled yet". I ran that exact filter separately on clean current main06f90c1; it failed with the same message (0 passed, 1 failed, 0 ignored). This control supports treating the suite failure as pre-existing, not a regression from this PR. The new alias/overwrite regressions pass at this head.I did not run a paired title smoke on
104265ea, test actual budget eviction under pressure, or test AMD, Intel, or Wine. The clean-head smoke pair and a green full-suite gate still need resolution before merge.AI use: Codex (GPT-6.2 Sol) reviewed the changed paths, ran the commands, checked counts and skip notices, and drafted this report.
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.