Repository navigation
D3D12.X: integration branch that reaches the in-world HUD on NVIDIA (reference, not for merge) - #2057
theaustinayers wants to merge 87 commits into
Conversation
Helpers for the copy path that changes no behaviour yet: - sparse.rs: extract new_state from the inline closure in init, so shadow_window (next commit) can call it when no sparse windows exist - uma.rs: Uma::shadowed flag and is_gpu_copy(p): a sparse window or a committed one the GPU has a copy of. Never set to true in this commit. - list_x.rs: note_copy_into tracks PC copies into console buffers whose memory the GPU has a copy of; note_write uses is_gpu_copy - real.rs: uma_shadowed helper, res_map and dev_create_placed_resource_x use is_gpu_copy (= is_sparse while shadowed is false) Based on Ahmet-Dedeler's c70bf8a on mac-on-main-wip. Co-authored-by: Ahmet Dedeler <105894172+Ahmet-Dedeler@users.noreply.github.com> Assisted-by: Claude Code (Claude Opus 4.6 ported it; Claude Opus 5.5 reviewed it)
D3DMetal 3.0 applies SetPredication for draws, dispatches and ExecuteIndirect but not for copies: a predicated CopyBufferRegion runs unconditionally. The UMA shadow path (next commit) makes UMA available on this host, so the predication test would run and fail. A one-copy probe detects whether a predicated copy is skipped (Windows, any real D3D12) or run (D3DMetal). When run, the test skips with "host ignores SetPredication for copies" instead of failing. Based on us3r40456's bisect and measurement in xcl-dev#258. Co-authored-by: Ahmet Dedeler <105894172+Ahmet-Dedeler@users.noreply.github.com> Assisted-by: Claude Code (Claude Opus 4.6 ported it; Claude Opus 5.5 reviewed it)
D3DMetal answers E_NOTIMPL for OpenExistingHeapFromAddress. A committed UMA window is then a buffers-only heap of video memory (Uma::shadowed), kept in step like a sparse window's tiles (sparse::shadow_window): CPU writes go up before each ExecuteCommandLists (the window's write watch), GPU writes come back on Map and after the lists' memory writes, and PC copies into console buffers there are read back after the submit (list_x::note_copy_into). XCL_UMA_SHADOW=1 forces the path on a GPU that has such heaps, =0 never. On main 930e8b4: the start-up check that the GPU sees CPU writes (check_uma_import) is not run for a shadowed window (it is a copy by design); sparse::new_state carries the new parked list. The runner's run_in_region falls back to upload/readback copies per window on E_NOTIMPL. The sparse test's shadowed readback and constant-rewrite stress validate the data path. Part of xcl-dev#258. Based on Ahmet-Dedeler's c70bf8a on mac-on-main-wip. Co-authored-by: Ahmet Dedeler <105894172+Ahmet-Dedeler@users.noreply.github.com> Assisted-by: Claude Code (Claude Opus 4.6 ported it; Claude Opus 5.5 reviewed and fixed the import-check assertion)
…ough the memory store is full The disk cache of compute driver blobs (xcl-dev#634) wrote a blob only when the in-memory store had taken it first: keep_compute_blob stored it there within COMPUTE_BLOBS_MAX (512 MB) and the caller then looked it up for the file. Once the store was full the lookup found nothing and no later build was written. Those are the builds that matter most: a retail title's world needs compute pipelines of 20 to 150 s each in the NVIDIA driver, made after hundreds of smaller ones, and it built them again in every run. keep_compute_blob now returns the blob it fetched; it is kept in memory only while there is room (remember_compute_blob), and goes to the disk either way. Assisted-by: Claude Code (Claude Fable 5.2)
D3D12.X: eliminate multi-heap UpdateTileMappings and per-texture Signal stalls in vram::Pages
D3D12.X: an ExecuteIndirect reads the arguments written before it
D3D12.X: promote R9G9B9E5_SHAREDEXP render/UAV targets to R11G11B10_FLOAT
`readback_after_execute` made the sparse queue GPU-wait for the title's queue and then waited on the CPU for the copy, on the thread that was submitting. The title's queues can wait for work that same thread submits next (four compute queues waiting for a Write64 on q1 whose list is recorded but not submitted yet). So the copy waited its 5 s on every such submission, and the uploads queued behind it on the sparse queue waited too (`before_execute` waiting for ring room). In thread dumps of a retail title on an RTX 5090, the submitting thread is in `readback_ranges` -> `wait_for` while another title thread waits for the sparse state's lock in `commit_range`. lucsoft found the same cycle on RDNA3 / Linux (xcl-dev#505). The copies now run on a queue of their own, which GPU-waits for the title's queue, and the submitting thread returns. Readback buffers are sized to the copy (64 KiB and up) and reused. Without a readback queue (it could not be made), the old path runs. The data lands in the title's memory once the copy is done, before the title can see the work it follows is done: - on the next submit, and from a thread that looks every 0.5 ms; - before Map's readback and in the CPU memory waits of Wait64BitValueX (`settle_readbacks`), which wait for the copy once the title's lists it follows are done; - in the title's fence observations: `GetCompletedValue` settles the copies first. `SetEventOnCompletion` hands the fence an event of XCL's own, and a thread-pool wait on it settles them, then sets the title's event. The new test `a_copy_back_does_not_wait_for_the_title_queue` waits 5.0 s on the old path and under 1 s with this change. Without the fence hooks, the e2e test title read 0 for its Write32BitValueBottomOfPipeX after its fence wait. With them, both e2e tests pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retail title's intro cutscene ran at 0.3-0.5 fps with the GPU at 98-100 %, and nothing in XCL measured GPU time per draw or dispatch: the logs could not say which console programs the GPU time went to. With XCL_GPU_PROFILE=1 each translated draw, dispatch and ExecuteIndirect (and an ExecuteIndirect with a PC pipeline) gets a timestamp query on its PC list before and after it, resolved right behind it into a readback ring of 2^17 pairs. Nothing on the CPU waits: a reporter thread takes the written pairs every 100 ms, and every 2 s logs the 15 console programs with the most GPU time (every 20 s also since the start): hash, kind, calls, total and longest ms, group counts of the longest call, and for compute the thread group size, wave64 / split form, code and DXIL size. Ticks are converted with a title queue's GetTimestampFrequency. Off by default; with it off each op pays one LazyLock read. Overlapping queues are each charged in full, so the sum can exceed wall time; bundles get no stamps; a recording run again without a Reset is counted once. The resolve waits on the GPU for the op to finish, so with the profile on a queue runs its ops one after the other. The unit tests cover the pair states and the ranking. Assisted-by: omp (Claude Opus 5.5)
When a bridged Wait64BitValueX times out, the watchdog logs the producer queue's state, but not the queue.Waits XCL adds on its own: texture page mappings (vram::before_execute), sparse uploads and tile mappings, and sparse readbacks. They are not in SYNC_GRAPH, so a producer queue that stands behind one of them looked like a queue with "no tracked wait". On an RTX 3080 10 GB (driver 621.01) with the retail title, every timeout came with the producer queue (and another title queue) waiting for the texture page-mapping fence, about 25 mappings behind after 7.7 s; skipping that one wait in a local experiment took the CPU releases from 4 to 0-1 per run. note_internal_wait records each such wait per queue, and each watchdog round logs the unmet ones next to the pending title fences. The watchdog timeout (5000 ms) can now be changed with XCL_GPU_WAIT_TIMEOUT_MS, like XCL_WAIT_TIMEOUT_MS for the CPU waits. No behaviour change otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015JSG96tVb4ZSAZ5WH4v95v
…d walks the rest (local test)
…fences (local test)
… hook (local test)
The newer factory's CreateQueue (slot 10) takes a 0x20-byte desc whose u64 @0x18 is the queue's DSTORAGE_QUEUE_OPTIONS; a new retail game sets bit 0, AutoSubmitDisabled. XCL ignored it, and a half-full queue still submitted by itself. The title writes a request's destination page list after EnqueueRequest and before its own Submit, so a request that the half-full submit sent to the worker could run before its list was written, with the pages of the slot's previous request. Such a queue now runs its requests only at Submit, and an enqueue into it at capacity waits until Submit, a cancel or Close takes entries, as the console's queue stalls one. Queues made without the option, or through the first CreateQueue, submit when half full as before. Other option bits are logged once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ir fence; looks counted against list closes (local test)
… reports (local test)
`would_signal_close_cycle` took every armed wait on the target cell with `val <= sig_val` as waiting on the new signal. A wait that an earlier signal of the cell already satisfies (submitted on the GPU or released on the CPU) does not depend on it. With pipelined frames – queue A waits on cell X >= N, queue B then signals X = N + 1 after waiting on something A signals later – every such frame was reported as a cycle, signalled on the CPU and its waiters released before the GPU work they wait for ran. A retail title on an RTX 4070 Laptop broke 14-32 such "cycles" in each run's world load (traced: queue 1 waiting on 0x...fde0 >= 0x6db, covered by queue 2's earlier 0x6db signal, counted against queue 2's 0x6dc signal). With the fix: no cycle break in two runs of the same load. The waiters taken now are those no earlier signal covers (`val > max(submitted_max, cpu_signaled_max)`); a test reproduces the traced case and keeps the true cycle detected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retail title keeps its destination page lists in slots of its own table and writes a slot's pages after EnqueueRequest. At enqueue such a slot can still name the pages of the slot's previous request, and the snapshot taken then is what execute() wrote to (xcl-dev#289 rereads only the entries that are 0). Over 16 000 requests a run were written into pages the title had since reused: its objects got garbage pointers and it crashed about 20 s into world loading; when the old pages were freed, the request failed with E_ACCESS_VIOLATION. The console reads the list when it runs the request. execute() now reads it again (through read_own, as the snapshot) and takes it when it differs and every page in it is allocated (kernelx::physical_pages_live); otherwise the snapshot stays, so arrays on the stack that were overwritten since still work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…al a cycle" Local test only (the upstream PR is a draft, xcl-dev#2052). On this title the change left a real multi-queue wait cycle: at 111 s of the world load all five queues waited on each other for values one past their completed ones, the watchdog released 102 GPU waits and the title froze. The cycle breaks logged before the change had been the false positives it meant to avoid; the true ones it no longer breaks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
RTX 3070 8 GB / 32 GB RAM, Windows, After that stop, the title and XCL are both waiting and nothing runs:
This is an 8 GB card on Windows. The stop is at about the time @frenziedcoder's RTX 5080 loses the device on this head. Setup
Precompile (2 689 compute programs)
Title runs on
¹ For comparison,
In runs 2 and 3 it presented 2–7 frames per second from ~40–60 s on. What the stop looks like
Not tested
AI use: Claude Code (Claude Opus 5.5) built the tree, ran the precompile and the runs, read the logs and thread dumps (XCL frames symbolized with the build's PDB) and wrote this report. I watched runs 4 and 5 and checked the report before posting. |
|
Test of Setup: RTX 5060 Ti 16 GB (32-lane waves), driver 621.24, Intel Core Ultra 5 225F (10 cores), 32 GB RAM, Windows 11 build 26200, Rust 1.100.0, release build of this head. The newer retail title of #505, my own copy, default console type. Caches: 8 processes with Runs:
So on this card the world is never reached, and I have no frame rate in the world to compare with your 5090. Not tested: the Series S profile; presses other than A and down; the test suite on this tree. AI use: Claude Code (Claude Opus 5.5) built this tree, ran it on my machine and wrote this; checked by mrejecutor. No game data attached. |
|
Test report on Setup: NVIDIA GeForce RTX 3080 Ti Laptop 16 GB (driver 32.0.16.2140), Intel i7-12700H, 32 GB RAM, Windows 11 build 26300, release build. Env: Result:
Why it stops presenting: after that point, a title thread compiles huge compute pipelines one at a time:
Other observations:
Not tested: AMD; a run long enough to get through all the huge compiles. AI use: Claude Code (Claude Opus 5.5) ran the builds and runs on the hardware above, read the logs and wrote this report. |
|
Follow-up to my report above, same RTX 3070 8 GB machine and caches,
@vakaobr, this may concern #1329's shadow. @theaustinayers. 1. What is pending at the stop, with the shadow.
2. The same tree without
3. Why the shadow could leave the title waiting: a reading of the code, not measured.
Not tested
AI use: Claude Code (Claude Opus 5.5) wrote the diagnostic, ran the runs, read the logs and the code, and wrote this comment. I watched the runs and checked it before posting. |
`readback_after_execute` made the sparse queue GPU-wait for the title's queue and then waited on the CPU for the copy, on the thread that was submitting. The title's queues can wait for work that same thread submits next (four compute queues waiting for a Write64 on q1 whose list is recorded but not submitted yet). So the copy waited its 5 s on every such submission, and the uploads queued behind it on the sparse queue waited too (`before_execute` waiting for ring room). In thread dumps of a retail title on an RTX 5090, the submitting thread is in `readback_ranges` -> `wait_for` while another title thread waits for the sparse state's lock in `commit_range`. lucsoft found the same cycle on RDNA3 / Linux (xcl-dev#505). The copies now run on a lane per title queue: a fence the title's queue signals after its lists, and a queue of its own that GPU-waits for that fence. The submitting thread returns. With one fence for all title queues, a later signal on another queue let a copy start before its own queue's lists ran (CharlyRien); with one queue for all, a title queue waiting for work still to come held back the copies of the others. The lanes (8) are made in `init`, before the device's methods are hooked: made later, a lane's queue was adopted as one of the title's, and the e2e title under the debug layer read 0 for what its lists wrote. A lane serves a title queue while that queue has copies back in flight; with all lanes busy (or none made), the old path runs. Readback buffers are sized to the copy (64 KiB and up) and reused. The data lands in the title's memory once the copy is done, before the title can see the work it follows is done: - on the next submit, and from a thread that looks every 0.5 ms; - before Map's readback (waiting for the copy once the title's lists it follows are done), and in the CPU memory waits of Wait64BitValueX, which only try the sparse state's lock: its holder can be waiting for work the waiting thread is to submit; - in the title's fence observations: `GetCompletedValue` settles the copies first. `SetEventOnCompletion` hands the fence an event of XCL's own, and a thread-pool wait on it settles them, then sets the title's event. Lanes land in their own order, so an older copy back of one lane can land after a newer one of another: it leaves the bytes the newer one landed. A CPU wait for a copy uses its lane's event, not the sparse state's: a wait that gave up leaves its registration behind, which set the shared event later and ended a tile-queue wait early (theaustinayers, in xcl-dev#2057). Tests: - `a_copy_back_does_not_wait_for_the_title_queue` waits 5.0 s on the old path and under 1 s with this change; - `a_copy_back_waits_for_its_own_title_queue`: two title queues, the first blocked; with one lane for both, the first one's copy lands before its list ran; - `an_older_copy_back_does_not_overwrite_a_newer_one`. They run on a WARP device of their own: they block a queue on purpose, and on the GPU's device, which the tests in the process share, other queue tests then hung in the driver releasing resources (upipibi; reproduced in 3 of 3 runs of the d3d12x queue tests). Without the fence hooks, the e2e test title read 0 for its Write32BitValueBottomOfPipeX after its fence wait. With them, both e2e tests pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
RTX 5080 16 GB on Setup: NVIDIA GeForce RTX 5080 16 GB (driver 610.88, 32-lane waves), AMD Ryzen 9 9950X, 32 GB RAM (commit limit 97 GB), Windows 11 Pro 26200, release. This PR at Caches: Runs (all with
DRED, the two runs: Both times the operation in flight is Flicker ( A page budget does not get this card under its memory. Locally I applied #640 on this head (10 conflict blocks; its pool part rewritten for the Series S profile ( Not tested
AI use: Claude Code with Claude Fable 5.2 built the trees, ran the title, read the logs and wrote this report. |
|
@kanade333 @dhillonjagdeep650-boop on the Branch foreach ($t in 'a_vram_copyq','b_sys_copyq','c_split_copyq','d_sys_direct','e_split_direct','f_half_null_copyq_write','g_half_null_direct_write','h_all_null_copyq_read','i_all_null_direct_read','j_sys_null_copyq_write','r_null_during_copyq','r_null_during_direct','r_other_tiles_during_copyq') {
cargo test -q -p xcl --lib "copyfault_probe::$t" -- --ignored --nocapture --test-threads=1 | Select-String PROBE
}
On the 4070 Ti, all 13 cases: no removal. Data is right in the mapped tiles, and NULL tiles read 0. Adapter 0 is used; set If any AI use
|
|
RTX 4070 12 GB / 32 GB RAM on Setup
What a run looks like now: 30 fps in the menus from 6 s, the loading artwork from ~110 s (the older head
So on this card the removals come in two kinds, both while video memory stands far over the card: DXGI reports 20.7–21.0 GB local and 1.6–1.8 GB non-local at the removal (target pages 10.1–10.3 GB, sparse pools 6.1 GB, UMA shadow), with 2–5 GB of RAM free:
Skipping late pipelines ( Update, runs 63–66 (same tree, same settings unless said): what the faults are not –
Not tested: more than one run per row; AMD; the tree without #2195 (it changes no behaviour here unless an index lands in 1,000,000 – 2^21); whether the faulting texture's tiles were mapped at the moment of the copy (the next thing I'm looking at). AI use: Claude Code (Claude Opus 5.5) made the builds and runs on this machine, wrote the two diagnostics and wrote this report. |
|
RTX 5070 / Windows 10 follow-up on exact #2057 head Setup: RTX 5070 12 GiB, driver 610.88 (32.0.16.1088), i7-7700K, 32 GiB RAM, Windows 10 build 19045, Rust 1.100.0, unchanged release build. The newer title of #505 ran offline from an SSD with a copied local profile for each run. Shared flags:
In the crashing run, the last two 2 s activity samples showed 2,296 and 2,206 DirectStorage requests (0 failed), with 9 dispatches in each sample. DRED reported a GPU page fault against a resource (allocation type 34, no recently freed allocation listed). One list on the reported queue showed 33/36 completed operations with Peak sampled XCL process commit was 23,820 MiB, peak local video memory was 12,122 MiB, minimum available host RAM was 15.95 GiB and minimum system commit headroom was 29.58 GiB. There were zero AI-assisted (Codex) for the runs, log analysis and this report. No game data attached. |
|
RTX 5090 32 GB on This looks like the same stop as @kanade333's first row ( Setup
Runs (80 s each unless noted; "hot" = the default
What I think it is (not verified): the description says a write to an idle block can reach video memory ~20 ms late. Both switches that bring the removal put title memory behind XCL's windows, which the looks have to bring up; a value the GPU waits on (or reads indirect arguments from) that arrives late in such a block would explain a hang at a steady frame rate on a static screen. A 60 s hot window, which keeps a block in every look once it was written, removes it here (2 of 2). DRED not tried for the menu stop. Not tested
Edit (world load on the same card,
Not tested for this part: a run with every graphics pipeline warm from the start (a fourth run should start with none left to build); more than 320 s after the world appears; AI use: Claude Code (Claude Opus 5.5) ran the precompile and every run above, read the logs and wrote this report. |
|
@joeypercia I ran your unchanged synthetic probe at
This matches the device-removal HRESULT on this hardware. The synthetic probe does not establish that the title lost the same resource or took the same code path. AI-assisted (Codex) for execution and reporting. The probe ran without title files. |
A retail title's world load can stop with no GPU-wait time-out: presents, submits and DirectStorage requests go to 0 and every thread waits. The watchdog's summaries of pending title fences and of XCL's own unmet queue waits are only logged at a time-out, so such a stop did not say whether a fence or a queue was behind. At each XCL_THREAD_DUMP_AT dump XCL now logs the two summaries and the number of armed GPU waits, on a thread of its own so that a lock the stall holds cannot hold up the next dump. On xcl-dev#2057's tree this showed every fence and queue caught up at 135, 200 and 300 s after a stop at 110 s (xcl-dev#2057 (comment)). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZrhsCAiLU1tTuEBwPLaRW
|
@joeypercia Your unchanged probe at
So on this card AI-assisted (Claude Code). Synthetic probe only, no title files. |
Draft, for reference only: the tree my runs of the newer retail title of #505 use on an RTX 5090, so that others can build and run the same thing. It is not meant to be merged as it is. Most of it is other people's open PRs; my own commits on top will be split into small PRs (list below). Merged with
mainat568e7db.The game runs listed under Tested were made with the same commits on an older base (
7f7e768, no rebuild of the shader caches needed there). This merged tree has unit and GPU tests but has not run in the game yet: its compute pipelines are being built now.What is in it
Other people's work:
XCL_UMA_SHADOW=1)globallycoherenton compute memory windows only when the program needs itXCL_GPU_PROFILEAutoSubmitDisabledwaits forSubmittitle_list::reset. Without it a list that was split kept its old segments and sent them again every frame: the freeze after about 30 s in the world, garbage indirect arguments and GPU hangsmainsince: D3D12.X: eliminate multi-heap UpdateTileMappings and per-texture Signal stalls in vram::Pages #1747, D3D12.X: an ExecuteIndirect reads the arguments written before it #1791, D3D12.X: promote R9G9B9E5_SHAREDEXP render/UAV targets to R11G11B10_FLOAT #605New commits, each to become its own PR or a note on the PR it changes:
16826cb,3877446,c28d531the counts of an ExecuteIndirect are read by a program of XCL's before the GPU runs them;f98a1d6D3D12.X: a wait an earlier signal covers does not make a signal a cycle #2052's rule for title fences;0d25b89the console's cache flushes (list #131, Add synthetic Cargo benchmark suite #132, FlushPipelineX) are UAV barriers;dc651eaa tile a placed buffer uses stays mapped70a160e,0764a57on Memory: new sparse tiles are mapped together before the next submit #1517 (a mapping put off goes before a CPU or queue signal, before lists that follow a CPU wait, and after 2 ms at the latest);6112bd8on kernelx: commit a mapping call's sparse pages once per run, not per page #1792 (a page with data is told to the sparse windows before its bytes come: a look in between dropped them);f659f75the mapped runs and the pieces to clear are kept in order;77be198a thread that maps memory lets waiting submits have the sparse lock first (171 ms median wait → 0.14 ms in a test);04c2fe7a texture whose memory is not all there is read region by region80dc4dcsmall CPU writes go up in one dispatch;73fc616,0b66349,b659291,f064c82the parts of a texture that changed go up, through lists and buffers that are kept, in order across queues;a261e72what a file read puts into graphics memory is a known write;55e58c3readableasks the working set6e7040b,2987c19what each recorded call looks up is kept in parts with a lock each;680a719,0ba3b8clast releases7c18bc4and after it (blocks written lately, a thread walks the rest; off withXCL_WATCH_HOT=0). Not strict: a write to a block that was idle reaches video memory up to about 20 ms late.a004fe7XCL_LOOK_AHEAD=ms(off; known gaps, see its commit)414adb2one device is opened at a time (two test threads made two and opened the memory windows for each)9baaa6fa compute pipeline's driver blob reaches the disk cache although the memory store is full;5ea55e2XCL_PRECOMPILE_SLICE=i/n1225bb9,5e3c657,b5e8bafon top of D3D12.X: a copy back after a submission does not wait for the title #1993XCL_ACTIVITYcall times,XCL_LOOK_STATS)Tested
cargo test --release -p xcl --lib -- --test-threads=4at4df1e6e: 1145 passed, 4 failed, 26 ignored. The 4 aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(the driver answers E_OUTOFMEMORY to CreateComputePipelineState); they fail the same way onmainwith this card. SKIPPED: the tests that need 64-lane waves.XCL_ADAPTER=warp(the software adapter, as CI): 1149 passed, 0 failed, 26 ignored. The CI failure of the head before (f7e08e6) was one of my tests: the software device does not survive copies into a reserved buffer of 3 GiB; the test skips there now.7f7e768(XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_COHERENT_HEAPS=sparse:16 XCL_LOOK_SKIP=1, compute pipelines built ahead), two runs of 300 s:Regression run
Not tested
AI use
🤖 Generated with Claude Code