D3D12.X: title texture uploads run on the title's queue and wait for its page mappings #2548
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2558"
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 treybertram06 on 2026-11-25T22:55:35Z.
Supersedes #455 (@Cattn). That PR has had no update from its author since 2026-11-24, and it no longer merges into
main. This carries its commit forward unchanged in substance, with Cattn's authorship kept, rebased onto currentmain. It adds the fix for a race the reviews and runs found in it.Title texture uploads go on the queue of the submit that needs them (
ExecuteCommandLists/KickoffXon a DIRECT queue), ahead of the title's lists, instead of on XCL's upload queue followed by a CPU wait (#455's description has the rest). With uploads on the title's queue, nothing made that queue wait for the texture page mappings, which XCL's own upload queue waits for (vram::before_execute). A texture created on another thread afterrefresh_once's wait, or the levelsmap_levels_with_texelsmaps right before the copies, could therefore be copied into tiles whoseUpdateTileMappingshadn't run yet on the page queue.On an RTX 3080 that was a copy-engine write page fault and a hung device in the retail title's world load:
DmaPageFaultWrite | EngineResetRequired4.6 ms beforeVidSchErrorHardwarePageFaultin a DxgKrnl trace. This is the one in my Aftermath report on #1452.What is in it
D3D12.X: title texture uploads run on the submitting queue, without a CPU wait(gpu/texture.rs,hle/d3d12x/title_textures.rs). This is #455's commit by Cattn, rebased ontomaine1d84b7. The two conflicts intitle_textures.rswere with code added onmainsince. Both sides are kept:seed_stream_recheckruns beforeupload_all, which takes the title queue;main's stream recheck andbatch_fits/BATCH_ITEMScaps come before #455'sON_QUEUE/submit_on_title_queue.D3D12.X: a title-queue texture upload waits for the page mappings first(hle/d3d12x/title_textures.rs, test hooks inhle/d3d12x/vram.rs):submit_on_title_queuecallsvram::before_executefirst.gpu_a_title_queue_upload_waits_for_the_page_mappings_before_it. It records a page mapping, uploads on a title queue, and checks the queue waited for that mapping. Without the wait it fails (waited 0, needed 1).#455's review points
mainthis is covered bylate_release. The title's lastReleaseof a resource is held until a fence value signalled on every known title queue (present::known_queues), the sparse queue and the upload queues has been passed. An upload submitted on the title queue before that release is ahead of the fence on the same queue, so the texture can't be destroyed under the copy. This also avoids holding the destinations inInFlight, which @ozimchuk measured breaksplaced_title_textures_share_vram_and_preserve_pixelsby moving a shadowed placement's reactivation to a laterreclaim. I checked this by readinglate_release.rs; I didn't add a test of it here.Tested
cargo test -p xcl --lib title_textures -- --test-threads=1: 22 passed, 0 failed. The new test fails without the wait.cargo test --workspace --no-fail-fast -- --test-threads=4(XCL_DXC_DIRset to DXC 1.9): 1426 passed, 0 failed, 46 ignored.SKIPPED:no wave64;no heap windows;XCL_DIRECT_DXIL=1 XCL_UMA_SHADOW=1): page-fault device removals (0x887a0006, nvlddmkm 153) in 3 of 4 runs without the wait, 0 of 7 with it. The silent0x887a0005that remains in those runs is the 512 MB driver shader-code heap of #2403, not this.Regression run
Not tested
Releaseis held behind an in-flight title-queue upload (reasoned fromlate_release, above).AI use
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T23:15:18Z.
AMD run (listed as untested) on an RX 9070 XT, plus an RTX 3060: all 3 new GPU tests pass on both cards, with no skips.
Head
2dc76acapplied onmain08db802, debug, Windows 11 Pro 26200,cargo test -p xcl --lib -- title_textures --test-threads=4, card chosen withXCL_ADAPTER(the tests take the backend device,real::device_raw()):gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released,gpu_a_title_queue_upload_waits_for_the_page_mappings_before_itandgpu_an_upload_still_running_is_kept_when_its_wait_times_outok.Not tested: the whole suite with this PR, Intel, Linux / vkd3d-proton, a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T23:19:14Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-25T23:22:19Z.
D3D12 debug-layer check: the three new GPU tests run clean under the layer (only the exit-time live-object report), and the e2e title's messages are the same as
main's. It adds the layer to the RTX 3080 / 3060 runs above.Tested:
2dc76acmerged ontomain08db802(clean). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug, Graphics Tools (D3D12 debug layer) installed.gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released,gpu_a_title_queue_upload_waits_for_the_page_mappings_before_it,gpu_an_upload_still_running_is_kept_when_its_wait_times_out, each withXCL_D3D12_DEBUG=1(D3D12: debug layer enabledin the output)id 0live-object lines at process exite2etest_title_draws_with_a_root_signature_under_the_debug_layer, merged vsmain08db802The e2e title's log doesn't show whether it takes the title-queue upload path, so the three tests are what checks the new code here.
Not tested: the whole suite (DarkPanda69 and the description cover NVIDIA), a title, a release build.
AI use: Claude Code (Claude Opus 5.5) ran the debug-layer checks and wrote this report.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T01:37:25Z.
RX 6800M focused GPU report for #2558: the title-queue upload mapping-wait regression passes on this RDNA2 card.
Setup: clean detached head
2dc76ac89461198bc502f26bd6088eed26a3f521; Windows 11 Home build 26200; Ryzen 9 5980HX; AMD Radeon RX 6800M, driver30.0.13002.13003; Rust 1.99.0 MSVC, debug lib-test build with its own Cargo target.XCL_ADAPTER=6800MandXCL_REQUIRE_GPU=wave64were set. The run log confirmsbackend 'real' – AMD Radeon RX 6800M (11987 MiB VRAM)and the tiled-resource page queue/fence path.Tested:
cargo test --locked -p xcl --lib -j 1 hle::d3d12x::title_textures::tests::gpu_a_title_queue_upload_waits_for_the_page_mappings_before_it -- --exact --test-threads=1 --nocapture, under a free-memory guard: 1 passed, 0 failed, 0 ignored, 0 measured, 1326 filtered out, 0.65 s; noSKIPPEDline and no guard stop. The fixture checked that the title queue waited for the mapping-fence value before the upload and completed a 64×64 texture upload/readback.Limit: The fixture's test helper signals the page-mapping fence but does not itself issue
UpdateTileMappings, so this verifies the queue-wait ordering and GPU upload/readback rather than a physical tile-mapping race. I did not run the full suite or a title smoke pair. DXC was configured but this fixture did not compile a shader. No game files were used.AI use: Codex (GPT-6) and a Codex Luna subagent prepared the clean worktree, ran the guarded focused test, checked the log and source coverage, and wrote this report.
Imported from ivall/xcl. Originally posted by itsSio on 2026-11-26T03:24:36Z.
Independent dual-PC NVIDIA full-workspace test report on clean head
2dc76ac89461198bc502f26bd6088eed26a3f521.Tested
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 buildcargo build --workspace: exit 0 (1dead_codewarning invram.rs:1110)cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1426 passed, 0 failed, 46 ignored (all 22title_texturestests passed)SKIPPED: 26 (wave64-only GPU tests,#1426wave32 f16/cvt refusals, no heap windows,pso_measurementdriver-cache disable0x887A002D)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 buildcargo build --workspace: exit 0 (3 warnings)cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1426 passed, 0 failed, 46 ignoredSKIPPED: 29 (same 26 as Machine 1 plus 3 requiringd3d12SDKLayers.dll)Not tested
scripts/smoke.ps1runs--release)AI use
Ran via Samaritan:
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-26T04:57:45Z.
First Wine/NVIDIA verdict for the mapping-wait fixture, now that a diagnostic stack can run it. Head
2dc76ac89461198bc502f26bd6088eed26a3f521, RTX 4060 Laptop GPU 8 GiB, Wine 11.0, NVIDIA 590.48.1,--locked --target x86_64-pc-windows-msvc, one test thread, freshCompiling xcl .../xcl-pr2558/...provenance.On stock vkd3d-proton 3.2.0 this fixture aborts before its body:
ID3D12Fence1 – 12 PC methods, 10 internal slots under the guardthenAssertion failed: iface->lpVtbl == &d3d12_fence_vtbl (vkd3d_private.h:705)— the #175 identity wall, which is why my earlier report could make no pass/fail claim for the GPU leg.On a relaxed diagnostic build of the exact same provenance commit (
2576c0b4adfae4a,-Db_ndebug=true+ the twofrom_ifacerelaxations described in #175, local-only, not proposed anywhere),gpu_a_title_queue_upload_waits_for_the_page_mappings_before_itpasses 1/1 (0.86 s, 0 ignored) on the real adapter: the upload waits for the title queue's page mappings ahead of it and the fixture's readback checks hold.Scope: this verifies the fixture's own assertions under Wine/vkd3d-proton, not retail title behavior, and the relaxed DLL means the identity checks that stock builds enforce were absent — it removes the abort, it does not validate XCL's vtable patching against a stock runtime. Log:
.compat-xcl/logs/verify-pr2558-wine-mapping-wait-relaxed.log(local). AI-assisted verification and report (OpenAI Codex).Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-26T05:04:41Z.
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 168 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.The three new upload-queue tests (
gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released,gpu_a_title_queue_upload_waits_for_the_page_mappings_before_it,gpu_an_upload_still_running_is_kept_when_its_wait_times_out) ran inside the suite: passed (suite gained 3 passes over main).Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T06:37:01Z.
Review: COMMENTED
Both error branches run after
texture::submit_batch()has submitted the upload list. IfCreateFenceorqueue.Signalfails, they calltexture::wait(dev, queue)?; that recovery wait can also fail (including its 10-second timeout), so?returns and dropsfwithout proving the queued copy finished.fowns the staging resource and command allocator used by that copy. Microsoft's D3D12 synchronization guidance requires those objects to remain valid until GPU work is done. Could the retirement fence be established before submission where possible, and could a failed recovery wait retain/quarantinefinstead of dropping it? A blocked-queue fault injection (submit, fail fence setup or signal, let recovery time out, then unblock) would cover this path. The normal success path and the new mapping-wait tests do not exercise it.Exact-head source review of
2dc76ac89461198bc502f26bd6088eed26a3f521; I did not force a device/fence failure or run a title on this head. AI-assisted review with Codex.Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T02:44:58Z.
Independent desktop NVIDIA verification of PR #2558 at head
2dc76ac89461198bc502f26bd6088eed26a3f521(2commits779d533c -> 2dc76ac8; exact merge-base:e1d84b7d9153f86a97d2ec5d209d196046fc0bea, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
2dc76ac8)cargo test --release -p xcl --lib gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1326 filtered out× 3 (0.37s,0.36s,0.37s,0skipped — live D3D12 execution on RTX 4060)cargo test --release -p xcl --lib gpu_a_title_queue_upload_waits_for_the_page_mappings_before_it -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1326 filtered out× 3 (0.36s,0.36s,0.37s,0skipped — live D3D12 execution on RTX 4060)cargo test --release -p xcl --lib gpu_an_upload_still_running_is_kept_when_its_wait_times_out -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1326 filtered out× 3 (0.40s× 3,0skipped — live D3D12 execution on RTX 4060)cargo test --release -p xcl --lib gpu::texture:: -- --test-threads=1(3 consecutive runs)15 passed; 0 failed; 0 ignored; 1312 filtered out× 3 (0.87s× 3,0skipped)cargo test --release -p xcl --lib hle::d3d12x::title_textures:: -- --test-threads=1(3 consecutive runs)22 passed; 0 failed; 0 ignored; 1305 filtered out× 3 (1.01s,1.03s,0.93s,0skipped)cargo test --release -p xcl --lib hle::d3d12x::vram:: -- --test-threads=1(3 consecutive runs)19 passed; 0 failed; 1 ignored; 1307 filtered out× 3 (2.41s,2.40s,2.41s,0skipped)cargo build --release -p xcl1m 11s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact merge-base (
e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):PR #2558 (
2dc76ac89461198bc502f26bd6088eed26a3f521):Runtime log observations (
xcl.log)9222log lines,0[ERROR]/ device-removal / panic lines.19531 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13933 MB committed by the process; video memory 6112 MB local, 4604 MB non-local.Limits of coverage
3/3each,0skipped),gpu::texture::(15/15× 3),title_textures::(22/22× 3), andvram::(19/0/1× 3).title: 29640639exercises live title-texture uploads on desktop RTX 4060 with zero device removals or crashes (frame-count and peak-commit deltas vs. cached merge-base reflect single-run startup variance, not this PR); frame-time latency impact under multi-minute world streaming was not separately benchmarked.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T21:49:24Z.
merge-check claim
head:
2dc76ac894Imported from ivall/xcl. Originally posted by throny on 2026-11-27T22:11:30Z.
merge-check
base:
2c717a04head:
2dc76ac894merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1469 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1466 passed, 0 failed, 47 ignored
review: open from an earlier review and still on this head: in submit_on_title_queue, when CreateFence or Signal fails, the code waits and then drops the upload (allocator, list, staging); if that wait fails too, the early return drops them while the GPU may still be copying. Main's upload_batch deliberately forgets them on a failed wait for this reason. Also to answer: the submit now goes back through the hooked ExecuteCommandLists with XCL's own list (bookkeeping for a title list runs on it; not verified harmless); a texture uploaded on one queue and read on another without a fence between them could be read stale, where main's CPU wait finished the copy first; ON_QUEUE entries are never removed when a queue is released.
performance: this changes the default path. The title's submit thread no longer waits per batch, but it now creates an allocator, a list and an upload buffer (up to 32 MB) per batch instead of reusing the cached uploader, and blocks up to 10 s per batch with the table locked once more than 512 MB is in flight; up to 512 MB of staging can stay alive until that queue's next upload. Reasoned, not measured: a load-time and commit comparison on a title is needed.
verdict: not yet: forget instead of drop on the failed-wait path, answers on the hook re-entry and on readers from other queues, and a measurement of the default-path cost.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T02:46:06Z.
merge-check claim
head:
2dc76ac894Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T03:52:52Z.
merge-check
base:
e429936c10head:
2dc76ac894merge: conflicts (crates/xcl/src/gpu/texture.rs, crates/xcl/src/hle/d3d12x/title_textures.rs, crates/xcl/src/hle/d3d12x/vram.rs)
build: not run (the PR does not merge into this base)
tests: not run on this base. On the previous base
753e8b1athe trial merge was clean, built, and its suite gave 1514 passed, 1 failed, 47 ignored, 25 SKIPPED (fine_timer_makes_short_sleeps_short failed only under the load of 6 other suites running at once and passed alone).review: not repeated on this base. On
753e8b1a: 1 major finding. title_textures.rs upload_all / submit_on_title_queue: CPU-written title textures are now uploaded on the direct queue whose ExecuteCommandLists ran refresh(), with no CPU wait; before, every batch was waited for on the CPU (upload_batch), so all queues saw the texels. refresh() runs on every queue's ExecuteCommandLists (real.rs, compute queues included), and refresh_once takes the dirty pages of all title textures (GetWriteWatch with reset) and uploads every one of them on that queue. Failure: the title writes a texture on the CPU, submits graphics work on its direct queue A (the upload is queued on A, the dirty pages are consumed), then submits work that reads the texture on its compute queue B without waiting on A, as it may on the console where the CPU write is already visible. B's refresh finds nothing dirty and nothing orders B after A's copy, so B reads old or partly copied texels while the texture may be in COPY_DEST on A. The new tests only check ordering on the same queue. A fix could make other queues wait on ON_QUEUE's fence in refresh, or keep the synchronous path when the title has more than one queue. The rest reads sound: before_execute is called on the title queue first, staging, allocator and list live until the fence passes, and the in-flight bytes are capped at 512 MiB.performance: not assessed on this base.
verdict: not yet: conflicts with main (crates/xcl/src/gpu/texture.rs, crates/xcl/src/hle/d3d12x/title_textures.rs, crates/xcl/src/hle/d3d12x/vram.rs); rebase onto main
hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile. Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft).
Imported from ivall/xcl. Originally posted by treybertram06 on 2026-11-30T06:55:58Z.
Closing:
mainhas all of this now, from other PRs.mainas124ccfb1/cfa24826.e9c60bd4(bmjask, via #2959), with its test made robust in #3278.submit_onintitle_textures.rs. The fence is created before anything is submitted. When the Signal fails, the upload buffer is dropped only if the drain succeeded, and leaked otherwise.ON_QUEUEinforget_queue.@throny, thanks for the merge-check. If your other points (cross-queue staleness, the hooked ExecuteCommandLists, the cost on the default path) still hold, they now apply to
main's code, not this branch.AI use: Claude Code (Claude Opus 5.5) compared this branch with
maind52ff48cand wrote this comment.Pull request closed