HLE: hold DirectStorage reads behind held status entries and preserve sequence order #2615
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T16:56:55Z.
Summary
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).Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T17:15:52Z.
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.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:51:41Z.
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.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:17:44Z.
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
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T05:18:11Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64:unsubmitted, switchingreads/statusestoBTreeMap<u64, _>, and holding reads behind a held status entry preserves original enqueue ordering for both status fences and first-failure reporting when a queue auto-submits before an explicitSubmit.cargo test -p victory-hle dstorage: 18 passed, 0 failed (includinga_queue_that_submits_itself_holds_reads_after_held_statusanda_queue_that_submits_itself_keeps_enqueue_order_for_first_failure).cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.