DirectStorage: a queue submits itself past half its capacity, not at half #2072
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2074"
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 0xkn0wh3r3 on 2026-11-25T04:23:02Z.
The problem
A DirectStorage queue submitted itself one entry too early.
The public DirectStorage overview for the console queue says an Enqueue submits the queue once it has filled more than half of its capacity since the last submission. Our queue (
queueinmodules/dstorage.rs) submitted at exactly half. For example, a queue of 8 holding 4 entries since its last submission submitted itself, where the overview says they stay pending.The reference pages for
EnqueueStatusandQuerysay the submit happens at half, so the public pages disagree (see the thread). This PR follows the overview. Flipping it is one line inLane::submits_atplus the two boundary tests.The fix
Lane::submits_at). A queue of 8 holding 4 entries since its last submission now leaves them pending until Submit or a fifth entry.Lane::most, the check the blocking loop already made). So a queue of 2 holds one entry and could never pass half. It submits once full, or its next Enqueue would wait forever.Testing
half_a_queue_submits_itselfis nowmore_than_half_a_queue_submits_itself, which uses status entries only and does not sleep. On a capacity-8 queue, after a Submit, four status entries stayE_PENDINGand the fifth submits all of them. A status with no read before it is written by the submit itself, so the check does not depend on worker timing. With the old threshold the test fails at the fourth entry.a_full_queue_has_submitted_itself: checks the table above, and that for every capacity up to 1024 a queue submits before it is full, so an Enqueue never waits forever.a_page_list_the_title_changes_before_its_submit(fromeddde73) enqueues a third read. Two of four no longer submit the queue, and the test needs a self-submit.cargo test -p victory-hle: all pass.cargo test -p victory-hle --lib dstorage::passed 55 runs in a row. On the first run after the build,a_page_list_filled_after_its_request_startsfailed once. It submits explicitly on a capacity-128 queue, so the threshold does not affect it. It races a 2 ms filler thread against the 8 x 1 ms late-list retries.cargo clippy -p victory-hle --all-targets: clean.cargo xtask policy: ok.Not covered / Related
Querymeasurement to settle which public page is right.KNOWNlist (a listed check that passes fails that test).Rebased onto
63bcca4eddde73. When a queue submits itself (now past half instead of at half), its reads into physical pages and the status entries behind them still wait for the title's Submit. A full queue still submits everything.Lane::mostreplaces the inline one-free-slot check inqueue. eddde73's self-submit log line and comments now say "more than half full".Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:26:31Z.
Review: COMMENTED
Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.
DirectStorage queue self-submits past half capacity — queue-depth policy change; check the threshold against real DirectStorage behavior (half-full submit is the documented pattern).
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T04:41:43Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-hle --lib dstorage::— 15 passed, 0 failed (includingmore_than_half_a_queue_submits_itselfanda_full_queue_has_submitted_itself)cargo clippy -p victory-hle --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean fix submitting DirectStorage queues strictly past half capacity rather than at half, with targeted unit tests. Looks good.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T04:33:23Z.
Triage verdict — Implementation verified, reference threshold unresolved (
2ced771)Evidence
EnqueueStatusandQueryreferences for the same GDK release say it triggers at half. Both descriptions are relevant to the #2057 conformance expectation. GDK overview · EnqueueStatus · QueryChecks and limits
Next step
Queryresult for the trigger count.This verification was AI-assisted.
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T06:35:29Z.
Thanks @jeremygold02, and you're right that the references disagree. This PR follows the DirectStorage overview: an enqueue that leaves more than half the capacity filled since the last submit triggers one. I took the overview as the description of the behaviour, and the
EnqueueStatusandQuerypages as describing what those calls report.I have no console measurement to settle it. #2057's known-divergence entry quotes the overview, so its expectation follows the same reading. If someone with a console finds that
Queryshows a submit at exactly half, the change is one line in the threshold plus flipping the two boundary tests. Your status-only boundary control and the small-queue cases would catch it either way, so I've kept both.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:28:08Z.
Automated triage for the maintainers.
Needs work: needs the maintainer's decision. It merges cleanly into current
main.Two of the earlier points are fixed on
d3b373f:more_than_half_a_queue_submits_itself(crates/victory-hle/src/modules/dstorage.rs) now uses status entries only and does not sleep. On a capacity-8 queue, entries 1 to 4 after a Submit stayE_PENDINGand the fifth submits them all.a_full_queue_has_submitted_itselfchecks thatsubmits_at <= mostfor every capacity up to 1024, so an Enqueue cannot wait forever.Still open: the change to
Lane::submits_atchanges emulated runtime behaviour, and the public sources disagree. The overview says "more than half", while theEnqueueStatus/Queryreference pages say "at half".into_destination's late page-list retry depends on when a queue submits itself. The maintainer should decide which reading to follow. A consoleQueryresult, or how the title itself sizes and fills its queues, would settle it. The code is otherwise ready.On your reply: thanks, both fixes are confirmed. The remaining point is the one you also leave to the maintainer.
CI: passing (
check).Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T00:06:23Z.
Thanks. The branch is rebased onto
main(63bcca4) and the new head isd3b373f.Commit message: reworded in
d3b373f. It now cites "the public DirectStorage documentation for the console queue". The SDK name is gone from the branch's commit, the PR title and the description. The code is unchanged apart from the test below.Conflicting evidence: agreed, this is your call. These are the two public sources the thread cites (links in the verification comment above):
IDStorageQueueXsection: the queue submits automatically once more than half of it has filled since the last submit;IDStorageQueueX::EnqueueStatusandIDStorageQueueX::Queryreference pages: the submit happens at half.The PR follows the overview's wording. I have no console
Queryresult to settle it. If you prefer the reference pages, I'll flip it: one line inLane::submits_atplus the two boundary tests.Timing-dependent
E_PENDING: fixed ind3b373f.more_than_half_a_queue_submits_itselfis now the status-only boundary control from the thread, with no sleep. On a capacity-8 queue, after a Submit, four status entries stayE_PENDINGand the fifth submits all of them. A status with no read before it is written inside the submit (Lanes::submit_as->Lane::flush), so no worker timing is involved. With the old threshold, the test fails at the fourth entry.Tests:
cargo test -p victory-hlepasses, and--lib dstorage::passed 55 runs in a row. On the first run after the build,a_page_list_filled_after_its_request_startsfailed once. That test submits explicitly on a capacity-128 queue, so the threshold does not affect it. It races a filler thread's 2 ms sleep against the 8 x 1 ms late-list retries. I did not reproduce the failure onmainin 40 runs.cargo clippy -p victory-hle --all-targetsis clean, andcargo xtask policyis ok.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.