DirectStorage: complete work when a queue worker cannot start #2492
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by jeroenhaentjens on 2026-11-25T20:54:55Z.
When 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. See the known Submit-boundary issue below. 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
Paired release builds from clean commits, run on AC power on the same Windows 11 Pro machine and Quadro RTX 3000 (driver 597.06). Both runs used the same retail title, 60 seconds, input schedule (
15:A,35:A),XCL_ADAPTER=nvidia,XCL_NETWORK=0, and separate initially empty XCL shader caches. Windows reported AC power before and after both runs. The PR retained 87.8% of main's frames and used 100.04% of main's peak process commit. Both exited normally with no crash or device removal.Main:
PR head:
Not tested
thread::Builder::spawn. No AMD adapter or real OS resource exhaustion was tested.Closere-entered from its own notification callback are outside this change.AI use
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T21:08:19Z.
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.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T21:14:06Z.
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!
Imported from ivall/xcl. Originally posted by Oliwettoo on 2026-11-25T22:27:33Z.
Review on
6950978(read from the diff, not run). Failing the pending batch is right, but it reusesclosed, 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.Imported from ivall/xcl. Originally posted by jeroenhaentjens on 2026-11-25T23:07:23Z.
@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.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T01:36:38Z.
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
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:18:26Z.
Review: COMMENTED
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.Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:31:42Z.
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.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:36:03Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:12:41Z.
Triage (#1607) – head
ca34127No open or merged PR makes the same change. On main,
QueueInner::submitstill just drops the batch when thexcl-dstoragethread cannot be spawned, so its statuses and fences never complete. This PR fails them in FIFO order throughfail_unstarted.No problems found in the diff. The re-entrant Submit and the Close-while-draining paths have their own tests.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.