Skip to content

D3D12.X: keep ordinary GPU work ahead of a recorded Wait64 - #851

Open
Abuudiii wants to merge 1 commit into
xcl-dev:mainfrom
Abuudiii:xcl-external-wait-order
Open

Abuudiii wants to merge 1 commit into
xcl-dev:mainfrom
Abuudiii:xcl-external-wait-order

Conversation

@Abuudiii

@Abuudiii Abuudiii commented Nov 24, 2026 •

Copy link
Copy Markdown

Follow-up to #708. A wrapped list can record ordinary GPU work before an eligible Wait64BitValueX even when it has no tracked Write64 signal. Reuse the existing list split so that work can run before the wait. This leaves the upstream GPU-fence bridge and the bounded CPU fallback for untracked counters in place.

What is in it

  • Track recorded work on the active title-list segment and reuse the existing split for eligible >= waits. Leading waits stay unsplit.
  • A synthetic GPU regression checks the prefix readback before the external counter advances, then checks that the suffix was held and completes after release.

Tested

  • Local: Core i9-12900K, RX 9070 / RADV 26.2.5, GE-Proton 11-7 / vkd3d-proton 3.1, Rust 1.99.1 Windows GNU, debug. The synthetic prefix timed out on beaa245 before the counter advanced. With the patch, the copy-order, tracked split/spare reuse, and legacy batch-split tests passed: 3 passed, 0 failed, 0 ignored, no skips. The GPU runs used a disposable native-list vtable adapter that is not part of this PR.
  • Independent native Windows integration: Windows 11 build 26300, RTX 5080 (610.88), Core Ultra 7 265, release, with both changed Rust files matching 4bf6d607b5 byte for byte. The same three tests passed individually with --nocapture --test-threads=1. The copy reached readback before the external counter advanced.
  • Independent AMD / Windows report: Ryzen 7 9800X3D, RX 9070 XT (32.0.32015.16001), Rust 1.100.0, Windows 11. With this head merged onto 1ec4c98, cargo test --workspace -- --test-threads=4 reported 714 passed, 0 failed, 41 ignored; all three focused wait and copy tests passed on native D3D12.

Regression run
Independent native Windows smoke pair. The workspace integration result above is separate from the two exact-commit builds below.

Main (beaa245):

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

PR (4bf6d60):

xcl-smoke v1
commit: 4bf6d607b5e65dcb760bd1eb39248b716620e3fc
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1661 (PresentX 1661)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14857 MB

Not tested

  • Gameplay beyond the menus. The smoke pair checks the boot/menu path, not world rendering. The full native workspace result above is for the integration with 1ec4c98, not the bare PR head.

AI use

  • omp (GPT-6.2 Sol) implemented the change, ran the local Proton checks, and updated this description. The linked native Windows results were reported independently.

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)
@badoomtch

badoomtch commented Nov 24, 2026 •

Copy link
Copy Markdown

Clean 60-second Windows smoke pair

The clean main release and the exact PR head both exited normally. I used the same unnamed retail title and RTX 5080, fresh title state each time, and each checkout’s unmodified scripts/smoke.ps1. The scripts were byte-identical. A local launcher ran each binary in a network-isolated Windows AppContainer and passed the native exit status and log back to the script. The clean main block is the same control run used for #850 earlier in this session.

Main

xcl-smoke v1
commit: 1ec4c98cda119432a4b3f205e146fba2d6f8379a
gpu: NVIDIA GeForce RTX 5080
title: ScarlettGame
seconds: 60
exit: 0x0
frames shown: 196 (PresentX 196)
presents per 2 s (last 3): 10 10 11
device removals: 0
crashes: 0
peak commit: 15081 MB

Exact PR head

xcl-smoke v1
commit: 4bf6d607b5e65dcb760bd1eb39248b716620e3fc
gpu: NVIDIA GeForce RTX 5080
title: ScarlettGame
seconds: 60
exit: 0x0
frames shown: 231 (PresentX 231)
presents per 2 s (last 3): 11 10 11
device removals: 0
crashes: 0
peak commit: 15113 MB

Native Windows result for 4bf6d607b5e65dcb760bd1eb39248b716620e3fc. Both changed Rust files matched that head byte for byte in the local integration. Windows 11 build 26300, RTX 5080 (610.88), Core Ultra 7 265, release build.

ordinary_copy_runs_before_wait64_for_late_external_value passed on D3D12. The ordinary copy reached readback while the later wait was still pending. mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares and execute_with_waits_splits_batches_before_unsatisfied_list also passed. Each test ran individually with --nocapture --test-threads=1.

I also compared one offline retail run per arm on the same beaa245-based integration. The control was 81d73215, the local build with this change was 8a0eaaa8. Both used the same returning profile, learned 4,095 MiB coherent window and shared cache. The second run could reuse additional cache entries.

Control With #851
Title presents 1,450 1,409
Mid-list splits logged 1 2
GPU wait bridges logged 5 3
Wait64BitValueX timeout messages 0 0
First ListX slot 101 call to title abort 30.949 s 31.617 s

Both runs showed the loading illustration, faded to black and ended at the same title abort. Neither produced a verified world frame. The per-list split message does not identify which prefix caused the split in the retail run. The isolated readback test establishes the ordering change directly.

AI use: Codex (GPT-6) built the integration, ran the Windows tests and comparison, checked the logs and drafted this report.

@Abuudiii

Copy link
Copy Markdown
Author

Verification status for 4bf6d607b5:

  • The native Windows D3D12 report confirms the ordinary copy reached readback before the external counter advanced. The tracked split/spare reuse and legacy batch-split tests also passed, with both changed Rust files matching the PR head. Our earlier RX 9070 / Proton checks passed the same three tests with the temporary native-list adapter; that adapter is not part of the PR.
  • The retail comparison was run on integration builds. Both runs ended at the same title abort, with no verified world frame. It is useful context, not a clean main / exact-head smoke pair or a gameplay claim.
  • The description check is still missing the two xcl-smoke blocks (clean main and exact PR head, same title and duration). The separate hosted Windows workflow requires approval and has started zero jobs.

AI use: omp (GPT-6.2 Sol) implemented the change, ran the local Proton checks, and drafted this update.

@SlopTart

Copy link
Copy Markdown

Linux / AMD RDNA3 datapoint.

Merged state: head 4bf6d60 onto main beaa245, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 704 passed, 10 failed, 41 ignored. Failures are the known Wine-lane set from my #42 rows plus #718 trio members; nothing here fails because of your change. Wait64 ordering tests green; no new failures against the known Wine-lane set.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…#851, ivall#864, ivall#875-ivall#876 and Wine raw fences

Integrate clean upstream PRs on top of upstream/main (1ec4c98):
- ivall#849: direct move_away for remapped physical pages (avoids 4x sparse tile-mapping round-trips)
- ivall#838: FillMemoryWith*BitValueX uses list upload arena instead of leaked pattern buffers
- ivall#840: merge released ranges of the shared descriptor heap
- ivall#839: map queue-specific D3D12_BARRIER_LAYOUT values to legacy resource states
- ivall#841: preserve due frame-clock events when schedule changes at deadline
- ivall#851: split wrapped command lists before Wait64 GE after ordinary GPU work
- ivall#864: export XMemIsToolsMemAvailable returning 0 on retail
- ivall#875: tbuffer_load_format_* uses identity DST_SEL instead of V# DST_SEL
- ivall#876: implement IDXGIDevice2::EnqueueSetEvent

Also add real::create_raw_fence for internal fences (late_release and EnqueueSetEvent) so Wine/vkd3d-proton never receives a FenceProxy on unadopted internal queues or SetEventOnMultipleFenceCompletion, and wrap list_x test exec with UnadoptGuard.

Assisted-by: Antigravity (Google DeepMind)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
… Linux PRs ivall#867/ivall#871/ivall#877

Update fork README for upstream/main 1ec4c98 (fenced late_release and queue-wait diagnostics), newly integrated PRs (ivall#838-ivall#841, ivall#849, ivall#851, ivall#864, ivall#875, ivall#876), live gameplay audio progress, and our three open upstream Linux PRs (ivall#867, ivall#871, ivall#877).

Assisted-by: Antigravity (Google DeepMind)
@eizispark

eizispark commented Nov 24, 2026 •

Copy link
Copy Markdown

Hardware check of 4bf6d607b5e65dcb760bd1eb39248b716620e3fc (verified clean merge with main 1ec4c98): pass.

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: 714 passed, 0 failed, 41 ignored (GPU tests skipped on this adapter: none)
  • ordinary_copy_runs_before_wait64_for_late_external_value, mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares, execute_with_waits_splits_batches_before_unsatisfied_list: 3 passed, 0 failed on native Windows D3D12

Regression run
main (beaa245):

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

PR (4bf6d60):

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

Not tested

  • wave32-only GPUs (NVIDIA / Intel); 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.

@juliptree

Copy link
Copy Markdown

Independent native Windows D3D12 validation on an RTX 5060 Ti, NVIDIA driver 616.92. Each test process verified the adapter from its actual D3D12 device. I ran the same synthetic Wait64 fixture three times per revision.

  • Base beaa245: 0/3 passed. The copy recorded before the wait missed the fixture’s 1,000 ms deadline. The second copy completed after the wait was released.
  • PR head 4bf6d60: 3/3 passed. The first copy completed before release. The second stayed pending until release, then returned the expected bytes.
    No skips or 20-second process timeouts. Both revisions used the same test-only diagnostics. Production code was unchanged. Synthetic fixtures only. AI-assisted validation and write-up by Codex.

wondercrash pushed a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
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.
@Prime1997

Copy link
Copy Markdown
Contributor

RTX 3060 Ti 8 GB · ordinary copy before Wait64

We reproduced the ordering problem on Windows 11 build 26200, NVIDIA driver 617.14, i5-10400, Rust 1.100.0. We used our #891 + #934 integration as the baseline, then applied Abuudiii’s runtime change at 4bf6d607. Both arms used the PR’s regression with the same extra logging to identify the physical adapter and readback values. Baseline source · PR revision tested

Native D3D12 test Baseline With this PR
Ordinary copy before a wait on an external value 0/3 passed. All three timed out at 1,000 ms. 3/3 passed. All three read 0x0102030405060708 before release.
Existing mid-list Write64 and batch-splitting controls 2/2 passed 2/2 passed

On all three runs with the fix, the copy after the wait stayed pending for the 100 ms check, then returned 0xa1b2c3d4e5f60798 after release. We built each fixture with cargo test --offline --locked --release -p xcl --lib ordinary_copy_runs_before_wait64_for_late_external_value --no-run -j2 and ran each test serially with --exact --nocapture --test-threads=1. All ten test invocations ran their bodies.

Retail coverage. A clean local build with this PR (ba3cfc7, Series S, 50 ms shader wait, preload off) reached a readable Account Picker and exited cleanly after a 90-second no-input check. We haven’t tested the player-controlled prologue on this build or run its full suite. The prior build showed loading art and audio before the intro streaming watchdog fired. This fixture exercises copy ordering. The cause of the retail stall is still open.

AI use — OpenAI Codex (GPT-6) prepared the comparison, ran the tests and helped write this report.

I use a temporary Discord to coordinate my work. Anyone helping test XCL or compare results is welcome. Test coordination on Discord

@throny

throny commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Two world-loading runs of 4bf6d60 on an RTX 4080 with XCL_PSO_WAIT_MS=50, against two runs of main with the same settings. No improvement on this machine: the GPU waits still time out and the title's watchdog ends both runs earlier than on main.

Tested

  • Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 4080 16 GB (driver 610.88, 32-lane waves), Intel i9-12900K, 64 GB; Rust 1.100.0 stable-x86_64-pc-windows-msvc; release. 4bf6d60 merged onto main 47efa2e (clean merge); the main runs are on 384f7f7.
  • xcl run <folder> with XCL_NETWORK=0, XCL_ACTIVITY=1, XCL_PSO_WAIT_MS=50, XCL_PRESS_AT for the profile prompt, 420 s limit, warm DXIL and driver-blob caches. Retail title 1.0.2.1.
this PR, run 1 this PR, run 2 main, run 1 main, run 2
last present 102 s 128 s 132 s 114 s
presents after 82 s 2 9 24 20
GPU queue.Wait … did not complete within 5000 ms 30, from 106.2 s 61, from 117.0 s 78, from 122.3 s 29, from 112.4 s
end watchdog at 131.9 s watchdog at 156.1 s my memory guard at ~134 s watchdog at 170.0 s
draws / dispatches skipped 1 310 / 64 8 192 / 346 12 899 / 2 048 6 922 / 333
peak commit 31.2 GB 32.8 GB 33.9 GB 32.7 GB
  • No device removal in any run. Run 1 of this PR did not exit after the watchdog's exception and was killed by my runner's timeout (I have seen that on main builds too).
  • With two runs each the difference in the end time is within what I see between runs of one build, so I read this as "no visible effect here", not as a regression.

Not tested

  • More than two runs; the test suite on this head; AMD; without XCL_PSO_WAIT_MS.

AI use

  • Claude Code (Claude Fable 5.2) read the diff, built the tree, ran the title and wrote this report. Counts and XCL's own log text only.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
, ivall#875-ivall#876

Re-apply the 8 non-merged upstream PRs from our previous fork main onto upstream/main (930e8b4): ivall#838 (upload-arena fills), ivall#839 (queue-specific barrier layouts), ivall#840 (coalesced shared descriptor heap), ivall#841 (frame clock deadline reschedule), ivall#851 (split before Wait64 GE after ordinary work), ivall#864 (XMemIsToolsMemAvailable), ivall#875 (tbuffer_load_format identity DST_SEL), and ivall#876 (IDXGIDevice2::EnqueueSetEvent with create_raw_fence).

Assisted-by: Antigravity (Google DeepMind)
@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@JJAutoCompare

Copy link
Copy Markdown

Empirical test report (4bf6d60)

Verified PR #851 at commit 4bf6d60.

Hardware / environment

  • Windows NT 10.0.26200.0 x64, AMD CPU (Family 23, Model 113). The run held the machine's Arc A770 test lock and set XCL_ADAPTER=A770. The fixture calls D3D12CreateDevice with a null adapter, so Windows selects the default device and the fixture emits no adapter name or driver version.
  • Rust 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5 (01b62ad47), Cargo test profile with debug info and incremental compilation disabled.

Commands and results

  • cargo test --workspace --no-run outside Invoke-ArcTest.ps1. Exit code 0. The build produced the library test executable used below.
  • xcl-77aca8ccb20e299f.exe --exact hle::d3d12x::list_x::tests::ordinary_copy_runs_before_wait64_for_late_external_value inside Invoke-ArcTest.ps1 with RUST_TEST_NOCAPTURE=1. Exit code 0. Libtest reported 1 passed, 0 failed, and 0 ignored. The log contained 0 SKIPPED markers. 1 fixture ran and passed.

Observed behavior

The ordinary prefix copy completed and returned the expected first word before the external counter advanced. The suffix completion fence timed out during the fixture's 100 ms pre-release check. After the producer advanced the counter, the suffix completed and returned the expected second word. The leading Wait64 assertion passed, and XCL logged one direct command-list split at the recorded memory wait.

Not tested

The full GPU workspace suite and game smoke runs were omitted. Execution covered the PR's new regression fixture.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr851-focused.log and published.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants