DirectStorage: keep raw reads running while staging drains #1457
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!1457
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1457"
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?
@Luizbc2 on GitHub · 2026-11-24 18:09 UTC · original
Luizbc2:fix/directstorage-raw-reads-while-staging-drains→main· +55 −13 · 1 files · 1 commits · openSummary
If the scheduler picks a read that cannot fit in the remaining staging space, it currently stops dispatching reads from every queue. A raw read at the front of a different queue needs zero staging bytes and can run while the buffered work drains.
Allow that read to run. Keep the existing weighted queue order among eligible reads and continue reserving staging space for the blocked request. Smaller buffered requests therefore cannot indefinitely postpone a larger one.
Reproduction and testing
cargo test --workspace --lib --locked --offline modules::dstorage::testsThe new synthetic test sets a 100-byte staging limit, holds 60 bytes in flight, and queues a blocked 120-byte read, a raw read, and a small buffered read in different queues. On
ffe310ethe scheduler returns no work. With the patch it starts the raw read, waits for staging to drain, then starts the 120-byte read. All 14 DirectStorage tests passed on Windows.AI-assisted with Codex.
@acetonahard-code on GitHub · 2026-11-24 21:05 UTC · original
Heads-up: #1187 (opened about two hours earlier) changes the same scheduler block in
dstorage.rs. A read that needs no staging keeps going when the next read can't fit the staging space. The two conflict, so only one can land as-is.Tested on Windows 11 with the repo toolchain, merged into current
main(ffe310e):cargo test -p victory-hlemainmain+ this PRcargo clippy --all-targets -- -D warnings, with and without--all-features: clean.cargo fmt --checkwould rewrap one block this PR adds (dstorage.rs).mainisn't rustfmt-clean either, so take it or leave it.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.
@Marvisak on GitHub · 2026-11-25 03:28 UTC · original
Automated triage for the maintainers.
Merge candidate.
Lanes::startincrates/victory-hle/src/modules/dstorage.rsnow starts a queue's raw (zero-staging) read when the next read in order must wait for staging space. It still holds staging back for the blocked request, so smaller buffered reads cannot overtake it. The candidate tuple (class clock, class, lane clock, seq, id) gives the same order asmain's two-step choice, and the new test covers the blocked/raw/drain sequence. The overlapping #1187 is closed. One small point: a raw read from another class setsnowfrom that class's clock, which can later step back; #1187 usedmaxfor this, which may be worth doing here too. CI has not run on this head; a tester reports the HLE tests and clippy pass.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 00:51 UTC · original
Code review (concurrency & ordering audit) and Windows 11 verification at head
ff3b10e753a3merged cleanly ontomain(63bcca43c6a0):crates/victory-hle/src/modules/dstorage.rs:513-557):selected.5 != 0) andself.staged > 0 && self.staged + selected.5 > self.staging, falling back tonext_read(true)still inspects only each queue'slane.reads.front(). Raw reads in the same queue never overtake a blocked staged read ahead of them, soLane::flushseqordering and error propagation stay intact.self.starved = trueis set before the raw fallback (line 536), so when the in-flight staged read completes,work()(std::mem::take(&mut lanes.starved)) wakes waiting workers vianotify_all()with no lost-wakeup or deadlock window.self.staged > 0(so oversized single requests still launch oncestaged == 0), and blocked staged queues do not advance their virtual clock.cargo xtask policy:191 files ok;cargo clippy --locked -p victory-hle --tests -- -D warnings: 0 warningscargo test --locked -p victory-hle -- dstorage: 17/17 passed (includingraw_reads_from_other_queues_can_run_while_staging_drains).LGTM.
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.