HLE: hold DirectStorage reads behind held status entries and preserve sequence order #2617
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!2617
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2617"
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?
@fuzeofficlal on GitHub · 2026-11-25 16:56 UTC · original
fuzeofficlal:fix/hle-dstorage-hold-reads-after-held-status→main· +157 −22 · 1 files · 1 commits · openSummary
In
crates/victory-hle/src/modules/dstorage.rs,Lanes::submit_as(..., explicit = false)(auto-submit when a queue reaches half capacity) holdsPAGE_DESTINATIONreads and subsequentCommand::Statusentries inlane.heldwithout assigning them sequence numbers, while allowing plain reads (options & PAGE_DESTINATION == 0) to bypasslane.heldand receive earlierself.next_seqvalues.That causes two ordering bugs in
Lane::flush(self.failures.split_off(&seq)):[R1(PAGE_DESTINATION), S1]followed by[R2(plain), S2](either across two auto-submits or in one batch),R2bypasseslane.held, receives an earlierseqthanS1, and ifR2fails (END_OF_FILE) its error is misattributed toS1, leavingS2withS_OK.[R1(PAGE_DESTINATION, fails INVALID_DATA), R2(plain, fails END_OF_FILE), S0](whereR2intentionally starts early whileR1andS0wait forSubmit), givingR2a smallerseqthanR1causesS0to reportR2'sEND_OF_FILEinstead ofR1's earlier failureINVALID_DATA.Changes
crates/victory-hle/src/modules/dstorage.rs:seqonce in strict enqueue order when commands drain fromlane.unsubmitted, storing(u64, Command)inlane.heldso explicitSubmit()preserves original enqueue sequence numbers.Lane::readsandLane::statusesinBTreeMap<u64, ...>(first_key_value/pop_firstinLanes::startandLane::flush) so releasing earlier-seqheld commands ahead of already-queued plain reads keeps both structures strictly ordered byseq.held_statusinLanes::submit_asso plain reads after a heldCommand::Statusstay behind that fence, while plain reads before any held status continue starting early (a_queue_that_submits_itself_holds_reads_into_pages).a_queue_that_submits_itself_holds_reads_after_held_statusanda_queue_that_submits_itself_keeps_enqueue_order_for_first_failure.Verification
cargo test -p victory-hle --lib modules::dstorage::tests— 18/18 pass (includinga_queue_that_submits_itself_holds_reads_into_pages).cargo clippy -p victory-hle --all-targets -- -D warnings— pass (0 warnings).cargo xtask policy— pass (184 files ok).@oni-swr on GitHub · 2026-11-25 17:15 UTC · original
CPU verification of
2fe1cdcmerged cleanly ontoorigin/main13f91ca(detached checkout). CPU only;victory-hlecreates no GPU device. Windows 11,cargo -j 4, separateCARGO_TARGET_DIR.Commands and results:
cargo clippy -j 4 -p victory-hle --all-targets: clean.cargo test -j 4 -p victory-hle --lib: 148 passed, 0 failed, 0 ignored. Both new tests pass:a_queue_that_submits_itself_holds_reads_after_held_statusanda_queue_that_submits_itself_keeps_enqueue_order_for_first_failure.origin/main'sdstorage.rsboth fail (1 passed, 2 failed under thea_queue_that_submits_itselffilter).Review notes: no bug found. Held commands keep their original sequence numbers, and the
BTreeMapkeyed by sequence slots later releases back in order. A held status now also holds later plain reads, andflushstill reports the first failure by enqueue order. No overlap with the other PRs in this batch (this one only touchesdstorage.rs).Not tested: a retail title or real DirectStorage workloads.
Independent review and CPU verification by Claude Code (Claude Sonnet 5.5), an AI. No game files, dumps or retail data were used.
@kotekompotek on GitHub · 2026-11-25 17:51 UTC · original
Reviewed: keeping sequence numbers on held commands and moving reads/statuses to
BTreeMappreserves the original submission order across the hold — and 'reads behind a held status entry wait' closes the reorder where a later read could jump its fence.first_key_value/pop_firstkeep the take-oldest discipline identical to the VecDeque version. CI green.@Marvisak on GitHub · 2026-11-25 22:17 UTC · original
Automated triage for the maintainers.
Recommended for a maintainer's look. In
crates/victory-hle/src/modules/dstorage.rs,Lanes::submit_asnow gives every command its sequence number when it leavesunsubmitted(held commands keep theirs), and a plain read enqueued behind a held status entry is held too. Onmainsuch a read took an earlier sequence number than the held status before it, soLane::flushcould charge its failure to the earlier status entry, which contradicts a status entry covering only the requests enqueued before it. I checked thatreads/statusesasBTreeMaps keep the oldest-first behaviour ofstartandflush, and that the two new tests exercise both orderings. Merges cleanly, CIcheckpassing.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.