DirectStorage: a queue submits itself past half its capacity, not at half #2074
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!2074
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@0xkn0wh3r3 on GitHub · 2026-11-25 04:23 UTC · original
0xkn0wh3r3:hle/dstorage-auto-submit-past-half→main· +77 −21 · 1 files · 1 commits · openThe 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".@jeremygold02 on GitHub · 2026-11-25 04:33 UTC · original
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.
@0xkn0wh3r3 on GitHub · 2026-11-25 06:35 UTC · original
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.@Marvisak on GitHub · 2026-11-25 10:28 UTC · original · edited 2026-11-26 00:26 UTC
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
@0xkn0wh3r3 on GitHub · 2026-11-26 00:06 UTC · original
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.