Repository navigation
Conversation
|
Review (head c42d20c, diff read, not a merge-check):
Fine: with AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
c42d20c to
3008ae0
Compare
|
Updated to
The remaining points (full workspace suite beyond CI and AI use: Antigravity (Gemini 4 Neon) applied the |
|
Follow-up review (head 3008ae0, since c42d20c, diff read, not a merge-check):
New: none. The new smoke block runs with AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
…re pools to L0 Add opt-in XCL_L0_VRAM_MARGIN_MB (default 0 = disabled) to dynamically spill new sparse tile pools (sparse.rs) and sampled-only texture tile pools (vram.rs) to D3D12_MEMORY_POOL_L0 (system memory) once DXGI local VRAM usage is within the configured headroom margin of budget. Render targets, depth buffers, and UAV textures (!evictable) always stay in local DEFAULT VRAM and keep_pools skips L0 heaps. When a non-evictable target binds a console page currently backed by an L0 heap (DENY_RT_DS_TEXTURES), bind_range promotes the page in-place to a local VRAM tile, cools the old L0 tile, and remaps any live mapped aliases in Pages::targets onto the promoted local tile so aliased reads never observe stale data. Non-OOM adapter refusals of custom L0 heaps are cached per heap class. Distinct from xcl-dev#3614 (two-pass UAV buffers in bind.rs, untouched here), xcl-dev#3112 (stale draft on amd-dev), xcl-dev#2987 (static sparse cap), xcl-dev#3039 / xcl-dev#1702 (unconditional sysmem opt-ins), and xcl-dev#3587 (amd-dev).
3008ae0 to
476983d
Compare
|
Fixed the aliased target/texture sharing issue cleanly in
AI use: Antigravity (Gemini 4 Neon) implemented the in-place L0 -> local promotion, added the hardware |
|
Follow-up review (head 476983d, since 3008ae0, diff read, not a merge-check):
New:
Fine: with AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
On 12 GiB non-UMA discrete GPUs during heavy world loads, sparse tile pools (
sparse.rs) and sampled-only texture tile pools (vram.rs) can push local VRAM over the DXGI budget, forcing WDDM to evict render targets, depth buffers, and hot arenas across PCIe / into the pagefile.This PR adds a single opt-in DXGI budget-headroom control (
XCL_L0_VRAM_MARGIN_MB, default0= disabled) that dynamically spills new sparse tile pools and sampled-only (!gpu_owned) texture tile pools intoD3D12_MEMORY_POOL_L0(system memory) only when DXGI local VRAM usage is within the configured headroom margin of budget.Relation to existing PRs
#3614covers two-pass UAV buffers inbind.rs(bind.rsis untouched here); this PR covers onlyvram.rsandsparse.rs.amd-dev): Draft PR#3112(created 2026-11-28) targetsamd-devwith a static opt-in sparse cap and has not been updated since submission whilemainhas changed substantially.amd-dev), and D3D12.X: allow title texture pages in system memory #1702:#2987uses a static sparse tile cap,#3039/#1702move streamed/texture pools to L0 unconditionally behind opt-ins, and#3587targetsamd-dev; this PR offers a cleanmain-based single opt-in DXGI-headroom mechanism covering both sparse and sampled-only texture pools dynamically only when approaching budget.What is in it
crates/xcl/src/hle/d3d12x/vram.rs:XCL_L0_VRAM_MARGIN_MB(parse_l0_vram_margin_bytes, default0= disabled),vram_within_margin, and 250 ms cachedshould_spill_l0_for_vram()usingsuper::real::video_memory().L0_TEX_HEAP_UNSUPPORTED/note_l0_heap_error: caches non-OOMCreateHeapL0 refusals per heap class so unsupported adapters go straight toDEFAULT.alloc_pool_heap: sampled-only (evictable) 64 MiB texture pools spill toD3D12_MEMORY_POOL_L0(D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | D3D12_HEAP_FLAG_DENY_BUFFERS) when within margin, with clean fallback toDEFAULT(andDEFAULT-> L0 fallback whenXCL_L0_VRAM_MARGIN_MB > 0). WhenXCL_L0_VRAM_MARGIN_MBis unset/0, behavior andTilePoolallocation classes are identical tomain.bind_range+remap_promoted):PoolHeaps::is_l0tracks L0 heaps andkeep_poolsskips them. When a non-evictable target (RT/DS/UAV) binds a console page currently backed by an L0 heap (DENY_RT_DS_TEXTURES),bind_rangeallocates a local VRAM tile, promotesp.tilein-place, cools the old L0 tile, and callsremap_promotedto re-map every live mapped resource inPages::targetsreferencing that page onto the promoted local tile — preserving 100% shared page identity with zero stale aliased reads.l0_vram_margin_parses_opt_in_default_and_checks_budget(parsing, budget boundaries,texture_pool_heap_desc).pool_heaps_tracks_l0_flag_across_slot_reuse_and_l0_heap_creates(slot reuse + hardware D3D12 L0 texture and L0 bufferCreateHeap).l0_page_promotes_in_place_to_local_when_target_binds_same_va(real hardware D3D12bind_rangetest: binds a reserved sampled texture onto an L0 pool, then binds a reserved RT at the exact same VA, verifying in-place promotion to local VRAM,users == 2, zeroextra_pagessplit, old L0 tiles cooled, and device health).crates/xcl/src/hle/d3d12x/sparse.rs:vram::l0_vram_margin(),vram::should_spill_l0_for_vram(), andvram::note_l0_heap_errorwith its ownL0_SPARSE_HEAP_UNSUPPORTEDflag to spill new 4 MiB sparse tile pools (D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES) to L0 when within the DXGI headroom margin, skippingset_heap_priorityon L0 heaps.Tested
32.0.16.2140), AMD Ryzen 7 7800X3D, 31.1 GB RAM, Windows 11 build 26300,rustc 1.100.0, DXC1.8.2502.11.cargo test -p xcl --lib -- l0_vram_margin_parses_opt_in_default_and_checks_budget pool_heaps_tracks_l0_flag_across_slot_reuse_and_l0_heap_creates l0_page_promotes_in_place_to_local_when_target_binds_same_va --nocapture --test-threads=1on476983d4: 3 passed, 0 failed, 0 skipped.cargo test -p xcl --lib hle::d3d12x::vram::tests -- --test-threads=1andsparse::tests: 213 passed, 0 failed (plus full workspace test check by reviewer on prior head: 2,911 passed, 0 failed).Regression run
Matched 60 s smoke runs with identical settings (
XCL_DIRECT_DXIL=1, defaultXCL_PSO_PRELOAD,smoke.ps1defaultXCL_PREPARE=0):main(f07e426d):this PR (
476983d4, defaultXCL_L0_VRAM_MARGIN_MBunset):this PR (
476983d4, active spillover path withXCL_L0_VRAM_MARGIN_MB=12288):Not tested
vkd3d-proton), and full workspace test suite locally on476983d4(covered by CI).AI use
bind_rangepromotion test, running unit tests and matched default + active-spillover smokes, and drafting this description. Reviewed by me.