Keep unstaged DirectStorage reads moving under staging pressure #1187

Closed
github-bot wants to merge 1 commit from gh-pr/1187/head into gh-pr/1187/base
Owner

@⁠Jitheswar on GitHub · 2026-11-24 16:22 UTC · original
directstorage-unstaged-reads → main · +80 −17 · 1 files · 1 commits · closed without merging

The DirectStorage scheduler starts reads in fair order: the class with the least virtual time, then its lane with the fewest bytes started. When the read at the head needed more staging than was free, start returned nothing. Every other queued read then waited too, including reads that need no staging at all (uncompressed reads, and reads from memory sources). One large compressed read could stall unrelated raw reads until staging drained.

What changes

  • start still picks the next read in scheduler order. If that read must wait for staging, it now looks for the next read in the same order that needs no staging and starts that instead. The waiting read keeps first claim on staging: nothing else that needs staging can start ahead of it.
  • Starting an unstaged read out of order can step past an older virtual time, so the class and lane clocks now only move forward (max), and newly active queues don't inherit an earlier time.

Tests (synthetic):

  • staging_wait_does_not_block_an_independent_raw_read: a queue whose staged read is waiting for space still lets another queue's raw read start. A second staged read doesn't jump ahead of the waiting one. When the first read finishes, the waiting read starts and the clock doesn't move backwards.
  • oversized_buffered_read_can_run_alongside_an_unstaged_read: a read larger than the whole staging buffer runs alone in staging, while a memory-source read alongside it uses none.

victory-hle tests for the Windows target under Proton 11, merged onto 940d32f: 143 passed / 2 failed. Plain 940d32f gives 141 / 2 with the same two failures (only_loopback_is_reachable and a_kept_blob_past_the_link_limit_is_copied, both Wine-host gaps); this PR adds the 2 new tests above. Windows-target clippy is clean. Not run in the game for this change specifically. Merges cleanly onto 940d32f.

AI-assisted (Claude Code, Codex).

🤖 Generated with Claude Code

**@⁠Jitheswar** on GitHub · 2026-11-24 16:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1187) `directstorage-unstaged-reads` → `main` · +80 −17 · 1 files · 1 commits · closed without merging The DirectStorage scheduler starts reads in fair order: the class with the least virtual time, then its lane with the fewest bytes started. When the read at the head needed more staging than was free, `start` returned nothing. Every other queued read then waited too, including reads that need no staging at all (uncompressed reads, and reads from memory sources). One large compressed read could stall unrelated raw reads until staging drained. **What changes** - `start` still picks the next read in scheduler order. If that read must wait for staging, it now looks for the next read in the same order that needs no staging and starts that instead. The waiting read keeps first claim on staging: nothing else that needs staging can start ahead of it. - Starting an unstaged read out of order can step past an older virtual time, so the class and lane clocks now only move forward (`max`), and newly active queues don't inherit an earlier time. **Tests (synthetic):** - `staging_wait_does_not_block_an_independent_raw_read`: a queue whose staged read is waiting for space still lets another queue's raw read start. A second staged read doesn't jump ahead of the waiting one. When the first read finishes, the waiting read starts and the clock doesn't move backwards. - `oversized_buffered_read_can_run_alongside_an_unstaged_read`: a read larger than the whole staging buffer runs alone in staging, while a memory-source read alongside it uses none. `victory-hle` tests for the Windows target under Proton 11, merged onto `940d32f`: 143 passed / 2 failed. Plain `940d32f` gives 141 / 2 with the same two failures (`only_loopback_is_reachable` and `a_kept_blob_past_the_link_limit_is_copied`, both Wine-host gaps); this PR adds the 2 new tests above. Windows-target clippy is clean. Not run in the game for this change specifically. Merges cleanly onto `940d32f`. AI-assisted (Claude Code, Codex). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:22:56 +00:00
github-bot closed this pull request 2026-11-26 04:22:56 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 18:00 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at bcfd293: cargo test -p victory-hle passes, 97 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 18:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/1187#issuecomment-7140023392) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at bcfd293: `cargo test -p victory-hle` passes, 97 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:34 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #1457. The same scheduler change as #1457 (a read that needs no staging may start while a staged one waits), with no description at all.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1187#issuecomment-7148649003) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1457. The same scheduler change as #1457 (a read that needs no staging may start while a staged one waits), with no description at all. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1187
No description provided.