D3D12.X: compare the pages a mapping changed under a texture before upload #3482

Open
Foniass wants to merge 2 commits from upstream-pr/3482 into main
Foniass commented 2026-11-30 00:10:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-30T00:10:08Z.


Stacked on #3477 (same file); only the top commit (2b0ef63e) belongs here.

Port of raylitebull's amd-dev commit 02ceae64. When CopyPageMappingsBatchX changes the pages under a texture read through its pages, those 64 KiB pages went up again without comparison, because no write watch fires for a clean pool page newly mapped. In a retail title's open world on amd-dev (RX 9070 XT), about 4,400 textures per 1,024 submits went up again that way, next to 2 GB of uploads.

The changed pages are now compared with the hashes of what the PC texture got at its last upload, the same comparison CPU-written pages get, and only those that differ go up. A page whose hash is unknown counts as different. Render targets, UAVs and textures whose GPU write gives way to the mapping still go up without comparison. XCL_TEXTURE_REMAP_COMPARE=0 restores the old behaviour.

A main bug this fixes on the way. Main clears gpu_written once the GPU's bytes are copied back (publish_download), but it kept the page hashes from the upload before the GPU write. A page that later held those old bytes again would look "the same", and the PC texture would keep the GPU's texels. That applies to remapped pages, and already on main to CPU-written ones. A published GPU write now makes the texture's page hashes unknown (texture_upload::unknown). The cost: after a copy-back, the next CPU write to that texture sends it whole instead of only its changed pages. That cost is not measured.

What is in it

  • crates/xcl/src/hle/d3d12x/title_textures.rs: the comparison in mapping_changed / the upload selection (texture_needs_upload), unknown on a published GPU write, tests remapped_pages_are_compared_with_what_they_held and a_remapped_page_of_a_texture_the_gpu_wrote_is_not_taken_for_what_it_held
  • crates/xcl/src/hle/d3d12x/texture_upload.rs: the hashes used by the comparison
  • Port: amd-dev's XCL_GPU_WRITE_STAYS (c06cf419) is not ported (main has its own GPU-write copy-back), so its early return is left out; the upload breakdown line is the stacked follow-up.

Tested

  • NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke
  • cargo test -p xcl --lib -- title_textures texture_upload: 77 passed, 0 failed, 1 ignored. Each new test fails without its change: without the comparison, and without the unknown() call.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 2b0ef63e, rebased on main 86e86fcb (5070 Ti): 2892 passed, 0 failed, 51 ignored. SKIPPED: 28 notices, almost all no wave64 (the others: no D3D12 debug layer, heap windows off, driver cache needs Developer Mode). The narrower runs listed here are from before the rebase.
  • Retail title: 60 s smoke run below. The run doesn't reach this code: the log's CopyPageMappingsBatchX line says 0 textures read again for a changed mapping.

Regression run

main:

xcl-smoke v1
commit: 86e86fcb33f94fa5d0c809d9b50af7b84bf49cce
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1608 (PresentX 1608)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15766 MB

this PR:

xcl-smoke v1
commit: 2b0ef63e5286e1b3f519940456cc096d36ff636c
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1607 (PresentX 1607)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16972 MB

Not tested

  • The open world, where the remaps happen; the 2 GB figure is amd-dev's
  • AMD GPUs
  • The tests check the bookkeeping and changed(), not an upload on a device

AI use

  • Claude Code with Claude Opus 5.5: ported the commit to main without its XCL_GPU_WRITE_STAYS dependency, found and fixed the stale hashes after a copy-back, wrote the extra test, ran the tests and the smoke runs, wrote this description.
  • Original code: raylitebull's amd-dev 02ceae64.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5556654178 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3482). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-30T00:10:08Z. --- Stacked on #3477 (same file); only the top commit (`2b0ef63e`) belongs here. Port of raylitebull's amd-dev commit `02ceae64`. When `CopyPageMappingsBatchX` changes the pages under a texture read through its pages, those 64 KiB pages went up again without comparison, because no write watch fires for a clean pool page newly mapped. In a retail title's open world on amd-dev (RX 9070 XT), about 4,400 textures per 1,024 submits went up again that way, next to 2 GB of uploads. The changed pages are now compared with the hashes of what the PC texture got at its last upload, the same comparison CPU-written pages get, and only those that differ go up. A page whose hash is unknown counts as different. Render targets, UAVs and textures whose GPU write gives way to the mapping still go up without comparison. `XCL_TEXTURE_REMAP_COMPARE=0` restores the old behaviour. **A main bug this fixes on the way.** Main clears `gpu_written` once the GPU's bytes are copied back (`publish_download`), but it kept the page hashes from the upload before the GPU write. A page that later held those old bytes again would look "the same", and the PC texture would keep the GPU's texels. That applies to remapped pages, and already on main to CPU-written ones. A published GPU write now makes the texture's page hashes unknown (`texture_upload::unknown`). The cost: after a copy-back, the next CPU write to that texture sends it whole instead of only its changed pages. That cost is not measured. **What is in it** - `crates/xcl/src/hle/d3d12x/title_textures.rs`: the comparison in `mapping_changed` / the upload selection (`texture_needs_upload`), `unknown` on a published GPU write, tests `remapped_pages_are_compared_with_what_they_held` and `a_remapped_page_of_a_texture_the_gpu_wrote_is_not_taken_for_what_it_held` - `crates/xcl/src/hle/d3d12x/texture_upload.rs`: the hashes used by the comparison - Port: amd-dev's `XCL_GPU_WRITE_STAYS` (`c06cf419`) is not ported (main has its own GPU-write copy-back), so its early return is left out; the upload breakdown line is the stacked follow-up. **Tested** - NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke - `cargo test -p xcl --lib -- title_textures texture_upload`: 77 passed, 0 failed, 1 ignored. Each new test fails without its change: without the comparison, and without the `unknown()` call. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on 2b0ef63e, rebased on main 86e86fcb (5070 Ti): 2892 passed, 0 failed, 51 ignored. SKIPPED: 28 notices, almost all `no wave64` (the others: no D3D12 debug layer, heap windows off, driver cache needs Developer Mode). The narrower runs listed here are from before the rebase. - Retail title: 60 s smoke run below. The run doesn't reach this code: the log's `CopyPageMappingsBatchX` line says 0 textures read again for a changed mapping. **Regression run** main: ``` xcl-smoke v1 commit: 86e86fcb33f94fa5d0c809d9b50af7b84bf49cce gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1608 (PresentX 1608) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15766 MB ``` this PR: ``` xcl-smoke v1 commit: 2b0ef63e5286e1b3f519940456cc096d36ff636c gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1607 (PresentX 1607) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16972 MB ``` **Not tested** - The open world, where the remaps happen; the 2 GB figure is amd-dev's - AMD GPUs - The tests check the bookkeeping and `changed()`, not an upload on a device **AI use** - Claude Code with Claude Opus 5.5: ported the commit to main without its `XCL_GPU_WRITE_STAYS` dependency, found and fixed the stale hashes after a copy-back, wrote the extra test, ran the tests and the smoke runs, wrote this description. - Original code: raylitebull's amd-dev `02ceae64`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fromthemoonx commented 2026-12-02 02:00:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-02T02:00:33Z.


merge-check
base: 1c8b551475
head: 2b0ef63e52
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2912 passed, 0 failed, 51 ignored (base: 2909 passed, 0 failed, 51 ignored); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none
review: read this PR's commit 2b0ef63e on top of #3477 (d8c75c5c, which my merge-check on #3477 covers). No correctness problem found.

  • A mapping change under a texture read through its pages now goes to texture_upload::recheck, and its next upload compares those pages with the hashes of what the PC texture last got. Before, they went up whole. A render or UAV target, a texture the GPU wrote, and XCL_TEXTURE_REMAP_COMPARE=0 keep the old whole upload.
  • A published GPU write now makes the texture's page hashes unknown (texture_upload::unknown), so old bytes mapped again are not taken for what the PC texture holds.
  • Each 30 of 30 alone, not skipped: title_textures::tests::remapped_pages_are_compared_with_what_they_held and a_remapped_page_of_a_texture_the_gpu_wrote_is_not_taken_for_what_it_held.
  • hle::d3d12x::title_textures::tests:: at --test-threads=8: 20 of 20 ok.
  • Mutation: the comparison branch off (every remapped page goes up whole, as on main) fails both new tests. Good.
  • Mutation: the texture_upload::unknown call after a published GPU write removed fails a_remapped_page_of_a_texture_the_gpu_wrote_is_not_taken_for_what_it_held. Good.
  • No retail title on this machine.
    performance: on by default.
  • Remapped pages are hashed before they go up, instead of going up whole: fewer uploads in the author's amd-dev count (about 4,400 textures per 1,024 submits), not measured here.
  • After a copied-back GPU write, the next CPU write sends the whole texture. The description says this is not measured.
    verdict: safe to merge
    hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
<!-- greyfinch-sync:ivall/xcl:comment:7332360199 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3482#issuecomment-7332360199). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-12-02T02:00:33Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: 2b0ef63e5286e1b3f519940456cc096d36ff636c merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2912 passed, 0 failed, 51 ignored (base: 2909 passed, 0 failed, 51 ignored); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none review: read this PR's commit `2b0ef63e` on top of #3477 (`d8c75c5c`, which my merge-check on #3477 covers). No correctness problem found. - A mapping change under a texture read through its pages now goes to `texture_upload::recheck`, and its next upload compares those pages with the hashes of what the PC texture last got. Before, they went up whole. A render or UAV target, a texture the GPU wrote, and `XCL_TEXTURE_REMAP_COMPARE=0` keep the old whole upload. - A published GPU write now makes the texture's page hashes unknown (`texture_upload::unknown`), so old bytes mapped again are not taken for what the PC texture holds. - Each 30 of 30 alone, not skipped: `title_textures::tests::remapped_pages_are_compared_with_what_they_held` and `a_remapped_page_of_a_texture_the_gpu_wrote_is_not_taken_for_what_it_held`. - `hle::d3d12x::title_textures::tests::` at `--test-threads=8`: 20 of 20 ok. - Mutation: the comparison branch off (every remapped page goes up whole, as on main) fails both new tests. Good. - Mutation: the `texture_upload::unknown` call after a published GPU write removed fails `a_remapped_page_of_a_texture_the_gpu_wrote_is_not_taken_for_what_it_held`. Good. - No retail title on this machine. performance: on by default. - Remapped pages are hashed before they go up, instead of going up whole: fewer uploads in the author's amd-dev count (about 4,400 textures per 1,024 submits), not measured here. - After a copied-back GPU write, the next CPU write sends the whole texture. The description says this is not measured. verdict: safe to merge hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
bmjask commented 2026-12-02 08:15:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:15:19Z.

Review: COMMENTED


Review of 2b0ef63e: 3 finding(s). 3 are inline.


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.

<!-- greyfinch-sync:ivall/xcl:review:6146964429 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3482#pullrequestreview-6146964429). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T08:15:19Z. **Review:** COMMENTED --- Review of `2b0ef63e`: 3 finding(s). 3 are inline. --- _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._
bmjask commented 2026-12-02 08:15:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:15:20Z.

Code review location: crates/xcl/src/hle/d3d12x/title_textures.rs; line 2168

@@ -2114,21 +2157,23 @@ unsafe fn refresh_parts(queue: *mut c_void, look: bool, mut sample: Option<&mut
                 visited += 1;
             }
             let mut again = texture_upload::Change::None;
+            let mut recheck = Vec::new();
             if waiting.contains(&res) && e.cpu_backed && !e.gpu_written {
                 let (queue, waited) = target.on(e.device);
                 match texture_upload::take_again(&e.known, queue, waited) {
                     texture_upload::Again::Now(c) => again = c,
                     texture_upload::Again::NotYet => drop(later.insert(res)),
                     texture_upload::Again::Nothing => {}
                 }
+                recheck = texture_upload::take_recheck(&e.known, e.src);

take_recheck only runs when the texture is in waiting and !e.gpu_written. A GPU-written texture is still removed from AGAIN and not put back in later, so its remapped pages are stranded in known.recheck and never compared or uploaded. The title remaps a pool page under mip 3 of a non-target texture (recheck, AGAIN). Before the next submit, a list that writes only subresource 0 is published, so the whole entry becomes gpu_written. refresh_parts takes AGAIN, skips take_recheck, and drops the texture. publish_download then writes back only the pages that differ (subresource 0), so mip 3 never goes dirty, nothing re-queues it, and the PC texture keeps the old mip-3 texels. The old stale path had the same gap. Re-queuing the texture when recheck is non-empty would close it.

<!-- greyfinch-sync:ivall/xcl:review-comment:4766550101 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3482#discussion_r4766550101). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T08:15:20Z. **Code review location:** `crates/xcl/src/hle/d3d12x/title_textures.rs`; line 2168 ~~~~diff @@ -2114,21 +2157,23 @@ unsafe fn refresh_parts(queue: *mut c_void, look: bool, mut sample: Option<&mut visited += 1; } let mut again = texture_upload::Change::None; + let mut recheck = Vec::new(); if waiting.contains(&res) && e.cpu_backed && !e.gpu_written { let (queue, waited) = target.on(e.device); match texture_upload::take_again(&e.known, queue, waited) { texture_upload::Again::Now(c) => again = c, texture_upload::Again::NotYet => drop(later.insert(res)), texture_upload::Again::Nothing => {} } + recheck = texture_upload::take_recheck(&e.known, e.src); ~~~~ --- `take_recheck` only runs when the texture is in `waiting` and `!e.gpu_written`. A GPU-written texture is still removed from AGAIN and not put back in `later`, so its remapped pages are stranded in `known.recheck` and never compared or uploaded. The title remaps a pool page under mip 3 of a non-target texture (recheck, AGAIN). Before the next submit, a list that writes only subresource 0 is published, so the whole entry becomes `gpu_written`. refresh_parts takes AGAIN, skips `take_recheck`, and drops the texture. `publish_download` then writes back only the pages that differ (subresource 0), so mip 3 never goes dirty, nothing re-queues it, and the PC texture keeps the old mip-3 texels. The old `stale` path had the same gap. Re-queuing the texture when recheck is non-empty would close it.
bmjask commented 2026-12-02 08:15:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:15:20Z.

Code review location: crates/xcl/src/hle/d3d12x/title_textures.rs; line 980

@@ -949,6 +974,10 @@ pub(super) fn publish_submission_effects(queue: Option<WriterQueueId>, writes: &
                 let epoch = NEXT_GPU_EPOCH.fetch_add(1, Ordering::Relaxed) + 1;
                 let writer = GpuWriter { epoch, queue };
                 apply_gpu_writer(&mut e.gpu_writers, n, write.subresource, writer);
+                // (what its pages held at its last upload is no longer what the PC texture holds,
+                // also once the GPU's bytes are copied back: a page mapped again with the old
+                // bytes must not look the same, `mapping_changed`)
+                texture_upload::unknown(&e.known);

texture_upload::unknown() now runs on every published GPU write, so after each copy-back the next look finds the texture's hashes empty and uploads the whole texture instead of the changed pages. For a non-target texture written by GPU copies and copied back every frame, publish_download writes into title memory, the write watch flags those pages, and changed() sees h.len() != pages_of and returns Change::All, a full upload every frame where only differing pages went up before. publish_download already holds the exact console bytes the PC texture now has, so storing those pages' hashes there (via all_sent) would fix the stale-hash problem without throwing the hashes away.

<!-- greyfinch-sync:ivall/xcl:review-comment:4766550110 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3482#discussion_r4766550110). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T08:15:20Z. **Code review location:** `crates/xcl/src/hle/d3d12x/title_textures.rs`; line 980 ~~~~diff @@ -949,6 +974,10 @@ pub(super) fn publish_submission_effects(queue: Option<WriterQueueId>, writes: & let epoch = NEXT_GPU_EPOCH.fetch_add(1, Ordering::Relaxed) + 1; let writer = GpuWriter { epoch, queue }; apply_gpu_writer(&mut e.gpu_writers, n, write.subresource, writer); + // (what its pages held at its last upload is no longer what the PC texture holds, + // also once the GPU's bytes are copied back: a page mapped again with the old + // bytes must not look the same, `mapping_changed`) + texture_upload::unknown(&e.known); ~~~~ --- `texture_upload::unknown()` now runs on every published GPU write, so after each copy-back the next look finds the texture's hashes empty and uploads the whole texture instead of the changed pages. For a non-target texture written by GPU copies and copied back every frame, `publish_download` writes into title memory, the write watch flags those pages, and `changed()` sees `h.len() != pages_of` and returns Change::All, a full upload every frame where only differing pages went up before. `publish_download` already holds the exact `console` bytes the PC texture now has, so storing those pages' hashes there (via `all_sent`) would fix the stale-hash problem without throwing the hashes away.
bmjask commented 2026-12-02 08:15:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:15:20Z.

Code review location: crates/xcl/src/hle/d3d12x/title_textures.rs; line 888

@@ -865,25 +867,48 @@ fn recheck_gpu_view_sources() {
 }
 
 /// The queue's page mappings changed `parts` (from, to) of `e` by call `call`. A texture read
-/// through its pages sends them again with its next upload, as known changes with no comparison
-/// (a clean pool page newly mapped holds bytes the PC texture never had): true, and it goes into
-/// AGAIN. A shadowed one goes up whole once it is uncovered, as on a change of its source. The
-/// GPU's write of a list submitted at or after that call stays; an older one gives way.
+/// through its pages compares them with what they held at its next upload (`remap_compare`; no
+/// write watch fires for a clean pool page newly mapped, whose bytes the PC texture may never have
+/// had), or sends them again with no comparison: true, and it goes into AGAIN. A shadowed one goes
+/// up whole once it is uncovered, as on a change of its source. The GPU's write of a list submitted
+/// at or after that call stays; an older one gives way.
 fn mapping_changed(e: &mut Entry, call: u64, parts: Vec<(usize, usize)>, active: bool) -> bool {
     if !e.paged || e.pending || (e.gpu_written && e.written_call >= call) {
         return false;
     }
-    e.gpu_written = false;
+    let was_gpu_written = std::mem::take(&mut e.gpu_written);
     REREAD.fetch_add(1, Ordering::Relaxed);
     if !active {
         e.pending = true;
         PENDING.fetch_add(1, Ordering::Relaxed);
         return false;
     }
-    texture_upload::stale(&e.known, parts);
+    // (a render target or UAV the GPU may have written: no comparison with what the CPU's bytes
+    // were; nor one the GPU wrote, whose pages' hashes are not what it holds)
+    if remap_compare() && !e.target && !was_gpu_written {

Not certain about this one: forget() and unknown() clear again but not the new Pages::recheck, so leftover recheck parts from before a forget surface in a later, unrelated upload and are compared against hashes they no longer belong to. Every place that clears or consumes again needs to handle recheck too, or the two should be one pending-change record with a compare flag.

<!-- greyfinch-sync:ivall/xcl:review-comment:4766550125 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3482#discussion_r4766550125). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T08:15:20Z. **Code review location:** `crates/xcl/src/hle/d3d12x/title_textures.rs`; line 888 ~~~~diff @@ -865,25 +867,48 @@ fn recheck_gpu_view_sources() { } /// The queue's page mappings changed `parts` (from, to) of `e` by call `call`. A texture read -/// through its pages sends them again with its next upload, as known changes with no comparison -/// (a clean pool page newly mapped holds bytes the PC texture never had): true, and it goes into -/// AGAIN. A shadowed one goes up whole once it is uncovered, as on a change of its source. The -/// GPU's write of a list submitted at or after that call stays; an older one gives way. +/// through its pages compares them with what they held at its next upload (`remap_compare`; no +/// write watch fires for a clean pool page newly mapped, whose bytes the PC texture may never have +/// had), or sends them again with no comparison: true, and it goes into AGAIN. A shadowed one goes +/// up whole once it is uncovered, as on a change of its source. The GPU's write of a list submitted +/// at or after that call stays; an older one gives way. fn mapping_changed(e: &mut Entry, call: u64, parts: Vec<(usize, usize)>, active: bool) -> bool { if !e.paged || e.pending || (e.gpu_written && e.written_call >= call) { return false; } - e.gpu_written = false; + let was_gpu_written = std::mem::take(&mut e.gpu_written); REREAD.fetch_add(1, Ordering::Relaxed); if !active { e.pending = true; PENDING.fetch_add(1, Ordering::Relaxed); return false; } - texture_upload::stale(&e.known, parts); + // (a render target or UAV the GPU may have written: no comparison with what the CPU's bytes + // were; nor one the GPU wrote, whose pages' hashes are not what it holds) + if remap_compare() && !e.target && !was_gpu_written { ~~~~ --- Not certain about this one: `forget()` and `unknown()` clear `again` but not the new `Pages::recheck`, so leftover recheck parts from before a forget surface in a later, unrelated upload and are compared against hashes they no longer belong to. Every place that clears or consumes `again` needs to handle `recheck` too, or the two should be one pending-change record with a compare flag.
bmjask commented 2026-12-02 14:12:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:12:57Z.


@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.

<!-- greyfinch-sync:ivall/xcl:comment:7348176632 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3482#issuecomment-7348176632). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T14:12:57Z. --- @Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
stijn-boer commented 2026-12-02 18:12:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T18:12:05Z.


merge-check
base: 817eb1fc9f
head: 2b0ef63e52
verdict: not yet: the focused remap tests passed and the workspace and retail smoke runs ended early on both builds. Retail upload counts remain unverified.

Windows / AMD RDNA4 (native D3D12) — texture page remapping checks on 2b0ef63

Clean merge onto main at 817eb1f (merge commit f6c15bb86396d979bc9f67aa2f0b73f750594706). git diff --check was clean.

Setup

  • AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332
  • Rust 1.100.0, debug builds, Agility SDK 1.620.2 with matching d3d12SDKLayers.dll, DXC 1.9.2609.5

Tested

cargo build --workspace passed. cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output exited 101 on both builds. The baseline table row is from a prior run of the same commit, machine, SDK, and command.

Build Passed Failed Ignored SKIPPED notices
main 340 3 23 0
Merged PR 340 3 23 0

Counts are partial because two test processes aborted on each build.

  • Tests that failed on the PR and passed on main — none observed in the comparable results.
  • New focused tests — 3 passed, 0 failed, 0 ignored, 0 skip notices with --test-threads=1 --show-output --nocapture. They cover equal and changed bytes after page remaps, invalidation after GPU writes, and newly covered blocks.
  • Debug-layer coverage — both debug-layer E2E tests, including DRED, and uploads_start_from_each_subresources_state passed.
Shared failures and process aborts
  • fuzz_validate_and_gpu_1, fuzz_validate_and_gpu_3, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs reported failures on both builds.
  • The library and gpu_compute_e2e test processes exited with 0xc0000409 on both builds.

Retail smoke

Ran scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary> with XCL_UMA_DRIVER=mixed for title hash 2c508222.

Build Exit Frames logged Device removals logged Peak commit
main 0xc0000409 None 0 1321 MB
Merged PR, defaults 0xc0000409 None 0 4911 MB
Merged PR, XCL_TEXTURE_REMAP_COMPARE=0 0xc0000409 None 0 1320 MB
Merged PR, defaults repeated from fresh data root 0xc0000409 None 0 1321 MB

The higher initial startup commit did not reproduce. These exits leave retail upload counts and frame behavior unverified.

Diff review

The remap comparison path schedules affected pages for comparison while GPU-written textures invalidate cached page fingerprints. The focused tests exercised both choices as well as comparison-disabled behavior.

Not tested

Remaining workspace tests after the aborts, retail frame performance, and a retail upload-count comparison with remap comparison off and on.

AI use

Codex (GPT-6) merged and built the PR, ran the tests, compared the results with main, reviewed the diff, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7354110038 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3482#issuecomment-7354110038). Originally posted by [stijn-boer](https://github.com/stijn-boer) on 2026-12-02T18:12:05Z. --- merge-check base: 817eb1fc9fb0763008ae5d8de1f7f586f442b51d head: 2b0ef63e5286e1b3f519940456cc096d36ff636c verdict: not yet: the focused remap tests passed and the workspace and retail smoke runs ended early on both builds. Retail upload counts remain unverified. **Windows / AMD RDNA4 (native D3D12) — texture page remapping checks on `2b0ef63`** Clean merge onto `main` at `817eb1f` (merge commit `f6c15bb86396d979bc9f67aa2f0b73f750594706`). `git diff --check` was clean. **Setup** - AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332 - Rust 1.100.0, debug builds, Agility SDK 1.620.2 with matching `d3d12SDKLayers.dll`, DXC 1.9.2609.5 **Tested** `cargo build --workspace` passed. `cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output` exited 101 on both builds. The baseline table row is from a prior run of the same commit, machine, SDK, and command. | Build | Passed | Failed | Ignored | `SKIPPED` notices | |---|---:|---:|---:|---:| | `main` | 340 | 3 | 23 | 0 | | Merged PR | 340 | 3 | 23 | 0 | Counts are partial because two test processes aborted on each build. - **Tests that failed on the PR and passed on `main`** — none observed in the comparable results. - **New focused tests** — 3 passed, 0 failed, 0 ignored, 0 skip notices with `--test-threads=1 --show-output --nocapture`. They cover equal and changed bytes after page remaps, invalidation after GPU writes, and newly covered blocks. - **Debug-layer coverage** — both debug-layer E2E tests, including DRED, and `uploads_start_from_each_subresources_state` passed. <details><summary>Shared failures and process aborts</summary> - `fuzz_validate_and_gpu_1`, `fuzz_validate_and_gpu_3`, and `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` reported failures on both builds. - The library and `gpu_compute_e2e` test processes exited with `0xc0000409` on both builds. </details> **Retail smoke** Ran `scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary>` with `XCL_UMA_DRIVER=mixed` for title hash `2c508222`. | Build | Exit | Frames logged | Device removals logged | Peak commit | |---|---|---|---:|---:| | `main` | `0xc0000409` | None | 0 | 1321 MB | | Merged PR, defaults | `0xc0000409` | None | 0 | 4911 MB | | Merged PR, `XCL_TEXTURE_REMAP_COMPARE=0` | `0xc0000409` | None | 0 | 1320 MB | | Merged PR, defaults repeated from fresh data root | `0xc0000409` | None | 0 | 1321 MB | The higher initial startup commit did not reproduce. These exits leave retail upload counts and frame behavior unverified. **Diff review** The remap comparison path schedules affected pages for comparison while GPU-written textures invalidate cached page fingerprints. The focused tests exercised both choices as well as comparison-disabled behavior. **Not tested** Remaining workspace tests after the aborts, retail frame performance, and a retail upload-count comparison with remap comparison off and on. **AI use** Codex (GPT-6) merged and built the PR, ran the tests, compared the results with `main`, reviewed the diff, and drafted this report.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3482:upstream-pr/3482'
git switch 'upstream-pr/3482'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3482'
git switch 'upstream-pr/3482'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3482'
git switch 'upstream-pr/3482'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3482'
git switch 'main'
git merge --squash 'upstream-pr/3482'
git switch 'main'
git merge --ff-only 'upstream-pr/3482'
git switch 'main'
git merge 'upstream-pr/3482'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3482
No description provided.