DirectStorage: read deferred zero mappings as native inputs #666
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/671"
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 Prime1997 on 2026-11-24T03:14:09Z.
DirectStorage could reject a valid zero-filled memory source or a physical-page table before its first CPU access. Native reads bypass XCL's first-touch handler.
What is in it
Tested
cargo test --locked --workspace -- --test-threads=4 --nocaptureon the PR head, debug, 696 passed, 0 failed, 41 ignored. Two GPU tests emittedSKIPPEDbecause this adapter lacks wave64:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware.dd2ae9athe untouched memory source and zero-filled page-table tests both failed withE_ACCESS_VIOLATION. Ond9a96fdall 19 DirectStorage tests and both existing kernelx lazy-page tests passed.Regression run
Official main:
PR head:
Not tested
AI use
I use a temporary Discord to coordinate my work. Anyone helping test XCL or compare results is welcome. Test coordination on Discord
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-24T03:30:35Z.
Tested
I tested a legal cross-page memory request through XCL’s DirectStorage queue, including enqueue, submit, worker execution, and the completion status. The first 48 bytes came from committed memory filled with
0x5a. The next 48 bytes came from a tracked zero page that was still reserved after enqueue.mainat91f9a5ecompleted withE_ACCESS_VIOLATIONand left all 96 destination bytes unchanged.d9a96fdintegrated onto that baseline, the same queued request completed withS_OKand returned the expected 48 patterned and 48 zero bytes.cargo test --offline --locked -p xcl --lib hle::dstorage -- --nocapture --test-threads=1passed 14/14 on the baseline and 20/20 with the patch. Each count includes the scratch queue fixture and its revision-specific assertion.Windows 11 build 26300, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug. This was a CPU-side synthetic check.
Not tested
Retail streaming, GPU timing, and the full workspace suite.
AI use
Codex with GPT-6.2 Sol wrote the scratch fixture, ran the tests, and drafted this report.
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T04:27:02Z.
Test report: #671 under Wine (Linux, NVIDIA): one new test fails on Wine's
ReadProcessMemorywith a guard page; GTA VI regression pairSetup
experimental-11.0-20261112(wine-11.0), vkd3d-proton v3.1 (4522cc1a) + the patch from #257, DXVK from Proton, DXC 1.9.2609,DXVK_CONFIG="dxgi.hideNvidiaGpu = False"x86_64-pc-windows-gnu(mingw-w64-gcc 16.2.0); debug for the tests, release for the runsd9a96fdand its merge basemaindd2ae9aUnit tests (lib test binary under Wine,
--test-threads=1, filterdstorage): 18 passed, 1 failed, in 2 of 2 runs.To see which protection it is, I printed each case locally (test file restored afterwards):
protectcopy_fromsnapshot_page_arrayProtectafterwardsPAGE_READONLY(0x2)Ok, zerosOk([0])PAGE_NOACCESS(0x1)Err, destination untouchedErr(E_ACCESS_VIOLATION)PAGE_READWRITE | PAGE_GUARD(0x104)Err, destination untouchedOk([0])So only the guard-page case differs:
ReadProcessMemory(GetCurrentProcess(), …)under this Wine reads a guard page and the guard is gone afterwards, so the test's last assert (Protect == protect) would fail too.read_ownonmainmakes the sameReadProcessMemorycall; the PR only adds the retry around it, so this looks like a Wine difference that the new test exposes, not something the PR changes. I didn't check other Wine versions.GTA VI 1.0.2.1 (my own dump; 60 s runs with
scripts/linux/smoke.shfrom #257,XCL_NETWORK=0, alternating base / PR / PR / base)dd2ae9ad9a96fd(The first pair.
peak commit: 0 MBis XCL reading 0 MB committed under Wine, see #257.) GTA VI's requests all succeed on both builds, so these runs don't show whether it ever hits the deferred-zero-page case.Not tested
AI use: Claude Code (Claude Opus 5.5) built both commits, ran everything above on the machine above and wrote this report. The blocks, counts and the panic are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.
Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T04:54:01Z.
Test run of
d9a96fd1fd57314b516b452d7eb1ef7315b698e9on AMD RDNA4. I merged it onto currentmain64b3f35locally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 707 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 666 passed, 0 failed, 21 ignoredSKIPPED; thedstorageandlazytests pass, the new ones included.Review: This run is on native Windows; the Wine failure reported above (Wine's
ReadProcessMemoryon a guard page) does not show up here, so it looks Wine-specific rather than a problem in the change. Preparing the reserved pages kernelx tracks and retrying the read once keeps a valid zero-filled source from being refused before its first touch. I did not trace the concurrent first-touch race the description mentions.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Imported from ivall/xcl. Originally posted by PedroNunes11 on 2026-11-24T12:41:26Z.
Native Windows retail-title data point for
d9a96fd.Tested
XCL_NETWORK=0,XCL_ACTIVITY=1,XCL_UMA_MB=4095,XCL_COHERENT_MB=4095.d9a96fdcherry-picked ontomaine50836b(local commit16e2f17). The tree also had a four-line localXCL_NO_SYSTEM_XGAMERUNTIMEopt-out because the system XGameRuntime crashes on this machine; that change is outside DirectStorage.cargo test -p xcl --lib deferred -- --test-threads=1: 7 passed, 0 failed (including the five new deferred-input tests selected by the filter).The PR removes the deferred physical-page failures this title hits. On the immediately preceding
mainbaseline (d208e14, the only latermainchange was README), with unsupported BCPack destinations filled and reported as successful, the activity log had 1,893 failed DirectStorage requests in one 2 s interval, with representative status0x89240009. Withd9a96fdintegrated and the same local BCPack diagnostic, every activity interval reported 0 failed requests, including the heavy world-streaming intervals.It does not remove the later world-loading stall on this machine:
The local BCPack diagnostic filled unsupported blocks and reported those requests as successful; it is not proposed as a fix. Its purpose here was to isolate the remaining stall after both known DirectStorage failure classes were suppressed. The result supports
d9a96fdfixing the lazy-input failures, but shows that those failures are not the only cause of the GTA VI stall tracked in #232.Not tested
AI use
OpenAI Codex with GPT-5 built the branches, ran the tests and title, analyzed the logs, and drafted this report. The account owner requested that the useful results be posted.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T06:24:43Z.
Empirical test report (
d9a96fd1)Hardware / environment
d9a96fd1fd57314b516b452d7eb1ef7315b698e9.x86_64-pc-windows-msvc. DXC 1.9.2609.5 (01b62ad47). CPU-only execution withXCL_ADAPTER=NONE_CPU_ONLY. No GPU adapter used.Commands and results
cargo test --workspace --no-runexited 0 and built the workspace test executables. Compilation only.cargo test -p xcl --lib hle::dstorage::lazy_input_tests:: -- --test-threads=1exited 0 withRUST_TEST_NOCAPTURE=1. The captured result was 6 passed, 0 failed, 0 ignored, and 671 filtered out. The log contained 0 case-sensitive lines beginning withSKIPPED.Observed behavior
Not tested
The full GPU workspace suite and game smoke runs were omitted.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr671-focused.log and published.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T12:22:58Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). 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 thehollowedone on 2026-11-27T16:58:47Z.
merge-check
base:
6089122a1c96dff16e93b6fdf04c8ed20cfb6102(main, checked 2026-11-27)head:
d9a96fd1fd57314b516b452d7eb1ef7315b698e9merge: clean text merge; one test call is incompatible with current
mainbuild:
cargo build --workspace-> ok on the unmodified mergetests:
cargo test --workspace --no-fail-fast -- --test-threads=4-> compilation failed on the unmodified merge (E0061 atdstorage_lazy_input_tests.rs:59; no tests ran). After adding only the missingfalseargument in a disposable local copy, the same command ran: 1,470 passed, 1 failed, 47 ignored, with 25SKIPPEDGPU notices. All six new deferred-input tests passed. The failure wasgpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk(cached_only console_mesh hit: "DXIL not compiled yet"). The exact focused test also failed on untouched base6089122(0 passed, 1 failed).review: the test helper calls
execute(&request, None, None, None), but currentmainadded thedest_on_stack: boolparameter beforesrc_pages. This test uses a virtual destination, sofalsematches its setup. I found no further issue in the merged source path for deferred preparation or owned page snapshots.performance: successful native reads retain one read and do not acquire the lazy-page lock. A failed read tries preparation under that lock and retries once; this path is limited to failed/first-touch reads. Frame-time and memory effects were not measured.
verdict: not yet. Update the fixture call on the PR head and rerun the required checks against current
main; then the merge result can be checked again.hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, NVIDIA RTX 3080 Ti 12 GB / 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11. Codex (GPT-6.2 Sol) ran the builds/tests and checked the merge; Codex (GPT-6.2 Astra) independently traced the source path.
One-line test compatibility adjustment used for the verification run
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T19:13:08Z.
merge-check claim
head:
d9a96fd1fdImported from ivall/xcl. Originally posted by throny on 2026-11-27T19:24:10Z.
merge-check
base:
6089122ahead:
d9a96fd1fdmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> does not compile: E0061 in crates/xcl/src/hle/dstorage_lazy_input_tests.rs:59,
executetakes 5 arguments on current main (aboolbefore the source pages), the test passes 4. No test ran. Base alone: 1465 passed, 0 failed, 47 ignored.review: apart from that, nothing blocking. prepare_read checks the range for overflow, holds the write lock and commits only tracked pages whose whole 64 KiB is still reserved; its lock order matches the fault handler's. read_own now also prepares pages for its other callers (late-fill compare, file-vtable read): harmless, but not in the description. The test's VirtualAlloc / VirtualProtect touch only its own reservation.
performance: a read that succeeds is unchanged; only a failed read takes the write lock and retries once (reasoned).
verdict: not yet: add the new argument to the test call (the first check says
false), rebase on current main; I will rerun the suite on the new head.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 bmjask on 2026-11-29T22:46:10Z.
Review: COMMENTED
Critical review of current head
d9a96fd1. The deferred-zero input retry is targeted and the cross-page behavior has a direct queue-level Windows test. Current-main test-build blocker:dstorage_lazy_input_tests.rs:59callsexecutewith four arguments, while main's signature now takes five; a text-clean merge cannot run the suite until the missing argument is ported. See the merge-check report. Please rebase that fixture and rerun the whole storage test filter; also retain the protection/partial-commit negative cases so the retry does not make unrelated addresses readable. No local Windows run.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:49:28Z.
Review (head
d9a96fd1, diff read, not a merge-check; it conflicts with main, so not built or run):kernelx::lazy::ensure. The gap is still on main: the memory source is only checked withshader::readable(dstorage.rs~970) and the page array read withread_own(~811), neither of which commits lazy pages first.prepare_readadds a second version oflazy::commit/ensure(lazy.rs~38, ~92) instead of reusing them aswritable()does (dstorage.rs~868).read_ownispub(crate)and called frombvh_want.rs~79,list_x.rs~302 / ~2471 andsparse.rs~3500, so after a rebase a failed read in any of those would commit lazy pages too, a behaviour change outside DirectStorage.#[path]file instead of dstorage.rs'smod tests.Fine: the tests cover the protection and partial-commit cases. Recommendation: close in favour of #2359 (moving the protection and partial-commit tests there), or rebase onto
lazy::ensurelimited to the two DirectStorage reads.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
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.