Repository navigation
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. 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.
|
Tested Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (NVIDIA 621.35), Rust 1.99.1 MSVC, debug. The run confirmed XCL selected the real RTX 3080 Ti backend. Commit 07e6199d
Not tested Full workspace suite, AMD, retail titles, and frame-rate impact. AI use Codex with GPT-6.2 Sol ran the tests and drafted this report. |
|
Tested RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed, so the debug-layer tests run), rustc 1.100.0 MSVC, debug, Pass: 677 passed, 0 failed, 41 ignored. SKIPPED: only the 2 Run and written with Claude Code (Claude Opus 5.5). |
Part of #248; related to #262 (the same direction for sparse uploads, see #262 (comment)).
title_textures::refreshruns on the title's thread before each of its submits. It uploaded the CPU's writes to kept-in-step textures on XCL's own queue, then waited on the CPU until the GPU had run them (texture::upload_batch→wait). While a retail title streams its world with video memory past the card, those waits are long:title_textures::refresh→texture::upload_batch→texture::wait→gpu::fence::wait;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. The GPU orders the copies before the work that samples them, without a cross-queue wait (the deadlock #262 describes for waiting on title queues). A fence on that queue retires each batch's allocator, list and staging buffers at later submits; with over 512 MB in flight the oldest batches are waited for. Compute and copy queues, and a queue of another device, keep the upload queue and its wait.
What is in it
gpu/texture.rs:submit_batch=upload_batchwithout the wait, returning what has to stay alive (InFlight).upload_batchissubmit_batch+wait, unchanged for its callers.hle/d3d12x/title_textures.rs:upload_alltakes the submitting queue;title_queue_forpicks it when it is DIRECT on the same device;submit_on_title_queuesignals a per-queue fence;reclaimreleases finished batches and waits over the cap.New GPU test
gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released:read_r8moves from the mirror test to the test module so both tests use it. The existinggpu_mirror_upload_follows_cpu_writes_and_later_mapping_changescallsrefreshwith a DIRECT queue, so it now runs through this path too and still reads the written bytes back.Tested
RTX 4070 12 GB (driver 617.42), Ryzen 7 7800X3D, 32 GB RAM, Windows 11 26200, rustc 1.93.1.
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4: 677 passed, 0 failed, 41 ignored, run alone on the GPU.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.cargo testused the same GPU. The rerun alone passed.cargo test --release -p xcl --lib title_textures: 8 passed.Retail title, world streaming (guarded runs,
XCL_NETWORK=0, frame-event, activity and thread-dump logging): with this change the title got past its loading screen for the first time on this machine, twice. Without it, every run ended on the loading screen (the title's watchdog, or a free-RAM guard). Both runs used larger local stacks:3516080+ this change;3516080+ D3D12.X: constant buffer views are float4 rows (stride 16), not raw buffers #335 + this change + Textures: a layout's high-coordinate tables hold one period, not 65536 entries #435.After loading the world draws black and the title stops, which is a separate problem.
Regression run
main:
PR:
(The 60 s run reaches the intro video, whose planes are uploaded through this path every frame.)
Not tested
AI use