D3D12.X: preserve recorded positions of 64-bit waits #708
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!708
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/708/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Abuudiii on GitHub · 2026-11-24 03:56 UTC · original
Abuudiii:xcl-recorded-waits→main· +1165 −198 · 10 files · 4 commits · closed without mergingXCL could move a wait ahead of a producer, time out, and read stale data. Split supported command lists at the recorded wait and gate the continuation on the producer’s value.
What is in it
Tested
89184d1merged ontof4ce27c, Windows 11 / RTX 4070 SUPER: 704 passed, 0 failed, 41 ignored; two wave64 skips. The wait test passed without the Proton shim.89184d1and passed after the fix. Both GPU readback tests passed with the same disposable vtable shim. The separate late-fence test passed without the shim.64b3f35: 706 passed, 0 failed, 41 ignored. The two focused wait tests passed 10/10; all four producer tests passed.VirtualFreefailure incoherent_buffer_sanitizes_console_flags_and_statedid not recur in isolation; a matched main-only run was not reported.Regression run
Native Windows runs reported by @eizispark.
Not tested
AI use
@brainhay5 on GitHub · 2026-11-24 04:04 UTC · original
Verification on a retail title, since your Not tested lists "GTA VI's black screen is unverified".
Setup: merged onto
mainf4ce27c(merge7e29c9b, clean), release, RTX 5070 Ti, driver 32.0.16.1088, Windows 11 22631, interactive session,XCL_NETWORK=0, full launch.It fixes the waits. On plain
f4ce27cthe same run logs 14Wait64BitValueXtimeouts (2 s each, addresses0x70417ff88…0x704180058stepping0x10, every one expecting0x623while memory holds0). With this PR: 0 timeouts in the whole run.The crash is unchanged. Same fault, same offset, same ~120 s:
So the wait timeouts were a symptom alongside the crash, not its cause — worth knowing, because it means fixing the waits alone will not clear the black screen.
Not tested: AMD, other titles, longer runs.
AI use: OpenCode, DeepSeek V4.1 Flash 1017.
@QemmHD on GitHub · 2026-11-24 04:06 UTC · original
Native Windows + NVIDIA test-suite run (the description lists it as not tested; the run above is a retail title on NVIDIA, this one is the suite and the PR's own tests):
89184d1merged onto mainf4ce27con Windows 11 Home 26200, RTX 4070 SUPER (driver 621.24, wave32), Rust 1.98, DXC 1.8.2502.11: pass.cargo test --workspace -- --test-threads=4: 704 passed, 0 failed, 41 ignored (main: 701 / 0 / 41). Per test, the only difference is the 3 new tests. Clean merge, 0 build warnings. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64), as on main.cross_queue_wait64_runs_at_its_recorded_positionran on the hardware D3D12 device through the adopted queue'sExecuteCommandListshook; on Windows it needs no shim. It passed. Thecpu_writestests (includingblocked_queue_does_not_stall_another_queues_writes) anddisasm_prints_vop3_literal_and_advances_pcpassed. The wait test and the blocked-queue test passed 20 of 20 repeated runs.wait_memorydisabled (list_x.rs:1342), the two-queue test times out after 2000 ms and reads[STALE, UPDATED]; restored, it passes. So the stale read reproduces on NVIDIA too, and this PR fixes it there.wait_gate.rs:70warns once and leaves the queue blocked), andImmediateU64writes are now dropped after a 10 s fence timeout (cpu_writes.rs:62-64, set atlist_x.rs:1179), where they used to be written anyway. Together, a producer queue stalled for more than 10 s could leave the consumer queue blocked for good. Also, an error while arming the gate ends the process (list_x.rs:1030-1038), and with sparse writes in the same batch the wait still falls back to the bounded 2 s CPU wait (list_x.rs:1009).AI-assisted (Claude Code, Claude Opus 5.5).
Discord: bigpeppa.
@lordon1a on GitHub · 2026-11-24 04:10 UTC · original
Independent D3D12.X GPU test report on
89184d1:Tested
616.64, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200),rustc 1.100.0(x86_64-pc-windows-gnullvm), debug build, DXC1.9.2609.5(01b62ad4)cargo test -p xcl --lib wait_ -- --test-threads=1 --nocapture: 5 passed, 0 failed, 0 ignored in0.45s(includinghle::d3d12x::list_x::wait_tests::cross_queue_wait64_runs_at_its_recorded_position)cargo test -p xcl --lib hle::d3d12x -- --test-threads=1: 97 passed, 0 failed, 1 ignored in7.40sNot tested
xcl-smoke)AI use
89184d1in a detached worktree, audited the diff, ran the D3D12.X wait and module test suites, and posted this report.@crosettiremi on GitHub · 2026-11-24 04:16 UTC · original
Native Windows 11, RX 7900 XT, DXC 1.9.2602.17. On exact head
89184d1, the existing two-queue regression passed (cargo test --offline --locked -p xcl --lib cross_queue_wait64_runs_at_its_recorded_position -- --nocapture --test-threads=1).I found one remaining ordering case in a local integration of this head. Record an ordinary D3D12 CopyBufferRegion, a supported 64-bit GE wait on an external counter, and a second CopyBufferRegion. Neither the first copy nor an ordinary forwarded draw has to set wrote_uma or add a cpu_writes entry. In my copy case, append_pieces returned one PC list. The production queue would gate that entire list, including the copy recorded before the wait. The new regression failed with
left: 1, right: 2.Locally I removed the fast path that treats an empty tracked-write set as an empty recording. The test then observed an ungated prefix and a gated continuation. On this PR head plus that small change, both GPU tests passed (
cargo test --offline --locked -p xcl --lib list_x::wait_tests:: -- --nocapture --test-threads=1). This conservative implementation can also create an empty prefix for a genuinely leading wait.Retail 1.0.2.1, separate from those focused tests: the local build also includes preload, bounded PSO waits, sparse-buffer release changes and a 6,144 MiB texture budget. Same profile, input and starting application caches in both runs. With the PR's original split rule, the first gate opened, legacy wait timeouts were zero, two gates were still waiting at 149.727 s, and the title took a read AV at 149.888 s. The host stayed open after saving its report and was terminated. With the copy-order adjustment, the game logged zero legacy timeouts and zero delayed-gate warnings before a different title read AV at 163.244 s. No device removals in either run. Neither reached a verified playable scene. The pair does not establish why either crash occurred.
The adjusted integration passed 727 workspace tests, 0 failed, 41 ignored, after building the workspace fixtures. One nominal pass reported SKIPPED because xgameruntime.dll was unavailable. Codex (GPT-6) ran the checks, wrote the additional regression and summarized the logs.
@Abuudiii on GitHub · 2026-11-24 04:25 UTC · original
@crosettiremi Thanks for the native Windows reproduction. The new head
db4599dd7bc5keeps the ordinary copy ahead of the wait and retains late producer writes. Both focused regressions passed locally through Proton.If you have time, could you provide the two required
xcl-smokeblocks on native Windows: one clean build of upstreammainand one of this exact clean PR head? Any supported, unpacked title is fine; use the same machine, title, and duration for both.Please paste the generated blocks only; no game files or dumps are needed.
@burber on GitHub · 2026-11-24 04:27 UTC · original
Native Windows + NVIDIA test of this PR with the retail title: no
Wait64BitValueXtimeouts any moreSetup: RTX 4070 Ti 12 GB (driver 32.0.16.1062, 32-lane waves), i5-13600K, 32 GB RAM + 32 GB page file, Windows 11 26300, DXC 1.8.2502. Release build of
main9182f27+ #533 + #267, with this PR merged on top. It merged cleanly; the only conflict in my stack was #690'spso_async.rsagainst #533. Title 1.0.2.1,XCL_NETWORK=0, terms already accepted, the same scripted input in every run.Tests:
cargo test --release --workspacegives 667 passed, 0 failed (2 GPU skips for no wave64), includinglist_x::wait_tests.Retail runs:
Wait64BitValueX timed outat 0x70417fe58 (op 7, want 0x802 …; memory holds Some(0))0xffffffffffffffffat+0x81cb67, 138 svcruntime140+0x14d3, write 0x20); not seen again+0x23cf683, 116 sSo on this machine the stale-counter reads are gone. What stops the title now is the watchdog during world loading: 10–13 compute pipelines are still building past 4 s at ~100 s (first builds on the NVIDIA driver). I don't see anything from this PR in that.
Investigated with AI assistance; all numbers are from runs on my machine.
@QemmHD on GitHub · 2026-11-24 04:34 UTC · original
Re-ran
db4599dmerged onto main64b3f35on Windows 11 26200, RTX 4070 SUPER (621.24): 706 passed, 0 failed, 41 ignored (main: 701 / 0 / 41); clean build, no warnings.wait_tests(cross_queue_wait64_runs_at_its_recorded_position,ordinary_copy_runs_before_wait64_for_late_external_value) pass on the hardware device, 10 of 10 repeated. The 4cpu_writestests pass, includingimmediate_u64_survives_a_producer_fence_timeout.On the two points from my earlier comment:
cpu_writes.rs:64-76). That loop has no upper bound either.wait_gate.rs:66-71; the monitor loop at:84). If a producer never signals, both places now wait for good. A bounded give-up, with a log line naming the address and the value it was waiting for, would make that case diagnosable instead of a silent hang.AI-assisted (Claude Code, Claude Opus 5.5).
Discord: bigpeppa.
@eizispark on GitHub · 2026-11-24 04:52 UTC · original
Hardware check of
db4599dd7bc5281aee79fb9965c9cc3a261497f3(verified clean merge withmain64b3f35): smoke & PR regressions pass; 1 concurrent unit-test failure under--test-threads=4.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:694 passed, 1 failed, 41 ignored(GPU tests skipped on this adapter:none);hle::d3d12x::real::readback_routing_tests::coherent_buffer_sanitizes_console_flags_and_statefailedVirtualFreeatcrates/xcl/src/hle/d3d12x/real.rs:5234during concurrent--test-threads=4execution (cargo test -p xcl --lib coherent_buffer_sanitizes_console_flags_and_state:1 passed, 0 failed, 0 ignored)hle::d3d12x::list_x::wait_tests(cross_queue_wait64_runs_at_its_recorded_position,ordinary_copy_runs_before_wait64_for_late_external_value):2 passed, 0 failed;hle::d3d12x::cpu_writes::tests(blocked_queue_does_not_stall_another_queues_writes,immediate_u64_survives_a_producer_fence_timeout,readback_u64_lands_after_the_queue,writes_land_after_the_queue):4 passed, 0 failedRegression run
main(f4ce27c):PR (
db4599d):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.@Abuudiii on GitHub · 2026-11-24 05:20 UTC · original
Thanks @eizispark for the native Windows tests and smoke blocks. I added the credited smoke pair to the description. If you have the same RX 9070 XT setup handy, could you run
cargo test --workspace -- --test-threads=4on clean64b3f35and compare whethercoherent_buffer_sanitizes_console_flags_and_statealso fails there? The failure passed in isolation, so the matching four-thread baseline matters. No need to repeat the retail smoke. Drafted with omp (GPT-6.2 Sol).@jimokulou2-ops on GitHub · 2026-11-24 05:30 UTC · original
RX 9070 XT run of the suite you asked for, and two retail runs with this PR. In both runs the title reached the world on this card. In one of them a gate that stayed blocked was followed by a device removal. Written by Claude Code (Claude Opus 5.5), which built the trees, ran the tests and read the logs; I drove the pad.
Setup: Windows 11 Pro 10.0.26300, Ryzen 7 9700X, RX 9070 XT (RDNA4, Adrenalin 26.11.2 / 32.0.32029.2010), Rust 1.100.0, DXC 1.9.2602.17.
Tests:
db4599dmerged ontomaind208e14(clean)..\scripts\test.ps1(--test-threads=4): thexcllib reported 666 passed, 1 failed, 21 ignored, and the run stopped there. The failure wasreadback_routing_tests::coherent_buffer_sanitizes_console_flags_and_state, same as @eizispark's, here asleft != right(0, 0) atreal.rs:5393. It passes alone, 3 out of 3 times. I then rancargo test -p xcl --lib -- --test-threads=44 times on each tree:maind208e14placed_title_textures_share_vram_and_preserve_pixels,transitions_apply_when_their_list_is_submitted,d32s8_targets_take_their_own_size_of_video_memorydb4599dcoherent_buffer_sanitizes_console_flags_and_stateThat test is on
mainunchanged, so I read these as the concurrency flakesmainalready has (#718), not something this PR adds.Retail title (v1.0.2.1, a save past first boot, A → loading → world,
XCL_NETWORK=0). The tree wasmain64b3f35+db4599d, plus three local changes:copy_fromworkaround from #662;pso_async::resolve_waitreturn the stand-in instead of waiting (XCL_PSO_NO_WAIT=1). Without that switch the title stops on pipeline waits before the world (#662).0
Wait64BitValueXtimeouts in both runs. Without this PR, with the same local switch on, they came every 2 s and the screen stayed black.Game Running, frame 2020, camera at<1832.26, 142.90, 3.28>, a current mission and 69 peds, at about 1 fps. It ended at 120 s inside my ownXCL_THREAD_DUMP_ATdump (host.rs:90), so the crash is the diagnostic's, not this PR's.0x887a0006) at 94 s, while the world loaded. Just before it, many dispatches were skipped because their pipelines were still building (484 → 512 in the log). The gates then logged:My guess, not verified: a producer write was in work that the local switch skipped. The gate then kept its queue blocked, and the device was removed 1.6 s later. That only happens with my skipping switch. Still, the same can follow from any dispatch
mainalready drops (stand-ins,Dispatch with a pipeline that has no translated console shader skipped). Leaving the queue blocked after the timeout turns that into a device removal rather than a stale read.Not tested: this PR without my local switch into the world on this card (it stops on the pipeline waits first); smoke pairs on the exact head.
@ddm-j on GitHub · 2026-11-24 05:51 UTC · original
Linux (Wine, NVIDIA): the
Xid 109context-switch timeout seen in itsd-effex's #769 run also comes without this PR, so the GPU-side wait isn't what causes it.Base:
mainf4ce27c+ #257 + #684, vkd3d-proton master30b0eb9with dxil-spirv at53aac41+ #257's patch; RTX 4070 Ti 12 GB (NVIDIA 615.78.08), Fedora, Proton Experimental 11.0 Wine; warm caches (#690). 300 s runs.Tested
db4599d): 0Wait64BitValueXtimeouts (one run; without it 0, 12 and 9 in three runs). The heartbeat abort still comes at ~102 s, because title threads block on compute pipeline builds.a966993, three hunks against #690 resolved by hand):NVRM Xid 109at +84 s and +85 s (two runs), ~8 s after the last present, then the heartbeat abort.XCL_COMPUTE_PSO_WAIT_MS=15000: Xid 109 at +81 s, before the first compute wait timed out, so no dispatch had been skipped yet.Wait64BitValueXtimeouts are back (6).breadcrumbson had no Xid (frames still stopped at ~74 s); a single run, so only a hint that extra synchronization hides the hang.Not tested
AI use
@Arvi23 on GitHub · 2026-11-24 05:55 UTC · original
Second data point for the device removal seen with this PR plus a local "don't wait for pipelines" switch (same pattern as @jimokulou2-ops's second run). My reading of the log is that the gate is not the cause. Details below so you can check.
Build
maine50836b+ this PR + the CopyFromSubresource fix from #684 + a local switch,XCL_PSO_NO_WAIT=1. With the switch,pso_async::resolve_waitreturnsresolve(pso)(the stand-in) instead of waiting. The switch is not part of this PR.cargo build --release, envXCL_PSO_NO_WAIT=1,XCL_NETWORK=0What happened
Wait64BitValueX gate … still waiting … after 2 s; leaving the queue blocked, 47 of them "on preceding queue work" and 3 "on the memory condition", across 5 queues.D3D12 device removed: 0x887a0006(TDR); the title then hit int3 at +0x2474606.Why I don't think the gate causes it
In
wait_gate.rs, "preceding queue work" means the gate's fence never reachedREACHED. The GPU had not finished the work submitted before the gate. The first of these warnings fire at 90.84 s after 2 s of waiting, so the GPU stopped completing work at about 88.8 s, and the TDR follows about 3 s later. A queue waiting on a fence should not trigger a TDR by itself. More likely, a dispatch or draw that ran never finished, for example because it consumed buffers (indirect arguments, counts) from one of the ~34 000 dispatches the switch skipped. That last part is a hypothesis; I have not identified the hanging work.So I'd treat this run as evidence against the skip-instead-of-wait switch, not against this PR. Next I'll rerun the same build now that
used-pipelines.txthas the world's pipelines (1191 keys), to see whether fewer skips also means no hang.Not tested
Log analysis written with Claude Code (Claude Opus 5.5); the run and the numbers are from my machine.
@Abuudiii on GitHub · 2026-11-24 06:46 UTC · original
Main now has the tracked GPU-fence bridge and its mid-list split from #795 and #797. This PR is not being rebased over those implementations.
Two independent cases still reproduced on
beaa245and are available as focused changes:Native Windows and paired retail smokes remain unverified at both new heads. Implementation and local verification used omp (GPT-6.2 Sol).
@raylitebull on GitHub · 2026-11-24 10:42 UTC · original
Closing as superseded by #795 and #797 (both already merged into
main), as noted in the thread.Pull request closed