D3D12.X: land a list's sparse GPU writes in chunks the CPU changed #3162
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3162"
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 tiagonleal on 2026-11-28T14:36:21Z.
Part of #3093 (group 1). On
maine429936cthe threee2etitle tests fail on NVIDIA and AMD withpost-Wait32/64 write failed (0x0). Since04de3234a sparse copy-back skips every 64-byte chunk whose hash no longer matches the last upload, so that a newer CPU store is not overwritten. After a list executes, though, the copy-back ranges are that list's recorded GPU writes, and those bytes are newer than any CPU store made before the list ran. When the CPU had written other bytes of the same chunk, the GPU's write was dropped. The test title does exactly this: its CPU thread stores the wait cells at+0x300and+0x308, the list writes+0x310, and+0x310read back 0.The issue suggested rebuilding the uploaded bytes from the chunk's hash and merging byte by byte. That does not work here: logging showed the copy-back range was only the 4 written bytes and the chunk's sent hash matched neither the CPU's view nor the GPU's. The written range itself is what tells the two apart.
What is in it
sparse.rs:land_pageandreadback_rangestakegpu_wrote. The copy-back after a list executes (readback_after_execute) passes true: the written bytes land in a chunk the CPU changed as well, and the chunk keeps its old hash, so the next look uploads the CPU's bytes together with the GPU's. The Map-time copy-back (readback_now, whole spans) passes false and keeps the CPU-wins rule of04de3234.gpu_write_lands_next_to_cpu_writes_in_one_chunk: two CPU cells and one GPU cell in one chunk, all three present after the copy-back, and the chunk still uploads next.Tested
cargo test -p xcl --test e2e -- --test-threads=1: 2 passed, 3 failed onmaine429936c; 5 passed, 0 failed with this change.cargo test -p xcl --lib d3d12x::sparse: 84 passed, 0 failed, 1 ignored, including 04de3234'sdirty_chunks_survive_gpu_copy_back_and_upload_nextandclean_chunks_take_gpu_copy_back_bytes.cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4, one run on headb673f36d: 2126 passed, 10 failed, 48 ignored (25SKIPPEDlines). All 10 failures also fail onmaine429936con this machine (2122 passed, 13 failed, 48 ignored): the 4gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_*(#1919 fixes them) and 6 of the 9 in #3093. Fixed againstmain:test_title_draws_with_a_root_signature_under_the_debug_layer,test_title_runs_and_game_folder_is_untouched,test_title_runs_under_the_debug_layer_with_dred.Regression run
scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e(Newer Retail Game), release builds of both commits in clean trees,maine429936cfirst, one run each, in one queue with this account's other PRs. Both runs hadXCL_PREPARE=0and the same warm DXIL cache. A warm-up run ofmaincame before them and is not shown. A second run ofmainat the end of the queue showed 374 frames and a peak commit of 14157 MB, so differences of a few tens of frames between runs are noise here.main(e429936c):This PR (
b673f36d):Not tested
land_pagealready relies on the title's fence discipline for this window.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-28T14:37:53Z.
Closing as a duplicate: #3149 (KOLESNiii) fixes the same copy-back case and was merged into
mainwhile this one was still running its suite and smoke pair.AI use: Claude Code wrote this comment (Claude Fable 5.2).
Pull request closed