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.

@Dezmonius

Copy link
Copy Markdown

Follow-up on unmodified upstream cbc296ab65a2661a61e3e2da109134bcd5319f60 (same RTX 5070 / 610.88, offline, direct DXIL, two DXC threads, PSO preload off, 32 GiB RAM and 24 GiB extra SSD page file). The old #1464 diff no longer passes git apply --check against this main in dstorage.rs around the destination-page reread. I tested the upstream archive as-is.

  • First run, fresh XCL cache: 74 DirectStorage failures across 66,138 sampled requests, followed by DXGI_ERROR_DEVICE_RESET (0x887a0007) at 162 s. Minimum available physical memory and commit headroom were 15.93 GiB and 29.26 GiB.
  • Repeat using that cache with XCL_DRED=1: 1,975 failures across 87,954 sampled requests. The first failure records were 0x89240009. World-loading artwork was the last visible checkpoint, with 857 PresentX calls and 56 trailing two-second intervals at zero presents. This run ended at its 300 s timeout, exit 0, without another device reset.

The runs differ in cache state and DRED, so this is not a controlled GPU-reset comparison. The repeat confirms this DirectStorage error still occurs on the newer main. No game data included. AI-assisted (OpenAI Codex, GPT-6).

@Dezmonius

Copy link
Copy Markdown

I tested a local adaptation of #1464 on cbc296ab. It keeps #476's fault-safe read_own for every reread, preserves nonzero entries from the enqueue snapshot, and returns E_ACCESS_VIOLATION on an unreadable table or if zeros remain after the 50 ms wait. No upstream code or PR was changed.

300 s offline run (RTX 5070, NVIDIA 610.88) Activity-sampled requests Failures PresentX calls Trailing 0-present samples
Unmodified cbc296ab 87,954 1,975 857 56
Local late-page wait 86,836 4 826 57

Same DRED, direct DXIL, scripted A presses, starting profile and reused XCL cache location. These were separate runs, with the adapted build going second, so cache state and request timing may differ. Both reached world-loading artwork and exited at the timer with code 0. The adapted run still logged 0x89240009 and did not resume presenting. Minimum system commit headroom was 24.19 GiB in the adapted run.

Focused validation on Rust 1.100.0 (Windows x64): cargo test --locked --offline -j 4 -p xcl --lib hle::dstorage:: -- --test-threads=1: 31 passed, 0 failed, 0 ignored, including the existing test of an unreadable deferred table and the late-page test from this PR. Full suite was not run. No game data included. AI-assisted (OpenAI Codex, GPT-6).

@Dezmonius

Copy link
Copy Markdown

Warm-cache control after the local #1464 adaptation test above. I switched back to unmodified cbc296ab and kept the same 300 s limit, RTX 5070 / 610.88, offline/DRED settings, startup profile, scripted input and cache location. In run order the sampled failure counts were 1,975 on upstream, 4 with the adapted late-page wait, then 952 back on upstream. The last control logged 0x89240009, 87,232 sampled requests, 825 PresentX calls and 58 trailing two-second samples at zero presents. It ended at the timer with exit 0.

The failure count varies between upstream runs, but the high count returned even after the patched run warmed the same cache. All three runs still stopped presenting at world loading. No game data included. AI-assisted (OpenAI Codex, GPT-6).

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