DirectStorage: allow 0-byte memory-source requests instead of E_ACCESS_VIOLATION #1302
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1312"
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 b3IKK on 2026-11-24T14:36:42Z.
execute()calledgpu::shader::readable(r.source, r.source_size)before checking!b.is_empty(). Becausereadable(ptr, 0)unconditionally returnsfalse, valid 0-byte virtual-memory-source requests (which passRequest::checkandwritable(dst, 0), and succeed for file and physical-page sources) failed withE_ACCESS_VIOLATION.This guards the
readable()check and copy underelse if !b.is_empty().What is in it
crates/xcl/src/hle/dstorage.rs: skipreadable()andcopy_nonoverlappingwhenb.is_empty()on virtual-memory-source requests; add unit testzero_byte_memory_source_request_succeeds(verified failing withE_ACCESS_VIOLATIONbefore the fix).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib zero_byte_memory_source_request_succeeds: 1 passed, 0 failed (failed withE_ACCESS_VIOLATIONbefore the fix)Regression run
main:
PR:
Not tested
AI use
dstorage.rs, wrote the fix and unit test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:46:15Z.
Full-suite run, since this PR has no test report yet. Tested exact head
2393489(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.zero_byte_memory_source_request_succeeds.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T15:38:43Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, ~21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T10:04:46Z.
Independent Windows run on 2393489. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC.
cargo build --workspace --offline --locked -j 4passed.cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --nocapture --test-threads=4finished with 752 passed, 0 failed, 41 ignored. The pass count includes two wave64 runtime skips.The scratch fixture
local_zero_byte_request_preserves_queue_status_and_following_copypassed 1 of 1 withcargo test --offline --locked -j 4 -p xcl --lib local_zero_byte_request_preserves_queue_status_and_following_copy -- --nocapture --test-threads=1. I submitted an empty request and a 16-byte copy on the same DirectStorage memory queue, with a status slot after each. Both returnedS_OK, the error record counted zero failures, all 16 bytes of the empty request's destination stayed unchanged, and the following copy matched all 16 source bytes. With the original length check restored in the scratch copy, the first status returnedE_ACCESS_VIOLATIONand the error record counted one failure. The second status still returnedS_OK. I restored the edit. Synthetic CPU queue coverage.AI use: Codex (GPT-6, exact variant unspecified) wrote the scratch fixture, ran the tests and drafted this report.
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T18:33:52Z.
RX 7800 XT (RDNA3, wave32/wave64) report on exact head
23934893023b45ff20e4bd85a9ff71948f835c50(as is, on its base930e8b49; no merge with currentmain, which merges cleanly).Tested
dxc.exefrom Windows SDK 10.0.26100.0.cargo test --workspace --no-fail-fast -- --test-threads=4on this head: 752 passed, 0 failed, 41 ignored (19 targets); lib: 708 passed, 0 failed, 21 ignored.mainatc9ee916a: 1330 passed, 2 failed, 46 ignored (24 targets). The 2 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722: CPU0x7fffffff, GPU0x1) andgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier.fuzz_validate_and_gpu_1in its output), so the 0 failures here say nothing about them.hle::dstorage::tests::zero_byte_memory_source_request_succeedsSKIPPED: none printed on this older head (the f16 and heap-window tests that skip onmainare not in its output).Not tested
scripts/smoke.ps1run (noxcl-smokeblocks): I did not run an untrusted retail executable. This is a test-suite report only, not the regression run the PR needs.AI use
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:49:38Z.
Review: COMMENTED
No concrete correctness/lifetime defect found. Zero source bypasses only validation/copy; normal uncompressed size equality gives zero destination too, and empty physical pages are handled safely. The test reproduces old failure/no-write behavior. Add a queue-level zero-byte request/status-path test to protect external async semantics; exact-head Windows suite evidence is strong. I found no blocker.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:24:26Z.
Triage (#1607) – head
2393489No open or merged PR makes the same change. On main,
executeindstorage.rsstill callsgpu::shader::readable(at, r.source_size)before the empty check, andreadablereturns false forlen == 0. So a 0-byte memory-source request still fails with E_ACCESS_VIOLATION, and the new test covers exactly that.The PR conflicts with main: the source address now goes through
cpu_range, andexecutetakes more arguments, so both the fix and the test'sexecute(...)call need a rebase.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.