Repository navigation
Conversation
…cl-dev#1732) sparse::readback_after_execute previously stalled sparse::State::queue behind the title queue (s.queue.Wait) and synchronously blocked the submitter thread inside STATE.lock() for up to 5000 ms (s.wait_for). When an async compute queue carried both a sparse write and a wait-before-signal Wait64BitValueX whose producer direct queue had not yet been submitted on the same thread, this deadlocked both the submitter thread (blocking submission of the producer queue) and sparse::State::queue for 5000 ms per submit, triggering xcl-sync-watchdog timeouts and the title's stall watchdog after 5-6 consecutive submits. Dispatch sparse readbacks to per-queue background workers that wait on a raw per-queue fence outside STATE.lock() before invoking readback_ranges, never stalling sparse::State::queue or blocking ExecuteCommandLists.
|
Independent Windows release GPU check on NVIDIA RTX 3060 Ti ( Setup
Workspace tests (
Regression run (
Base ( PR head ( Not tested: Linux / Wine, repeating AI use: Antigravity ( |
…pub(crate) Fixes compilation errors on MSVC Windows target: - D3D12.X: restores pub(crate) unsafe fn create_raw_fence in real.rs required by sparse::readback_after_execute (xcl-dev#1732). Creates an unproxied raw ID3D12Fence bypassing title vtable hooks so internal queue worker threads under Wine/vkd3d-proton signal native fences without hitting proxy mismatches. - KernelX: restores pub(crate) visibility for commit_sparse in kernelx.rs (xcl-dev#549, xcl-dev#1298), required by DirectStorage's lazy MEM_RESERVE sparse window allocation in dstorage.rs and placeholder mappings. - Recompiler: adds #[cfg(test)] gate above mod tests in emit.rs to silence unused PRELUDE_MEM import warnings in non-test release builds (xcl-dev#1524). Assisted-by: Antigravity
…driver gave up callback Eliminates compiler warnings for unused items: - D3D12.X: removes rb_fence and rb_value from sparse::State and test fixtures (xcl-dev#1732). Readback fences are now managed per-queue in RB_QUEUES by async readback workers, making the fields on State obsolete. - D3D12.X: hooks note_driver_gave_up in real::translated_compute_pso_once when driver_compile_identified returns E_OUTOFMEMORY after DRIVER_GAVE_UP_AFTER (xcl-dev#1665, xcl-dev#1524), ensuring failed massive compute pipelines are persisted in used-pipelines.txt (!<key>) and eliminating dead code warnings. Assisted-by: Antigravity
00eec16 to
64cb447
Compare
|
Thanks @LocranKing for catching that on Windows! Your diagnosis was spot on: when an unstalled queue (like Updated
(The two earlier commits |
…er Wine (xcl-dev#175) vkd3d-proton validates iface->lpVtbl on adopted D3D12 objects passed back into d3d12core.dll (command allocators, lists, heaps, resources, PSOs, and fences). On unmodified assertion-free vkd3d-proton (such as GE-Proton or -Db_ndebug=true builds), XCL's in-place vtable adoption causes CreateCommandList/Reset to fail with E_INVALIDARG and fence waits to reject adopted fences. Under Wine (gated behind util::under_wine(), native Windows unchanged): - UnadoptGuard temporarily restores the native vtable on adopted command allocators (including alloc_pool backings and reset_pc_allocator), command lists, heaps (CreatePlacedResource/CreatePlacedResource1), RTV resources, and PSOs around calls into d3d12core.dll. - FenceProxy wraps title ID3D12Fence1 objects so the underlying PC fence keeps its native lpVtbl, unwrapping in queue Signal/Wait while preserving Fence::xcl-dev#12 completed_value_address and freeing on final Release. - real::create_raw_fence creates un-proxied native ID3D12Fence objects for XCL's own internal queue tracking (late_release, alloc_pool, list_x, cpu_writes, present, vram, drain_gpu) so un-adopted internal queues like sparse::queue() never receive a FenceProxy. Note: assert-enabled vkd3d-proton builds (such as stock Proton Experimental) still validate iface->lpVtbl inside an adopted object's own methods, so an assertion-free build (-Db_ndebug=true / GE-Proton) remains required for in-place adoption. Assisted-by: Antigravity (Google DeepMind)
On Linux with amdgpu, a multi-GiB coherent UMA window imported via OpenExistingHeapFromAddress (VK_EXT_external_memory_host userptr) causes two severe stalls: 1. GetWriteWatch(WRITE_WATCH_FLAG_RESET) on the userptr range triggers amdgpu MMU-notifier evictions (~100-200 ms/submit). 2. A multi-GiB userptr BO stalls every Vulkan GPU submission (~150 ms/frame, dropping PresentX frames). Under Wine (native Windows unchanged): - Key the default 512 MiB coherent_hint() cap on AMD GPUs (DXGI VendorId 0x1002) under Wine so NVIDIA Linux keeps a full-size coherent window (unless XCL_COHERENT_MB is set). - Allocate the coherent window without MEM_WRITE_WATCH and exclude it from watch_regions(), notifying title_textures on DirectStorage writes into it and hashing small/dynamic coherent textures with a 1/16 round-robin sweep for large ones. - Route overflow PAGE_GRAPHICS_* title GPU heaps into the sparse VRAM windows so shaders still read them directly. Assisted-by: Antigravity (Google DeepMind)
…#175) Under Wine, overflow PAGE_GRAPHICS_* title heaps are routed to sparse VRAM windows (xcl-dev#871). Eagerly mapping 64 KiB VRAM tiles for the full reserved heap up front consumes ~3.2 GiB of local VRAM for zero-filled or never- written pages before the title even leaves the menus. Add sparse::alloc_lazy (used under util::under_wine() only; native Windows unchanged): - Commits CPU pages up front so host accesses never fault, while deferring 64 KiB VRAM tile allocation until the first non-zero CPU write or GPU write target registration (placed buffers, buffer UAVs, and command-list memory writes via sparse::ensure_lazy_mapped). - Unit tests cover lazy-range overlap, hole masks, non-zero page detection, and coalesced lazy tile allocation. Assisted-by: Antigravity (Google DeepMind)
…g STATE or sparse::State::queue sparse::readback_after_execute previously stalled sparse::State::queue behind the title queue (s.queue.Wait) and synchronously blocked the submitter thread inside STATE.lock() for up to 5000 ms (s.wait_for). When an async compute queue carried both a sparse write and a wait-before-signal Wait64BitValueX whose producer direct queue had not yet been submitted on the same thread, this deadlocked both the submitter thread (blocking submission of the producer queue) and sparse::State::queue for 5000 ms per submit, triggering xcl-sync-watchdog timeouts and the title's stall watchdog after 5-6 consecutive submits. Dispatch sparse readbacks through per-queue FIFO background workers that wait on a raw per-queue fence outside STATE.lock() before invoking readback_ranges, never stalling sparse::State::queue. Track active unsatisfied queue.Wait calls via note_queue_wait (in q_wait_pc and the Wait64BitValueX GPU bridge, cleaned up in q_release via forget_queue): when the queue has an unsatisfied Wait, readback_after_execute returns immediately while the worker finishes asynchronously; when no unsatisfied Wait is active, readback_after_execute waits on the worker's completion condvar outside STATE.lock() so CPU reads immediately after a GPU fence wait (such as Write32BitValueBottomOfPipeX in testtitle) always observe the updated bytes.
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
64cb447 to
e4d8229
Compare
|
Thanks @DavidM1911! Rebased the stack (#867 -> #871 -> #877 -> #1732) onto |
XCL PR #1732 verification on Intel Arc A770Head Tested
Workspace failures and skips 24 DXIL/recompiler tests failed (20 compute PSO rejections with 0x80070057 and four output mismatches). The title e2e failed its dynamic depth-bias check (blue pixel, expected green). The log contains 25 exact Not tested Matched main run, retail-title smoke, sample-data coverage, Wine or other GPUs. AI use T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against |
Move
sparse::readback_after_executeoffsparse::State::queueand out from underSTATE.lock()into per-queue FIFO background workers, completing asynchronously when the queue has an unsatisfied GPUqueue.Wait(avoiding CPU/GPU deadlocks on wait-before-signalWait64BitValueX) and synchronously when no unsatisfiedqueue.Waitis active (preserving immediate CPU visibility after a GPU fence wait). Part of #1452.Stacked on #877; only the top commit (
e4d8229) belongs here.Previously,
sparse::readback_after_executelockedSTATE, calleds.queue.Wait(&s.rb_fence, v), and synchronously executeds.readback_ranges(&merged)(s.wait_for(s.value)with a 5,000 ms timeout) insideExecuteCommandLists. When an async compute queue carried both a sparse memory write and a wait-before-signalWait64BitValueXwhose producer direct queue had not yet been submitted on the same thread, this deadlocked both the submitter thread (preventing submission of the producer queue) andsparse::State::queuefor 5,000 ms per submit, triggering repeatedxcl-sync-watchdogtimeouts and causing a retail title's stall watchdog to abort after 5–6 consecutive submits.With per-queue FIFO workers waiting on a raw per-queue fence outside
STATE.lock()before invokingreadback_ranges,sparse::State::queueis never stalled behind a blocked title queue (sparsereadback timeouts dropped to0across >500 s gameplay runs). Active unsatisfiedqueue.Waitcalls are tracked viasparse::note_queue_wait(hooked inq_wait_pcand theWait64BitValueXGPU bridge, cleaned up inq_releaseviasparse::forget_queue): whenqueuehas an unsatisfied wait,readback_after_executereturns immediately; whenqueueis unstalled,readback_after_executewaits on the worker's completion condvar outsideSTATE.lock()so CPU reads immediately after a GPU fence wait (such asWrite32BitValueBottomOfPipeXintesttitle) always see the read-back bytes.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:RB_QUEUESmap (RbQueueStateholding a rawID3D12Fenceviasuper::real::create_raw_fence, monotonic fence value, and channel sender to a dedicatedxcl-sparse-rb-<queue>FIFO worker thread) andQUEUE_WAITStracking (note_queue_wait,queue_has_unsatisfied_wait,forget_queue).readback_after_executefilter/merge sparse ranges usinguma::get(), signal the queue's fence, and enqueue anRbJobwithout acquiringSTATEor callings.queue.Wait— returning immediately ifqueue_has_unsatisfied_waitis true, or waiting on the job's completion condvar outsideSTATE.lock()otherwise.STATE.lock()(5,000 ms timeout with power-of-two warning logging on late queues) before lockingSTATEand runnings.readback_ranges(&job.ranges).readback_after_execute_does_not_block_on_stalled_queueverifying on a real mapped sparse tile thatreadback_after_executereturns in< 1 sand leavesSTATEunlocked while a compute queue is blocked on an unsignaled fence, and completes synchronously once the gate fence is signaled.crates/xcl/src/hle/d3d12x/real.rs&crates/xcl/src/hle/d3d12x/list_x.rs:queue.Waitcalls viasparse::note_queue_waitinq_wait_pcandtry_gpu_wait, and clean up per-queue state inq_releaseviasparse::forget_queue.Tested
GE-Proton11-14-x86_64,vkd3d-protonmasterec20719452e916b(-Db_ndebug=true), DXC 1.9.2609.5, cross-compiledx86_64-pc-windows-msvc(clang-cl+lld-link).main689f2db+ D3D12.X: preserve native vtables and wrap fences for vkd3d-proton under Wine (#175) #867 (a4c5a82) + Memory: avoid amdgpu userptr stalls under Wine (#175) #871 (b3f2f7c) + Memory: lazily map sparse VRAM tiles for Wine graphics heaps (#175) #877 (b112fe7) and verified under Proton (--test-threads=1,XCL_DXC_DIRset for GPU tests):--exact hle::d3d12x::sparse::tests::readback_after_execute_does_not_block_on_stalled_queue: 1 passed, 0 failed, 0 ignored, 0 skippedhle::d3d12x::sparse::tests: 16 passed, 0 failed, 1 ignored (pre-existing#[ignore]early_commit_timing)hle::d3d12x::list_x::: 27 passed, 0 failed, 0 ignored--exact gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem gpu::recomp::tests::gpu_valu_float_and_int: 2 passed, 0 failed, 0 ignored, 0 skippedGE-Proton11-14(XCL_NETWORK=0 XCL_PSO_PRELOAD=0 XCL_RUN_SECONDS=60 XCL_ACTIVITY=1,VKD3D_CONFIG=""):1079frames shown (1079PresentX,0 0 0presents/2 s) with0crashes and0device removals.Regression run
Produced under Wine (
GE-Proton11-14, AMD Radeon RX 9060 XT,vkd3d-proton ec20719452e916b,XCL_NETWORK=0 XCL_PSO_PRELOAD=0 XCL_RUN_SECONDS=60 XCL_ACTIVITY=1,VKD3D_CONFIG="") using thexcl-smoke v1log extraction format (Linux environment; native Windowsscripts/smoke.ps1could not be run;peak commit: 0 MBis what689f2dblogs under Wine before #1097).main(689f2db):This PR (
e4d8229, stacked on #877):Not tested
test_title_runs_and_game_folder_is_untouchede2e needs re-check on Windows aftere4d8229).AI use