D3D12.X: omit VRAM-only sparse tiles and GPU-written textures from write-watch ranges #2754
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!2754
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2754"
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?
@Saksukella on GitHub · 2026-11-26 10:15 UTC · original
Saksukella:fix/write-watch-skip-vram-and-gpu-textures→amd-dev· +161 −28 · 2 files · 2 commits · openWhat is in it
crates/xcl/src/hle/d3d12x/sparse.rs:watchable_tile_runs(mapped)and exclude VRAM-only tiles (holes == 0xFFFF, never CPU-committed) frommapped_ranges()soGetWriteWatchskips purely GPU-resident sparse tiles.drain_lazy_commits(), invalidateself.runsand bumpMAPPED_GENwhen a lazily CPU-committed tile transitions offholes == 0xFFFF.drain_lazy_commits_if_pending()(zero-lockAcquirefast path when no lazy commits are pending) sorefresh_once()reflects newly CPU-committed tiles on the very first submit without a 1-submit delay.watchable_tile_runs_omits_vram_only_holes_until_unmasked.crates/xcl/src/hle/d3d12x/title_textures.rs:Table::watchable_ranges(&self)excludinge.gpu_writtenrender targets / UAV textures fromcached_watch_ranges(), bumpTEXTURES_GENinnote_gpu_write()when a texture becomes GPU-written, and callsparse::drain_lazy_commits_if_pending()beforecached_watch_ranges(u)inrefresh_once().watchable_ranges_excludes_gpu_written_textures.amd-dev(wherealloc_vram_only/drain_lazy_commitslive).Tested
32.0.32029.2010), 24-thread x86_64 CPU, 32 GB RAM, Windows;rustc 1.100.0 (0ef1bc386 2026-11-09); debug (tests) and release (xcl.exe).cargo test -p xcl --lib watchable_tile_runs_omits_vram_only_holes_until_unmasked: 1 passed, 0 failed (0.00s).cargo test -p xcl --lib watchable_ranges_excludes_gpu_written_textures: 1 passed, 0 failed (0.00s).Regression run
Not tested
AI use
GetWriteWatchrange collection, catching the first-submitdrain_lazy_commitsordering hazard, writing the patch and unit tests, and running local tests and smoke verification. All diffs and measurements were verified locally on hardware.@luckyteagirl on GitHub · 2026-11-26 10:20 UTC · original · reviewed
On
60bc047f,mapped_ranges()now excludes an existing tile whileentry.holes == 0xFFFFand caches that empty result ins.runs. The new invalidation indrain_lazy_commits()covers VEH commits, but the ordinarycommitted()→commit_range()path can also clear a hole bit on a tile that is already ins.mapped. In that caseensure_mapped()has no new entry to map, andcommit_range()changesentry.holeswithout clearings.runsor incrementingMAPPED_GEN.title_textures::cached_watch_ranges()can therefore keep omitting the newly CPU-backed tile on later submits, missing its CPU dirty pages until some unrelated mapping changes.I reproduced the cache transition with a small CPU harness that compiles the exact
commit_range,mapped_ranges, and newwatchable_tile_runsfunctions from this head, with minimal state/ensure_mappedstubs for one already-mapped tile. After priming an all-holes tile and committing one 4 KiB page, the baseb5c0275still returned its watch range (exit 0); this head returned[]withholes=0xfffeand generation unchanged (assertion failure, exit 101). This isolates the cache behavior; it does not reproduce a D3D12 title failure.Could the explicit commit path invalidate both the cached runs and generation when a tile becomes watchable? A regression test should prime
mapped_ranges()before committing part of a VRAM-only tile, then assert the next range and generation include it. Codex (GPT-6.2 Sol and GPT-6.2 Astra) reviewed this exact head and CPU differential.@oni-swr on GitHub · 2026-11-26 11:30 UTC · original
Independent test report: PR #2754 at head
60bc047f5bc418dc68563e3c9f8c9aeb56632ae2(baseamd-dev@b5c0275f)Hardware / toolchain
-j 4.Tested (
cargo test -p xcl --lib -j 4 ..., separate target dir)watchable_tile_runs_omits_vram_only_holes_until_unmaskedandwatchable_ranges_excludes_gpu_written_textures: 1 passed each (lazy_commit_clears_vram_only_holes_without_clobbering_to_zero, an existing sparse test, also passes).hle::d3d12x::sparse: 26 passed, 0 failed, 1 ignored.hle::d3d12x::title_textures: 31 passed, 1 failed (title_bytes_are_used_in_place_when_all_are_readable, "a committed page is not copied").--no-fail-fast -- --test-threads=4on the PR head: the process aborts (STATUS_STACK_BUFFER_OVERRUN, "non-unwinding panic") intitle_textures::tests::placed_title_textures_share_vram_and_preserve_pixelswhen run in parallel; that test passes alone (1 passed). Re-running with--skipfor that one test: 1534 passed, 11 failed, 27 ignored, 1 filtered out.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(known, #2115),gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole,gpu::recomp::lower_dxil::tests::{a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, f32_programs_on_the_gpu},hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap,hle::d3d12x::list_x::tests::{a_dispatch_with_a_pipeline_still_building_waits_at_the_submit, a_put_off_dispatch_runs_at_the_submit_when_its_build_outlasts_the_wait_budget, bitset_runs_emit_exact_contiguous_page_ranges},hle::d3d12x::real::big_compile_tests::giant_driver_compiles_have_their_own_lane,hle::d3d12x::title_textures::tests::title_bytes_are_used_in_place_when_all_are_readable,hle::kernelx::tests::physical_home_without_sparse_windows_uses_coherent_window.b5c0275f(same--skip): 1532 passed, 11 failed, 27 ignored. The failing set is identical, and the full run without--skipaborts the same way. So these failures and the abort exist onamd-devbefore this PR; the PR adds 2 passing tests and no failures. (title_bytes_are_used_in_place...,giant_driver_compiles...andphysical_home_without_sparse...were also checked alone on both commits: they fail on both.)origin/main@b49be183full lib run: 1308 passed, 1 failed (fuzz_validate_and_gpu_1), 27 ignored. The extra failures above come from theamd-devline, not from this PR.SKIPPEDlines (4):lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic and f16 packed, each wave32 and wave64, "refused (unsupported V_MUL_F16 / V_PK_MUL_F16 ... #1426 semantics differ from the console's)".hle::d3d12xfilter run on the PR head: 409 passed, 5 failed, 2 ignored (all five are in the list above).Regression run
scripts/smoke.ps1run).Not tested
tests/integration or e2e suites (only-p xcl --lib), no other GPU vendors. Whether the PR changes GetWriteWatch behaviour on a real title is not covered.AI use
@Saksukella on GitHub · 2026-11-26 11:33 UTC · original
Good catch @luckyteagirl — fixed in
891c97a5.State::commit_range()now tracks transitions offholes == 0xFFFFviaunmask_committed_holesand invalidatesself.runs+ incrementsMAPPED_GENwhenever an explicit commit makes a VRAM-only tile watchable. Addedcommit_range_unmasking_vram_only_tile_invalidates_runs_and_genand re-ran 60s RX 9070 XT smoke (1671 frames, 15086 MB, 0 removals, 0 crashes).@thehollowedone on GitHub · 2026-11-26 11:47 UTC · original
Independent Windows/NVIDIA check of PR #2754 head
891c97aagainst itsamd-devbaseb5c0275. The head was unchanged when checked before posting. RTX 3080 Ti 12 GiB, NVIDIA 621.35, Windows 11 build 26300, rustc 1.99.1 MSVC; synthetic tests, no game files.cargo build --offline --locked --workspace: passed.cargo test --offline --locked -p xcl --lib watchable_ -- --nocapture --test-threads=1: both new watch-range tests passed (2 passed, 0 failed, 0 ignored, 0 GPU skips).cargo test --offline --locked -p xcl --lib commit_range_unmasking_vram_only_tile_invalidates_runs_and_gen -- --nocapture --test-threads=1: the new explicit-commit regression passed (1/0/0, 0 skips).cargo test --offline --locked -p xcl --lib hle::d3d12x::sparse::tests:: -- --test-threads=1: 22 passed, 0 failed, 1 ignored, 0 skips.cargo test --offline --locked -p xcl --lib hle::d3d12x::title_textures::tests:: -- --test-threads=1: 31 passed, 1 failed, 0 ignored, 0 skips. The failingtitle_bytes_are_used_in_place_when_all_are_readablesays “a committed page is not copied.” I restored both changed files from the exactb5c0275base, rebuilt, and ran that test alone with--nocapture --test-threads=1: it failed with the same assertion (0/1/0). I then restored the PR files.I also attempted
cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4. The library process aborted with Windows0xc0000409after a worker dereferenced the sentinel0xffffffffffffffffinwindows-core::interface; there is no complete library count. Twenty GPUSKIPPEDnotices appeared before the abort and are not coverage. Other completed targets includedd3d12_mesh_stream(2 passed, 1 failed: expected AS-slot refusal but gotMS: no NGG hardware variant) andgpu_compute_e2e(4 passed, 2 failed: offline second-process cache paths). I have not established those integration failures as changes from the base. This run is not a whole-suite pass.Not tested: paired clean-commit retail smoke, the time saved by
GetWriteWatch, a title phase with GPU-written textures, visual output, or AMD/Intel hardware. The focused results confirm the new range-selection and explicit-commit tests on this NVIDIA machine; they do not measure the PR's runtime benefit.AI use: Codex (GPT-6.2 Sol) ran the Windows checks, compared the focused failure with the base, 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.