Skip to content

DirectStorage: wait briefly for late destination pages - #1464

Draft
sh00kapic wants to merge 1 commit into
xcl-dev:mainfrom
sh00kapic:fix/dstorage-late-pages
Draft

sh00kapic wants to merge 1 commit into
xcl-dev:mainfrom
sh00kapic:fix/dstorage-late-pages

Conversation

@sh00kapic

@sh00kapic sh00kapic commented Nov 24, 2026 •

Copy link
Copy Markdown

Part of #505. During the retail title streaming, a destination physical-page list was still zero when a submitted DirectStorage request reached its worker. A diagnostic reread found a valid page in the same slot 50 ms later. The worker currently reports E_ACCESS_VIOLATION immediately, after which the title receives many failed requests and stops presenting.

This complements #1405: that PR handles stale nonzero page numbers between enqueue and execution; this PR gives zero entries a bounded chance to appear after execution begins.

What is in it

  • crates/xcl/src/hle/dstorage.rs: retry only zero destination page entries for up to 50 ms, using read_own, and retain nonzero numbers snapshotted at enqueue. A focused test checks a late entry and preservation of a saved entry.

Tested

  • Windows, NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 9 9950X3D, Rust 1.94.1; debug workspace tests and release build.
  • cargo build --workspace; cargo test --workspace -- --test-threads=4: 771 passed, 0 failed, 41 ignored. Two GPU tests reported SKIPPED because this adapter has no wave64.
  • On a local branch combining this commit with the open compact shader and pipeline wait work, a guarded retail title run without this change logged 268 failed DirectStorage requests by 56 s. A run with this change logged zero failures and continued presenting through 68 s. Both runs used automatic Space input. The latter was stopped at 71 s because Windows commit headroom fell below 0.35 GB. After increasing the page file to 64 GB minimum / 96 GB maximum and rebooting, two further composite-build runs continued for about 10 and 12 minutes with zero DirectStorage failures and ample commit headroom. Their world load stayed at 0 FPS while the NVIDIA driver compiled compute pipelines; full gameplay remains unverified. These longer runs were not on this PR's standalone tree.

Regression run

Both 20 s smoke runs stop before the late page case and used XCL_PSO_PRELOAD=0.

Main:

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: NVIDIA GeForce RTX 5070 Ti
title: c3cd08c0
seconds: 20
exit: 0x0
frames shown: 432 (PresentX 432)
presents per 2 s (last 3): 60 60 58
device removals: 0
crashes: 0
peak commit: 14667 MB

PR head:

xcl-smoke v1
commit: 3b7d329aed7491d004e22da6934113b582cd6a4d
gpu: NVIDIA GeForce RTX 5070 Ti
title: c3cd08c0
seconds: 20
exit: 0x0
frames shown: 428 (PresentX 428)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14625 MB

Not tested

AI use

  • Codex with GPT-6 wrote the code, test, commit, and PR description; I reviewed the diff and ran the commands above.

During GTA VI streaming, a destination page table can still contain zero when the worker reaches a submitted request. The title filled one observed entry 50 ms later; without a retry, XCL refused hundreds of subsequent requests with E_ACCESS_VIOLATION and loading stopped presenting.

Recheck only zero entries for up to 50 ms before writing. Preserve nonzero page numbers captured at enqueue, since callers can reuse a stack array. A guarded run with this change had zero DirectStorage failures and kept presenting through 68 s; the machine then approached its commit limit.

Assisted-by: Codex (GPT-6)
@crosettiremi

Copy link
Copy Markdown

Windows RX 7900 XT hardware comparison at 3b7d329, with the same downstream XCL stack, same saved Series X profile, separate copies of the same starting DXIL/PSO cache, and the same scripted Player1 selection. All 15 DirectStorage module tests passed.

60–150 s, summed two-second activity counters Without #1464 With #1464
Requests 55,937 46,848
Failed 2,061 (3.68%) 6 (0.013%)
Peak failures in a single window 2,053 6

The individual warnings are rate-limited; the control printed only two failed-request warnings in its entire log. The candidate still logged a 64 KiB asset request returning 0x89240009. One run per build, with different request totals.

The candidate last presented in the sample ending at 194.1 s, then reported device removal (0x887a0006) at 196.3 s. DRED reported a page fault, and the next breadcrumb on a partly executed list was Dispatch. The control instead ended on a guest breakpoint after 248 s. The candidate’s last captured image was dark; I could not verify visible gameplay. The reduction in failed requests did not eliminate the later GPU fault on this stack.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@Dezmonius

Copy link
Copy Markdown

Independent test of the #1464 patch (head 3b7d329a) applied cleanly to 689f2db4. Both builds also had the same local, logging-only DirectStorage probes, capped at 32 events per process. RTX 5070, NVIDIA 610.88, i7-7700K, 32 GiB RAM, Windows 10 build 19045, extra fixed 24 GiB page file on NVMe, Rust 1.100.0 release. Both runs used the same starting profile, scripted A presses, offline settings, direct DXIL, two DXC threads, PSO preload off, and the same reused cache. The patched run went second, so cache state and timing could differ.

420 s run Requests in activity samples Failed requests PresentX calls Lowest system commit headroom
Logging-only control 86,282 493 847 23.20 GiB
With #1464 87,712 4 856 23.03 GiB

All 32 sampled control errors and all four patched errors were file-backed requests that still had all-zero destination page IDs when the physical write was attempted. Both runs reached the world-loading artwork and ended at the configured timeout with exit 0. Neither resumed presenting after the artwork (118 vs 119 consecutive two-second samples with 0 presents). No device removal or guest exception was logged. This is one pair of runs. It shows fewer DirectStorage failures here, with the later presentation stall still present.

Focused synthetic tests: cargo test --locked --offline -j 4 -p xcl --lib hle::dstorage::tests -- --test-threads=1: control 17 passed, patched 18 passed, zero failed or ignored in both. Full suite was not run. Only aggregate telemetry is included. OpenAI Codex (GPT-6) assisted with local instrumentation, testing and this report.

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.

5 participants