hle(dstorage): preserve sequence order across held page-destination auto-submits #554

Closed
opened 2026-11-28 03:13:11 +00:00 by github-bot · 2 comments
Owner

@⁠Sheffy007 on GitHub · 2026-11-28 03:08 UTC · original

Bug

In crates/victory-hle/src/modules/dstorage.rs, Lanes::submit_as(id, false) (triggered when a queue reaches half capacity before an explicit Submit) holds PAGE_DESTINATION reads and any Command::Status behind them in lane.held without assigning sequence numbers (seq), while immediately assigning seq numbers to plain (PAGE_DESTINATION == 0) reads.

When a second auto-submit (or more plain reads) runs on the same queue before Submit():

  1. Plain reads enqueued after an earlier held Status(S0) receive seq numbers smaller than the seq later assigned to S0 during Submit().
  2. S0 then waits on reads enqueued after it and consumes any failure HRESULT belonging to a later Status(S1), causing S0 to fail and S1 to falsely report S_OK.
  3. Held PAGE_DESTINATION reads are appended behind later unstarted plain reads in lane.reads on Submit(), starting after later reads on the same queue.

Plan

  • Assign monotonic seq numbers in enqueue order when commands first leave lane.unsubmitted in submit_as, keeping (u64, Command) in lane.held and keying lane.reads / lane.statuses by seq (BTreeMap, matching running and failures).
  • Check earlier held reads in Lane::flush as well so no status completes ahead of an earlier held read.
  • Add a unit test pinning multi-auto-submit sequence ordering, status completion boundaries, and error attribution across held PAGE_DESTINATION batches.

Refs #460

**@⁠Sheffy007** on GitHub · 2026-11-28 03:08 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/550) ## Bug In `crates/victory-hle/src/modules/dstorage.rs`, `Lanes::submit_as(id, false)` (triggered when a queue reaches half capacity before an explicit `Submit`) holds `PAGE_DESTINATION` reads and any `Command::Status` behind them in `lane.held` without assigning sequence numbers (`seq`), while immediately assigning `seq` numbers to plain (`PAGE_DESTINATION == 0`) reads. When a second auto-submit (or more plain reads) runs on the same queue before `Submit()`: 1. Plain reads enqueued *after* an earlier held `Status(S0)` receive `seq` numbers *smaller* than the `seq` later assigned to `S0` during `Submit()`. 2. `S0` then waits on reads enqueued after it and consumes any failure `HRESULT` belonging to a later `Status(S1)`, causing `S0` to fail and `S1` to falsely report `S_OK`. 3. Held `PAGE_DESTINATION` reads are appended behind later unstarted plain reads in `lane.reads` on `Submit()`, starting after later reads on the same queue. ## Plan - Assign monotonic `seq` numbers in enqueue order when commands first leave `lane.unsubmitted` in `submit_as`, keeping `(u64, Command)` in `lane.held` and keying `lane.reads` / `lane.statuses` by `seq` (`BTreeMap`, matching `running` and `failures`). - Check earlier held reads in `Lane::flush` as well so no status completes ahead of an earlier held read. - Add a unit test pinning multi-auto-submit sequence ordering, status completion boundaries, and error attribution across held `PAGE_DESTINATION` batches. Refs #460
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 03:13:11 +00:00
Author
Owner

@⁠Sheffy007 on GitHub · 2026-11-28 03:08 UTC · original

/claim

**@⁠Sheffy007** on GitHub · 2026-11-28 03:08 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/550#issuecomment-7232830847) /claim
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-28 03:09 UTC · original

Claimed by @⁠Sheffy007. Open a draft pull request with Refs #550 in its description within 24 hours, or the claim expires.

**@⁠github-actions[bot]** on GitHub · 2026-11-28 03:09 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/550#issuecomment-7232833434) Claimed by @⁠Sheffy007. Open a draft pull request with `Refs #550` in its description within 24 hours, or the claim expires.
This discussion has been locked. Commenting is limited to contributors.
No description provided.