Repository navigation
D3D12.X: title texture uploads run on the title's queue and wait for its page mappings - #2558
treybertram06 wants to merge 2 commits into
Conversation
… CPU wait title_textures::refresh runs on the title's thread before each of its submits and uploaded the CPU's writes to its textures on XCL's own queue, then waited on the CPU until the GPU had run them (texture::upload_batch). While a retail title streams its world with video memory past the card, those waits are long: thread dumps show its submit thread blocked in fence::wait under refresh, presents drop to a few per 20 s, and the title's watchdog ends it on the loading screen. When the submitting queue is a DIRECT queue on the texture's device, the upload list now runs on that queue, ahead of the title's lists, so the GPU orders the copies before the work that samples them, with no cross-queue wait. A fence on that queue retires each batch's allocator, list and staging buffers at later submits; over 512 MB in flight the oldest batches are waited for, and a batch whose wait fails or times out stays in flight. Compute and copy queues, and a queue of another device, keep the upload queue and its wait. texture::submit_batch is upload_batch without the wait.
With uploads on the title's queue (the commit before), the copies of a batch went out on that queue without the wait for texture page mappings that XCL's own upload queue makes (vram::before_execute). A texture made on another thread after refresh_once's wait, or its levels mapped just before the upload by map_levels_with_texels, could then be copied into tiles whose UpdateTileMappings had not run on the page queue yet. On an RTX 3080 (driver 621.40) with a retail title that was a copy-engine write page fault (DmaPageFaultWrite, EngineResetRequired, 4.6 ms before VidSchErrorHardwarePageFault in a DxgKrnl trace) and a hung device (0x887a0006 with nvlddmkm 153) in 3 of 4 runs of the world load; with the wait, 0 of 7. submit_on_title_queue now waits first, so every title-queue upload does. The test fails without it (the queue never waits for the mapping). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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
Not tested: the whole suite with this PR, Intel, Linux / vkd3d-proton, a title. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! — Devin |
|
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 Tested:
The 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. |
…queues Port upstream #2558 adapted to amd-dev's staging pool and low-commit guards so streaming texture uploads no longer stall ExecuteCommandLists on synchronous CPU fence waits: - gpu/texture.rs: extract plan_batch and add submit_batch returning an InFlight guard that reuses STAGING_POOLS for <=8 MiB batches (returned on GPU completion) and frees oversized staging buffers immediately - title_textures.rs: submit batches inline on matching DIRECT title queues after vram::before_execute(queue), track per-queue in-flight batches bounded by 512 MiB (64 MiB under low Windows commit), and non-blockingly reclaim completed batches on quiet refresh_once ticks - vram.rs: add test helpers (note_mapping_for_test, waited_for_test) for the #2558 title-queue upload and tile-mapping wait regression tests Assisted-by: Antigravity (Gemini 4 Neon High)
|
RX 6800M focused GPU report for #2558: the title-queue upload mapping-wait regression passes on this RDNA2 card. Setup: clean detached head Tested: Limit: The fixture's test helper signals the page-mapping fence but does not itself issue 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. |
|
Independent dual-PC NVIDIA full-workspace test report on clean head Tested
Not tested
AI use
|
|
First Wine/NVIDIA verdict for the mapping-wait fixture, now that a diagnostic stack can run it. Head On stock vkd3d-proton 3.2.0 this fixture aborts before its body: On a relaxed diagnostic build of the exact same provenance commit ( 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: |
|
Tested: current PR head merged onto current
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. |
luckyteagirl
left a comment
There was a problem hiding this comment.
Both error branches run after texture::submit_batch() has submitted the upload list. If CreateFence or queue.Signal fails, they call texture::wait(dev, queue)?; that recovery wait can also fail (including its 10-second timeout), so ? returns and drops f without proving the queued copy finished. f owns 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/quarantine f instead 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.
… GPU writeback (port upstream xcl-dev#2470 + xcl-dev#2558 + xcl-dev#2678) (cherry picked from commit f78556f9601c01eac0e05e43532047658d085701)
…queues Port upstream xcl-dev#2558 adapted to amd-dev's staging pool and low-commit guards so streaming texture uploads no longer stall ExecuteCommandLists on synchronous CPU fence waits: - gpu/texture.rs: extract plan_batch and add submit_batch returning an InFlight guard that reuses STAGING_POOLS for <=8 MiB batches (returned on GPU completion) and frees oversized staging buffers immediately - title_textures.rs: submit batches inline on matching DIRECT title queues after vram::before_execute(queue), track per-queue in-flight batches bounded by 512 MiB (64 MiB under low Windows commit), and non-blockingly reclaim completed batches on quiet refresh_once ticks - vram.rs: add test helpers (note_mapping_for_test, waited_for_test) for the xcl-dev#2558 title-queue upload and tile-mapping wait regression tests Assisted-by: Antigravity (Gemini 4 Neon High)
|
Independent desktop NVIDIA verification of PR #2558 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
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, 0 skipped — 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, 0 skipped — 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, 0 skipped — 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, 0 skipped) |
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, 0 skipped) |
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, 0 skipped) |
cargo build --release -p xcl |
Clean build (1m 11s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact merge-base (e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):
xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13982 MB
PR #2558 (2dc76ac89461198bc502f26bd6088eed26a3f521):
xcl-smoke v1
commit: 2dc76ac89461198bc502f26bd6088eed26a3f521
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1589 (PresentX 1589)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13962 MB
Runtime log observations (xcl.log)
9222log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
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
- Title-queue texture upload ordering, GPU fence wait on prior page mappings, and retention of in-flight uploads past wait timeout were directly verified on desktop D3D12 / RTX 4060 via all 3 new GPU tests (
3/3each,0skipped),gpu::texture::(15/15× 3),title_textures::(22/22× 3), andvram::(19/0/1× 3). - The 60 s retail smoke on
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).
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 Retail game (retail title, Series X build): GPU device removal after Wait64BitValueX waits with no producer; also watchdog stalls on slow compute pipeline builds #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 D3D12.X: title texture uploads run on the submitting queue, without a CPU wait #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 D3D12.X: title texture uploads run on the submitting queue, without a CPU wait #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 NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403, not this.Regression run
Not tested
Releaseis held behind an in-flight title-queue upload (reasoned fromlate_release, above).AI use