DirectStorage: wait briefly for late destination pages #1454

Open
sh00kapic wants to merge 1 commit from upstream-pr/1464 into main
sh00kapic commented 2026-11-24 16:30:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by sh00kapic on 2026-11-24T16:30:14Z.


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

  • Full retail title gameplay after loading: post-reboot runs remained at 0 FPS while compute pipelines compiled for over 10 minutes. AMD GPUs and wave64 hardware. Interaction with #1405 requires a rebase if either PR lands first.

AI use

  • Codex with GPT-6 wrote the code, test, commit, and PR description; I reviewed the diff and ran the commands above.
<!-- greyfinch-sync:ivall/xcl:issue:5476203887 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1464). Originally posted by [sh00kapic](https://github.com/sh00kapic) on 2026-11-24T16:30:14Z. --- 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** - Full retail title gameplay after loading: post-reboot runs remained at 0 FPS while compute pipelines compiled for over 10 minutes. AMD GPUs and wave64 hardware. Interaction with #1405 requires a rebase if either PR lands first. **AI use** - Codex with GPT-6 wrote the code, test, commit, and PR description; I reviewed the diff and ran the commands above.
crosettiremi commented 2026-11-24 17:06:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by crosettiremi on 2026-11-24T16:45:23Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7138157827 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1464#issuecomment-7138157827). Originally posted by [crosettiremi](https://github.com/crosettiremi) on 2026-11-24T16:45:23Z. --- 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 commented 2026-11-24 19:07:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:53:00Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7141285223 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1464#issuecomment-7141285223). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T18:53:00Z. --- 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 commented 2026-11-25 00:08:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Dezmonius on 2026-11-24T23:34:59Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7147563580 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1464#issuecomment-7147563580). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-24T23:34:59Z. --- 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 commented 2026-11-25 04:10:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Dezmonius on 2026-11-25T04:05:37Z.


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).

<!-- greyfinch-sync:ivall/xcl:comment:7152522192 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1464#issuecomment-7152522192). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-25T04:05:37Z. --- 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 commented 2026-11-25 05:08:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Dezmonius on 2026-11-25T04:47:37Z.


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).

<!-- greyfinch-sync:ivall/xcl:comment:7153168847 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1464#issuecomment-7153168847). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-25T04:47:37Z. --- 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 commented 2026-11-25 05:08:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Dezmonius on 2026-11-25T05:00:28Z.


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).

<!-- greyfinch-sync:ivall/xcl:comment:7153362385 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1464#issuecomment-7153362385). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-25T05:00:28Z. --- 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).
Foniass commented 2026-12-01 05:51:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:51:10Z.


Triage (#1607) – head 3b7d329

Same problem as #549 (page-array entries still 0 when a request runs), solved differently: #549 refills them at the title's Submit and holds a half-full queue, this one polls the title's array on the worker for up to 50 ms. Main (#1405 and later) rereads the array once at execution but does not wait.
In dstorage.rs:destination_pages_when_ready every request with a 0 entry that never gets filled now costs its worker 50 ms of sleep, which queues behind it on the same worker. Main also has a dest_on_stack case now, so the rebase should decide whether an array on the enqueuing thread's stack is polled.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302206696 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1464#issuecomment-7302206696). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:51:10Z. --- **Triage (#1607)** – head 3b7d329 Same problem as #549 (page-array entries still 0 when a request runs), solved differently: #549 refills them at the title's `Submit` and holds a half-full queue, this one polls the title's array on the worker for up to 50 ms. Main (#1405 and later) rereads the array once at execution but does not wait. In `dstorage.rs:destination_pages_when_ready` every request with a 0 entry that never gets filled now costs its worker 50 ms of sleep, which queues behind it on the same worker. Main also has a `dest_on_stack` case now, so the rebase should decide whether an array on the enqueuing thread's stack is polled. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1464:upstream-pr/1464'
git switch 'upstream-pr/1464'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1464'
git switch 'upstream-pr/1464'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1464'
git switch 'upstream-pr/1464'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1464'
git switch 'main'
git merge --squash 'upstream-pr/1464'
git switch 'main'
git merge --ff-only 'upstream-pr/1464'
git switch 'main'
git merge 'upstream-pr/1464'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1454
No description provided.