DirectStorage: commit lazy pages before reading a source or page array #2359
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2359
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2359"
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?
@safesearch77 on GitHub · 2026-11-25 16:30 UTC · original
safesearch77:fix/dstorage-read-own-lazy-source→main· +73 −0 · 1 files · 1 commits · draftA physical page mapped while its contents are still zero is only reserved until its first use (
kernelx::lazy): a CPU access faults it in, but a kernel call fails on it. DirectStorage commits its destinations first (writable()callslazy::ensure), but not what it reads:read_own(ReadProcessMemory) reads the source and destination page arrays, and a virtual memory source is checked withgpu::shader::readable(VirtualQuery/QueryWorkingSetEx), which sees a lazy page as reserved. A request whose page array or memory source sits in a page the title has not touched yet fails withE_ACCESS_VIOLATION(0x89240009).This complements #561 and does not overlap it: #561 changes how the memory source is copied (
read_owninstead ofcopy_nonoverlapping, for a source unmapped under the worker). This PR commits lazy pages before the check and the read.git apply --checkof #561's patch on top of this branch succeeds. The race fix and its stress test are dropped from this PR and left to #561.What is in it
crates/xcl/src/hle/dstorage.rs:read_owncommits the lazy pages of its range (lazy::ensure) beforeReadProcessMemory, and refuses a range that wraps. The memory-source branch ofexecute()callslazy::ensurebeforereadable(). A 0-byte source is still refused, as on main.crates/xcl/src/hle/dstorage.rs(tests):a_memory_source_and_page_array_in_lazy_pages_are_read. It reads a memory source that spans a committed page and alazy::marked one (expectsS_OK,[0xA5; 8]then[0; 8]), and a page array in a lazy page (snapshot_page_arraygivesOk(vec![0])). On main, both reach a reserved page and fail withE_ACCESS_VIOLATION.Tested
x86_64-pc-windows-gnu:cargo check --workspace --testsgave 0 errors. Its 3 warnings are ind3d12x/real.rs,xgameruntime/mod.rsandd3d12x/vram.rs, are already on main, and none are indstorage.rs.git diff --check: clean. 1 file, +73 / -0.Regression run
xcl-smokeblocks (mainb49be183and this head) have to come from a Windows run before this leaves draft.Not tested
cargo teston Windows, including the new test (red on main, green here), and the rest of thedstoragetests.git apply --checkonly. The two were not built and tested together.AI use
@FIJI1299 on GitHub · 2026-11-25 17:42 UTC · original
Tested commit
94fae46on Windows:Environment
621.35,wave32)1.8.2502.11(Windows SDK10.0.26100.0)Results
hle::dstoragetests (cargo test -p xcl --lib dstorage): 32 passed, 0 failed..\scripts\test.ps1): 1201 passed, 4 failed, 26 ignored — the 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineStateE_OUTOFMEMORY0x8007000Eon this NVIDIA driver during the full single-process run).13(no wave64)3(wave32, per-lane form: refused (unsupported V_CVT_F16_F32 / V_MUL_F16 / V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)))1(cannot disable the driver cache (Windows Developer Mode is required): 0x887A002D)@DavidM1911 on GitHub · 2026-11-25 18:37 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@SlopTart on GitHub · 2026-11-25 19:06 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).suite: 144/3 = the three known baseline failures on this lane (
fuzz_validate_and_gpu_2seed 1003,gpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_depth_buffer_created_for_unordered_access_is_placed). Targeted run of the new memory-source/page-array tests: 2 passed.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@throny on GitHub · 2026-11-26 02:18 UTC · original
Two contributors checked independently and found that #561 solves the same problem in a different way: #1607, group D115. 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.
94fae4661bto520c259a49@bmjask on GitHub · 2026-11-25 20:26 UTC · original · reviewed
No concrete code defect found. The change safely commits lazy pages before kernel reads and replaces unsafe worker-thread raw copies with ReadProcessMemory. It is not merge-ready: the current head has no Windows build/test or required smoke-pair evidence, only a failed PR-description check. Please provide those, and consider coverage for multi-page lazy sources, a real >256 MiB source, and byte-integrity assertions during the decommit race.
DirectStorage: read memory sources and lazy pages through read_ownto DirectStorage: commit lazy pages before reading a source or page array@safesearch77 on GitHub · 2026-11-26 14:07 UTC · original
Rebased onto
b49be183and narrowed to520c259a(+73 / -0indstorage.rs), keeping onlykernelx::lazy::ensurebeforeread_ownandreadable()so this PR composes cleanly with #561 (git apply --checkpasses with zero overlap on #561'sread_owncopy change, re#1607D115). Remains in Draft pending a Windows GPU suite andscripts/smoke.ps1pair.AI use: Antigravity (Claude Opus 5.5)
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.