DirectStorage: resolve GPU-view addresses to their paired CPU view #979
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!979
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-979"
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?
@n-romanovich on GitHub · 2026-11-24 09:50 UTC · original
n-romanovich:dstorage/gpu-view-mirrors→main· +327 −33 · 3 files · 1 commits · openA title that reserves paired 64 KiB CPU and GPU views (
VirtualAllocflags0x20402000:PAGE_READWRITE, thenPAGE_NOACCESS | PAGE_GRAPHICS_NOACCESS) maps physical pages into the CPU view while passing GPU-view virtual addresses as DirectStorage request destinations and memory sources. Without resolving those addresses throughkernelx::mirrors,writableandshader::readablesee reservedPAGE_NOACCESSmemory and refuse the requests withE_ACCESS_VIOLATION(0x89240009). Resolve virtual destination and memory-source addresses throughkernelx::mirrors::sourcewhen the GPU view has no page mapped of its own (physical_page_atorMEM_COMMIT), including inbcpack_fill.What is in it
crates/xcl/src/hle/kernelx.rs: addmirrors::overlaps_gpu_viewandmirrors::resolvefor GPU-view reservations without a page mapped of their own (physical_page_atorMEM_COMMIT).crates/xcl/src/hle/dstorage.rs: add per-64 KiB-pagefor_each_mirror_run/mirror_writable/write_virtual_destination/read_virtual_sourceso multi-page and mixed-view spans,execute(includingsnapshot_page_arrayand late zero-entry re-reads), andbcpack_fillresolve GPU-view addresses and re-check/write viaNtWriteVirtualMemory.crates/xcl/src/hle/dstorage/parallel.rs: route file-backed zlib parallel decompression checks and writes throughmirror_writableandwrite_virtual_destination.gpu_view_addresses_read_and_write_their_paired_cpu_view: tests zlib memory-source/destination mirror resolution,XCL_DSTORAGE_BCPACK_FILL(mode 2 / BC2), direct physical-page mappings + cross-page mixed-view reads (withrunner::skip_testif unavailable), and file-backed zlib viaparallel.rs.Tested
Hardware: Windows 11 x64, NVIDIA GeForce RTX 5060 Ti.
cargo test -p xcl --lib dstorage -- --test-threads=4:30 passed; 0 failed; 0 ignoredcargo test --workspace -- --test-threads=4:892 passed; 0 failed; 42 ignoredSKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64),shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode is required),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)Regression run
Main (
5478c4a7c1ae5adba127c8d27018d7fdbf3a8725):PR (
063c281f879e53fb081fc335fcaaefd573f30d28):Not tested
AI use
smoke.ps1runs.@raylitebull on GitHub · 2026-11-24 10:40 UTC · original
Code/CI review only (not independently runtime-tested by me): clean merge and
PR descriptiongreen (just awaiting CI workflow approval). Cleanly resolves DirectStorage GPU-view addresses to their paired CPU view. Recommend approving CI and merging, @ivall.@Filip722 on GitHub · 2026-11-24 11:22 UTC · original · edited 2026-11-24 11:46 UTC
I tested
b8d21b0on XCL main47efa2eplus #640, #793 and #820, using an RTX 5060 Laptop GPU (8 GB, driver 615.78.08) on Bazzite 44 with Proton Experimental11.0-20261112, the vkd3d-proton4522cc1compatibility build from #257 and the #775 dxil-spirv pin.hle::dstorage::tests --test-threads=1(15 tests). Fourteen passed.gpu_view_addresses_read_and_write_their_paired_cpu_viewpassed the zlib source/destination checks and failed at the BC7 debug-fill assertion. On this main, that BC7 request reaches the decoder, which rejects the malformed stream withE_DECOMPRESSION. The solid-fill branch runs on an enqueue refusal.XCL_COHERENT_MB=512,XCL_PAGE_BUDGET_MB=2048,XCL_PSO_WAIT_MS=50andXCL_BIG_COMPILES=1. Both builds showed unlit silhouettes during loading and exited after avkAllocateMemoryaccess violation. The run with this PR recorded zero storage failures through 39,196 executed requests. The comparison recorded 44 failures (0x89240009first on a file request) by 45,904 requests and crashed after 59,883 sampled requests. The patched run ended before it reached a comparable request count, so the retail result is inconclusive for this fix.AI assistance by OpenAI Codex for the build, test and report. Model GPT-6.2-Sol (high).
Visual follow-up: a later run rendered the full loading artwork. The earlier silhouette frames did not establish entry into the playable world.
Focused retest: changing the debug-fill subcase to BC2 exercises the enqueue refusal on current main. With that test-only adjustment, the same
hle::dstorage::tests --test-threads=1suite reported 15 passed and 0 failed under Proton.@SlopTart on GitHub · 2026-11-24 11:55 UTC · original
Linux / AMD RDNA3 run: the new GPU-view/CPU-view pairing test fails deterministically under Wine.
Merged state: head onto main (
a027808lane merge), clean merge, full suite 729 passed / 13 failed / 41 ignored: the known Wine-lane set from #42, this rig's mirror flake, and thexapu_connect_returns_oom...flake from my #943 footnote. The one that does not clear in isolation:hle::dstorage::tests::gpu_view_addresses_read_and_write_their_paired_cpu_view- fails 2/2 isolated, panic atcrates/xcl/src/hle/dstorage.rs:2603: after filling through the GPU view, the paired CPU view's 16-byte chunks don't match the source block (slice::from_raw_parts(fill_dst_cpu...).chunks(16).all(...)is false).Diagnosis lead, not a verdict: on this rig all D3D12.X heaps come through vkd3d-proton's translated/host-visible path rather than real device-memory aliasing, so "resolve GPU-view address to its paired CPU view" has different coherence semantics here than on native Windows or NVIDIA's d3d12-on-Wine lanes. Either the test assumes console-style paired views that vkd3d-proton can't provide (then it should gate like #983's atomics skip), or the pairing code returns a stale/duplicate CPU address on the translated path. Worth one isolated run on a Windows lane to split those two.
Everything else dstorage-related is green in-lane (the batch's
multi_stage...andrequests_are_checked...tests included).Counts only, no game data.
Not tested: retail titles (none here), Windows, RDNA4.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@DavidM1911 on GitHub · 2026-11-24 12:27 UTC · original
Independent verification — the PR's own new test fails standalone on its head
b480ae7(which already contains amainmerge), and identically after merging currentmain384f7f7locally.Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.
cargo test -p xcl --lib dstorage: 14 passed, 1 failed —gpu_view_addresses_read_and_write_their_paired_cpu_view.E_DECOMPRESSION(packed=16, dst=32— "the stream ends early or is corrupt"), sofill_dst_cpunever receives the expected block and thechunks(16) == blockassertion atdstorage.rs:2603fails. The paired GPU→CPU view resolution itself looks right (the request reaches the queue with the resolved destination); the fixture stream appears too short for the destination size, or the test needs thebcpackdecode path to accept it.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
@SlopTart on GitHub · 2026-11-24 12:44 UTC · original
Re-check on the updated head: re-merged
b8d21b0onto current main (lane merge568cb1a) andgpu_view_addresses_read_and_write_their_paired_cpu_viewstill fails, same panic sitedstorage.rs:2603(chunks(16)comparison against the expected BC7 block), same as my comment above and same as the Windows reproduction from DavidM1911 (E_DECOMPRESSIONon the BCPack fill,packed=16, dst=32).So the failure survives the head move and now has three independent confirmations: this Wine/RADV rig, that Windows/NVIDIA rig, on both the old head and the post-main-merge head. It does not look rig-specific or Wine-specific anymore; the destination resolution reaching the queue looks fine on both reports, the decompression/fill step is where the stream dies.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@einfachama on GitHub · 2026-11-24 14:49 UTC · original
Test report for #979 at
b8d21b0, merged locally ontomain47efa2e(no conflicts), on my retail title's world load. Short version: on this title, #979 doesn't change the0x89240009failures. They come in both builds, at the same time in the load, from the same package files and in about the same numbers.Setup
cargo build --release -p xcl).main47efa2e;main+ #979 (b8d21b0merged locally).XCL_NETWORK=0,XCL_ACTIVITY=1,XCL_RUN_SECONDS=100, A pressed at 26 s and 30 s. The title then starts its world load by itself at about 66 s.main/ #979 / #979 /main/main/ #979 / #979 /main, with the same shader caches.DirectStorage … failedcounts in theXCL_ACTIVITY2 s lines.Results
main0x887a0006at 83.5 smainmainmainmain17–754 (median 195), #979 70–4 054 (median 177). All of them are0x89240009, on file-source reads from the title's package files, in one or two 2 s bursts 1–9 s into the world load.main+ #816 (2ffb5a4) twice withXCL_DSTORAGE_FAILURE_DETAILS=1. All 10 records it wrote aresubmit=HalfFull stage=DestinationPages destination=pages, and the destination page array still has its one entry at 0, also on the late reread (dst-snapshot=[1 total/1 zero] … late-reread=Read). These destinations are physical-page arrays, not virtual GPU-view addresses, so #979's change doesn't reach them. That matches what #549 describes. Those records come frommain+ #816 runs, not from #979 runs, so I'm inferring that #979's failures are the same kind from their code, timing and files.0x887a0006(device hung) at 83.5 s, while presents were coming back after the load. In the same session, 1 of 2main+ #816 runs also hung, at 65.3 s. None of the 6mainruns hung (the 4 above and 2 later controls), and neither did 4main+ #549 runs. With 2 hangs in 16 runs, spread over two different PRs, I can't attribute it to #979.1870880, merged locally), in the same session and with the same settings: 0 failed requests in 4 of 4 runs. Its 2 interleavedmaincontrols had 7 and 1 009.E_OUTOFMEMORY. In every run of both builds, the only WARN kind that first shows up after the load starts is thea request failedline. Commit and video memory are the same within the noise: peak commit 26.9–28.4 GB at 96–98 s.Not tested
gpu_view_addresses_read_and_write_their_paired_cpu_view) andcargo test --workspacewere not run on this merge.AI use
@n-romanovich on GitHub · 2026-11-24 18:04 UTC · original
Thanks for the reviews and test reports (@pvfreis, @SlopTart, @DavidM1911, @Filip722, @einfachama).
Rebased onto
main(9e3831e) and updated the PR:gpu_view_addresses_read_and_write_their_paired_cpu_viewsubcase 2 from mode 7 (now decoded onmainsince8cad517) to mode 2 (BC2, withassert!(!crate::hle::bcpack::can_decode(2))), sobcpack_fillexercises the enqueue-refusal path as intended.skip_testfor subcase 3: Addedcrate::gpu::recomp::runner::skip_test(...)when unified memory or title physical pages are unavailable instead of silently skipping.24 GiBto26 GiB + 64 KiBso it does not collide in globalkernelx::mirrorswithtitle_texturestests under--test-threads=4.Verified on Windows 11 (RTX 5060 Ti):
mirror_address(0x89240009), passes with it (dstorage::tests: 18 passed, 0 failed).cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored (3 consecutive runs).xcl-smokeblocks in the PR description for9e3831eandce8acc5.@einfachama: thanks for tracing the
0x89240009burst in your run — indeed,DestinationPageszero-entry arrays are separate from virtual GPU-view addresses (handled by#549).Ready for re-review!
@pvfreis on GitHub · 2026-11-24 18:19 UTC · original
Thanks. Checked at
ce8acc5(read in full): the BCPack subcase uses mode 2 and assertscan_decode(2)is false, and the two skips print. On an RTX 3060, merged ontomain9e3831e(clean),cargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4: 776 passed, 1 failed, 41 ignored (main: 775 / 1 / 41). The one added test isgpu_view_addresses_read_and_write_their_paired_cpu_view, which passes; the one failure is the e2e test, which fails the same way onmainhere (no display in this session). SKIPPED: the two wave64 tests andheap_window_out_of_memory_falls_back_to_the_switch_form. Finding 1 of the review is fixed. Not tested: AMD, a retail title.Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.
@crastinator on GitHub · 2026-11-24 20:59 UTC · original
@n-romanovich retested
8f7dc3aunder Wine on RDNA2. No regression againstmain4178e88, and the new test passes. Details are in my review above (edited), with one leftover doc line from the conflict resolution. I can't merge (I'm not a maintainer), so that's up to the maintainer's batch.@n-romanovich on GitHub · 2026-11-24 20:45 UTC · original · edited 2026-11-24 21:08 UTC
I just rebased onto
main(4178e88) after#819landed (and wiredparallel.rs+ multi-page mixed-view handling into8f7dc3awhile resolving the conflict). Sincedstorage.rsis getting heavy traffic right now, keeping this open much longer will likely force another rebase and re-review cycle for all of us.If
8f7dc3alooks good, ready for a quick approval/merge while the branch is clean so I can move on to the next DirectStorage issues.@JJAutoCompare on GitHub · 2026-11-25 05:38 UTC · original
Empirical test report (8f7dc3a0)
PR #979, “DirectStorage: resolve GPU-view addresses to their paired CPU view,” at
8f7dc3a057001c698bc007ef8432ff40d0f9e39d.Hardware / environment
rustc 1.100.0 (0ef1bc386 2026-11-09). DXC reports1.9.2609.5 (01b62ad47).Commands and results
cargo test --workspace --no-runbuilt the workspace test executables and exited 0.cargo test -p xcl --lib hle::dstorage::tests::gpu_view_addresses_read_and_write_their_paired_cpu_view -- --exactran withXCL_ADAPTER=NONE_CPU_ONLY,RUST_TEST_NOCAPTURE=1, andXCL_DSTORAGE_PARALLEL_DECOMPRESS=1. It exited 0 with 1 passed, 0 failed, 0 ignored, 0SKIPPEDlines, and 864 filtered out. Both commands ran outside the Arc test wrapper.Observed behavior
E_DECOMPRESSION(0x89240030) and wrote the fallback blocks through the paired CPU view.Not tested
The full GPU workspace suite and game smoke runs on main and the PR head were omitted. This run provides focused CPU fixture coverage.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr979-focused.logand published.@thehollowedone on GitHub · 2026-11-25 07:04 UTC · original
Independent Windows check of b986487. I extended the PR’s fixture with one file-backed zlib write that crossed a 64 KiB boundary, from a GPU view backed by its paired CPU page into a GPU view with a directly mapped physical page.
Tested
cargo test --offline --locked -p xcl --lib dstorage -j 3 -- --nocapture --test-threads=1passed twice (31 passed, 0 failed, 0 ignored, 0 runtime skips each).S_OK. Both 512-byte halves matched their distinct expected data. The guard bytes and the second page in the paired CPU view remained intact. The existingBeforeDecodehook recorded one worker decode for this request, confirming the parallel path.Not tested
Workspace suite, retail streaming, or other adapters. Synthetic input only. I have the fixture as a test-only patch if useful.
AI use
Codex (GPT-6.2 Sol) wrote and ran the test extension and drafted this report.
@pvfreis on GitHub · 2026-11-25 22:00 UTC · original
Read at
063c281f(nothing run): no defect found. One thing for your next rebase: #1405 added a page-list read inexecutewith plainread_own(r.destination, …); it needsfor_each_mirror_runlike your other two.AI use: Claude Code (Claude Opus 5.5) read it; Claude Fable 5.2 reviewed the text; checked by a person before posting.
@DavidM1911 on GitHub · 2026-11-26 00:23 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier BCPack fixture failure is fixed.Thanks!
— Devin
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.