Skip to content

D3D12.X: preserve recorded positions of 64-bit waits - #708

Closed
Abuudiii wants to merge 4 commits into
xcl-dev:mainfrom
Abuudiii:xcl-recorded-waits
Closed

Abuudiii wants to merge 4 commits into
xcl-dev:mainfrom
Abuudiii:xcl-recorded-waits

Conversation

@Abuudiii

@Abuudiii Abuudiii commented Nov 24, 2026 •

Copy link
Copy Markdown

XCL 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

  • RX 9070 / Proton: the two-queue test read stale data before the fix and the correct value after it, with the same test-only vtable shim. The queue-worker and disassembler tests passed in separate focused runs.
  • Independent Windows suite: 89184d1 merged onto f4ce27c, Windows 11 / RTX 4070 SUPER: 704 passed, 0 failed, 41 ignored; two wave64 skips. The wait test passed without the Proton shim.
  • Independent retail-title run: Windows 11 / RTX 5070 Ti, wait timeouts fell from 14 to 0. The title still crashed around the same point.
  • Follow-ups on RX 9070 / Proton: ordinary-copy regression failed on 89184d1 and passed after the fix. Both GPU readback tests passed with the same disposable vtable shim. The separate late-fence test passed without the shim.
  • Independent Windows 11 / RTX 4070 SUPER retest of this head merged onto 64b3f35: 706 passed, 0 failed, 41 ignored. The two focused wait tests passed 10/10; all four producer tests passed.
  • Independent Windows 11 / RX 9070 XT retest: all six focused wait and producer tests passed. The four-thread workspace run reported 694 passed, 1 failed, 41 ignored, no GPU skips. The VirtualFree failure in coherent_buffer_sanitizes_console_flags_and_state did not recur in isolation; a matched main-only run was not reported.

Regression run
Native Windows runs reported by @eizispark.

xcl-smoke v1
commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1667 (PresentX 1667)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14847 MB
xcl-smoke v1
commit: db4599dd7bc5281aee79fb9965c9cc3a261497f3
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1666 (PresentX 1666)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14848 MB

Not tested

  • Sparse-memory readbacks and gameplay beyond the smoke run’s boot/menu window. The retail title crash is not fixed. The cause of the parallel AMD test failure is not established.

AI use

  • omp (GPT-6.2 Sol) wrote and locally tested the change and drafted this description. The linked Windows results were produced by the credited contributors.

Verify the wide literal prints as an operand and advances the next instruction to byte 12.
Assisted-by: omp (amd-openai/gpt-6.2-sol)
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)
@brainhay5

Copy link
Copy Markdown

Verification on a retail title, since your Not tested lists "GTA VI's black screen is unverified".

Setup: merged onto main f4ce27c (merge 7e29c9b, 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 f4ce27c the same run logs 14 Wait64BitValueX timeouts (2 s each, addresses 0x70417ff88…0x704180058 stepping 0x10, every one expecting 0x623 while memory holds 0). With this PR: 0 timeouts in the whole run.

The crash is unchanged. Same fault, same offset, same ~120 s:

unhandled exception 0xc0000005 in game_scarlett_master.exe+0x23cf683 (write at address 0x0)
on the stack: game_scarlett_master.exe+0x4e4ba89, +0x2215c35, +0x71b9a20, +0x2215eca
presents: 1474   translated_pipelines: 1114   xapu_packets_decoded: 15,185

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

QemmHD commented Nov 24, 2026

Copy link
Copy Markdown

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): 89184d1 merged onto main f4ce27c on 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_mask and gpu_wave32_program_in_wave64_hardware (no wave64), as on main.
  • This PR's tests: cross_queue_wait64_runs_at_its_recorded_position ran on the hardware D3D12 device through the adopted queue's ExecuteCommandLists hook; on Windows it needs no shim. It passed. The cpu_writes tests (including blocked_queue_does_not_stall_another_queues_writes) and disasm_prints_vop3_literal_and_advances_pc passed. The wait test and the blocked-queue test passed 20 of 20 repeated runs.
  • Negative control: with the progress-wait branch in wait_memory disabled (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.
  • Risk worth a look: the gate has no timeout (wait_gate.rs:70 warns once and leaves the queue blocked), and ImmediateU64 writes are now dropped after a 10 s fence timeout (cpu_writes.rs:62-64, set at list_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).
  • Not run: smoke.ps1 (no retail title on this machine).

AI-assisted (Claude Code, Claude Opus 5.5).
Discord: bigpeppa.

burber added a commit to burber/xcl that referenced this pull request Nov 24, 2026
…the world-loading stall past 12 GB of video memory remains

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lordon1a

Copy link
Copy Markdown

Independent D3D12.X GPU test report on 89184d1:

Tested

  • Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver 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, DXC 1.9.2609.5 (01b62ad4)
  • cargo test -p xcl --lib wait_ -- --test-threads=1 --nocapture: 5 passed, 0 failed, 0 ignored in 0.45s (including hle::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 in 7.40s

Not tested

  • AMD / Intel GPU, retail title (xcl-smoke)

AI use

  • Antigravity (Google DeepMind agent) — fetched 89184d1 in a detached worktree, audited the diff, ran the D3D12.X wait and module test suites, and posted this report.

burber added a commit to burber/xcl that referenced this pull request Nov 24, 2026
… the card, no out-of-order waits; first builds of world compute pipelines remain

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@crosettiremi

Copy link
Copy Markdown

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.

A healthy producer that misses the initial fence deadline can still advance. Keep its 64-bit completion write pending until actual completion instead of stranding the consumer gate.
Proton/RX 9070: real D3D12 late-fence regression passed.
Assisted-by: GPT-6.2 Sol
An empty tracked-write set does not mean earlier PC commands are absent. Split eligible waits even when their prefix may be empty.
Proton/RX 9070: the ordinary-copy regression fails on the old head; both readback tests pass with the fix using the same disposable vtable adapter.
Assisted-by: GPT-6.2 Sol
@Abuudiii

Copy link
Copy Markdown
Author

@crosettiremi Thanks for the native Windows reproduction. The new head db4599dd7bc5 keeps 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-smoke blocks on native Windows: one clean build of upstream main and one of this exact clean PR head? Any supported, unpacked title is fine; use the same machine, title, and duration for both.

cargo build --locked --release -p xcl
.\scripts\smoke.ps1 -Game 'D:\Games\YourTitle' -Seconds 60

Please paste the generated blocks only; no game files or dumps are needed.

@burber

burber commented Nov 24, 2026

Copy link
Copy Markdown

Native Windows + NVIDIA test of this PR with the retail title: no Wait64BitValueX timeouts any more

Setup: 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 main 9182f27 + #533 + #267, with this PR merged on top. It merged cleanly; the only conflict in my stack was #690's pso_async.rs against #533. Title 1.0.2.1, XCL_NETWORK=0, terms already accepted, the same scripted input in every run.

Tests: cargo test --release --workspace gives 667 passed, 0 failed (2 GPU skips for no wave64), including list_x::wait_tests.

Retail runs:

run build Wait64BitValueX timed out end
12 without this PR at 0x70417fe58 (op 7, want 0x802 …; memory holds Some(0)) read of 0xffffffffffffffff at +0x81cb67, 138 s
13 with this PR 0 null writes at 90.6 s (vcruntime140+0x14d3, write 0x20); not seen again
14 with this PR 0 title watchdog +0x23cf683, 116 s
15 with this PR + #640 0 watchdog, 127 s
16 with this PR + #640 0 watchdog, 129 s

So 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

QemmHD commented Nov 24, 2026

Copy link
Copy Markdown

Re-ran db4599d merged onto main 64b3f35 on 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 4 cpu_writes tests pass, including immediate_u64_survives_a_producer_fence_timeout.

On the two points from my earlier comment:

  • Late producer writes are kept now: after a fence timeout the write path samples the fence every 20 ms until it is reached (cpu_writes.rs:64-76). That loop has no upper bound either.
  • The gate still has no timeout: it warns after 2 s and leaves the queue blocked (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

Copy link
Copy Markdown

Hardware check of db4599dd7bc5281aee79fb9965c9cc3a261497f3 (verified clean merge with main 64b3f35): smoke & PR regressions pass; 1 concurrent unit-test failure under --test-threads=4.

Tested

  • Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo 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_state failed VirtualFree at crates/xcl/src/hle/d3d12x/real.rs:5234 during concurrent --test-threads=4 execution (cargo test -p xcl --lib coherent_buffer_sanitizes_console_flags_and_state: 1 passed, 0 failed, 0 ignored)
  • Native Windows D3D12 (without Proton shim): 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 failed

Regression run
main (f4ce27c):

xcl-smoke v1
commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1667 (PresentX 1667)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14847 MB

PR (db4599d):

xcl-smoke v1
commit: db4599dd7bc5281aee79fb9965c9cc3a261497f3
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1666 (PresentX 1666)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14848 MB

Not tested

  • wave32-only GPUs (NVIDIA / Intel); sparse-memory readbacks; gameplay past the menus

AI use

  • Antigravity (Gemini 4 Carbon) ran the build, test suite, and scripts/smoke.ps1 harness on this machine and formatted this report.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…se markers

Integrates upstream PR xcl-dev#708 with Wine UnadoptGuard preservation and
sparse-window marker support:
- Split command lists at recorded Wait64BitValueX and gate continuations
  non-blockingly on the GPU via wait_gate, backed by per-queue
  cpu_writes completion workers (xcl-dev#708).
- For Write32/64BitValue* targeting sparse windows (used for overflow
  graphics heaps under Wine), mirror immediate values asynchronously via
  cpu_writes + sparse::sync_sent_now instead of synchronous sparse
  readback, allowing non-blocking wait_gate segmentation on sparse
  progress markers.
@Abuudiii

Copy link
Copy Markdown
Author

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=4 on clean 64b3f35 and compare whether coherent_buffer_sanitizes_console_flags_and_state also 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

Copy link
Copy Markdown

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: db4599d merged onto main d208e14 (clean). .\scripts\test.ps1 (--test-threads=4): the xcl lib reported 666 passed, 1 failed, 21 ignored, and the run stopped there. The failure was readback_routing_tests::coherent_buffer_sanitizes_console_flags_and_state, same as @eizispark's, here as left != right (0, 0) at real.rs:5393. It passes alone, 3 out of 3 times. I then ran cargo test -p xcl --lib -- --test-threads=4 4 times on each tree:

tree runs ok failures
main d208e14 2 / 4 twice: placed_title_textures_share_vram_and_preserve_pixels, transitions_apply_when_their_list_is_submitted, d32s8_targets_take_their_own_size_of_video_memory
+ db4599d 2 / 4 once the same three; once coherent_buffer_sanitizes_console_flags_and_state

That test is on main unchanged, so I read these as the concurrency flakes main already 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 was main 64b3f35 + db4599d, plus three local changes:

0 Wait64BitValueX timeouts in both runs. Without this PR, with the same local switch on, they came every 2 s and the screen stayed black.

  • Run A: the title reached the world. Its own crash report says 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 own XCL_THREAD_DUMP_AT dump (host.rs:90), so the crash is the diagnostic's, not this PR's.
  • Run B: a device removal (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:
[ 92.278] D3D12.X: Wait64BitValueX gate on queue … still waiting on the memory condition after 2 s; leaving the queue blocked
[ 92.725] D3D12.X: Wait64BitValueX gate on queue … still waiting on preceding queue work after 2 s; leaving the queue blocked
[ 92.733] (same, preceding queue work)
[ 92.764] (same, memory condition)
[ 93.900] D3D12 device removed: 0x887a0006 … Wait64BitValueX gate on queue …: D3D12 device removed

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 main already 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

ddm-j commented Nov 24, 2026

Copy link
Copy Markdown

Linux (Wine, NVIDIA): the Xid 109 context-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: main f4ce27c + #257 + #684, vkd3d-proton master 30b0eb9 with dxil-spirv at 53aac41 + #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

Not tested

  • Windows, AMD. The test suite. More than one or two runs per variant. Which dispatch or draw is still running at the hang.

AI use

  • Claude Code (Claude Opus 5.5) built the trees, ran the runs and wrote this comment from the logs; checked by me.

@Arvi23

Arvi23 commented Nov 24, 2026

Copy link
Copy Markdown

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

  • main e50836b + this PR + the CopyFromSubresource fix from XG: fix CopyFromSubresource 7-argument ABI and guard destination span #684 + a local switch, XCL_PSO_NO_WAIT=1. With the switch, pso_async::resolve_wait returns resolve(pso) (the stand-in) instead of waiting. The switch is not part of this PR.
  • cargo build --release, env XCL_PSO_NO_WAIT=1, XCL_NETWORK=0
  • RX 9070 XT 16 GB (driver 26.11.2), Ryzen 7 5800X3D, 32 GB, Windows 10 IoT Enterprise LTSC 2021 (19044)

What happened

  • Reached the title screen; audio played and the intro cinematic started. 1558 presents.
  • From 71.8 s, pipelines still being built were skipped. The warnings stop after 4, but the counters show the scale. From 72.0 s to 88.3 s:
    • translated draws: 521 ran, 20 869 skipped
    • dispatches: 8 191 ran, 34 107 skipped
  • From 90.84 s: 50 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.
  • 91.72 s: 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 reached REACHED. 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.txt has the world's pipelines (1191 keys), to see whether fewer skips also means no hang.

Not tested

  • This PR without the no-wait switch on this title (the world isn't reached without it in my runs; it stalls on pipeline waits).
  • Other GPUs.

Log analysis written with Claude Code (Claude Opus 5.5); the run and the numbers are from my machine.

@Abuudiii

Copy link
Copy Markdown
Author

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 beaa245 and are available as focused changes:

  • Ordinary copy before an external Wait64: the prefix readback timed out on main before the external counter advanced. The prefix/suffix regression, tracked split and legacy batch split passed with the fix on RX 9070 / GE-Proton. The GPU run used a disposable native-list adapter, not included in the branch.
  • Deferred 64-bit producer write: main published the progress word while its producer fence was still pending. All three producer tests passed with the fix, including independent progress on a second queue.

Native Windows and paired retail smokes remain unverified at both new heads. Implementation and local verification used omp (GPT-6.2 Sol).

wondercrash pushed a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
Do not publish a CPU-visible 64-bit progress value when its GPU fence has not reached the submission. Keep the timed-out progress write and its suffix ordered on the originating queue’s worker; other queues can still publish.
On base beaa245 the real-fence regression observed 0x123456789abcdef0 before fence completion. With the fix, three deferred-write tests pass on RX 9070 / GE-Proton, including the independently completing second queue. Native Windows and a retail smoke pair were not run.
Refs: xcl-dev#708
Assisted-by: omp (GPT-6.2 Sol)
wondercrash pushed a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
Reuse the tracked-write split for eligible Wait64 comparisons after ordinary recorded work. Leave leading waits unsplit and untracked counters on the existing bounded CPU fallback. Keep upstream fence bridging and cycle handling intact.
The ordinary prefix readback times out before the producer advances on beaa245. With the fix, the prefix and suffix readback test, tracked split/spare reuse test, and legacy batch split test pass on RX 9070 / GE-Proton. The disposable native-list adapter used for vkd3d is not part of this commit.
Refs: xcl-dev#708
Assisted-by: omp (GPT-6.2 Sol)
wondercrash pushed a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
… split

xcl-dev#708 predates xcl-dev#795 (GPU-fence bridge) and xcl-dev#797 (mid-list split) and was
not rebased. Resolution keeps main's split machinery (xcl-dev#797 + xcl-dev#851) and
cpu_writes from xcl-dev#850 (the xcl-dev#708 per-queue workers with xcl-dev#873's
diagnostics), and ports xcl-dev#708's core change onto it:

- wait_gate.rs (from xcl-dev#708): a queue-side gate the CPU opens once it
  sees the progress value.
- PendingWait::gate: a Wait64 GE, full mask, on a non-sparse value the
  CPU can read, in a direct/compute title list, that starts its PC
  segment (split by xcl-dev#797/xcl-dev#851, or nothing recorded before it).
- execute_with_waits_on / KickoffX: gated waits arm a wait_gate instead
  of the xcl-dev#795 GPU-fence bridge; with sparse writes at or after the list
  in the batch they take the bounded CPU wait (xcl-dev#708's rule). Other waits
  keep the xcl-dev#795 bridge. Arming failure stops the title (xcl-dev#708).
- Dropped from xcl-dev#708: its own title_list piece/split machinery,
  split_recording, restore_after_reopen, open-query / split-barrier
  tracking and the Result-returning execute_with_waits.
- wait_tests.rs (from xcl-dev#708) adapted to push_segments /
  execute_with_waits_on.
@upipibi upipibi mentioned this pull request Nov 24, 2026
@raylitebull

Copy link
Copy Markdown
Member

Closing as superseded by #795 and #797 (both already merged into main), as noted in the thread.

wondercrash added a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
After a submission with GPU writes into sparse windows, the sparse queue waited for the
title queue and the submitting thread waited for the copy, up to 5 s per flush with the
sparse lock held. On a queue still held by a gate that is a stall until the gate's
release: the thread cannot submit the producer, and every title queue waits for the
sparse queue in before_execute. The rule from xcl-dev#708 only covered sparse lists at or after
the gated one in the same call. Two cases were left:

- KickoffX of a split list: a gate armed for an earlier segment was followed by the
  active segment's readback. The active segment's sparse flag now reaches the earlier
  segments' waits (execute_with_waits_before), which keep the bounded CPU wait.
- A later submission to a queue whose gate is still closed. wait_gate now counts the
  gates the CPU has not opened per queue (closed_on). For such a queue the copy back is
  recorded on the title queue itself, followed by a signal of a fence of its own, and a
  worker lands it in the CPU view once the GPU is there, in order (from xcl-dev#433, which does
  this for any queue with an unfinished wait). Later copies of that queue take the same
  way until the earlier ones landed. Other queues keep the synchronous readback.

A CPU read right after the title's own fence can see the old bytes of such a copy until
the worker lands it; before, the call stalled there instead.

Found in review (integ-review.md W2). Not run.

Assisted-by: omp (Claude Opus 5.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.