D3D12.X: sparse upload lists move the windows they copied into back to COMMON #1526
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1536"
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 dhanush2412 on 2026-11-24T17:22:19Z.
Part of #1452. With
XCL_D3D12_DEBUG=1a 130-170 s run of the retail game (retail title 1.0.2.1, Series X) reports 2,569 xINVALID_SUBRESOURCE_STATEonIASetIndexBuffer(the buffer is inCOPY_DEST, "promoted from COMMON", needsINDEX_BUFFER) and a few dozen onIASetVertexBuffers. The sparse upload lists (sparse.rs,upload_dirtyand the zero fill) copy into the window buffers; the copy promotes a window from COMMON to COPY_DEST, and a write state does not decay at the end ofExecuteCommandLists, so the title's own lists find it there. This records which windows an upload list copied into and, before it is closed, moves them from COPY_DEST back to COMMON. Off by default (XCL_UPLOAD_BARRIER=1).What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:UploadSlot.touched(a bit per window),upload_barrier()(the switch), the barrier insubmit_slot, andtouchedset at the twoCopyBufferRegionsites.Tested
cargo test --release --workspace -- --test-threads=4: 776 passed, 0 failed, 41 ignored (SKIPPED GPU tests on this adapter:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows))XCL_PRESENT_SRC_BARRIER=1as well, see the sibling PR):IASetIndexBuffererrors 2,569 -> 892 (the rest come from a copy path this does not cover), allINVALID_SUBRESOURCE_STATE8,808 -> 1,127. The device is still removed at the end of that run (#1452), so this does not fix that.Regression run
main:
PR:
Not tested
AI use
Imported from ivall/xcl. Originally posted by crosettiremi on 2026-11-24T17:50:08Z.
Windows RX 7900 XT, Series X retail profile. I applied
a780e1dby itself to a downstream XCL build with the sparse-release, streaming and partial-readback fixes. Release build. XCL_UPLOAD_BARRIER=1, DRED on, 28 GiB whole-job limit. The present-source barrier was absent.The game passed the Player1 picker after a second scripted A, displayed loading artwork and streamed assets. Last positive present interval 299.155 s. Device removal at 302.892 s (0x887a0006), DRED page fault at GPU VA 0xd79c28000 with no matching existing or recently freed allocation. Peak sampled process commit 28,433 MB. The final capture was dark. The previous build without this patch ended in a guest watchdog after 258 s. Input timing differed substantially, so elapsed times do not establish a performance improvement.
This tests the opt-in path on AMD. The D3D12 debug layer was off, so this run cannot compare your index/vertex resource-state error counts.
Imported from ivall/xcl. Originally posted by srcamarda on 2026-11-24T18:14:39Z.
#1535 and #1536 on AMD RDNA3 (RX 7800 XT) with the debug layer: #1535 removes the presenter's errors here too (~4 500 → 0); #1536's case does not come up on this card in 150 s; no fps drop in either setting
Both PRs were merged together onto
main9e3831elocally (clean merges, not pushed; local merge commit944fc18). Each switch was then turned on alone and together.Setup
XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=150, Enter (= A) at 30 / 40 / 50 s (title screens into the start of loading).Debug layer (
XCL_D3D12_DEBUG=1). XCL logs only 8 messages per id, so for these five runs both builds carried the same local diagnostic, not part of either PR: every debug-layer message counted by id, call and actual state, printed at the end of the run. Totals over 150 s:mainXCL_PRESENT_SRC_BARRIER=1XCL_UPLOAD_BARRIER=1CopyResource, source inRENDER_TARGETClearRenderTargetView, inCOPY_SOURCECopyTextureRegion, source inNON_PIXEL|PIXEL_SHADER_RESOURCE(0xC0)IASetIndexBuffer/IASetVertexBuffersNo device removal or crash in any of the five.
CopyResourceand the title's nextClearRenderTargetViewboth go to 0 on this card as on the RTX 3060.IASetIndexBufferinCOPY_DESTcase on this card in these 150 s, not even onmain, so these runs show neither the fix nor a regression. Your 130–170 s runs reach further into the world load than mine.CopyTextureRegionwith its source in a shader-resource state (0xC0), about 200–320 per run. The ids outside 538 are the same in every column: 745 (simultaneous-access / buffer still referenced onExecuteCommandLists/UpdateTileMappings), 677, 679, 680, 1047, 1422.Smoke runs, no debug layer (
scripts/smoke.ps1 -Seconds 60, interleaved, two rounds):main9e3831eNo device removal or crash. The drop in your PR smoke block (presents 42 22 8, peak commit +3.3 GB, with the switch off) does not reproduce here.
Tests:
cargo test --workspace --no-fail-fast -- --test-threads=4on the merged tree: 776 passed, 0 failed, 41 ignored, with the switches unset and with both set to 1.SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows), in both.Not tested
Claude Code (Claude Opus 5.5), from runs on the hardware above.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:05:58Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
upstream-sync referenced this pull request2026-11-24 21:07:02 +00:00
upstream-sync referenced this pull request2026-11-24 21:07:52 +00:00
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:01:18Z.
Triage (#1607) – head
a780e1dNo open or merged PR makes the same change; #1535 (same author, same issue #1452) is a separate barrier in present.rs. Opt-in behind
XCL_UPLOAD_BARRIER=1. Buffers promoted to COPY_DEST already decay to COMMON when the ExecuteCommandLists call completes, so it would help to show which debug-layer message goes away with it.touchedis au32bit set indexed by window, so1 << wioverflows with more than 32 windows. The upload code in sparse.rs has changed a lot on main (submit_slotnow returnsSubmitResult), so this needs rebasing.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.