Skip to content

DirectStorage: a queue made with AutoSubmitDisabled waits for Submit - #1599

Open
mgrein wants to merge 1 commit into
xcl-dev:mainfrom
mgrein:dstorage-auto-submit-disabled
Open

mgrein wants to merge 1 commit into
xcl-dev:mainfrom
mgrein:dstorage-auto-submit-disabled

Conversation

@mgrein

@mgrein mgrein commented Nov 24, 2026 •

Copy link
Copy Markdown

The newer factory's CreateQueue (slot 10) takes a 0x20-byte desc whose u64 at 0x18 is the queue's DSTORAGE_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 after EnqueueRequest and before its own Submit (#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 at Submit only, and an enqueue into it at capacity waits until Submit, a cancel or Close takes entries, as the console's queue stalls one; queues made without it, or through the first CreateQueue, are unchanged. Follows the race @certified-retart pointed out on #1405.

What is in it

  • crates/xcl/src/hle/dstorage.rs: factory_create_queue1 reads the options and passes AutoSubmitDisabled on; QueueInner::auto_submit gates the half-full submit in enqueue and enqueue_numbered; other option bits are logged once.
  • Same file, after review: QueueInner::wait_for_room holds an enqueue into such a queue while it has capacity entries, on a condition variable that Submit, CancelRequestsWithTag and Close signal (Close lets a held enqueue go into the closed queue). A queue's entries leave it at Submit, so a held enqueue goes on as soon as the title submits.
  • Test 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 at Submit; the same queue without the option runs them by itself. It fails without the change.
  • Test 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 until Submit (then all three run), and a held enqueue goes on at Close. 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=4 at 5b1518f (rebased onto main 3da2abb): 1113 passed, 0 failed, 46 ignored (20 test binaries). SKIPPED (25): 20 GPU subtests that need wave64 (gpu::recomp::lower / lower_dxil program families, gpu_wave32_program_in_wave64_hardware, gpu_geometry_wave32_prefix_count_over_a_mask), 3 wave32 per-lane f16 subtests of lower_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: main plus other open PRs, among them DirectStorage: read a physical-page list again when its request runs #1405), with a temporary counter that is not part of this PR: the title called Submit itself (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 ([OFFICIAL] Looking for PRs with shaders optimization #1269), not on DirectStorage.

  • An independent run by @crosettiremi on an RX 7900 XT (comment below; main 9e3831e with 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 with AutoSubmitDisabled (options 0x1) at 4.0 s, so the changed path is reached.

main:

xcl-smoke v1
commit: 3da2abb81606df622610e009f0430de99aa9881c
gpu: NVIDIA GeForce RTX 4070
title: 5c412a26
seconds: 100
exit: 0x0
frames shown: 2744 (PresentX 2745)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16238 MB

This PR:

xcl-smoke v1
commit: 5b1518fc5de20c10c2e87ba584e0ca750d682866
gpu: NVIDIA GeForce RTX 4070
title: 5c412a26
seconds: 100
exit: 0x0
frames shown: 2748 (PresentX 2748)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16407 MB

Not tested

  • AMD GPUs, Linux / Wine.
  • World loading on current 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.
  • What the console reports in Query's "requests until the automatic submit" for such a queue; it is computed as before.
  • Interaction with DirectStorage: a late page array holds a half-full queue until Submit #549, which holds a half-full queue until Submit when a page list is still 0 at enqueue: with this change the title's queues do not submit when half full at all, so DirectStorage: a late page array holds a half-full queue until Submit #549's hold would only apply to queues made without the option.

AI use

  • Claude Code with Claude Opus 5.5: wrote the change, the test, the temporary counter and this description, and ran the tests and the runs on the hardware above.

🤖 Generated with Claude Code

@gut0to gut0to left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted review (GPT-6): I verified the full-queue behavior against the GDK queue-options contract and both enqueue paths.

Comment thread crates/xcl/src/hle/dstorage.rs Resolved
@crosettiremi

crosettiremi commented Nov 24, 2026 •

Copy link
Copy Markdown

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 9e3831e with #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.

@mgrein
mgrein force-pushed the dstorage-auto-submit-disabled branch from 52913f5 to 8142658 Compare November 24, 2026 18:25
@mgrein
mgrein marked this pull request as ready for review November 24, 2026 18:28
@DavidM1911

Copy link
Copy Markdown
Contributor

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 unmodified main.)

Thanks!

@throny

throny commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

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.

@iggyvilla

Copy link
Copy Markdown
Contributor

RDNA2 test report for #1599 at 81426586010a9215de0c9dd7a3aa7dd310b092b4 (the head then; it is now 6ef3b4a, not retested), merged cleanly onto main (9039900ba3710fda9d791db589d548b1aaeb3cf8).

Tested

  • AMD Radeon RX 6650 XT 8 GB (RDNA2, native wave64, driver 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=4 on main (9039900) + DirectStorage: a queue made with AutoSubmitDisabled waits for Submit #1599 (8142658, local merge 757da18): 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.
    • All 19 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).
    • The 3 failures are in 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), and hle::d3d12x::title_textures::tests::transitions_apply_when_their_list_is_submitted and hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory, which both panic with PoisonError (most likely a lock poisoned by the first failure). I did not run main without the PR for these three, and my attempt to rerun the two PoisonError tests on their own matched no tests, so I cannot say they pass alone or that they fail on main too. On this card the same three failed on earlier main trees without this PR (our test reports on D3D12.X: keep untranslated console graphics and stream shaders out of the driver #303 and D3D12.X: title texture reads outside the coherent window use the safe copy #751), where placed_title_textures_share_vram_and_preserve_pixels also failed alone and the two PoisonError tests passed alone.
  • World-load comparison on main (9039900) + Recompiler: oversized structured code falls back to pc blocks (#1307) #1321 (69a892c) + kernelx: Sleep does not count the time a bind waits for a pipeline build #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:
    • Control (without DirectStorage: a queue made with AutoSubmitDisabled waits for Submit #1599): 2,933 failed of 75,077 DirectStorage requests (4,299 MB) in the 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), with 0x89240009 logged 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.
    • With DirectStorage: a queue made with AutoSubmitDisabled waits for Submit #1599 (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.
    • On RDNA2 this reproduces the fix: 0x89240009 failures 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.ps1 runs on the same retail title (XCL_NETWORK=0, run in order main → main + #1599). The queue is created with AutoSubmitDisabled (u64 @0x18 = 0x1 at 2.49 s on main; options 0x1 at 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 (main has no #1321), not something #1599 adds.

main (9039900):

xcl-smoke v1
commit: 9039900ba3710fda9d791db589d548b1aaeb3cf8
gpu: AMD Radeon RX 6650 XT
title: retail
seconds: 60
exit: 0x0
frames shown: 1530 (PresentX 1531)
presents per 2 s (last 3): 46 50 60
device removals: 0
crashes: 0
peak commit: 70947 MB

main (9039900) + #1599 (8142658, local merge 757da18):

xcl-smoke v1
commit: 757da18404347c27271f2bd5d4ff236eb48f94e3
gpu: AMD Radeon RX 6650 XT
title: retail
seconds: 60
exit: 0x0
frames shown: 1518 (PresentX 1518)
presents per 2 s (last 3): 60 57 55
device removals: 0
crashes: 0
peak commit: 70895 MB

Not tested

  • 8142658 directly on its older base (9e3831e) without merging onto main (9039900).
  • Rendered 3D gameplay past the post-load stall; NVIDIA/Intel GPUs; Linux / Wine; Query's "requests until the automatic submit" value.

AI use

  • An agent (Antigravity CLI with Gemini 4 Neon) built the trees, ran the test suite, the smoke pair and the world-load runs on the hardware above, and drafted this report. Claude Code (Claude Sonnet 5.5) re-checked the numbers against the logs and rewrote the text.

The newer factory's CreateQueue (slot 10) takes a 0x20-byte desc whose
u64 @0x18 is the queue's DSTORAGE_QUEUE_OPTIONS; a new retail game sets
bit 0, AutoSubmitDisabled. XCL ignored it, and a half-full queue still
submitted by itself. The title writes a request's destination page list
after EnqueueRequest and before its own Submit, so a request that the
half-full submit sent to the worker could run before its list was
written, with the pages of the slot's previous request.

Such a queue now runs its requests only at Submit, and an enqueue into
it at capacity waits until Submit, a cancel or Close takes entries, as
the console's queue stalls one. Queues made without the option, or
through the first CreateQueue, submit when half full as before. Other
option bits are logged once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@upipibi

upipibi commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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 onto main 568e7db, with main run 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. main 568e7db: 1153 passed, 1 failed, 46 ignored.
    • test_title_runs_and_game_folder_is_untouched fails in both: it needs a title.
    • hle::xaudio2::tests::opus_source_voice_decodes_and_manages_lifetime fails only here. It's the playback-timing test of Tests: the XAudio2 voice tests wait 30 s for playback and skip a slow audio device (#1487) #1600, and a different XAudio2 voice test fails from run to run on this machine. It's not from this change.
    • SKIPPED (25 in both): mostly no wave64 (wave64 parity and lower_dxil GPU cases), plus cannot disable the driver cache and no 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants