Repository navigation
D3D12.X / XG: async texture upload, detiling, VRAM, XG ABI, and PSO scheduling improvements - #539
JGonzalezRodriguez wants to merge 16 commits into
Conversation
…ure uploads Avoid per-batch CPU stalls, upload-buffer churn, and command list allocation in title texture uploads by reusing a per-device async Uploader (fence-ordered GPU waits on consuming queues, dynamic 4-64 MiB staging chunks mapped once per chunk, capped idle pool/allocator recycling, and dedicated pinning on queue.Signal failure). Track Uploader's in-flight destination COM references so res_release detaches title-dropped textures from title_textures immediately (while deferring vram::forget until the GPU copy completes), order vram::Pages unmap/remap tile updates after the async upload fence without UPLOADERS/PAGES lock inversion, drop retired COM objects outside UPLOADERS, and clear queue wait tracking on both queue creation and release.
…t starving small PSOs
…ng the render thread
…d watch GPU completion
|
Evidence for the cross-queue main 9ce2070 + #435, with a local env-gated trace of writes, waits and submits on that block (once the shader cache is warm enough to reach the world, ~80 s):
This PR (head 4ff33f0, on its own base): the bridge does what it says. At 91.5 s three waits (B+0x58, +0x10, +0xe8 >= 0x6d5, compute waiting on direct producers) became GPU Question for you and the maintainer (design): XCL checks every Test report written with Claude Code (Claude Opus 5.5) from my own runs; the trace patch is local only. |
|
Native Windows/NVIDIA test of the draft on RTX 3060 12 GB (driver 610.88 / 32.0.16.1088), Core i5-8400, Windows 11 Home 26200.9974, Rust 1.100.0 x86_64-pc-windows-msvc, MSVC 14.44.35230, debug. Tested the exact PR head as-is against the then-current upstream main (no local merge).
No skip messages in these runs. The bundled title reported zero failures and the real RTX 3060 backend on both revisions. Not tested: full workspace suite, opt-in async compute, retail gameplay/loading, or other adapters. AI use: OpenAI Codex (GPT-6) ran the local checks and drafted the report. Follow-up: compute checks with the opt-in flag off and on. Same PR head |
|
Tested the two Tested: Tested
Not tested
The two AI use
|
Accept the extra argument before the tiled source pointer in CopyFromSubresource so the source and pitches are read from the right slots. Validate the destination span, preserve row padding, and report unavailable title memory through HRESULT. Exercise the console vtable with pitched output and an unmapped destination page. All 4 XG and 14 DirectStorage tests passed on Windows, and the XG oracle test target compiled. Related upstream work: xcl-dev#539 Assisted-by: Codex (gpt-6.2-sol)
|
Closing this rollup PR and replacing it with a clean, single-purpose PR against current Summary of what was dropped from #539:
|
|
RX 7900 XT comparison for the two Wait64 commits (
This confirms the bridge executes on RDNA3. I could not determine which GPU command caused the hang or establish that a particular CPU fence release caused it. AI disclosure: Codex ran the tests and prepared this report. |
|
Native Windows test of Tested
Not tested
AI use: Claude Code (Claude Opus 5.5) ran the commands above and wrote this report. |
On the console a Wait*BitValueX holds the GPU where it was recorded. XCL checks a list's waits before the whole list is submitted, so a list [wait A][write B][wait C][write D] cannot write B until C holds. A list on another queue that waits on B before it writes C then waits forever, or (with the Wait64 fence bridge) has its wait skipped as a cycle. A retail title records exactly this on its compute and direct lists at world start (xcl-dev#539). A title list object (title_list) now closes its PC list at a wait that follows other commands and goes on recording in another PC list: reset onto the title's allocator, with the recording's state (list_x state, bind's root state) moved over and the bindings set again as KickoffX does after its Reset. ExecuteCommandLists and KickoffX submit the parts in order through execute_with_waits_on, so each part's waits come right before it and its Write64 signals before the next part's waits. The forwarding thunks count calls, so a wait that comes first in a part does not split. QueryInterface, AddRef and Release stay on the PC list the object was made for. The PC lists XCL makes are reused after Reset and released with the object. Only direct and compute lists are split, and not while a query other than occlusion is open; XCL_SPLIT_WAITS=0 turns it off.
Split supported recording segments before waits; open the queue gate only when its progress value is visible. Verify the original stale read and patched result with a two-queue GPU fixture. Queue-local completion workers adapted from xcl-dev#562. Recorded-order trace and motivation: xcl-dev#539. Assisted-by: omp (amd-openai/gpt-6.2-sol)
This branch bundles D3D12.X performance, scheduling, and
XGABI/correctness fixes targeting heavy streaming and shader-compilation workloads (no Linux/Wine-specific workarounds are included).What is in it
crates/xcl/src/gpu/texture.rs,crates/xcl/src/hle/d3d12x/title_textures.rs,crates/xcl/src/hle/d3d12x/vram.rs,crates/xcl/src/hle/d3d12x/real.rs): per-device asyncUploaderwith fence-ordered consuming-queue waits, reusable mapped staging chunks and allocators, and tracked in-flight destination refs for safe texture release andvram::Pagesordering.xg::CopyFromSubresource7-argument ABI fix & destination span guard (crates/xcl/src/hle/xg.rs,crates/xcl/tests/xg_oracle.rs): handle the extrau32argument beforesrc, bounds-check the destination span, and log invalid arguments.crates/xcl/src/gpu/tiling.rs,crates/xcl/src/hle/d3d12x/title_textures.rs): copy linear mip levels row-by-row, hoist tiled detiling with parallel batch detiling, and cacheLayoutoffset tables viaArcslices while trimming unused high-bit tables.vram::Pagesoverhead reduction (crates/xcl/src/hle/d3d12x/vram.rs): coalesce page-queue fence signals and throttle idle-page sweeps.VirtualQueryspan cache (crates/xcl/src/hle/d3d12x/title_textures.rs): cacheVirtualQuerymemory region spans across sorted entries inrecheck_gpu_view_sources.crates/xcl/src/hle/d3d12x/pso_async.rs,crates/xcl/src/hle/d3d12x/bind.rs,crates/xcl/src/hle/d3d12x/real.rs):BELOW_NORMALpriority;XCL_ASYNC_COMPUTE=1non-blocking compute PSO mode.Wait64BitValueXGPU fence bridge, cycle-breaking, and GPU-completion watchdog (crates/xcl/src/hle/d3d12x/list_x.rs,crates/xcl/src/hle/d3d12x/real.rs):Write64BitValue{Bottom,Top}OfPipeX→Wait64BitValueX(GREATER_EQUAL, full 64-bit mask) onto per-addressID3D12Fencequeue.Signal/queue.Waitcalls, bypass redundant waits when the producer already submitted earlier on the same queue (D3D12 FIFO order), detect and break cross-queue fork-join wait cycles before hoistingqueue.Wait, and monitor armed GPU waits with a bounded GPU-completion watchdog (falling back to bounded CPU polling for non-monotonic or ineligible waits).Wait64BitValueXahead of the producer list on another queue previously stalled the CPU submission thread until timeout or risked cross-queue/unsubmitted-producer deadlocks; moving eligible waits to GPU fences preserves ordering without blocking command submission.Tested
rustc 1.98.1, debug):cargo check -p xcl --target x86_64-pc-windows-msvc --testspassed (0 errors, 0 warnings).list_x::tests: 19/19 passed (includingwrite_buffer_immediate_on_open_existing_heap_visible_to_cpu,cross_queue_wait64_before_signal_does_not_deadlock_submit_thread,cross_queue_cycle_and_same_queue_fifo_do_not_deadlock)vram: 6/6 passedtitle_textures: 9/9 passedgpu::texture: 15/15 passedgpu::tiling: 11/11 passedhle::xg: 4/4 passedbind: 4/4 passedRegression run
scripts/smoke.ps1runs (draft PR for contributor testing; will be split and includemain+ PRxcl-smokeblocks before review).Not tested
scripts/test.ps1(full workspace suite) andscripts/smoke.ps1regression runs (opening as draft for a Windows contributor to test).AI use