Repository navigation
Conversation
TilePool hands recycled cooling tiles back to Pages::bind_range with stale bytes from their prior texture, causing tile-shaped garbage blocks on new render targets, depth buffers, and UAVs (xcl-dev#505). Track per-heap recycled dirty bits in TilePool and lazily zero dirty tiles on the Pages mapping queue via a scratch reserved buffer and pre-zeroed upload buffer before mapping them to the new resource. Fresh heaps from CreateHeap and live/idle same-address aliases are untouched. Tested with recycled_pages_tiles_are_zeroed_before_reuse (failed with [ff, 00, ff, ff] leak pre-fix; passed post-fix) and tile_pool_marks_recycled_tiles_dirty_and_preserves_dirty_on_rollback. Assisted-by: Google Antigravity CLI (Gemini 4 Hydrogen (High))
itsSio
force-pushed
the
d3d12x/zero-recycled-vram-tiles
branch
from
November 26, 2026 12:08
94c5930 to
e540403
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TilePoolhands cooled recycled tiles back toPages::bind_rangewith stale GPU bytes from their previous texture, which can surface as tile-shaped garbage blocks on newly bound render targets, depth buffers, and UAVs (part of#505, recycled-tile finding). This change tracks recycled dirty bits per backing heap inTilePooland lazily zeroes dirty recycled tiles onPages::queuebefore mapping them to the new resource. Fresh heaps fromCreateHeapand same-address live orIDLEaliases incur no extra GPU work.What is in it
D3D12.X: zero recycled vram::Pages tiles before reuse:crates/xcl/src/hle/d3d12x/vram.rs(TilePool::dirty_tilesper-heap bitset set indrain_cooling, preserved across OOM rollback inreturn_tiles, cleared onadd_heap_at/reclaim_empty_heapsand after successfultake_batch; lazyPages::Zeroerusing a 256-tileCOMMONreserved scratch buffer, 16-tile zeroedUPLOADsource, and 8-slot fencedDIRECTcommand list ring toCopyBufferRegion-zero dirty recycled tiles onPages::queuebeforePages::map; unit testtile_pool_marks_recycled_tiles_dirty_and_preserves_dirty_on_rollbackand GPU testrecycled_pages_tiles_are_zeroed_before_reuseverifying recycled-tile zeroing and same-VAIDLEalias preservation)Tested
Commit
94c593033ba03fb5a2302786ff810483be13663d(based onmainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7), clean checkouts on each PC, debug builds for workspace tests and release builds for retail smoke runs.recycled_pages_tiles_are_zeroed_before_reusefailed without the fix (recycled tile row 0 leaked non-zero data: [ff, 00, ff, ff, ...]) and passes with the fix.32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200.9974,rustc 1.97.0(stable-x86_64-pc-windows-msvc), DXC1.9.2609.5, debug build (XCL_ADAPTER=NVIDIA).cargo build --workspace: exit 0.cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1437 passed, 0 failed, 47 ignored.SKIPPED: 26 (wave64-only GPU tests,#1426wave32 f16/cvt refusals,heap_window_out_of_memory_falls_back_to_the_switch_form,pso_measurement_compiles_an_exact_synthetic_record0x887A002D).cargo test -p xcl --lib vram:: -- --test-threads=1: 21 passed, 0 failed, 1 ignored (churn_update_tile_mappings_timing), 0 SKIPPED (recycled_pages_tiles_are_zeroed_before_reuseran on the RTX 5080).32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200.8653,rustc 1.99.1(stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC1.8.2502.11, debug build (XCL_ADAPTER=NVIDIA).cargo build --workspace: exit 0.cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1436 passed, 1 failed, 47 ignored (both newvram::testspassed; the sole failure was unrelatedhle::xgameruntime::gamesave::tests::atomic_writes_preserve_xcltmp_blobs_and_skip_leftover_temps, which passed 1/0 standalone on unpatchedb49be183).SKIPPED: 29 (same 26 as PC 1 plus 3 requiringd3d12SDKLayers.dll).Regression run
main(b49be183, RTX 5080, release):PR (
94c59303, RTX 5080, release):Not tested
#505tile-mosaic scene (the 60 s regression run above stays in the loading phase and verifies no performance/memory/stability regression onmain).>256tiles) and multi-copy (>16tiles) GPU stress paths.scripts/smoke.ps1on the RTX 2080 SUPER.AI use
Ran via Samaritan:
94c59303, ran the pre-fix/post-fix repro, and ran the dual-PC workspace test suites.vram::GPU tests on the RTX 5080.scripts/smoke.ps1regression runs, ranscripts/pr_check.py --local, and wrote this PR description.