DirectStorage: complete work when a queue worker cannot start #2502
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2502
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2502"
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?
@jeroenhaentjens on GitHub · 2026-11-25 20:54 UTC · original
jeroenhaentjens:dstorage/complete-failed-submissions→main· +361 −22 · 2 files · 1 commits · draftWhen Windows cannot start a DirectStorage queue worker,
Submitdrops its batch, leaving status slots pending and losing fence notifications. This change records a permanent worker-start failure separately fromClose: accepted requests fail without executing reads, status entries receive the first error in their interval, and fences complete in order. Later submissions use the same failure path instead of silently disappearing.What is in it
dstorage.rs: one failure drainer preserves FIFO order and status intervals across submissions. Re-entrant submissions queue behind it; entries enqueued withoutSubmitstay pending. Notification callbacks run outside queue locks with an owned queue reference, and concurrentClosewaits for retirement.Tested
XCL_ADAPTER=nvidia.ca341274fd526c87c864731bd37868df1a17a350, rebased onto maine1d84b7d9153f86a97d2ec5d209d196046fc0bea:cargo build --workspace --lockedsucceeded;cargo test --workspace --locked --no-fail-fast -- --test-threads=4exited 0: 1,426 reported passes, 0 failures, 46 ignored across 37 completed suites.SKIPPEDrecords: 21 unavailable native-wave64 cases; 3 refused per-lane FP16/conversion cases; 1 driver-cache-control case; 2 title/debug-layer cases; 1 unavailable heap-window case; 1 texture-state/debug-layer case. Reported passes include skipped cases; these are not coverage. Unset game sample inputs are not game coverage either.cargo test --locked -p xcl --lib hle::dstorage:: -- --test-threads=4 --nocapture: 34 passed, 0 failed / ignored / explicit skips. All 34 also passed in the clean-head full run.6950978, the revised later-submission regression (cargo test --locked -p xcl --lib a_failed_worker_start_completes_requests_statuses_and_fences -- --test-threads=4 --nocapture) failed: a later enqueued status returnedS_OKinstead ofE_PENDING. The fixed test verifies the eventual failure HRESULT and fence 99 completion. The original main negative control also failed with an initially submitted status left incomplete.git diff --checkpassed. Two independent subagents reviewed FIFO/Submit boundaries, queue lifetime, and concurrent Close ordering.Regression run
Not run: no suitable game package is available. This runtime change remains draft pending paired main/head
scripts/smoke.ps1runs.Not tested
thread::Builder::spawn.Closere-entered from its own notification callback are outside this change.AI use
@SlopTart on GitHub · 2026-11-25 21:08 UTC · original
First cold-cache
gpu_suite run:163 passed / 4 failed, the trio plusgpu_geometry_wave32_prefix_count_over_a_mask. Second run, same head:164 passed / 3 failed(baseline trio only). Solo run of the wave32 test on this head: passed. That test is this lane's known flaky family, unrelated to DirectStorage; recording it so nobody chases it here. The new worker-start-failure tests run inside the DirectStorage module and are not part of thegpu_filter; the suite shows this PR moves nothing GPU-side.@DavidM1911 on GitHub · 2026-11-25 21:14 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Oliwettoo on GitHub · 2026-11-25 22:27 UTC · original
Review on 6950978 (read from the diff, not run). Failing the pending batch is right, but it reuses
closed, which so far only the title's ownCloseset. After a failed start the title still holds an open queue, and every laterEnqueue*returns silently (enqueue,queue_enqueue_statusandqueue_enqueue_signalall checkclosedfirst):E_PENDINGor completed. A fresh one keeps readingS_OK; the test assertsstatus_get_hresult(s, 5) == S_OKfor work that never ran. The title sees success and reads a destination that was never written.99in the test) is never signalled, so a title waiting on it hangs.Suggestion: a separate "worker failed (hr)" state, in which later entries go straight through
fail_unstarted(requests fail withhr, status slots complete with it, fences are signalled), instead of being dropped.@jeroenhaentjens on GitHub · 2026-11-25 23:07 UTC · original
@Oliwettoo Confirmed, thanks. The revised regression fails on
6950978: the later status still readsS_OKrather than becoming pending. That assertion in my original test was incorrect.Fixed and squashed in
ca341274fd526c87c864731bd37868df1a17a350. Worker-start failure now has its own state;closedis reserved forClose. Later requests fail with the stored HRESULT, status intervals preserve their first error across submissions, and fence 99 is signalled. Normal enqueue/Submit boundaries are retained. A single drainer handles concurrent/re-entrant submissions in FIFO order outside queue locks, including a callback that releases the final queue COM reference.On the clean revised head, the full Windows/Quadro RTX 3000 build and workspace suite passed: 1,426 reported passes, 0 failures, 46 ignored, 29 explicit SKIPPED records (not coverage). All 34 DirectStorage tests passed. Hardware, exact commands, negative control and limitations are in the updated description. Still draft pending the paired retail smoke runs.
AI assistance: OpenAI Codex, GPT-6 (exact deployment variant unavailable), including two independent subagent reviews.
@DavidM1911 on GitHub · 2026-11-26 01:36 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
@luckyteagirl on GitHub · 2026-11-26 09:18 UTC · original · reviewed
On
ca341274, the worker-start failure path appends all currentpending.entriesto the batch that the firstSubmitalready took. An enqueue on another thread can therefore cross that Submit boundary: thread A takes batch A and blocks instart_worker; thread B enqueues a status and fence below the auto-submit threshold, without callingSubmit; then startup fails, and A'sbatch.appendpulls B's entries intofail_unstarted. The status completes and the fence signals even though B's batch was never submitted. The queue's pending lock protects each operation but does not make B's enqueue part of A's earlier Submit.The IDStorageQueueX contract holds entries until
Submitor auto-submit; the revised PR discussion also says normal enqueue/Submit boundaries are retained. Could the startup failure retire only the batch already taken, leaving later pending entries for their own submission (and the failed-worker state to retire them then)? The existingworker_starttest seam can pause A, enqueue B's status/fence, fail startup, and assert B stays pending/unsignaled until a second Submit. This is exact-head source review; I did not run that concurrent fixture.@luckyteagirl on GitHub · 2026-11-26 09:31 UTC · original
I reproduced the Submit-boundary race on exact head
ca341274fd526c87c864731bd37868df1a17a350using a local, test-only 39-line fixture (no production edits).The fixture pauses thread A's first
Submitin the existingworker_starthook, after it has taken its batch. Thread B then enqueues a status and mock-fence signal below the auto-submit threshold, without submitting them. The hook returns a forced worker-start error. Before B's laterSubmit, the status was alreadyS_OKand the fence had signaled 99; expectedE_PENDINGand 0. This directly exercises thebatch.append(&mut pending.entries)path discussed in my review above.Tested — Windows 11 x64, CPU-only fixture (
XCL_ADAPTER=NONE_CPU_ONLY), no D3D12 device:The rerun exited 101: 0 passed, 1 failed, 0 ignored, 1,327 filtered out; the focused test took 0.02 s. The observed/expected assertion was
(S_OK, 99)vs(E_PENDING, 0). A subsequent explicitSubmitis part of the fixture's control path, but the assertion checks the state before it. The exact PR code was otherwise unchanged.Not tested: a game, GPU workload, full workspace suite, or a candidate fix. The worker error and fence are synthetic.
AI use: OpenAI Codex (GPT-6.2 Sol) wrote and ran the local fixture and drafted this report; OpenAI Codex (GPT-6.2 Astra) checked the test flow and results before posting.
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.