DirectStorage: workers read a file through a handle each #2904
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2904
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2904"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@0xkn0wh3r3 on GitHub · 2026-11-25 23:32 UTC · original
0xkn0wh3r3:hle/dstorage-handle-per-worker→main· +182 −7 · 1 files · 1 commits · openWhat
Each DirectStorage worker now reads a file through its own handle instead of the one handle the title's
OpenFilemade. A worker makes its handle withReOpenFilethe first time it reads that file. If the host refuses, it falls back to the title's handle, logs a warning, and carries on. The handles close with the file object.VICTORY_DSTORAGE_HANDLES=0reads through the title's handle alone, as before.Why
The title's handle is opened for synchronous reads, and Windows performs the reads on one such handle one at a time. So the scheduler's workers (one per host core) queued behind each other on every file, however many were free.
Measured with 48 KiB reads at random offsets from 24 threads:
read_bench)Nothing here depends on the GPU vendor.
Where it comes from
From the avatarmanz/VIctory-7900XTX fork, commit
fbc1830. This PR takes only the fork's defaulthandlesmode. Left out: itsoverlappedand unbuffereddirectmodes, and its xmem lock rework from the same commit.#234 also targets this serialization, using overlapped reads on one handle, but it bundles that with xmem mapping changes. This PR is only the handle change.
Tested (Windows 11, RTX 5070 Ti)
cargo test -p victory-hle: 153 passed, 1 ignored (the benchmark). New testworkers_read_a_file_through_handles_of_their_own: six threads read through three handles, and through the title's handle alone, at offsets across a 300,001-byte file and past its end. It checks the bytes and checks that each handle slot a thread used was made.read_bench(ignored):VICTORY_BENCH_FILE=<file> cargo test --release -p victory-hle --lib read_bench -- --ignored --nocapture. The cached-file numbers above come from it.cargo clippy -p victory-hle --all-targets -- -D warnings: clean.Not tested
@Marvisak on GitHub · 2026-11-26 02:18 UTC · original
Automated triage for the maintainers.
Merge candidate (a recommendation to look, not an approval). In
modules/dstorage.rs, each scheduler worker now reads a file through its own handle, made lazily withReOpenFilefrom the title's handle (Files::read_at). If reopening fails it falls back to the title's handle, andVICTORY_DSTORAGE_HANDLES=0restores the old behaviour. Reads are still positional (seek_read), so sharing a handle never depended on a file position; the change only removes the per-handle serialisation, and the PR measured 185 vs 990 MB/s. The test checks that the bytes and end-of-file results match with and without extra handles. CIcheckpasses.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.