D3D12.X: leave uncommitted pages out when publishing a texture download #3549
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3549"
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 BBareth on 2026-11-30T22:48:05Z.
A GPU-written title texture is copied back into the title's memory when its fence completes, and the fence value stays hidden from the title until that copy succeeds.
write_changed_pagesrefused every changed page that was not committed. So a download into memory the title has only reserved (a sparse home not in use) failed on every retry, and its fence never became visible. This change leaves out pages that are reserved and settled, and free pages, since the title cannot read them. Committed pages that are read-only or guarded still fail closed and retry, as before.A reserved page is left out only when it is settled.
MapTitlePhysicalPagesunmaps what an address holds before it commits the new page, under kernelx'sAWAYlock. So a page is skipped only when that lock is free, no physical page is kept there, and the page is still not committed (kernelx::settled_uncommitted, which never blocks). Otherwise the download retries as before, and a page committed in between is written. A mapped physical page that XCL keeps reserved until its first use (kernelx::lazy) is readable by the title, so it is committed and written.In a retail title (part of #505) this hung the game when the world loaded. From 522 s, every retry of two downloads (0x20000 and 0x10000 bytes) found
MEM_RESERVEpages. The title's frame-pacing wait on that fence spun, submits stopped at 528 s, and the title's own GPU watchdog crashed it at 552 s. #3550 hits the same refusal sooner (crash at ~161 s) and depends on this PR: https://github.com/xcl-dev/xcl/pull/3550#issuecomment-7364038479The writes for textures over pages the title mapped (
CopyPageMappingsBatchX, themapped_homespart of the earlier revision) are taken out of this PR. They come back in a separate PR that addresses the review points on them.What is in it
crates/xcl/src/hle/d3d12x/title_textures.rs,write_changed_pages:kernelx::lazy::ensureon a reserved run, ascpu_writesand DirectStorage do before their writes;kernelx::settled_uncommittedsays they are settled, and retries otherwise;note_download_page_left_out: the first two, then at powers of two).crates/xcl/src/hle/kernelx.rs:settled_uncommitted(atry_lockofAWAY; a page kept inAway::atis never "uncommitted").write_changed_pages_leaves_out_pages_the_title_has_not_committedwrite_changed_pages_commits_a_lazy_page_and_writes_itwrite_changed_pages_waits_for_a_mapping_call_in_progress(a call holdingAWAYholds the download back until it ends)write_changed_pages_writes_a_page_committed_while_it_looked(a page committed between the query and the skip takes the bytes)Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4onfc7abe51(on main078358a0): 3010 passed, 0 failed, 52 ignored.SKIPPEDon this adapter, 28 in all:no wave64no heap windowsno d3d12SDKLayers.dllno D3D12 debug layerreserved pages must not hold the download back) and passes with it.XCL_RESIDENCY_PRIORITY=1:078358a0+ #3550 + this fix: 3 of 3 runs without a crash (3510, 3649 and 3956 frames); 64 to 128 pages left out per run, the first at 136 s.c53e9696+ #3550 alone: 3 of 3 crashed at 161 to 163 s.Regression run
Each run follows one warm-up run of the same build; the A button is pressed once at 70 s.
Not tested
CopyPageMappingsBatchX) still has its download written at its own address, a reserved GPU view. Its reserved pages are now left out, so its fence becomes visible without the GPU's bytes reaching the pages the title reads. Onmain, that download never completed and its fence stayed hidden. Writing those pages where they are kept is the follow-up PR.AI use
AWAYcheck, its tests and this description, and ran the suite, the smoke runs and the retail-title runs above.🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Gevroska on 2026-12-01T01:50:27Z.
I reproduced the reserved-page behavior on a pre-fix diagnostic build with Windows WARP. Once the texture readback completed, the native fence was at
11, but the fence visible to the title stayed at10while the destination was reserved. After I committed that memory and retried, the title saw11and all 4,096 texels matched the expected value.I also checked whether that pattern appeared during the RTX 3080 loading stall I reported in #505. On driver
32.0.16.1692, the instrumented build recorded six successful texture publications and zero refusals for reserved or free pages across 448 samples. The retail game still reached a black screen. That gives me a reproduction of the fence behavior in WARP, but no evidence tying it to this particular retail run.Next I’ll run the same mixed-page download on the PR’s parent and head
3cf3ebb4. I’ll keep one page reserved throughout and check two things after readback completes: whether the title sees fence11, and whether the committed page contains the expected bytes. I’ll also run a fully committed control on both revisions.AI disclosure — Codex GPT-6.2 Sol ran the initial diagnostics. GPT-6.2 Astra drafted this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T04:24:33Z.
Source review on head
3cf3ebb4: the new reserved-page skip can make a download appear complete while a mapped physical page still has its old bytes.This is distinct from an unused reservation. XCL's existing page-mapping fixture reserves a GPU-view VA, maps one of its pages to a committed physical pool page, and reads the pool's
0x5abytes throughmirrors::resolve.source_ofkeeps the GPU-view VA and marks it paged. Butprepare_downloadsuses that raw VA as the destination, andpublish_downloadcallswrite_changed_pageson it. The newMEM_RESERVEbranch skips that VA, returns success, and clears the GPU writer; the committed pool page is never updated. The title can read stale pool bytes after its fence becomes visible, without any later commit or remap.The publication path needs to distinguish a genuine unmapped hole from a reserved view with a mapped physical home. For a paged texture, resolve each destination page as uploads do, write changed bytes to the committed backing page, and skip only holes. Tie that resolution to the queue's mapping order so a remap cannot silently send the result to the wrong home before the writer is retired. A focused regression can extend the existing mapped-pool fixture with a GPU write and fence, then assert the pool bytes match the GPU result when the title sees completion. Keep the direct-reservation test too. This is a source trace; I did not run that new GPU regression.
AI use: Codex (GPT-6.2 Sol) checked the publication path; Codex (GPT-6.2 Astra) independently traced the mapped-page case and regression.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T04:31:42Z.
Follow-up to the mapped-page finding, on head
3cf3ebb4: a repair that resolves the physical destination only when the readback is published also needs to reject a later page mapping.The source permits this sequence: a queue submits a GPU write while a GPU-view page shows physical page A; a later
CopyPageMappingsBatchXmakes the same view page show B; then the earlier readback completes.mapping_changedclearsgpu_writtenwhen the mapping call is newer, but leavesgpu_writersintact.download_writesanddownload_currentstill accept that writer: the resource generation and rawentry.srchave not changed. Resolving the destination at publication would therefore write A's GPU result into B's backing page.The publication invariant should include page identity at the writer's queue position, not just resource generation and address. A later A→B remap must not send A's GPU result into B. If A remains live, its earlier write still needs publication to A; that may require taking the readback before the remap changes the resource's tiles. If A merely moves, publication should follow A to its current home. A focused regression should check both physical pages after A→B before fence publication, plus a move of A's backing address without a remap. This is a source-derived schedule; I have not run the new GPU regression.
AI use: Codex (GPT-6.2 Sol) traced the mapping and download lifecycle.
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T07:28:42Z.
Thanks for both findings; I checked them against the source and they hold. Head is now
069739d3.currentwas read from the wrong place too. A paged texture now carries the homes of its pages (kernelx::mirrors::resolve) fromprepare_downloadstopublish_download; the current bytes are read through them andwrite_changed_mapped_pageswrites each 64 KiB page where it is kept. A page that shows nothing takes no bytes. A page never named goes to the CPU view, where the reserved-page skip still applies.TEXTURESlock, and a page whose home differs from the one at preparation is not written. So A's result cannot reach B.Limits, also under Not tested in the description:
a_download_over_mapped_pages_is_written_where_they_are_keptcovers the write function on the existing mapped-pool fixture (pool page written, unmapped page skipped, remapped page left alone). There is no GPU test that drives a paged download through its fence, and no retail run with this part.Suite on
069739d3: 2891 passed, 0 failed, 51 ignored, 28 SKIPPED lines (as before). The smoke blocks in the description are rerun on this head.AI use: Claude Code, Claude Fable 5.2 checked both points against the source, wrote the change and this reply, and ran the tests.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:14:28Z.
merge-check
base:
7d86c5d2b7head:
069739d3b7merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2898 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: re-reviewed at
069739d3(one squashed commit, +86 since3cf3ebb4). A paged texture now records where each of its pages is kept (mapped_homes) when the download is prepared (prepare_downloads~3895), and on publish reads through that page table and writes with the newwrite_changed_mapped_pages(~4118), skipping pages that are unmapped or mapped elsewhere since preparation; this fixes my earlier point about paged targets falling back to the GPU-view address. Findings: (1) a page remapped after preparation loses the GPU's bytes at its old page too, and the fence is still published (~4010, ~4129); the PR lists this under Not tested. (2) Skipped and remapped pages are still dropped without a log line. (3) The comment at ~4052 still says every changed page must be committed. Fine: paged downloads are read and written through the same page table uploads use, bit-0 entries (pages the title never mapped) go to the CPU view, the page lookups underTEXTUREStake locks in the order the upload code already uses, a skipped region can't loop, read-only and guard pages still fail closed, and the new tests follow the existing patterns.performance: 60 s smoke of a retail title, main
7d86c5d2vs this merge (d7c56bde): 1663 -> 1684 frames shown (101 %; last presents per 2 s: 60 60 61), peak commit 17153 -> 17213 MB, 0 device removals, 0 crashes.verdict: safe to merge (a one-time log for skipped or remapped pages, and fixing the stale comment, would make it easier to follow)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Gevroska on 2026-12-01T08:27:51Z.
I finished the Windows WARP comparison I mentioned above, using the same two-page texture download on parent
ff0c364band PR revision3cf3ebb4. I kept the first page writable and the second page reserved throughout the test.While readback was pending, the native fence was
11and the title-facing fence stayed at10on both revisions. Once readback completed, all 4,096 bytes on the writable page matched on both. The difference was the title-facing fence: it stayed at10on the parent and advanced to11on3cf3ebb4while the second page was still reserved. In the fully committed control, both revisions copied all 8,192 bytes correctly and advanced the fence to11.This verifies the mixed-page fix in the synchronous fence-refresh path on WARP. The PR has since advanced to
069739d3, which I haven’t tested.AI disclosure — Codex GPT-6.2 Sol ran the comparison. A separate GPT-6.2 Sol agent verified the test source and original run logs. GPT-6.2 Astra drafted this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T09:39:35Z.
Follow-up to the merge check above, head
a615e1b1: the two optional points are in.D3D12.X: a texture download left out a page at ... (not committed | mapped elsewhere since; N so far)), for the first two and then at powers of two.write_changed_pagesno longer says every changed page must be committed.No other change. Suite on
a615e1b1: 2891 passed, 0 failed, 51 ignored, 28 SKIPPED lines. The smoke blocks in the description are rerun on this head (the 120 s run logged no such line).AI use: Claude Code, Claude Fable 5.2 wrote the change and this comment and ran the tests.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:41:35Z.
Re-review (head
a615e1b1; the range-diff from069739d3, which I merge-checked, read). Both suggestions are in. A page left out is now logged, the first two and then at powers of two (note_download_page_left_out), for "not committed" and "mapped elsewhere since". The doc comment ofwrite_changed_pagesnow says only committed pages must be writable. The branch restructuring in the mirror loop is equivalent to before apart from the log call, so my earlier merge-check (suite and smoke on069739d3) still describes this head.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:12:26Z.
Triage (#1607) – head
c3a9139No open or merged PR makes the same change.
write_changed_pagesnow skips only plain reservations: a reserved page marked bykernelx::lazyis committed withlazy::ensureand then written (c3a91393), andwrite_changed_pages_commits_a_lazy_page_and_writes_itcovers it.The PR also does two things (the reserved-page skip and the paged-texture download), and #3550's new test builds a
ReadyDownloadwithout thepagesfield this adds, so whichever lands second needs an update.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T10:44:58Z.
On the triage note above (lazy pages): confirmed in the source, and fixed in
c3a91393.A mapped physical page that is still zero stays
MEM_RESERVEuntil its first use (kernelx::lazy), and the title can read it, so the skip dropped the GPU's bytes for it.write_changed_pagesnow callskernelx::lazy::ensureon a reserved run before it decides to skip, ascpu_writesand DirectStorage do before their writes: a lazy page is committed and written, a plain reservation is still left out. New testwrite_changed_pages_commits_a_lazy_page_and_writes_it.On the two other points: the PR does carry two things since the review (the reserved-page skip and the paged-texture download); they are the same refusal in
publish_downloadand I kept them together, but I can split them if the maintainer prefers. And yes, whichever of this and #3550 merges second needs thepagesfield in that test'sReadyDownload; I will rebase the second one.Suite on
c3a91393: 2892 passed, 0 failed, 51 ignored, 28 SKIPPED lines. The smoke blocks in the description are rerun on this head.AI use: Claude Code, Claude Fable 5.2 checked the point against the source, wrote the change and this comment and ran the tests.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T11:52:36Z.
merge-check
base:
493dbd3dd0head:
c3a91393d3merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: re-check of the new head (the 34-line diff from
a615e1b1read; my merge-check of069739d3covers the rest). A pageVirtualQueryreports as reserved is now first offered tokernelx::lazy::ensurefor the rest of its changed run, then queried again (title_textures.rs~4076-4081). A mapped physical page that is only reserved until its first use is committed and written, and a plain reservation is still left out. Findings: none blocking. Theaddress >= ensuredguard meansensureruns at most once per run, so a reservation thatensuredoesn't commit falls through to the skip branch rather than looping. Minor: it costs one moreVirtualQueryper lazy run on the download path. Fine: the new test builds a committed, a lazy and a plain-reserved page side by side and checks that the first two get the GPU's bytes while the third stays reserved; it fails without the change (the lazy page was skipped).performance: 60 s smoke of a retail title, main
493dbd3dvs this merge (41403968): 1670 -> 1679 frames shown (100 %; last presents per 2 s: 60 60 60), peak commit 17083 -> 17313 MB, 0 device removals, 0 crashes.verdict: safe to merge
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by gut0to on 2026-12-01T15:03:14Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4007Could the mapping identity stay protected through these writes, or be revalidated under the same synchronization immediately before each write?
mapped_homes()callsmirrors::resolve(), which returns a snapshot after releasing the page-map locks;apply_batches()can change the mappings afterward. If it remaps a GPU-view page afternowis collected but before this loop writes the capturedhomesaddress, the stale download can write into a physical page whose mapping/ownership has since changed. Comparing againstnowcloses changes that happened before the snapshot but leaves this check-to-write window. Please serialize the write with mapping updates or add a per-page revalidation that cannot race.Imported from ivall/xcl. Originally posted by gut0to on 2026-12-01T15:03:14Z.
Review: COMMENTED
AI-assisted review: I traced the texture-download publication path and the page-mapping update path in the current head. I used AI assistance; I did not run a concurrency test.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T13:14:25Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4010High:
mapped_homes(...).unwrap_or_default()turns "no table now" into an emptynow, sowrite_changed_mapped_pagestreats every page as "mapped elsewhere since", including never-named (bit 0) pages that still go to the CPU view. It skips them all and returns true. Suppose the download is prepared while the entry is paged, and before publishresolvereturns None for the range (e.g.recheck_sourceflipped the entry topaged=falsewithsrcunchanged becausemirror_source(va)==va, or the record's pages went).download_currentonly checks generation/src/writers, so it passes,nowis[], and the result is Ok(true). The title's fence is published with none of the GPU's bytes written anywhere. Before this PR this case failed and retried. Treating a missing table as "not current" (retry) would keep it failing closed.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T13:14:25Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4151High: When several GPU-view pages share one home (range kind 1: pool page
startat each ofcountpages), each is written from its own staleoldslice, and only bytes that differ from that stale copy are written, so the pool page ends up mixing several pages' GPU data. If view pages 0 and 1 both map pool page P,currentread P for both before any write. Page 0's write changes P. For page 1, the bytes where new1 == old (P as it was before page 0's write) are left as page 0's bytes, so P holds neither page's result. Writing each home once, from the last view page that maps it (or comparing against the live bytes), would avoid the mix.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T13:14:25Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4082Medium: Pages in MEM_RESERVE/MEM_FREE are now skipped for good where they used to fail and retry, so a page the title is committing at that moment loses the GPU result permanently. If the title thread is in
VirtualAlloc(MEM_COMMIT)on a texture page the GPU just wrote, the poller'sVirtualQuerysees MEM_RESERVE, skips the page and publishes the fence, and the title then reads the newly committed page as zeros instead of the GPU output. Before, the next retry would have written it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T13:14:25Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 3895Medium: Not certain about this one: for a paged entry where
mapped_homesreturns None at prepare (e.g. the view's pages were released betweentouchedandresolve),pagesfalls back to None, so publish reads and writes the GPU-view reservation (NOACCESS/MEM_RESERVE) directly. With the new reserved-page skip,currentreads zeros, every changed page is skipped, Ok(true) is returned, and the fence goes up with the download lost, where before it failed closed.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T13:14:25Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4152Medium: Not certain about this one: the "mapped elsewhere since" check is a TOCTOU race.
nowis computed once, then the writes run without holding the mirrors/pages lock. If publish computesnow == wasfor page k and another thread'sCopyPageMappingsBatchXthen remaps pool page P to a different GPU-view page,write_changed_pages(P+off)writes the old texture's GPU bytes into P, which now backs another resource. That's the corruption the function's doc says it prevents.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T13:14:25Z.
Review: COMMENTED
Review of
c3a91393: 6 finding(s) (3 high, 3 medium), most severe first.crates/xcl/src/hle/d3d12x/title_textures.rs:4010:mapped_homes(...).unwrap_or_default()turns "no table now" into an emptynow, sowrite_changed_mapped_pagestreats every page as "mapped elsewhere since", including never-named (bit 0) pages that still go to the CPU view. (inline)crates/xcl/src/hle/d3d12x/title_textures.rs:4151: When several GPU-view pages share one home (range kind 1: pool pagestartat each ofcountpages), each is written from its own staleoldslice, and only bytes that differ from that stale copy are written, so the pool page ends up mixing several pages' GPU data. (inline)crates/xcl/src/hle/d3d12x/title_textures.rs:3877: see below.crates/xcl/src/hle/d3d12x/title_textures.rs:4082: Pages in MEM_RESERVE/MEM_FREE are now skipped for good where they used to fail and retry, so a page the title is committing at that moment loses the GPU result permanently. (inline)crates/xcl/src/hle/d3d12x/title_textures.rs:3895: Not certain about this one: for a paged entry wheremapped_homesreturns None at prepare (e.g. (inline)crates/xcl/src/hle/d3d12x/title_textures.rs:4152: Not certain about this one: the "mapped elsewhere since" check is a TOCTOU race. (inline)On lines outside the diff:
crates/xcl/src/hle/d3d12x/title_textures.rs:3877: Not certain about this one:download_currentand thesubmit_prepared_downloadscheck never compareentry.pagedor the page table with the snapshot, so a download prepared with one way of reaching the pages can be published with the other. Prepare runs withpaged=false(pages=None). ThenCopyPageMappingsBatchXtouches the view andrecheck_sourcesetspaged=truewithout bumping the generation (src stays va). Publish writes throughwrite_changed_pages(va): reserved GPU-view pages are now silently skipped instead of failing, the pool pages the texture really reads never get the GPU result, and the fence is released.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:11:28Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-12-02T17:13:18Z.
Linux / AMD RDNA4 (RADV, Wine + vkd3d-proton): full test suite on
c3a9139Merged onto
main5eaadb54(clean merge) and compared withmainrun twice on the same machine.Setup
v3.1-83-gcae8353edand DXVKdxgi.dllfrom GE-Proton11-16, DXC 1.9.2609.5x86_64-pc-windows-msvcwithcargo-xwin; test binaries run under WineTested:
cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-fail-fast -- --test-threads=4 --skip <31 tests>main5eaadb54main: none.write_changed_pages_leaves_out_pages_the_title_has_not_committed,write_changed_pages_commits_a_lazy_page_and_writes_it,a_download_over_mapped_pages_is_written_where_they_are_kept).main:gpu::recomp::tests::gpu_qsad_and_mqsad,gpu::recomp::tests::gpu_split_wave64_cross_half_operations(flaky onmainunder Wine).About the failures on
mainand the 31 skipped tests (same for every PR in this batch)main's 177 failures under Wine come from #175: once a test has set up the real device, vkd3d-proton refuses the command allocators XCL adopts (d3d12_command_list_Reset: Invalid command allocator), and later tests getE_INVALIDARG(0x80070057). Running vkd3d-proton master with its vtable check taken out,hle::d3d12x::sparse::testsgoes from 106 passed / 38 failed to 144 / 0.std::terminate()(Cannot reliably convert LLVM pointer type, we cannot differentiate between Function and Private), which kills the whole test binary. They are the split-wave64, dispatch-chain and bridged-mask GPU tests,gpu_compute_mode_dispatch_abi,gpu_compute_thread_limits_leave_the_lanes_past_them_out, the twogpu_mesh_mode_*tests, andconsole_wave64_compute_through_the_pso_hook_dispatch_and_read_back, plusserialize_root_signature_strips_console_flags_and_preserves_pc_flags, whose null descriptor vkd3d-proton dereferences. The dxil-spirv ones crash the same way with vkd3d-proton master (f8c1cae8, dxil-spirv93ab44c5).mainwas run twice: same counts, same failure set.SKIPPEDlines (same asmain): no heap windows (2), no D3D12 debug layer (2-3), driver cache control not implemented in vkd3d-proton (1).Not tested: Windows, NVIDIA, a retail title /
scripts/smoke.ps1, a review of the diff. This is a test report, not amerge-check.AI use: omp (Claude Opus 5.5) merged, built and ran the suites on this machine, compared the results with
main, and drafted this report. The user asked for it to be posted.Imported from ivall/xcl. Originally posted by throny on 2026-12-03T01:24:06Z.
Test report (not a merge check): with #3550 on top, main
078358a05+ this PR (c3a91393) ran a 300 s world run of the retail title on an RTX 4080 with no crash, no device removal and no Aftermath dump, 2.90 presents/s. Without this PR, #3550 crashes here about 100 s in. Details on #3550. AI use: Claude Code (Claude Opus 5.5).Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T01:35:35Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4010The mapped-page writes (
mapped_homes,write_changed_mapped_pages) are no longer in this PR as offc7abe51; they come back in a separate PR. There a missing table at publication will count as "not current" and retry, as you suggest, instead of treating every page as moved.Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T01:35:37Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4151The mapped-page writes (
mapped_homes,write_changed_mapped_pages) are no longer in this PR as offc7abe51; they come back in a separate PR. There each home is written once, from the last view page that maps it, compared against its live bytes.Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T01:35:39Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4152The mapped-page writes (
mapped_homes,write_changed_mapped_pages) are no longer in this PR as offc7abe51; they come back in a separate PR. The follow-up has to revalidate each page's home under the mapping lock right before its write, not against a snapshot taken earlier.Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T01:35:41Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4007The mapped-page writes (
mapped_homes,write_changed_mapped_pages) are no longer in this PR as offc7abe51; they come back in a separate PR. Agreed on the window between the snapshot and the write. In the follow-up each page's home is checked under the same lockapply_batchestakes, immediately before its write.Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T01:35:43Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 3895The mapped-page writes (
mapped_homes,write_changed_mapped_pages) are no longer in this PR as offc7abe51; they come back in a separate PR. What is left of this case: a paged texture's download is written at its own address (the reserved GPU view), as onmain. Its reserved pages are now left out, so the fence becomes visible without the GPU's bytes reaching the pool pages. Onmainthat download failed on every retry and the fence stayed hidden. This is listed under Not tested in the description; writing those pages where they are kept is the follow-up.Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T01:35:44Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 4082Addressed in
fc7abe51. A reserved page is left out only when it is settled:kernelx::settled_uncommittedtakesAWAYwithtry_lock(the lockMapTitlePhysicalPagesholds while it unmaps and commits). If a mapping call is in progress, the download retries. If a physical page is kept for the address (Away::at), it is not treated as uncommitted. Otherwise the page is queried again under the lock, and a page committed in between is written. Tests:write_changed_pages_waits_for_a_mapping_call_in_progressandwrite_changed_pages_writes_a_page_committed_while_it_looked. A page the title commits after the skip is a new physical page; on the console it does not hold what the GPU wrote while it was unmapped either.Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T01:36:05Z.
Updated to
fc7abe51(rebased on main078358a0). Suite, smoke blocks and GTA 6 runs are in the description. Thanks @throny for the 4080 run with #3550 on top. It matches mine: 3 of 3 runs clean here with the updated fix.@bmjask, on point 3 (outside the diff): this PR no longer has a paged path.
download_currentdoesn't need to comparepaged, because a download is always written atentry.srcas onmain. What remains is the case you describe at the end: a paged texture's reserved GPU-view pages are now left out, so its fence goes up without the GPU's bytes reaching the pool pages. Onmainthat download failed on every retry and its fence stayed hidden. I've listed it under Not tested. The follow-up PR that writes those pages where they are kept will also checkpagedand the page table against the snapshot.Points 1, 2, 5 and 6, and the point from @gut0to, were on the mapped-page writes, which are taken out of this PR. Point 4 is addressed by the
AWAYcheck; replies are in the threads.AI use: Claude Code (Claude Opus 5.5) wrote the change, ran the tests and runs, and wrote these replies.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T01:39:20Z.
Follow-up review of
fc7abe51, sincea615e1b(code reading only, not a merge-check) · 2 mediumIn short: Since
a615e1b1(merge-checked atc3a91393), the PR no longer does the download for textures over mapped pages:mapped_homes,write_changed_mapped_pagesandReadyDownload.pagesare gone. The description says that part will come back in a separate PR, not open yet. What remains is the reserved-page skip, now bounded to the end of the 64 KiB page and gated onkernelx::settled_uncommitted, plus thelazy::ensurestep, a test hook and two new tests. Nothing blocks it. Dropping the mapped-page part changes what happens to paged textures, though, and the new 64 KiB bound has no test.Medium
Paged textures now publish without the GPU's bytes and are no longer treated as GPU-written.
targetisentry.src, the reserved GPU view (title_textures.rs~3925,source_of~716). Every changed page there is left out, sopublish_downloadsucceeds. Not tested says so.gpu_writersand setsgpu_written = false(~4036-4042). After that the texture can be uploaded again from title memory, for examplependingon uncover (~425). Those pages never got the GPU's output, so such an upload can put stale bytes over the GPU's result in the PC texture.mainthe texture stayed GPU-owned.Fix: until the follow-up lands, keep
gpu_writtenset when a paged entry's download wrote nothing, or say in the description that this can happen.The 64 KiB bound on the skip has no test.
skip_tois capped at the end of the 64 KiB page (~4102), so the next page is checked again on its own. In all four tests the reserved region already ends at or before a 64 KiB boundary, so removing.min((address & !(PAGE - 1)) + PAGE)fails none of them. Fix: reserve two 64 KiB pages, use theBEFORE_LEAVING_OUThook on the first left-out page to commitbase + PAGE, and check the second page takes the GPU's bytes.Checked and fine
note_download_page_left_out, the first two then at powers of two, ~4149).write_changed_pagessays only committed pages must be writable, and describes the lazy-page case (~4069-4074).mapped_homespath, which is gone. So is thepagesfield that conflicted with #3550's test.MapTitlePhysicalPages,XMemMapPhysicalPagesScatterandFreeTitlePhysicalPagesholdAWAYfor the whole call, souncommittedis asked while no mapping call is between its unmap and its commit.settled_uncommittedreturningNone(anyAWAYholder) makeswrite_changed_pagesreturn false. The fence stays hidden and the publish is tried again on the next query. It usestry_lock, so it cannot deadlock underTEXTURES.Away::atthat is still reserved (a lazy commit in progress on another thread) returnsSome(false), then is written or retried, never skipped.ensuredmakeslazy::ensurerun at most once per run.skip_tois always pastaddress, so the loop cannot spin. Committed read-only or guarded pages still fail closed.BEFORE_LEAVING_OUTandwith_mapping_callare#[cfg(test)]only. The two new tests check theNonepath and the re-query afterSome(false).Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by throny on 2026-12-03T02:35:39Z.
merge-check
base:
078358a05head:
fc7abe517merge: clean (trial merge into main
078358a05)build: cargo build --workspace -> ok
tests: cargo test --workspace -- --test-threads=4 -> 3010 passed, 0 failed, 52 ignored; 25 SKIPPED (no wave64 and similar); failing: none
title run: retail title, RTX 4080, main
078358a05+ this head + #3550 on top, 300 s in the world (run 517), no crash, no device removal, no Aftermath dump, 2.93 presents/sreview: whole diff read (title_textures.rs write_changed_pages, kernelx.rs settled_uncommitted). Uncommitted (reserved or free) pages are left out to the end of their 64 KiB page at most. A lazy page is committed and written. While a mapping call is in progress (AWAY lock held), the write retries instead of leaving the page out, and a page that becomes committed meanwhile is written. The logging is bounded (first two, then powers of two). Tests cover leaving out, the lazy commit and the in-progress wait. Nothing found.
performance: no measurable cost (2.93 presents/s, as main on this machine)
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300 / Claude Code with Claude Opus 5.5 (trial suite, world run, diff review)
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T03:09:53Z.
The mapped-page part taken out of this PR is now #3759, stacked on this one. It writes a paged texture's download where each page is kept, and it addresses the points raised on its first form:
pagedand the homes are compared with the prepare-time snapshot;AWAY.It also includes the suite and smoke blocks for its head commit.
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.