hle: open DirectStorage files for overlapped reads #66

Open
github-bot wants to merge 1 commit from github-bot/gh-66 into main AGit
Owner

@⁠LouisRiverstone on GitHub · 2026-11-25 21:32 UTC · original
LouisRiverstone:fix/dstorage-overlapped-read → main · +12 −1 · 1 files · 1 commits · open

Related to #18.

Summary

  • open files created through the DirectStorage factory with FILE_FLAG_OVERLAPPED
  • enables asynchronous/overlapped reads for queued title asset loading
  • avoids changing the public file APIs or virtual-drive handling

Validation

  • Windows-native test: cargo test -p victory-hle dstorage_files_open_for_overlapped_reads
  • Result: 1 passed

This targets cold-load and streamed-texture bottlenecks on HDD/SDD setups while preserving the existing request scheduler.

**@⁠LouisRiverstone** on GitHub · 2026-11-25 21:32 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/66) `LouisRiverstone:fix/dstorage-overlapped-read` → `main` · +12 −1 · 1 files · 1 commits · open Related to #18. ## Summary - open files created through the DirectStorage factory with FILE_FLAG_OVERLAPPED - enables asynchronous/overlapped reads for queued title asset loading - avoids changing the public file APIs or virtual-drive handling ## Validation - Windows-native test: cargo test -p victory-hle dstorage_files_open_for_overlapped_reads - Result: 1 passed This targets cold-load and streamed-texture bottlenecks on HDD/SDD setups while preserving the existing request scheduler.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:42:56 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-26 23:14 UTC · original

This one is a pointer to related work in other VIctory repositories, in case it helps. I worked it out by reading the code. I have not run any of it.

At d4b71d7, this PR changes only the flag open_file passes (dstorage.rs:116-119). read_into still reads through file.seek_read (dstorage.rs:1109), so the reads have not become overlapped reads. The new test checks the flag constant and nothing else. Two things I could not settle by reading: whether std's seek_read handles completions correctly on a handle opened with FILE_FLAG_OVERLAPPED when several workers read the same file at once, and whether any of this speeds anything up. Nothing in this PR measures either one.

Other repositories have gone after the same serialization (one title handle, which Windows reads one request at a time):

  • avatarmanz/VIctory-7900XTX commit fbc1830 (on its main; at 014d52d, crates/victory-hle/src/modules/dstorage.rs:284-460): VICTORY_DSTORAGE_IO=one|handles|overlapped|direct. The default is handles, a ReOpenFile handle for each worker. overlapped really issues ReadFile and waits on GetOverlappedResult with an event per thread. direct is unbuffered, through a 4 KiB-aligned bounce buffer. The commit message reports 185 MB/s on one handle against 990 MB/s with a handle per worker, for 48 KiB random reads from 24 threads. There's an ignored read_bench (:2132) and a test that every mode returns the same bytes (:2181).
  • Marvisak/VIctory#2904 (open, head 487d01e): a port of only the handles mode. On an RTX 5070 Ti it measured 4.2 → 6.6 GB/s on a file already in the cache.
  • Marvisak/VIctory#234 (open, head e39fc9c, needs a rebase): overlapped reads on one handle, bundled with changes to xmem section views.
  • In this repository, #124 (head b95a8a9) does the actual overlapped ReadFile/GetOverlappedResult in read_into (dstorage.rs:1158-1223), but it's bundled with the VICTORY_AV_SYNC pacing work.

VItoriaBr main (1361e19, dstorage.rs:1103) still reads through the one handle. Of these, the handle-per-worker change is the smallest one that has measurements behind it.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠upipibi** on GitHub · 2026-11-26 23:14 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/66#issuecomment-7205378596) This one is a pointer to related work in other VIctory repositories, in case it helps. I worked it out by reading the code. I have not run any of it. At d4b71d7, this PR changes only the flag `open_file` passes (`dstorage.rs:116-119`). `read_into` still reads through `file.seek_read` (`dstorage.rs:1109`), so the reads have not become overlapped reads. The new test checks the flag constant and nothing else. Two things I could not settle by reading: whether std's `seek_read` handles completions correctly on a handle opened with `FILE_FLAG_OVERLAPPED` when several workers read the same file at once, and whether any of this speeds anything up. Nothing in this PR measures either one. Other repositories have gone after the same serialization (one title handle, which Windows reads one request at a time): - avatarmanz/VIctory-7900XTX commit fbc1830 (on its main; at 014d52d, `crates/victory-hle/src/modules/dstorage.rs:284-460`): `VICTORY_DSTORAGE_IO=one|handles|overlapped|direct`. The default is `handles`, a `ReOpenFile` handle for each worker. `overlapped` really issues `ReadFile` and waits on `GetOverlappedResult` with an event per thread. `direct` is unbuffered, through a 4 KiB-aligned bounce buffer. The commit message reports 185 MB/s on one handle against 990 MB/s with a handle per worker, for 48 KiB random reads from 24 threads. There's an ignored `read_bench` (`:2132`) and a test that every mode returns the same bytes (`:2181`). - Marvisak/VIctory#2904 (open, head 487d01e): a port of only the `handles` mode. On an RTX 5070 Ti it measured 4.2 → 6.6 GB/s on a file already in the cache. - Marvisak/VIctory#234 (open, head e39fc9c, needs a rebase): overlapped reads on one handle, bundled with changes to xmem section views. - In this repository, #124 (head b95a8a9) does the actual overlapped `ReadFile`/`GetOverlappedResult` in `read_into` (`dstorage.rs:1158-1223`), but it's bundled with the `VICTORY_AV_SYNC` pacing work. VItoriaBr main (1361e19, `dstorage.rs:1103`) still reads through the one handle. Of these, the handle-per-worker change is the smallest one that has measurements behind it. AI-assisted (Claude Code, Claude Opus 5.5).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/66/head:github-bot/gh-66'
git switch 'github-bot/gh-66'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-66'
git switch 'github-bot/gh-66'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-66'
git switch 'github-bot/gh-66'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-66'
git switch 'main'
git merge --squash 'github-bot/gh-66'
git switch 'main'
git merge --ff-only 'github-bot/gh-66'
git switch 'main'
git merge 'github-bot/gh-66'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.