DirectStorage: a memory source is copied without faulting #561
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!561
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-561"
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?
@requiemsnkrp on GitHub · 2026-11-24 01:50 UTC · original
requiemsnkrp:dstorage-memory-source-read→main· +73 −2 · 1 files · 1 commits · openA memory-source DirectStorage request's source was checked with
readable()and then copied withcopy_nonoverlappingon thexcl-dstorageworker at the request's turn. If the title unmapped the source between the two, the copy faulted in the worker and ended the process. It is now copied withread_own(ReadProcessMemory), as the page arrays are, so the request fails withE_ACCESS_VIOLATIONinstead. This is the source side of #476; @brothernog found it while reviewing #509. It is independent of #509: a different hunk ofexecute, branched frommain508a0c7.What is in it
crates/xcl/src/hle/dstorage.rs,execute: the memory source is copied withread_ownafter the existingreadable()check, which stays for the cheap refusals (empty or oversized sources)crates/xcl/src/hle/dstorage.rs, tests:a_memory_source_unmapped_under_the_worker_fails_the_requestruns 20000 memory-source requests while another thread decommits and recommits the source pageTested
--exact): 5 ×0xc0000005 STATUS_ACCESS_VIOLATION; with the fix: 10 of 10 passed;hle::dstoragetests: 14 passedcargo test --workspace -- --test-threads=4onc65cf2e: 681 passed, 0 failed, 41 ignoredgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareRegression run
main:
PR:
Not tested
main508a0c7without the change on this machine (the count above is for the PR head only)AI use
@brothernog on GitHub · 2026-11-24 01:55 UTC · original
Tested
c65cf2eon an RTX 3050 (driver 610.88), Windows 11 Home 26300, Rust 1.100.0, debug:a_memory_source_unmapped_under_the_worker_fails_the_request(--exact): 3 of 3 passed. With only theexecutehunk put back tocopy_nonoverlapping, 3 of 3 runs ended in0xc0000005 STATUS_ACCESS_VIOLATION.cargo test -p xcl --lib hle::dstorage: 14 passed.Thanks for picking this up. One more of the same shape, on the destination side (read only, not run):
executechecks a virtual destination withwritable()at its start (dstorage.rs:790on this head), then reads the file or copies the source and decompresses, and only then writes withcopy_nonoverlapping(:854). The window there is longer than the source's, since it spans the file read. A destination the title decommits in that time would fault inxcl-dstoragethe same way.WriteProcessMemoryon the current process would be the write-side counterpart ofread_own. Probably a separate PR, if it is worth doing.This review was AI-assisted.
@MesshM on GitHub · 2026-11-24 03:12 UTC · original
Test run of
c65cf2ef9a9ecb7d7673b93b8d210dfb979be8d8on AMD RDNA4. I merged it onto currentmaindd2ae9alocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 691 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 651 passed, 0 failed, 21 ignoredSKIPPED;a_memory_source_unmapped_under_the_worker_fails_the_requestpasses (20 000 requests against a page decommitted and committed in a loop, no crash).Review: Copying the source with
read_ownturns a source unmapped between the check and the copy intoE_ACCESS_VIOLATIONfor that request, as the page arrays already do, instead of a fault inxcl-dstorage. I found nothing to change.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.
@jacksonslab on GitHub · 2026-11-24 03:23 UTC · original
Tested the same change on a retail title (Windows 11, RTX 4070 SUPER 12 GB, i7-14700K, NVIDIA driver current as of this week), applied on top of main
508a0c7plus #533/#549/#567/#572/#551/#454.Before: the process ended with an access violation inside
VCRUNTIME140!memcpycalled from thexcl-dstorageworker, ~80 s in, during a burst of several thousand DirectStorage requests per 2 s while the title streams its world.After replacing the
copy_nonoverlappingof the memory source withread_own(identical to this PR) — together with the same treatment for the deferred page-array read (#509) and #454 for title textures — that crash is gone; the run continued past 140 s and DirectStorage reported 0 failed requests over the run.Note: tested with a local equivalent of this patch, not this exact branch.
@thaqiart139-alt on GitHub · 2026-11-24 22:48 UTC · original
Test report for this PR's head
c65cf2e, merged intomain689f2db(no conflicts), on AMD RDNA2 with native 64-lane waves and on a 32-lane NVIDIA card.Tested
XCL_ADAPTER.cargo test --workspace --no-fail-fast -- --test-threads=4:main689f2dbmain, from #1679's new fuzz tests, and both are already reported on #1679:fuzz_validate_and_gpu_0to_3(CreateComputePipelineState:0x8007000E)fuzz_validate_and_gpu_1(seed 540: res[833] = 0x7, CPU 0x6)a_memory_source_unmapped_under_the_worker_fails_the_request.mainwithout the change on the same machine, which the description lists as not tested, and an AMD GPU.SKIPPED tests (the same on
mainand with this PR)gpu::recomp::lower::tests:a_2d_or_3d_group_agrees_with_the_hlsl_path_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,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpugpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu, and the wave64 cases of itsf16/f32/f64/integer_programs_on_the_gpugpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwarelower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused ("its #1426 semantics differ from the console's")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)gpu::dxil::geometry_tests::gpu_geometry_direct_records,emitted_ms_primitive_attribute_reaches_the_pixel_shader,emitted_ms_ps_draw_a_triangle,gpu_geometry_mode_es_gs_strip,gpu_geometry_mode_es_gs_strip_with_branches,gpu_mesh_mode_two_passeslower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused, as aboveheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)pso_measurement_compiles_an_exact_synthetic_record(Developer Mode is off)Not tested
AI use
@DavidM1911 on GitHub · 2026-11-25 13:30 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@throny on GitHub · 2026-11-26 02:18 UTC · original
Two contributors checked independently and found that #2359 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.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.