Skip to content

DirectStorage: a late page array holds a half-full queue until Submit - #549

Draft
papasmurph0 wants to merge 1 commit into
xcl-dev:mainfrom
papasmurph0:dstorage-late-page-arrays
Draft

papasmurph0 wants to merge 1 commit into
xcl-dev:mainfrom
papasmurph0:dstorage-late-page-arrays

Conversation

@papasmurph0

@papasmurph0 papasmurph0 commented Nov 24, 2026 •

Copy link
Copy Markdown

A retail title fills a destination page array entry after EnqueueRequest and before its own Submit. #289 rereads such an entry at the request's turn, but a half-full queue submits by itself, so during the title's loading bursts the worker reaches the request first and it fails with E_ACCESS_VIOLATION (0x89240009). Part of #476: the missing entries are now read on the title's thread at Submit, which narrows that issue's window.

What is in it

Tested

  • NVIDIA GeForce RTX 4080 SUPER (driver 610.88), AMD Ryzen 7 7800X3D, Windows 11 build 26200, Rust 1.100.0. Tests in debug, runs in release.
  • cargo test --workspace -- --test-threads=4 at 1870880: 677 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • Retail title past its account prompt, XCL_RUN_SECONDS=230, with a local failure counter by HRESULT on both builds (not part of this PR):
    • main: about 2,850 failures with 0x89240009 (counted in steps of 50), plus 1,050 BCPack refusals.
    • This PR: 0 with 0x89240009, plus 161 BCPack refusals.
  • That PR run ended at 222 s with an access violation in title_textures (refresh → note_gpu_write, copying a page that was no longer mapped). This PR doesn't touch that code, and it's the same kind of race as D3D12.X: read_committed survives concurrent decommit and unmap #454/D3D12.X: tolerate concurrent page decommits in title texture reads #484. main's run didn't hit it. One run each.

Regression run

xcl-smoke v1
commit: 2997c9aca6ebf4577fed34ebdb3cb0a77dd9ec21
gpu: NVIDIA GeForce RTX 4080 SUPER
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 637 (PresentX 638)
presents per 2 s (last 3): 7 8 8
device removals: 0
crashes: 0
peak commit: 15076 MB
xcl-smoke v1
commit: 187088002783f4b189eadd823fa391142b923d71
gpu: NVIDIA GeForce RTX 4080 SUPER
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 568 (PresentX 568)
presents per 2 s (last 3): 8 8 9
device removals: 0
crashes: 0
peak commit: 15090 MB

Not tested

AI use

  • Claude Code with Claude Opus 5.5 found the cause, wrote the code, the test and this description, and ran the tests and measurements. I checked them.

https://claude.ai/code/session_01SEW8zXNUmMq1tRUZpstWXS

A retail title enqueues requests whose destination page array has an
entry of 0 and fills that entry after EnqueueRequest, before its own
Submit. ivall#289 reads such an entry again at the request's turn, but a
half-full queue submits by itself, so during the title's loading bursts
the worker reaches the request before the title has filled the entry:
the reread still sees 0 and the request fails with E_ACCESS_VIOLATION
(0x89240009). Logged on a local build: every refused request had a
one-entry array still holding 0 at its turn.

Now a queue holding such a request does not submit by itself; the
title's Submit reads the missing entries again on the title's own
thread (through ReadProcessMemory, as at enqueue), where the array is
still the title's - which also narrows the window ivall#476 describes. An
entry still 0 then is read again at the request's turn, as before.

Test: a capacity-2 queue does not run a request with a missing page
before Submit, and the request lands once the title fills the entry and
submits; it fails without the change.

Assisted-by: Claude Code (Claude Opus 5.5)

Claude-Session: https://claude.ai/code/session_01SEW8zXNUmMq1tRUZpstWXS
@dervoxx

dervoxx commented Nov 24, 2026

Copy link
Copy Markdown

Additional local validation of the late-page change: the baseline recorded 3,972 DirectStorage destination_physical failures with page_reason: zero_page (3,906 + 66). Two runs with a local port of the change recorded zero each. The local Submit counter recorded 32,816 and 33,604 destination page IDs populated at explicit Submit, respectively. The local port checks the autosubmit guard under the pending-queue lock and includes that counter.

Both patched runs still crashed before reaching the prologue, and BCPack refusals remained. The measured improvement is specific to the zero-page DirectStorage failures.

@Celegans12

Copy link
Copy Markdown

I ran into the same failures independently before finding this PR, so here's a second machine's
numbers – it lines up with your diagnosis.

How I got there. On a laptop I added a local log line for every failed DirectStorage request
(main only logs the first one per queue). During world loading almost all of the 0x89240009
failures were zlib requests with a destination page array (options 0x200001) whose entries were
all 0 when the worker reached them – #289's reread at the request's turn still saw 0. XCL never
hands out page 0 (page_number = (index + 1) * FRAMES), so the title simply hadn't filled them yet.
Only letting the queue submit itself when it's full (a local experiment, not your approach) took
them from 2,171 to 0 on the base I had then.

This PR on my machine. Your commit on main e50836b (clean pick), release build, same title,
same save, XCL_NETWORK=0, 240 s through scripts/smoke.ps1, scripted A presses; a local failure
counter on both builds (not part of the PR).

Build 0x89240009 failures BCPack refusals (0x89240030)
main e50836b 7 2,388
#549 on e50836b 0 2,363

On the older base (64b3f35) the same burst was about 2,000 failures, so main has already narrowed
the window a lot since; this PR closes what's left. Both runs still end in world loading (main: read
of 0xffffffffffffffff at +0x43a6b7a, 86.9 s; #549: read at 0x527c, +0x4e59848, 84.9 s) –
with BC1 still refused, that looks like the next missing data rather than anything in this change.
Adding Kalmarv's #208 + #273 (BC1) on top of #549 bears that out: failures fall to 302, all
BC5/BC6H/BC7 refusals, the garbage reads are gone, and the run ends instead in the familiar
+0x23cf683 watchdog at 105.8 s (#232) – the compute-pipeline stall, not missing data.

Setup and test suite
  • RTX 3080 Laptop 16 GB (driver 32.0.16.2114, 32-lane waves), i9-11900H, 32 GB, Windows 11 26300,
    Rust 1.100 MSVC, DXC 1.9.2609.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 on DirectStorage: a late page array holds a half-full queue until Submit #549-on-e50836b:
    705 passed, 0 failed, 41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask,
    gpu_wave32_program_in_wave64_hardware.

Not tested: AMD, runs longer than 4 minutes, the PR on its own base.

AI use: Claude Code with Claude Opus 5.5 built and ran everything, wrote the local counter and drafted
this; I reviewed it before posting.

@badoomtch

Copy link
Copy Markdown

One input pattern worth covering in refill_late_pages is two pending file requests that use the same page-array address and write disjoint byte ranges. I measured this on Windows with an RTX 5080, in an offline run of a retail title. The instrumented build was based on af20b4b38e5a, with a local change to inspect page arrays at explicit Submit on manual file queues.

In one run, 17,639 requests shared a table start with another pending request, had disjoint proposed destination writes, and had no other Enqueue snapshot that independently identified the missing page. Another 26 had partially overlapping tables with the same properties. These are counts of requests, not distinct tables. The local build left those requests alone. It adopted 6,612 independent snapshots in that run and completed all 6,612 file reads (1,488,826,368 bytes).

A small test case for this PR would enqueue two file slices against one initially empty table, fill it before Submit, reuse the table immediately afterwards, and check both destination byte ranges and their untouched neighbours. The counters establish that sharing occurs. They do not tell us whether the title intended to recycle the table, or whether either destination was incorrect. This was a local experiment, not a run of 1870880.

AI use: Codex (GPT-6) checked the per-run counters and the PR diff and drafted this note.

@JFyuhong

Copy link
Copy Markdown

I tested the late-page change on Windows 11 build 26300, i7-14650HX, 32 GB RAM, RTX 4060 Laptop 8 GB, NVIDIA 616.92. Both release builds ran the same retail 1.0.2.1 story load with the same saved profile, initial cache, four memory windows and default pipeline waits. I ran xcl run once per build with XCL_ACTIVITY=1 and XCL_DSTORAGE_FAILURE_DETAILS=1.

The control was #905 at d19a3d3a727d with diagnostics from #816 (2ffb5a4ebaef), #899 (c3d54293d2f1) and #924 (dc0fb788704f), local Git tree cbe61bec7ffc765090e73efb9895586f3a278ab9. The second build added the queue change from this PR at 187088002783, preserving the submission-origin diagnostics, tree 7e16903531f94f7cd578bc3b4a44018dd51334d5.

Control With #549
Failed / total DirectStorage requests, summed over activity intervals 2,045 / 87,461 0 / 87,038
Successful BCPack decodes / decode failures 2,372 / 0 2,370 / 0
Seconds from last activity interval with presents to the exception 29.175 29.163

All eight detailed failures captured in the control were HalfFull submissions on queue 12, with stage=DestinationPages and zero entries both in the captured page array and on reread. Both runs later exited with the same guest null write at +0x23cf683. The focused test cargo test --release -p xcl --lib a_late_page_array_holds_a_half_full_queue_until_the_titles_submit -- --nocapture passed on the second tree (1 passed, 0 failed, 0 ignored).

AI use OpenAI Codex (GPT-6) prepared the local builds, ran the tests and wrote this report.

@Ali-AbdulHadii

Copy link
Copy Markdown

Retail data from Linux for this PR: the failure it fixes, and a run with it merged.

Setup: RTX 5080 (NVIDIA 620.73.04), proton-cachyos-slr Wine, vkd3d-proton master 30b0eb9 + the repo patch. XCL: a local branch of main 47efa2e (+ #640 and others), retail title 1.0.2.1 loading its world.

  • In one 2 s window, 2 004 of 2 081 DirectStorage requests failed with 0x89240009 (the first: 64 KiB from ttdb\props\octa_imposters.ttpf). The title stopped submitting right after, and its watchdog ended it ~30 s later (+0x23cf683).
  • A local log of which check failed showed write_physical_pages refusing destination page arrays that still held a 0 entry at the request's turn (ttdb\vfx\ttdb_vfx.ttpf, 128 KiB – 4 MiB).
  • As a stopgap I made a 0 entry a hole: the other pages are written and an all-0 array is still refused. That did not make the failures go away. In the next 11 runs they were nearly all arrays with no page at all yet: 128 to over 2 048 destination physical pages all 0 per run (the counter logs at powers of two). So the arrays are filled after the worker gets there, which is what this PR reads into.

With this PR merged (head as of today, on the same branch, stopgap still in): 0 DirectStorage failures in a 270 s world-loading run, where the 11 runs before had 128 to over 2 048 each. a_late_page_array_holds_a_half_full_queue_until_the_titles_submit passes here too. The run still ends on the title's watchdog, for other reasons (compute pipelines still being built).

Not tested: Windows, AMD.

AI use: Claude Code (Claude Opus 5.5) found this in the run logs, ran the PR and wrote this text; the user approved posting it.

@ArturoWolff

Copy link
Copy Markdown

Linux RTX 4060 (8 GB), 16 GB RAM, NVIDIA 620.73.04, GE-Proton11-14; retail 1.0.2.1, Series X profile. Five runs used the same unmodified release binary from 47efa2ecea0a12934719ae69b81930cf02a4b1c3, with different run settings. A run on the baseline can have zero DirectStorage failures even well into loading. This matters when interpreting a single zero-failure run on a patch.

  • Four of the five logged 0x89240009. In three, the first warning named octa_imposters.ttpf, but the requested destination lengths differed: 32,768, 131,072 and 28,672 bytes. The fourth named lighting.ttpf. The stock warning doesn't distinguish a refused physical-page write from other destination checks.
  • The fifth reached 76,382 requests / 4,254 MiB requested / 0 failed before the host OOM kill described on #320. Each of the four warning runs had a lower final sampled request count. This is a counterexample to a fixed request-count threshold, not evidence that its RT setting prevented storage failures.
  • All five shared an earlier checkpoint of 22,865 requests / 1,271 MiB requested / 0 failed. A separate stage-logging build was stopped for host pressure at 19,028 requests with no failures; it never reached even that checkpoint, so it adds no evidence about the failure stage.

I didn't test the PR head. This is baseline variability on a second Linux/NVIDIA configuration, not confirmation or refutation of a late page array. For comparisons here I'd report the first same-request stage and the cumulative request count alongside the failure total. No game data or logs attached.

AI use: Hermes Agent (gpt-6.2-astra) ran the local measurements and checked the activity intervals against the title logs for this note.

@komglebissarov

Copy link
Copy Markdown

AMD (RDNA4) run of this change: 2 072 requests failed with 0x89240009 without it, 0 with it

Tested

  • AMD Radeon RX 9070 XT 16 GB (driver 32.0.31044.16), Ryzen 9 5950X, 64 GB RAM, Windows 11 Home 26H2 (26300). rustc 1.100.0, release, DXC 1.9.2602.17.
  • Without the change: main 47efa2e. With it: main 930e8b4 with 1870880 cherry-picked (it applies cleanly; dstorage.rs is the same in both main commits).
  • cargo test --release -p xcl --lib dstorage on the second tree: 15 passed, 0 failed, 0 ignored.
  • A retail title (package 1.0.2.1), xcl run <game folder> with XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_WAIT_MS=50, menus passed by hand, into the story load. One run each; the run with the change also had XCL_FRAME_DUMP=1.
47efa2e 930e8b4 + this change
DirectStorage requests failed 2 072, all 0x89240009 (2 069 of them in one 2 s window of the load) 0
Wait64BitValueX timeouts 7 0
first #101 105.2 s 95.2 s
end 196.2 s: 0x80000003 at title+0x4da6315 124.2 s: device removed, 0x887a0006

The run with the change ended on a device removal 2.7 s after split command list (type 2) around mid-list Wait after Write64 (#2); the last 2 s window before it had 6 submits with 835 dispatches. I cannot tell from one run whether that has anything to do with this change.

Not tested

  • A clean A/B: besides this change the second tree has 10 newer commits of main, and its run had frame dumps on.
  • More than one run per tree.
  • The whole test suite and scripts/smoke.ps1.
  • NVIDIA / Intel GPUs.

AI use: Claude Code (Claude Fable 5.2) built both trees, ran the tests, read the logs and wrote this report. A person passed the menus. All numbers are from the logs of these two runs.

@shelbykb2

Copy link
Copy Markdown

@papasmurph0 a follow-up to refill_late_pages, measured on an AMD RX 6800 with a newer retail game: the title also rewrites entries that were not 0 at EnqueueRequest. A local diagnostic compared each destination array at the title's Submit and at the request's turn with the copy kept. Of 33,050 requests, 6,173 had entries rewritten before Submit (9,105 entries, 0 cleared). Nothing changed after Submit, and 0 arrays were unreadable.

Plan: at the title's Submit, take every entry that is not 0 from the array as it is then. A 0 keeps the enqueue copy, and so does an unreadable array. Every request with a page array holds the half-full auto-submit. In 6 runs with this, none ended on the title assert that ended the run without it.

It is a small commit on top of this PR, with two tests. You can fold it in, or I can open it stacked on this one.

Measured in runs on my machine; the diagnostic, the change and this report were written with Claude Code (Claude Opus 5.5, reviewed with Claude Fable 5.2).

@einfachama

Copy link
Copy Markdown
Contributor

Test report for #549 at 1870880, merged locally onto main 47efa2e (no conflicts), on my retail title's world load. On this title it removes the 0x89240009 failures: 0 in 4 runs, against failures in all 6 main runs.

Setup

  • NVIDIA GeForce RTX 4060 8 GB (driver 621.24), Ryzen 7 5800X, 32 GB RAM, commit limit 63.9 GB, Windows 11 Pro 26300, Rust 1.100.0, release builds (cargo build --release -p xcl).
  • My retail title, XCL_NETWORK=0, XCL_ACTIVITY=1, XCL_RUN_SECONDS=100, A pressed at 26 s and 30 s. The world load starts by itself at about 66 s.
  • Same caches throughout. Failed requests are the sum of the DirectStorage … failed counts in the XCL_ACTIVITY 2 s lines.

Results

build runs failed requests per run runs with failures
main 47efa2e 6 44, 754, 17, 346, 7, 1 009 6 / 6
main + #549 4 0, 0, 0, 0 0 / 4

Not tested

AI use

  • Claude Code (Claude Opus 5.5) ran the builds and runs, counted the results from the logs and wrote this report; I checked it before posting.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

Linux (Wine + vkd3d-proton) + NVIDIA test of 1870880 on main 67a3735 + #684, 5 alternated runs of 100 s each way of a retail title: without it DirectStorage requests failed with 0x89240009 in 5 of 5 runs (3 to 2,032 of them), with it none failed in 5 of 5.

Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging (Wayland driver), vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch. RTX 4070 12 GB (driver 615.71.09), Ryzen 9 9950X3D, 64 GB RAM. Release, cross-compiled to x86_64-pc-windows-gnu (rustc 1.98.0), XCL_NETWORK=0, XCL_PSO_PRELOAD=0. Retail title 1.0.2.1, the first-run screens completed once and no story progress, one A press at 44.8 s through XCL_PRESS_AT. 1870880 merged onto main 67a3735 + #684 (e56dbc3) without conflicts. Counts are the sums of failed in the activity (2 s) lines (XCL_ACTIVITY=1).

Tested

  • cargo test --release -p xcl --lib a_late_page_array under Wine, on the merge: 1 passed, 0 failed.
67a3735 + #684, runs 1 to 5 the same + 1870880, runs 1 to 5
DirectStorage requests failed 951 / 3 / 213 / 2,023 / 2,032 0 / 0 / 0 / 0 / 0
a request failed (0x89240009) warnings 1 / 1 / 1 / 2 / 1 0 / 0 / 0 / 0 / 0
DirectStorage requests in 100 s 69,133 / 84,721 / 82,899 / 86,138 / 67,674 82,573 / 77,264 / 83,182 / 84,246 / 86,746
frames presented 1908 / 2075 / 2084 / 2156 / 1998 2102 / 2070 / 2009 / 2095 / 2073

Without the change the failures come in one burst, nearly all within one 2 s window between 74 s and 90 s of the run (for example 1,994 in the window ending at 82 s), during the world load. The files named in the warnings are the title's texture tables (data\ttdb\…). No fault and no device removal in any of the ten.

Read

  • dstorage.rs:1194 (submit_if_half_full) and :1074 (submit): a queue holding a request with a missing page entry no longer submits by itself and waits for the title's Submit, where refill_late_pages (:1007) reads the entries on the title's thread. In these runs that held nothing up that I can see: the request totals and frame counts of the two trees overlap.
  • As the description says under Not tested, a title that enqueues such a request and never calls Submit would now wait on a half-full queue. This title calls it: no request failed in these five runs.

Not tested: past 100 s, so not the title_textures fault the description saw at 222 s; the preload of #690 on; the rest of the test suite; AMD and Intel.

AI use: Claude Code (Claude Fable 5.2) read the diff, built the tree, ran the test and the ten runs with XCL_PRESS_AT, summed the counters and wrote this report.

anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
…fallbacks

Incorporate targeted upstream fixes from ivall/xcl PRs and local diagnostics
to resolve world-loading E_ACCESS_VIOLATION streaming errors, fence monitor
deadlocks, and mesh/compute PSO visibility:

- DirectStorage (ivall/xcl PR xcl-dev#549; relates to xcl-dev#289, xcl-dev#476, xcl-dev#1164):
  * crates/xcl/src/hle/dstorage.rs: Add Pending::late and refill_late_pages()
    so queues with 0 entries in destination physical-page arrays do not
    auto-submit at half capacity before the title calls Submit() and fills
    the page entries. Add unit test
    a_late_page_array_holds_a_half_full_queue_until_the_titles_submit.
  * Ensure lazy physical pages via kernelx::lazy::ensure() in
    snapshot_page_array() and before re-reading stale destination page tables
    on execute() failure, logging failing snapshot/live entries (adds test
    dest_physical_pages_rereads_stale_snapshot).

- D3D12.X fences (ivall/xcl PR xcl-dev#1297):
  * crates/xcl/src/hle/d3d12x/fence_x.rs: Track all intermediate queued signal
    values in Fence::pending (BTreeSet<u64>) before completed_value_address()
    creates the cell, initialize the cell from GetCompletedValue() before
    publishing, and arm all pending values > initial so *cell cannot remain
    stale at 0 and deadlock callers waiting on intermediate fence values.
    Adds test intermediate_signal_queued_before_completed_value_address_updates_cell.

- D3D12.X PSOs (ivall/xcl PR xcl-dev#1300 / xcl-dev#1035 and PR xcl-dev#1298):
  * crates/xcl/src/hle/d3d12x/real.rs: Log driver rejections of translated
    compute PSOs (hr, DXIL byte size, elapsed compile ms) directly via
    xlog_warn! so refusals are not masked after note_translation_error's
    40-reason limit is consumed (PR xcl-dev#1300).
  * Update fallback_stream() to handle subobject types 24/25 (AS/MS) so
    mesh pipelines with MS in slot 24 rewrite cleanly with stand-in mesh
    shaders instead of invalid null AS payloads (PR xcl-dev#1298).

Assisted-by: Antigravity (Gemini 4 Neon)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
ivall#1379

Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability:
- ivall#1321 (ivall#1307): fall back to pc blocks when structured CFG HLSL grows oversized (eliminates the 148 MB HLSL / 1 GB/s commit explosion from b8b1f49 so XCL_PSO_PRELOAD=1 stays flat at ~5.4 GiB)
- ivall#549, ivall#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests
- ivall#1365 (ivall#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0
- ivall#1368: translated compute PSOs use NodeMask 0
- ivall#1371 (ivall#105): deduplicate packed ISG1 vertex input struct fields
- ivall#1375 (ivall#1360): ES s_setpc_b64 ends block before gs_start
- ivall#1350, ivall#1351, ivall#1352, ivall#1353, ivall#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication
- ivall#1305, ivall#1306, ivall#1314, ivall#1319, ivall#1322, ivall#1334, ivall#1339, ivall#1355, ivall#1357, ivall#1379: console_list UMA hold on Release, v_cmp_class_f32 bitwise abs/neg, late_release vram queue wait, root arg clamping, empty BVH / NaN rays, NULL IASetIndexBuffer clearing, MSAA MipLevels=1, VFS lazy-page commits, coherent VirtualFree validation, cpu_writes PAGE_GUARD & stale fence wakeups
- README.md: document the integrated PRs, XCL_PSO_PRELOAD=1, and 16 GiB cap

Verified on RX 9060 XT / GE-Proton11-14: release build clean, targeted unit tests pass (75 passed, 0 failed), and 80 s run with XCL_PSO_PRELOAD=1 and XCL_MEM_LIMIT=12G stays flat at 5340-5413 MB with 512+ pipelines preloaded (1385 frames, exit 0x0).

Assisted-by: Antigravity (Google DeepMind)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
ivall#1379

Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability:
- ivall#1321 (ivall#1307): fall back to pc blocks when structured CFG HLSL grows oversized (eliminates the 148 MB HLSL / 1 GB/s commit explosion from b8b1f49 so XCL_PSO_PRELOAD=1 stays flat at ~5.4 GiB)
- ivall#549, ivall#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests
- ivall#1365 (ivall#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0
- ivall#1368: translated compute PSOs use NodeMask 0
- ivall#1371 (ivall#105): deduplicate packed ISG1 vertex input struct fields
- ivall#1375 (ivall#1360): ES s_setpc_b64 ends block before gs_start
- ivall#1350, ivall#1351, ivall#1352, ivall#1353, ivall#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication
- ivall#1305, ivall#1306, ivall#1314, ivall#1319, ivall#1322, ivall#1334, ivall#1339, ivall#1355, ivall#1357, ivall#1379: console_list UMA hold on Release, v_cmp_class_f32 bitwise abs/neg, late_release vram queue wait, root arg clamping, empty BVH / NaN rays, NULL IASetIndexBuffer clearing, MSAA MipLevels=1, VFS lazy-page commits, coherent VirtualFree validation, cpu_writes PAGE_GUARD & stale fence wakeups
- README.md: document the integrated PRs, XCL_PSO_PRELOAD=1, and 16 GiB cap

Verified on RX 9060 XT / GE-Proton11-14: release build clean, targeted unit tests pass (75 passed, 0 failed), and 80 s run with XCL_PSO_PRELOAD=1 and XCL_MEM_LIMIT=12G stays flat at 5340-5413 MB with 512+ pipelines preloaded (1385 frames, exit 0x0).

Assisted-by: Antigravity (Google DeepMind)
@pickles976

Copy link
Copy Markdown

Bumping with emphasis because the queue has jammed elsewhere and this has sat done-with-evidence since 14:53Z: Royalflamejlh's five alternated 100 s Wine/NVIDIA runs are the cleanest A/B posted on any thread this weekend — 5/5 fail-then-5/5 pass on the same build plus #684, DirectStorage request failures eliminated. Meanwhile #1337 today added an independent field data point of the same class from the other direction (texture-page failures at streaming start surviving everything else), and the mechanism is not speculative: enqueue-time page-array snapshot (dstorage.rs:697) with refill at submit is exactly what the trace picture in #175 predicts. If the hold-up is review bandwidth — 460+ open issues will do that — this is the one to spend it on: it is scoped, it has reproduction and fix-validation from a third party, and three separate threads' failure counts depend on it.

@Filip722

Filip722 commented Nov 24, 2026 •

Copy link
Copy Markdown

Reproduced the half-full queue failure on an RTX 5060 Laptop GPU (8 GB, NVIDIA 615.78.08), Bazzite 44 Testing and Proton Experimental 11.0-20261112, with vkd3d-proton 3.1 4522cc1 and dxil-spirv 1dc543f. I compared two Windows MSVC release builds on XCL 930e8b4 with identical local texture/mesh changes, #816 diagnostics, Series X title data and cache seeds.

  • Baseline recorded 817 failures in 81,638 DirectStorage requests. All eight detailed access-failure samples were file-backed physical destinations that auto-submitted at half full with every destination page still zero, including on the worker reread.
  • The local DirectStorage: a late page array holds a half-full queue until Submit #549 port recorded 0 failures in 78,019 requests, passing the point where the baseline failures appeared. The port rechecks eligibility under the pending lock and clears the deferral count when a late request is canceled. The focused regression failed on the baseline, and all five focused checks passed on the port, including the physical-page write.
  • Both title runs reached loading artwork and the same title GPU watchdog. Each logged 17 pipeline-bind timeout warnings, with no device removal or NVIDIA Xid.

I also tested the one-file port on clean main 9e3831e. All 19 DirectStorage tests passed under headless Proton. The two added tests cover initial deferral, an auto-submit that must recheck readiness after another enqueue, cancellation recovery, and retaining existing nonzero destination entries on explicit Submit. The branch contains the source and synthetic tests. Clean-main port at 4cd10c0

OpenAI Codex with GPT-6.2-Sol high prepared the local port, ran the comparison and wrote this report.

@kesku

kesku commented Nov 24, 2026

Copy link
Copy Markdown

Half-full check happens before submit locks the pending queue meaning another thread can enqueue a request with missing pages in between, so it still gets submitted.

Rechecking the late-page count inside the lock fixes that, may want to add!

Cancelling the last request with missing pages also leaves the late-page count set which holds up ready requests afterwards

Recomputing it after cancellation fixes

anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
…pub(crate)

Fixes compilation errors on MSVC Windows target:

- D3D12.X: restores pub(crate) unsafe fn create_raw_fence in real.rs required
  by sparse::readback_after_execute (xcl-dev#1732). Creates an unproxied raw
  ID3D12Fence bypassing title vtable hooks so internal queue worker threads under
  Wine/vkd3d-proton signal native fences without hitting proxy mismatches.

- KernelX: restores pub(crate) visibility for commit_sparse in kernelx.rs
  (xcl-dev#549, xcl-dev#1298), required by DirectStorage's lazy MEM_RESERVE sparse
  window allocation in dstorage.rs and placeholder mappings.

- Recompiler: adds #[cfg(test)] gate above mod tests in emit.rs to silence unused
  PRELUDE_MEM import warnings in non-test release builds (xcl-dev#1524).

Assisted-by: Antigravity
@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@Razen114514

Razen114514 commented Nov 25, 2026 •

Copy link
Copy Markdown

Native Windows follow-up (not a story-load A/B)

This is another occurrence of the already reported HalfFull / DestinationPages signature, not a new issue.

  • Prior diagnostic run: Native Windows, desktop RTX 5060 (8 GB), 32 GB system RAM, DirectStorage: trace access-failure stages and submission origins #816 at 2ffb5a4ebaefb922952d72b35901d39d04ec715e. The eight detailed 0x89240009 samples were HalfFull → DestinationPages; every destination page number was still zero on reread. The last 2 s activity interval counted 909 failures in 3,473 requests. The local memory guard closed the title after host commit headroom fell to about 0.1 GiB. This was not a natural crash or a confirmed out-of-memory error.
  • Fresh synthetic retest: Native Windows 11 build 26200. Clean 9e3831e1f570d3646e53ab753b19ec07eb8f1485: 17 passed. The one-file DirectStorage: a late page array holds a half-full queue until Submit #549 port at 4cd10c0d6f43b69e1a482bd7d863cc753ec8e503: 19 passed. Both: 0 failed, 0 ignored. The two added tests cover deferral/rechecking/cancellation and preserving nonzero destination entries.
cargo test --release --locked --offline -p xcl --lib hle::dstorage::tests -- --nocapture --test-threads=1

Not tested: No fresh title run with the port; I could not verify the local package's publisher. No claim about reduced real-game failures, the black screen, or playability. This is a focused retest, not the full suite.

AI use: OpenAI Codex reran the focused tests, checked the previous diagnostic evidence, and drafted this note (model ID not exposed).

Follow-up: same synthetic test on main 568e7db

Native Windows 11 (build 26200), base 568e7db7729c8fa6c8f0f4b32d798faaf11462bb. Both local trees ran the identical synthetic fixture: a capacity-four queue receives a memory-source request with an initially zero destination page number, plus a status entry. The test supplies the page before calling explicit Submit and checks both request status and the payload it writes.

Variant Observed result
Main + fixture The half-full queue completed before explicit Submit with 0x89240009 instead of staying E_PENDING. The focused assertion failed as expected (0 passed, 1 failed).
Main + same fixture + only the runtime hunks of the #549 port at 4cd10c0d6f43b69e1a482bd7d863cc753ec8e503 The status stayed E_PENDING, then became S_OK after explicit Submit. All 37 payload bytes matched. The focused test passed.
cargo test --release --locked --offline -p xcl --lib hle::dstorage::tests::synthetic_half_full_queue_waits_for_pages_at_explicit_submit -- --exact --nocapture --test-threads=1

The focused command uses a local test fixture, not a test in either public tree. Clean main's DirectStorage suite passed 18 tests; the patched tree passed 19 including this fixture (0 failed, ignored or skipped in either suite). No #1464 changes were included. This confirms the premature submission in this synthetic case only, not a game or story-load fix.

AI use: OpenAI Codex wrote and ran the synthetic fixture, applied the existing runtime hunks in the local test tree, and drafted this follow-up (model ID not exposed).

Reusable test-only patch

The diff below adds just the synthetic fixture; it changes no runtime code. Save it as 0001-synthetic-test.patch (UTF-8, LF) in a disposable checkout. The exact reproduction is pinned to 568e7db7729c8fa6c8f0f4b32d798faaf11462bb. To try a different candidate, apply only this fixture to that branch after git apply --check succeeds. No title data is needed.

Run in a Windows x64 MSVC developer shell with Git, the Rust MSVC toolchain and Windows SDK available:

$fixture = '0001-synthetic-test.patch'
git apply --check $fixture
if ($LASTEXITCODE -ne 0) { throw 'Test patch does not apply.' }
git apply $fixture
if ($LASTEXITCODE -ne 0) { throw 'Test patch failed.' }
$env:XCL_COHERENT_MB = '1'
$env:XCL_UMA_MB = '1'
$env:XCL_NETWORK = '0'
$focus = 'hle::dstorage::tests::synthetic_half_full_queue_waits_for_pages_at_explicit_submit'
# A: pinned base with the fixture only
cargo test --release --locked --target-dir target/repro-control -p xcl --lib $focus -- --exact --nocapture --test-threads=1
# B: same fixture and pinned base with the candidate runtime change applied
cargo test --release --locked --target-dir target/repro-candidate -p xcl --lib $focus -- --exact --nocapture --test-threads=1

A reproduces the assertion before explicit Submit: expected pending, got 0x89240009; B with the tested reference port passes and checks the payload. A compiler error or a SKIPPED result is not a reproduction. Keep distinct target directories: while validating separate source checkouts, using one target directory caused Cargo to reuse A's test executable for B. The intended results were reproduced with separate target directories. Undo the fixture with git apply -R $fixture after testing.

Test-only patch (0001-synthetic-test.patch)
diff --git a/crates/xcl/src/hle/dstorage.rs b/crates/xcl/src/hle/dstorage.rs
index 5dd9d2e..648eb37 100644
--- a/crates/xcl/src/hle/dstorage.rs
+++ b/crates/xcl/src/hle/dstorage.rs
@@ -1653,6 +1653,72 @@ mod tests {
         b
     }
 
+    #[test]
+    fn synthetic_half_full_queue_waits_for_pages_at_explicit_submit() {
+        use crate::hle::kernelx::{AllocateTitlePhysicalPages, FreeTitlePhysicalPages, MapTitlePhysicalPages, PHYS_PAGE_SIZE};
+        use windows_sys::Win32::System::Memory::{VirtualAlloc, VirtualFree, MEM_RELEASE, MEM_RESERVE, PAGE_READWRITE};
+        if crate::gpu::uma::get().is_none() {
+            crate::gpu::recomp::runner::skip_test("no title UMA window for the destination page");
+            return;
+        }
+
+        unsafe {
+            let mut page_count = 1usize;
+            let mut pages = [0usize];
+            assert_eq!(AllocateTitlePhysicalPages(std::ptr::null_mut(), 0, &mut page_count, pages.as_mut_ptr()), 1);
+            let mapped = VirtualAlloc(std::ptr::null_mut(), PHYS_PAGE_SIZE, MEM_RESERVE, PAGE_READWRITE);
+            assert!(!mapped.is_null());
+            assert_eq!(MapTitlePhysicalPages(mapped, 1, 0, 4, pages.as_mut_ptr()), mapped);
+
+            let mut desc = [0u8; 0x18];
+            desc[..4].copy_from_slice(&1u32.to_le_bytes()); // memory source
+            desc[8..10].copy_from_slice(&4u16.to_le_bytes()); // two entries reach half full
+            desc[10] = 2;
+            let (mut q, mut status) = (std::ptr::null_mut(), std::ptr::null_mut());
+            assert_eq!(factory_create_queue(std::ptr::null_mut(), desc.as_ptr(), &IID_QUEUE, &mut q), S_OK);
+            assert_eq!(factory_create_status_array(std::ptr::null_mut(), 1, std::ptr::null(), &IID_STATUS_ARRAY, &mut status), S_OK);
+            let wait_status = || {
+                let started = std::time::Instant::now();
+                while !status_is_complete(status, 0) && started.elapsed().as_secs() < 5 {
+                    std::thread::yield_now();
+                }
+                status_get_hresult(status, 0)
+            };
+
+            let data = b"synthetic DirectStorage queue payload";
+            let mut table = Box::new([0usize]);
+            let size = data.len() as u32;
+            let request = request_ex(SOURCE_MEMORY_BIT | DEST_PHYS_PAGES_BIT, table.as_ptr() as u64, 0,
+                size, data.as_ptr() as u64, 0, size, 0, 0);
+            queue_enqueue_request(q, request.as_ptr());
+            queue_enqueue_status(q, status, 0);
+
+            // A started worker must finish reading the table before the test changes it.
+            // On a deferred queue there is no worker yet, so inspecting the status is enough.
+            let started_early = queue(q).worker.lock().unwrap().is_some();
+            let before = if started_early { wait_status() } else { status_get_hresult(status, 0) };
+            let timed_out = started_early && before == E_PENDING;
+            if !timed_out {
+                std::ptr::write_volatile(&mut table[0], pages[0]);
+                queue_submit(q);
+            }
+            let after = if timed_out { E_PENDING } else { wait_status() };
+
+            queue_close(q);
+            let copied = after == S_OK && std::slice::from_raw_parts(mapped.cast::<u8>(), data.len()) == data;
+            queue_release(q);
+            status_release(status);
+            MapTitlePhysicalPages(mapped, 1, 0, 4, std::ptr::null_mut());
+            VirtualFree(mapped, 0, MEM_RELEASE);
+            assert_eq!(FreeTitlePhysicalPages(std::ptr::null_mut(), 1, pages.as_mut_ptr()), 1);
+
+            assert!(!timed_out, "an early worker did not finish within the fixture timeout");
+            assert_eq!(before, E_PENDING, "before explicit Submit: expected pending, got {before:#010x}");
+            assert_eq!(after, S_OK, "after explicit Submit: expected success, got {after:#010x}");
+            assert!(copied, "the submitted request must copy the synthetic payload");
+        }
+    }
+
     #[repr(C)]
     struct MockFence {
         vtbl: *const usize,

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

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.