DirectStorage: a queue made with AutoSubmitDisabled waits for Submit #1589
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1599"
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 mgrein on 2026-11-24T18:07:34Z.
The newer factory's
CreateQueue(slot 10) takes a 0x20-byte desc whose u64 at 0x18 is the queue'sDSTORAGE_QUEUE_OPTIONS. A new retail game creates its queues with bit 0 set,AutoSubmitDisabled, and XCL ignored it: a half-full queue still submitted by itself. The title writes a request's destination page list afterEnqueueRequestand before its ownSubmit(#1405), so a request the half-full submit sent to the worker could run before its list was written. A queue made with the option now runs its requests atSubmitonly, and an enqueue into it at capacity waits untilSubmit, a cancel orClosetakes entries, as the console's queue stalls one; queues made without it, or through the firstCreateQueue, are unchanged. Follows the race @certified-retart pointed out on #1405.What is in it
crates/xcl/src/hle/dstorage.rs:factory_create_queue1reads the options and passesAutoSubmitDisabledon;QueueInner::auto_submitgates the half-full submit inenqueueandenqueue_numbered; other option bits are logged once.QueueInner::wait_for_roomholds an enqueue into such a queue while it hascapacityentries, on a condition variable thatSubmit,CancelRequestsWithTagandClosesignal (Closelets a held enqueue go into the closed queue). A queue's entries leave it atSubmit, so a held enqueue goes on as soon as the title submits.a_queue_with_auto_submit_disabled_waits_for_submit: a capacity-4 memory queue made with the option leaves two requests unrun for 300 ms and runs them atSubmit; the same queue without the option runs them by itself. It fails without the change.a_full_queue_with_auto_submit_disabled_holds_an_enqueue_until_submit: a capacity-2 queue with the option holds a third enqueue on another thread untilSubmit(then all three run), and a held enqueue goes on atClose. It fails without the stall.Tested
NVIDIA GeForce RTX 4070 12 GB (32-lane waves), AMD Ryzen 5 5600X, 32 GB RAM, Windows 11 25H2 (build 26200), Rust 1.94.1 MSVC, DXC 1.9.2602.17. Debug for the tests, release for the runs.
cargo test --workspace -- --test-threads=4at5b1518f(rebased ontomain3da2abb): 1113 passed, 0 failed, 46 ignored (20 test binaries). SKIPPED (25): 20 GPU subtests that need wave64 (gpu::recomp::lower/lower_dxilprogram families,gpu_wave32_program_in_wave64_hardware,gpu_geometry_wave32_prefix_count_over_a_mask), 3 wave32 per-lane f16 subtests oflower_dxil::tests(refused: unsupported f16 instructions),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode is off).Each new test without its part of the change: fails (the half-full queue runs its requests before
Submit; the third enqueue returns at once). Checked before the rebase; the change itself is the same.The new retail game, a 400 s scripted world-load run on a local branch (not this PR's tree:
mainplus other open PRs, among them #1405), with a temporary counter that is not part of this PR: the title calledSubmititself (1 024 times by 51 s), and its queues reached the half-full point 1 599 times by 34 s, each of which the old code turned into a submit before the title's own. Loading went on as before; the run stopped later on first-time compute pipeline builds in the driver (#1269), not on DirectStorage.An independent run by @crosettiremi on an RX 7900 XT (comment below;
main9e3831ewith other PRs, one cold-cache run per build): in the common 60–140 s interval 109 failed DirectStorage requests in 82 108 without this change, 0 in 87 724 with it. Their measurement, quoted here, not ours.Regression run
The same title for 100 s on each build,
XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, warm shader caches. The PR's log shows the title's queue made withAutoSubmitDisabled(options 0x1) at 4.0 s, so the changed path is reached.main:
This PR:
Not tested
main: the title stops with a GPU hang at about 113 s on both builds, unrelated to this change, so the regression runs cover the start (queue creation, the first 9 766 DirectStorage requests) but not the long world-load phase measured above.Query's "requests until the automatic submit" for such a queue; it is computed as before.Submitwhen a page list is still 0 at enqueue: with this change the title's queues do not submit when half full at all, so #549's hold would only apply to queues made without the option.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:10:55Z.
Review: COMMENTED
AI-assisted review (GPT-6): I verified the full-queue behavior against the GDK queue-options contract and both enqueue paths.
Imported from ivall/xcl. Originally posted by mgrein on 2026-11-24T18:25:37Z.
Review: COMMENTED
No description provided.
Imported from ivall/xcl. Originally posted by crosettiremi on 2026-11-24T18:14:04Z.
Confirmed that the retail title exercises this option on Windows. In a downstream RX 7900 XT run, XCL logged CreateQueue with a 0x20-byte descriptor and u64 at offset 0x18 equal to 0x1 at 1.544 s. The queue then processed file-backed zlib requests. Several comparison runs reported 0x89240009 on 64 KiB world assets after account selection. That error alone does not establish that auto-submit caused it. I have queued a comparison with identical destination diagnostics and a saved profile on the parent integration and with this change.
RX 7900 XT hardware follow-up, one cold-cache run per build. Both used main
9e3831ewith #789, #1514, #1438 and a downstream fallible zlib output allocation, a saved Series X profile and a 28 GiB whole-job limit. All 20 DirectStorage tests passed on the candidate. In the common 60–140 s interval, the control recorded 109 failures in 82,108 attempted requests; with #1599 the count was 0 in 87,724. Across all candidate activity samples it was 0 in 111,308. The control logged physical destination lists containing a zero page at the point of writing. The candidate's first explicit batch contained 3,677 entries at capacity 4,159, and later batches also crossed the old half-full threshold. Player1 A was scheduled at 49 s on control and 33 s on candidate. The candidate's final capture showed the Vice City location card. DRED then reported 0x887a0006 and GPU fault VA 0x1d1675000 with no named allocations. The observed process exit was a guest breakpoint (0x80000003, +0x2474606). No playable scene verified. These runs support the queue change on this route; they do not establish stability.Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:10:56Z.
Code review location:
crates/xcl/src/hle/dstorage.rs; line 1173When
auto_submitis false, this bypasses all capacity handling:enqueuekeeps appending topending.entries, whilecapacityis used only to trigger auto-submit. GDK specifies that enqueueing at capacity must stall until another thread callsSubmitand frees a slot. As written, this queue can grow past its declared capacity without backpressure. Could this track outstanding entries and wait when full, including theenqueue_numberedpath? AI-assisted review: I checked both enqueue paths against the GDK queue-options contract.Imported from ivall/xcl. Originally posted by mgrein on 2026-11-24T18:25:36Z.
Code review location:
crates/xcl/src/hle/dstorage.rs; line 1173Thanks, done in
8142658(squashed into the commit).wait_for_roomnow holds an enqueue into a queue made withAutoSubmitDisabledwhile it hascapacityentries, in bothenqueueandenqueue_numbered.Submit,CancelRequestsWithTagandClosesignal it;Closelets a held enqueue go into the closed queue. In XCL a queue's entries leave it atSubmit, so a held enqueue goes on as soon as the title submits, not when the requests complete. The new testa_full_queue_with_auto_submit_disabled_holds_an_enqueue_until_submitcovers both cases and fails without the stall.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:21:55Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by throny on 2026-11-25T00:37:50Z.
Two contributors checked independently and found that #1790 solves the same problem in a different way: #1607, group D59. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by iggyvilla on 2026-11-25T01:35:25Z.
RDNA2 test report for #1599 at
81426586010a9215de0c9dd7a3aa7dd310b092b4(the head then; it is now6ef3b4a, not retested), merged cleanly ontomain(9039900ba3710fda9d791db589d548b1aaeb3cf8).Tested
32.0.21045.29003), AMD Ryzen 7 5700X, 32 GB RAM, Windows 11 (build 26300),rustc 1.100.0 (0ef1bc386 2026-11-09). Debug for tests, release for title runs.cargo test --workspace --no-fail-fast -- --test-threads=4onmain(9039900) + #1599 (8142658, local merge757da18): 857 passed, 3 failed, 42 ignored (20 test binaries).SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows. Both wave64 tests (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware) ran and passed.hle::dstorage::tests::*tests passed, including both new tests (a_queue_with_auto_submit_disabled_waits_for_submit,a_full_queue_with_auto_submit_disabled_holds_an_enqueue_until_submit).title_textures/vram, not in DirectStorage:hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels(3D 64x64x64 4 mips: subresource 2 mismatch), andhle::d3d12x::title_textures::tests::transitions_apply_when_their_list_is_submittedandhle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory, which both panic withPoisonError(most likely a lock poisoned by the first failure). I did not runmainwithout the PR for these three, and my attempt to rerun the twoPoisonErrortests on their own matched no tests, so I cannot say they pass alone or that they fail onmaintoo. On this card the same three failed on earliermaintrees without this PR (our test reports on #303 and #751), whereplaced_title_textures_share_vram_and_preserve_pixelsalso failed alone and the twoPoisonErrortests passed alone.main(9039900) + #1321 (69a892c) + #1288 (9cdae10), one 200 s scripted walk each (XCL_ACTIVITY=1,XCL_NETWORK=0) from a saved profile past first-run setup. Screenshots confirmed both runs got past setup into loading art and world streaming; neither rendered a 3D scene:activity (2 s)counters, in three bursts at 92.2 s (1,125 of 1,139), 94.2 s (941 of 3,031) and 104.2 s (867 of 3,799), with0x89240009logged on a streaming pack. 1,931 presents in total, the last at 126.2 s. The host script stopped the run at ~157 s with the process at 70,825 MB commit; no title crash, no device removal.8142658): 0 failed of 87,249 DirectStorage requests (5,154 MB), no failure warnings. 2,340 presents in total, the last at 150.2 s; the window then stays black (0 presents) to the end of the run at 209.3 s, peak process commit 70,849 MB, no crash, no device removal.0x89240009failures go from 2,933 to 0 across ~87k requests. The later stall (no presents after ~126-150 s) is still there with the PR and is a separate problem. One run per arm, so the later last-present time is an observation, not a measured improvement.Regression run
Paired 60 s
scripts/smoke.ps1runs on the same retail title (XCL_NETWORK=0, run in ordermain→main+ #1599). The queue is created withAutoSubmitDisabled(u64 @0x18 = 0x1at 2.49 s onmain;options 0x1at 2.55 s with #1599) and 9,767 DirectStorage requests (650 MB, 0 failed) during the 60 s front-end window. Peak commit is ~70.9 GB on both arms: that is the DXC compile runaway of #1307/#1332 (mainhas no #1321), not something #1599 adds.main(9039900):main(9039900) + #1599 (8142658, local merge757da18):Not tested
8142658directly on its older base (9e3831e) without merging ontomain(9039900).Query's "requests until the automatic submit" value.AI use
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T07:42:19Z.
NVIDIA test report for
5b1518f(part of #2057's stack). RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug. The PR is merged ontomain568e7db, withmainrun as a control on the same machine the same hour.cargo test --workspace --no-fail-fast -- --test-threads=4: 1154 passed, 2 failed, 46 ignored.main568e7db: 1153 passed, 1 failed, 46 ignored.test_title_runs_and_game_folder_is_untouchedfails in both, because my build step ran onlycargo build --workspace --tests, soxcl_testtitle.exeandtestgame_mw.dll, built from the repository'stests/testtitle, were missing (the panic says "build first: cargo build --workspace"). So the end-to-end test did not run here.hle::xaudio2::tests::opus_source_voice_decodes_and_manages_lifetimefails only here. It's the playback-timing test of #1600, and a different XAudio2 voice test fails from run to run on this machine. It's not from this change.no wave64(wave64 parity andlower_dxilGPU cases), pluscannot disable the driver cacheandno heap windows.cargo test -p xcl --lib hle::dstorage:: -- --test-threads=1: 32 passed, 0 failed.AI-assisted (Claude Code). Synthetic tests only; no title run.
Imported from ivall/xcl. Originally posted by Gevroska on 2026-11-25T10:12:09Z.
I compared
main(cbc296a) with a local integration of #1599 (5b1518fon the same base) during world loading in the retail game on Windows with an RTX 3080. Both runs passed Confirm. I compared the same 58 complete activity intervals after loading began, about 116 seconds per run.Both runs stopped showing new frames about 60 seconds into the matched window. Both late captures were black, and both 300-second runs exited cleanly with no reported GPU removal. The candidate run had zero reported storage failures, but I saw no improvement in visible loading progress.
I ran the baseline first. The candidate reached Confirm about 16 seconds earlier after launch, and the runs shared the NVIDIA driver cache. With one run per build and different request totals, I can’t attribute the difference in failure counts to the patch alone.
I used Codex with GPT-6.2 Sol to run the comparison. A separate GPT-6.2 Sol agent verified the matched intervals, counts, capture measurements, and exit results. GPT-6.1 Terra checked for overlap with existing upstream reports.
Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:45:30Z.
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-26T02:55:30Z.
Linux (Wine + vkd3d-proton) + NVIDIA, the title, 2 runs each of
main,main+ #1599 andmain+ #1790 (the other fix forAutoSubmitDisabled): both take the failed DirectStorage requests from 238 and 1,281 per run to 0, over about 88,000 requests each. This matches the three Windows reports above; it is the first run on Linux.Setup:
mainb49be183+ #684e56dbc3; + #15995b1518f; + #17907a6f47a, each tree differing only by its own commit, run in turn. RTX 4070 12 GB (615.71.09), Fedora 44, Wine 11.21 Staging, vkd3d-protonv3.1-90-g30b0eb9bwith the relaxed-vtable patch from #175 and a local dxil-spirv patch, release, Series X profile, the first-run screens completed once and no story progress, 120 s, A pressed when ready (16.2 to 16.5 s; 10.2 and 20.4 s in the #1790 run that presented to 86.1 s),XCL_PSO_PRELOAD=0. Counts are the sums of theactivity (2 s)lines' DirectStorage figures.mainmainthe first failure, the only one XCL logs, was0x89240009(E_ACCESS_VIOLATION) on…\octa_imposters.ttpfin both runs; each run's failures all fell in one 2 s interval (50.1 s, 52.0 s).QueueInner::enqueueandenqueue_numbered. At capacity they differ: #1599 holds an enqueue untilSubmit,CancelRequestsWithTagorClose(QueueInner::wait_for_room), while #1790'senqueuelets the queue grow pastcapacity. #1790 also makesQueryreport0xFFFFas the requests left until the automatic submit. These runs do not tell the two apart.RtlpWaitForCriticalSection … main process heap sectiontwice; bothmainruns exited at 135 s, with that line once. The same hang came on 2026-11-25 on a tree with neither fix (main6d12f58a+ #684 + #2427 + #2428, 1 of 7 runs), so these runs cannot say whether either fix adds to it.Not tested: a queue filled to capacity;
Query's count until auto-submit; the world load past 120 s; the suite; Windows; AMD and Intel.AI use: Claude Code (Claude Opus 5.5) ran the title and wrote this comment.
Posted without review by a person: the account owner was away and reads replies later.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-26T05:40:30Z.
NVIDIA and AMD full-suite run, to go with the reports above by upipibi, since none of them covers AMD. Tested exact head
5b1518fc(on its base3da2abb).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1101 passed, 0 failed, 44 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.a_queue_with_auto_submit_disabled_waits_for_submit,a_full_queue_with_auto_submit_disabled_holds_an_enqueue_until_submit.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1112 passed, 0 failed, 46 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on mainb49be183too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T05:48:29Z.
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 throny on 2026-11-27T20:32:20Z.
merge-check claim
head:
5b1518fc5dImported from ivall/xcl. Originally posted by throny on 2026-11-27T20:52:27Z.
merge-check
base:
6089122ahead:
5b1518fc5dmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1467 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1465 passed, 0 failed, 47 ignored
review: no blocker. No lost wake-up: Submit, cancel and Close each notify after taking entries or setting closed. Minor: status and signal entries count towards the capacity (if the console does not count them, the result would be a hang, not a crash; not verified); the query still says "until auto-submit" for such queues; the first test's 300 ms wait could be flaky on a loaded machine (passed here). It overlaps #1790 (same problem): one of the two.
performance: default queues pay one notify; queues made with the option hold requests until the title's Submit, as intended (reasoned; a title run was not repeated here).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T01:12:06Z.
merge-check claim
head:
5b1518fc5dImported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T01:51:02Z.
merge-check
base:
2c717a043chead:
5b1518fc5dmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1468 passed, 0 failed, 47 ignored, 25 SKIPPED: 21 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 1 no heap windows; failing: none. The suite ran on this PC at the same time as 6 other PRs' suites, in one queued job.
review: none. Whole diff read (dstorage.rs: queue options from the 0x20 desc, auto_submit / room condvar, wait_for_room in enqueue / enqueue_numbered, notify in submit / cancel / close + 2 tests). A queue made with AutoSubmitDisabled no longer submits when half full, and an enqueue into it when full waits on the condvar (lock released) until Submit, a cancel or Close; queues from the older factory and those without the option behave as before.
performance: reasoned, not measured: no change for queues without the option. A title that creates its queues with AutoSubmitDisabled (the PR names a retail game) now has its requests run at its own Submit instead of at half capacity, and an enqueue into a full queue blocks until Submit, as the comment says the console does.
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile; trial merge becfe0c8d137f4ffd569f2bd1a0046e5d12e00c9 (local, not pushed). Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft).