DirectStorage: wait up to 250 ms for a page list the title fills late #2336

Closed
JurajSimicevic wants to merge 1 commit from upstream-pr/2338 into main
JurajSimicevic commented 2026-11-25 11:01:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by JurajSimicevic on 2026-11-25T11:01:50Z.


Problem

A DirectStorage request into physical pages (PAGE_DESTINATION) whose page list still names page 0 is read again for 8 ms (#1726) and then fails with E_INVALIDARG. The title never looks at a request's result, so each failure is a model or texture left unwritten. #2181 sees untextured geometry after such a burst.

On a fast host the data is read and inflated before the title has filled the list, and 8 ms is not always enough. On this host (Windows 11, RTX 5080, NVMe), three world loads on main 940d32f, with the typed-UAV check of #1775/#1763 to boot, logged "a destination's physical pages could not be written; its request fails" 391, 45 and 24 times, each time in one burst while the world loads.

What the failed requests had in common (local diagnostics, not in this PR)

  • In all 40 failures logged in detail, the page list still named page 0 when the request failed, in full or in part. The other entries were pages the title holds. No page was freed, out of range or failing to map.
  • 24 lists were watched after their request had failed. Every one was filled 3 to 6.5 ms after the 8 ms ran out, and all the pages were ones the title holds. The data had been read and inflated; only the wait was too short.

Change

  • The list is read again for up to 250 ms (LATE_LIST_WAIT) instead of 8 tries of 1 ms. A list that still names page 0 after that fails as before.
  • The "written late" log line also says how long the read waited (waited_ms).
  • Tests: #1726's test is now a helper with two cases, the list filled 2 ms and 40 ms after the request starts. The 40 ms case fails with the 8 ms wait (E_INVALIDARG, -2147024809) and passes with this change.

crates/victory-hle/src/modules/dstorage.rs only, +26 −6.

Tested

  • cargo test -p victory-hle --locked: 144 passed.
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings, with and without --all-features: clean. No new rustfmt hunks.
  • In the title, with this change (two runs, RTX 5080, diag build):
run requests failed lists written late waited
1 0 none logged –
2 0 16 to 31 (the counter logs at powers of two) 5 to 6 ms

The limit, said plainly: in both runs the race either did not happen or ended within 8 ms, which the old wait also covers. So the in-title runs show that this changes nothing for the worse. The case it fixes, lists later than 8 ms, rests on the diagnostics above and on the test. The lateness varies between runs on the same machine (likely how warm the file cache is). A run on a fast host that logs the old warning on main and then written late with waited_ms over 8 here would settle it.

Notes

  • A worker waits for at most 250 ms per late request. In the measured bursts that is 3 to 15 ms per request.
  • Claim: #1633.

No game data attached: counts, timings and log lines only.

AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6602982793 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2338). Originally posted by [JurajSimicevic](https://github.com/JurajSimicevic) on 2026-11-25T11:01:50Z. --- ## Problem A DirectStorage request into physical pages (`PAGE_DESTINATION`) whose page list still names page 0 is read again for 8 ms (#1726) and then fails with `E_INVALIDARG`. The title never looks at a request's result, so each failure is a model or texture left unwritten. #2181 sees untextured geometry after such a burst. On a fast host the data is read and inflated before the title has filled the list, and 8 ms is not always enough. On this host (Windows 11, RTX 5080, NVMe), three world loads on `main` `940d32f`, with the typed-UAV check of #1775/#1763 to boot, logged "a destination's physical pages could not be written; its request fails" **391, 45 and 24 times**, each time in one burst while the world loads. ## What the failed requests had in common (local diagnostics, not in this PR) - In all 40 failures logged in detail, the page list still named page 0 when the request failed, in full or in part. The other entries were pages the title holds. No page was freed, out of range or failing to map. - 24 lists were watched after their request had failed. **Every one was filled 3 to 6.5 ms after the 8 ms ran out**, and all the pages were ones the title holds. The data had been read and inflated; only the wait was too short. ## Change - The list is read again for up to **250 ms** (`LATE_LIST_WAIT`) instead of 8 tries of 1 ms. A list that still names page 0 after that fails as before. - The "written late" log line also says how long the read waited (`waited_ms`). - Tests: #1726's test is now a helper with two cases, the list filled 2 ms and 40 ms after the request starts. The 40 ms case fails with the 8 ms wait (`E_INVALIDARG`, `-2147024809`) and passes with this change. `crates/victory-hle/src/modules/dstorage.rs` only, +26 −6. ## Tested - `cargo test -p victory-hle --locked`: 144 passed. - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`, with and without `--all-features`: clean. No new rustfmt hunks. - In the title, with this change (two runs, RTX 5080, diag build): | run | requests failed | lists written late | waited | |---|---|---|---| | 1 | 0 | none logged | – | | 2 | 0 | 16 to 31 (the counter logs at powers of two) | 5 to 6 ms | The limit, said plainly: in both runs the race either did not happen or ended within 8 ms, which the old wait also covers. So the in-title runs show that this changes nothing for the worse. The case it fixes, lists later than 8 ms, rests on the diagnostics above and on the test. The lateness varies between runs on the same machine (likely how warm the file cache is). A run on a fast host that logs the old warning on `main` and then `written late` with `waited_ms` over 8 here would settle it. ## Notes - A worker waits for at most 250 ms per late request. In the measured bursts that is 3 to 15 ms per request. - Claim: #1633. No game data attached: counts, timings and log lines only. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
catminou4 commented 2026-11-25 11:05:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T11:03:11Z.

Review: COMMENTED


Static review only: victory-hle is Windows-only; not tested on macOS. Replaces the fixed 8 ms retry loop with a 250 ms deadline for late DirectStorage page lists, motivated by observed 3-6.5 ms fill times — sensible; the waited_ms logging helps verify in the field.

<!-- greyfinch-sync:Marvisak/VIctory:review:6056393795 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2338#pullrequestreview-6056393795). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T11:03:11Z. **Review:** COMMENTED --- Static review only: victory-hle is Windows-only; not tested on macOS. Replaces the fixed 8 ms retry loop with a 250 ms deadline for late DirectStorage page lists, motivated by observed 3-6.5 ms fill times — sensible; the waited_ms logging helps verify in the field.
andrewpozdnakov7-jpg commented 2026-11-25 12:03:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T11:11:46Z.


Independent native Windows check on 77d5d1b. I copied only the two test cases onto 940d32f. The 2 ms case passed there and the 40 ms case returned E_INVALIDARG (0x80070057). Both tests passed five consecutive runs on the exact PR head, including the physical-page byte comparison. The full victory-hle library suite passed all 144 tests. The runs used synthetic requests and mapped pages.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7160721897 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2338#issuecomment-7160721897). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T11:11:46Z. --- Independent native Windows check on `77d5d1b`. I copied only the two test cases onto `940d32f`. The 2 ms case passed there and the 40 ms case returned `E_INVALIDARG` (`0x80070057`). Both tests passed five consecutive runs on the exact PR head, including the physical-page byte comparison. The full `victory-hle` library suite passed all 144 tests. The runs used synthetic requests and mapped pages.
JurajSimicevic commented 2026-11-25 13:02:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by JurajSimicevic on 2026-11-25T12:31:58Z.


In-title result with this PR's change: lists filled 62 to 84 ms late, all written

The PR said the in-title runs after the fix had not yet shown a list later than 8 ms. A longer run has now shown some.

Setup: RTX 5080, diag build of main 940d32f with this PR's commit (the same diff, cherry-picked), #1762, and #1968's program A skipped so the world keeps running. One run of 15 minutes, through the prologue into the first gameplay prompts.

  • written late lines: five, all in one burst while the world loaded. The counter logs at powers of two, so between 16 and 31 lists were filled late.
  • waited_ms on the logged ones: 62, 65, 68, 79, 84. The 8 ms wait on main would have failed every one of them with E_INVALIDARG.
  • a destination's physical pages could not be written: 0.

So the late lists are not limited to the 3 to 6.5 ms seen first. While the title loads they can trail the request by tens of milliseconds, and the 250 ms bound covers that with room to spare. The test's 40 ms case is still below what the title did here. I can raise it to 100 ms if you prefer a case above the longest wait seen.

No game data: log counts and timings only.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162501971 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2338#issuecomment-7162501971). Originally posted by [JurajSimicevic](https://github.com/JurajSimicevic) on 2026-11-25T12:31:58Z. --- **In-title result with this PR's change: lists filled 62 to 84 ms late, all written** The PR said the in-title runs after the fix had not yet shown a list later than 8 ms. A longer run has now shown some. Setup: RTX 5080, diag build of `main` `940d32f` with this PR's commit (the same diff, cherry-picked), #1762, and #1968's program A skipped so the world keeps running. One run of 15 minutes, through the prologue into the first gameplay prompts. - `written late` lines: five, all in one burst while the world loaded. The counter logs at powers of two, so between 16 and 31 lists were filled late. - `waited_ms` on the logged ones: 62, 65, 68, 79, 84. The 8 ms wait on `main` would have failed every one of them with `E_INVALIDARG`. - `a destination's physical pages could not be written`: 0. So the late lists are not limited to the 3 to 6.5 ms seen first. While the title loads they can trail the request by tens of milliseconds, and the 250 ms bound covers that with room to spare. The test's 40 ms case is still below what the title did here. I can raise it to 100 ms if you prefer a case above the longest wait seen. No game data: log counts and timings only. AI-assisted.
upstream-sync closed this pull request 2026-11-25 16:07:40 +00:00
Marvisak commented 2026-11-25 16:09:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:23:59Z.


Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-hle/src/modules/dstorage.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (merge-candidate) was for an older state of main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166781388 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2338#issuecomment-7166781388). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:23:59Z. --- <!-- victory-triage v1 head=77d5d1ba0f5dbb6d2c95c84f58e34be4688a77c9 verdict=needs-rebase at=2026-11-25T15:58:50Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-hle/src/modules/dstorage.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (merge-candidate) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
JurajSimicevic commented 2026-11-25 16:09:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by JurajSimicevic on 2026-11-25T16:02:56Z.


Closing this: eddde73 on main removes the cause instead of waiting it out. Reads into physical pages now wait for the title's Submit, which is where the title fills the page table. It measured 0 failed and 0 late writes after the change.

Our in-title numbers fit that explanation. The 62 to 84 ms lists in my comment above all came in one burst while the world loaded, which matches a queue that submits itself at half capacity before the title's Submit. A longer retry bound only matters if a list is still empty after Submit, and nothing here shows that. If it shows up later, it can come back as a small change on top of eddde73.

Thanks @andrewpozdnakov7-jpg and @catminou4 for checking it.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167546931 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2338#issuecomment-7167546931). Originally posted by [JurajSimicevic](https://github.com/JurajSimicevic) on 2026-11-25T16:02:56Z. --- Closing this: eddde73 on `main` removes the cause instead of waiting it out. Reads into physical pages now wait for the title's Submit, which is where the title fills the page table. It measured 0 failed and 0 late writes after the change. Our in-title numbers fit that explanation. The 62 to 84 ms lists in my comment above all came in one burst while the world loaded, which matches a queue that submits itself at half capacity before the title's Submit. A longer retry bound only matters if a list is still empty after Submit, and nothing here shows that. If it shows up later, it can come back as a small change on top of eddde73. Thanks @andrewpozdnakov7-jpg and @catminou4 for checking it. AI-assisted.

Pull request closed

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
Marvisak/VIctory!2336
No description provided.