D3D12.X: write a mapped texture's download where each page is kept #3759

Open
BBareth wants to merge 2 commits from upstream-pr/3759 into main
BBareth commented 2026-12-03 03:08:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T03:08:52Z.


Stacked on #3549; only the top commit (09de2dfd) belongs here.

Merge after #3781: its fix to two kernelx tests keeps this PR's new GPU test from crashing the test binary when they run side by side.

A texture over pages the title mapped with CopyPageMappingsBatchX has a reserved GPU view as its own address, and each 64 KiB page is kept elsewhere. Uploads already read such a texture where its pages are kept, but a download of it was written at the view. Since #3549, the view's reserved pages are left out, so the fence becomes visible without the GPU's bytes reaching the pages the title reads. This PR writes each page where it is kept. Part of #505.

This is the part taken out of #3549 after review. Reworked after the reviews of 0d9a09dd and 6548204f:

  • A download records which physical page each GPU-view page shows, not where that page is kept. A page the title moves (MapTitlePhysicalPages of the same physical page) gets the bytes at its new place; before, a move was taken for a remap and the fence was published without them.
  • A view page that shows another physical page than when the download was prepared gives way to the newer mapping, as in mapping_changed. Its bytes are not written, the other pages are, and the download's writers are retired, so no later download writes the earlier mapping's bytes into the new page.
  • (6548204f review) A remap between the GPU write and the signal is caught too. A download records with each page the mapping call that last changed what it shows. A page changed by a call newer than the write (Entry::written_call) is left out at preparation, and at publication a page must still show the same physical page from the same call. So an unmap and remap of the same physical page counts as a remap. A move keeps the call, so a moved page is still written.
  • (0d31bf1d, @Gevroska's case) Two view pages that show different parts of one physical page, as when a texture starts inside a 64 KiB page, each write their part. Before, only the last view page showing a physical page wrote, so the first page's bytes were lost. Now later eligible pages take only the bytes they share with earlier ones.

What is in it

  • crates/xcl/src/hle/kernelx.rs:
    • mirrors::resolve_with_pages: resolve, also giving the physical page each view page shows and the call that last changed it (Shown::page, Shown::call). resolve is unchanged for its callers.
    • settled_mappings(), a non-blocking hold on the AWAY lock, which apply_batches and the page moves take. settled_uncommitted from #3549 is now built on it.
  • crates/xcl/src/hle/d3d12x/title_textures.rs:
    • prepare_downloads records whether the texture was paged and what each page showed (mapped_download_pages), leaving out pages remapped after the GPU write. A paged texture whose pages cannot be resolved is not prepared, instead of falling back to its reserved view.
    • submit_prepared_downloads checks only that the texture is still paged as prepared: a remap before submission is handled at publication like one after it.
    • publish_download resolves the pages again and reads the current bytes from where each page is kept now.
    • write_changed_mapped_pages holds the mapping calls back (settled_mappings) and checks that nothing was mapped or moved since that resolve; if anything was, the publication retries with a fresh read. Then it writes each page that still shows its physical page from the same call, where that page is kept. Where eligible view pages show the same bytes of a home, the last of them writes those bytes, against what the home holds now; pages that show different parts of one home each write their part.
  • Tests:
    • a_download_over_mapped_pages_is_written_where_they_are_kept: the pool page and the CPU view of a never-named page take the bytes; an unmapped page takes none; nothing is written while a mapping call holds the lock; a move after the read makes the write retry.
    • a_download_writes_a_home_shown_twice_from_its_last_page
    • a_download_writes_both_halves_of_a_home_shown_twice_at_different_offsets, uncovered_leaves_out_the_taken_ranges
    • mapped_download_publishes_moved_pages_and_skips_remapped_pages (GPU): a real download through prepare_downloads, submit_prepared_downloads and publish_download. It covers a retry under a mapping call (the writer is kept), a page moved with MapTitlePhysicalPages (the bytes land at the new place), and a remap (the new page keeps its bytes, the unchanged page is written, the writer is retired). Once the page table is gone, nothing more is prepared. It fails on 0d9a09dd at the moved-page assertion.
    • mapped_download_skips_a_page_remapped_before_preparation, mapped_download_skips_a_page_unmapped_and_restored_before_preparation, mapped_download_skips_a_page_unmapped_and_restored_after_preparation (GPU): the same download with the remap made between the write and preparation, or an unmap and remap of the same physical page before or after preparation. The remapped page keeps its bytes, the others are written, the writer is retired.

Tested

  • RTX 5070 Ti, driver 32.0.16.2124; i7-12700K; Windows 11 Pro 26200; rustc 1.95.0; debug suite, release smoke.
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 on 09de2dfd (on #3549 fc7abe51, on main 078358a0): 3018 passed, 0 failed, 52 ignored.
  • SKIPPED on this adapter, 28 in all:
    • 22 no wave64
    • 2 no heap windows
    • 2 no d3d12SDKLayers.dll
    • 1 no D3D12 debug layer
    • 1 cannot disable the driver cache (no Developer Mode)
  • cargo test -p xcl --lib -- a_download mapped_download uncovered_leaves on 09de2dfd: 8 passed. The new shared-home test fails on 0d31bf1d (the test added to the old code) at its first-half assertion.
  • cargo test -p xcl --lib mapped on 0d31bf1d: 31 passed. With the preparation and publication checks reverted and the tests kept, the three new tests failed at their byte assertions (run by Codex on this machine).
  • Earlier, on 6548204f, cargo test -p xcl --lib mapped, 20 runs each:
    • on 6548204f: 18 passed, 1 failed (a_page_whose_move_fails_stays_mapped_where_it_was), 1 crashed with 0xc0000005;
    • on fc7abe51: 20 passed.
    • The new GPU test alone: 30 of 30 passed. Without that kernelx test (--skip a_page_whose_move_fails): 20 of 20.
    • The cause is a race in two kernelx tests on main, not in this change. They reserve an address and release it to get one with nothing reserved. A test beside them, here the new GPU test, can be given that address in between, and the page move then writes into its memory. The fix is a separate PR: #3781.
  • Merges cleanly into main 16c2fd08.

Regression run

xcl-smoke v1
commit: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 120
exit: 0x0
frames shown: 3046 (PresentX 3046)
presents per 2 s (last 3): 15 27 19
device removals: 0
crashes: 0
peak commit: 32465 MB
xcl-smoke v1
commit: 09de2dfd7ea6d8e4dc1dad8f0b051170f93ea6e3
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 120
exit: 0x0
frames shown: 3051 (PresentX 3051)
presents per 2 s (last 3): 37 14 15
device removals: 0
crashes: 0
peak commit: 32402 MB

Each run follows one warm-up run of the same build; the A button is pressed once at 70 s.

Not tested

  • A retail title through this path: the 120 s smoke runs end before the world, and no world run was made with this change.
  • mirrors::released (a view torn down) does not take AWAY. Such a teardown is caught by the comparison under the hold, not excluded by the lock.
  • Pages written before a later page reports a retry stay written. They went to places checked under the hold.
  • AMD GPUs.

AI use

  • Claude Code, Claude Fable 5.2: wrote the first form of the change and its tests.
  • Codex (GPT-6.2-Sol): wrote both reworks after review and the GPU publish tests, from briefs.
  • Claude Code, Claude Opus 5.5: wrote the briefs, checked the review points, reviewed the whole diff (lock order: AWAY before the views' STATE, as in apply_batches; the publisher only try_locks AWAY), found the test race behind the crash, wrote the fix and test for the shared-home case, ran the suite and the regression runs, and wrote this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5619105360 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759). Originally posted by [BBareth](https://github.com/BBareth) on 2026-12-03T03:08:52Z. --- Stacked on #3549; only the top commit (09de2dfd) belongs here. Merge after #3781: its fix to two `kernelx` tests keeps this PR's new GPU test from crashing the test binary when they run side by side. A texture over pages the title mapped with `CopyPageMappingsBatchX` has a reserved GPU view as its own address, and each 64 KiB page is kept elsewhere. Uploads already read such a texture where its pages are kept, but a download of it was written at the view. Since #3549, the view's reserved pages are left out, so the fence becomes visible without the GPU's bytes reaching the pages the title reads. This PR writes each page where it is kept. Part of #505. This is the part taken out of #3549 after review. Reworked after the reviews of 0d9a09dd and 6548204f: - A download records which physical page each GPU-view page shows, not where that page is kept. A page the title moves (`MapTitlePhysicalPages` of the same physical page) gets the bytes at its new place; before, a move was taken for a remap and the fence was published without them. - A view page that shows another physical page than when the download was prepared gives way to the newer mapping, as in `mapping_changed`. Its bytes are not written, the other pages are, and the download's writers are retired, so no later download writes the earlier mapping's bytes into the new page. - (6548204f review) A remap between the GPU write and the signal is caught too. A download records with each page the mapping call that last changed what it shows. A page changed by a call newer than the write (`Entry::written_call`) is left out at preparation, and at publication a page must still show the same physical page from the same call. So an unmap and remap of the same physical page counts as a remap. A move keeps the call, so a moved page is still written. - (0d31bf1d, @Gevroska's case) Two view pages that show different parts of one physical page, as when a texture starts inside a 64 KiB page, each write their part. Before, only the last view page showing a physical page wrote, so the first page's bytes were lost. Now later eligible pages take only the bytes they share with earlier ones. **What is in it** - `crates/xcl/src/hle/kernelx.rs`: - `mirrors::resolve_with_pages`: `resolve`, also giving the physical page each view page shows and the call that last changed it (`Shown::page`, `Shown::call`). `resolve` is unchanged for its callers. - `settled_mappings()`, a non-blocking hold on the `AWAY` lock, which `apply_batches` and the page moves take. `settled_uncommitted` from #3549 is now built on it. - `crates/xcl/src/hle/d3d12x/title_textures.rs`: - `prepare_downloads` records whether the texture was paged and what each page showed (`mapped_download_pages`), leaving out pages remapped after the GPU write. A paged texture whose pages cannot be resolved is not prepared, instead of falling back to its reserved view. - `submit_prepared_downloads` checks only that the texture is still paged as prepared: a remap before submission is handled at publication like one after it. - `publish_download` resolves the pages again and reads the current bytes from where each page is kept now. - `write_changed_mapped_pages` holds the mapping calls back (`settled_mappings`) and checks that nothing was mapped or moved since that resolve; if anything was, the publication retries with a fresh read. Then it writes each page that still shows its physical page from the same call, where that page is kept. Where eligible view pages show the same bytes of a home, the last of them writes those bytes, against what the home holds now; pages that show different parts of one home each write their part. - Tests: - `a_download_over_mapped_pages_is_written_where_they_are_kept`: the pool page and the CPU view of a never-named page take the bytes; an unmapped page takes none; nothing is written while a mapping call holds the lock; a move after the read makes the write retry. - `a_download_writes_a_home_shown_twice_from_its_last_page` - `a_download_writes_both_halves_of_a_home_shown_twice_at_different_offsets`, `uncovered_leaves_out_the_taken_ranges` - `mapped_download_publishes_moved_pages_and_skips_remapped_pages` (GPU): a real download through `prepare_downloads`, `submit_prepared_downloads` and `publish_download`. It covers a retry under a mapping call (the writer is kept), a page moved with `MapTitlePhysicalPages` (the bytes land at the new place), and a remap (the new page keeps its bytes, the unchanged page is written, the writer is retired). Once the page table is gone, nothing more is prepared. It fails on 0d9a09dd at the moved-page assertion. - `mapped_download_skips_a_page_remapped_before_preparation`, `mapped_download_skips_a_page_unmapped_and_restored_before_preparation`, `mapped_download_skips_a_page_unmapped_and_restored_after_preparation` (GPU): the same download with the remap made between the write and preparation, or an unmap and remap of the same physical page before or after preparation. The remapped page keeps its bytes, the others are written, the writer is retired. **Tested** - RTX 5070 Ti, driver 32.0.16.2124; i7-12700K; Windows 11 Pro 26200; rustc 1.95.0; debug suite, release smoke. - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4` on 09de2dfd (on #3549 fc7abe51, on main 078358a0): 3018 passed, 0 failed, 52 ignored. - `SKIPPED` on this adapter, 28 in all: - 22 `no wave64` - 2 `no heap windows` - 2 `no d3d12SDKLayers.dll` - 1 `no D3D12 debug layer` - 1 cannot disable the driver cache (no Developer Mode) - `cargo test -p xcl --lib -- a_download mapped_download uncovered_leaves` on 09de2dfd: 8 passed. The new shared-home test fails on 0d31bf1d (the test added to the old code) at its first-half assertion. - `cargo test -p xcl --lib mapped` on 0d31bf1d: 31 passed. With the preparation and publication checks reverted and the tests kept, the three new tests failed at their byte assertions (run by Codex on this machine). - Earlier, on 6548204f, `cargo test -p xcl --lib mapped`, 20 runs each: - on 6548204f: 18 passed, 1 failed (`a_page_whose_move_fails_stays_mapped_where_it_was`), 1 crashed with 0xc0000005; - on fc7abe51: 20 passed. - The new GPU test alone: 30 of 30 passed. Without that kernelx test (`--skip a_page_whose_move_fails`): 20 of 20. - The cause is a race in two `kernelx` tests on main, not in this change. They reserve an address and release it to get one with nothing reserved. A test beside them, here the new GPU test, can be given that address in between, and the page move then writes into its memory. The fix is a separate PR: #3781. - Merges cleanly into main 16c2fd08. **Regression run** ``` xcl-smoke v1 commit: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a gpu: NVIDIA GeForce RTX 5070 Ti title: 9cc6a39e seconds: 120 exit: 0x0 frames shown: 3046 (PresentX 3046) presents per 2 s (last 3): 15 27 19 device removals: 0 crashes: 0 peak commit: 32465 MB ``` ``` xcl-smoke v1 commit: 09de2dfd7ea6d8e4dc1dad8f0b051170f93ea6e3 gpu: NVIDIA GeForce RTX 5070 Ti title: 9cc6a39e seconds: 120 exit: 0x0 frames shown: 3051 (PresentX 3051) presents per 2 s (last 3): 37 14 15 device removals: 0 crashes: 0 peak commit: 32402 MB ``` Each run follows one warm-up run of the same build; the A button is pressed once at 70 s. **Not tested** - A retail title through this path: the 120 s smoke runs end before the world, and no world run was made with this change. - `mirrors::released` (a view torn down) does not take `AWAY`. Such a teardown is caught by the comparison under the hold, not excluded by the lock. - Pages written before a later page reports a retry stay written. They went to places checked under the hold. - AMD GPUs. **AI use** - Claude Code, Claude Fable 5.2: wrote the first form of the change and its tests. - Codex (GPT-6.2-Sol): wrote both reworks after review and the GPU publish tests, from briefs. - Claude Code, Claude Opus 5.5: wrote the briefs, checked the review points, reviewed the whole diff (lock order: `AWAY` before the views' `STATE`, as in `apply_batches`; the publisher only `try_lock`s `AWAY`), found the test race behind the crash, wrote the fix and test for the shared-home case, ran the suite and the regression runs, and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Foniass commented 2026-12-03 03:14:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T03:14:40Z.


Review of 0d9a09dd (code reading only, not a merge-check; draft) · 1 high, 2 medium

In short: Stacked on #3549 (as the description says); only the top commit 0d9a09dd (266+/15-) belongs here, which is under the size target. For a paged texture it writes the download to the place where each page is kept, under a non-blocking hold on AWAY, clears the writers on success, and keeps them when the pages changed. That closes the gap #3549 leaves on its own (gpu_written cleared without the bytes). But any change in where a page is kept between prepare and publish drops the download and still makes the fence visible without the GPU's bytes, including a plain move of the same physical page.

High

  1. A page move counts as a remap, and the fence is published without the bytes.

    • The homes compared in download_pages_current (title_textures.rs ~3914) and mapped_home (~4208) are where a page's bytes are kept, not which physical page the view shows.
    • When the title maps a physical page at a CPU address, MapTitlePhysicalPages copies the page there and calls page_placed → mirrors::page_at (kernelx.rs ~2633, ~694). That changes where the page is kept, but the view still shows the same page. gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes does exactly this (~4957).
    • If a move happens between prepare_downloads and the fence completing, publish_download returns Ok(true) (~4053, or Moved at ~4244 / ~4059). complete_fence_downloads (~4320) then drops the download and exposes the fence value, with the GPU's bytes at neither place.

    Fix: record the physical page each view page showed at preparation (Shown::page, kernelx.rs ~365), compare that, and write where that page is kept now while the lock is held. Add a test that moves the page with MapTitlePhysicalPages between mapped_now and the write.

Medium

  1. A page remapped after preparation still loses the GPU's bytes (still open from #3549).

    • When CopyPageMappingsBatchX points a view page at another page after preparation, Moved / not current returns Ok(true) (~4053, ~4059). The page the GPU wrote through never gets the bytes, and the fence is published.
    • The writers are kept, so the next download prepared on that queue writes the PC texture's bytes into the newly mapped page. The remap test asserts exactly that (~7736-7741). The commit message says the opposite: "the GPU's bytes for the earlier mapping never reach a page mapped since". By XCL's own rule in mapping_changed (~866-876), a GPU write older than a mapping call gives way.
    • The fix for finding 1 covers this. If the current behaviour is intended, drop the writers on Moved and say in the description that the fence is published without these bytes.
  2. The publish path is not tested. The four new tests call write_changed_mapped_pages and download_pages_current directly. Nothing checks:

    • what publish_download returns for Done, Again and Moved;
    • that writers and gpu_written are cleared on Done and kept otherwise;
    • the ? skip in prepare_downloads (~3937).

    gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes (~4808) already sets up a paged texture on a real device and queue and publishes a GPU write to it, so a download through its fence can be built on it.

Checked and fine
  • The first commit is #3549's head fc7abe51 unchanged. This PR needs #3549's settled_uncommitted and note_download_page_left_out, so it does not build on main alone.
  • The #3549 follow-up point is addressed on the normal path: a paged download writes the homes before it clears gpu_writers / gpu_written, and one that is not current leaves them set.
  • Locks: publish_download holds TEXTURES and only try_locks AWAY (settled_mappings). shows / resolve take STATE and the pages lock after AWAY, in the same order as apply_batches. lazy::ensure does not take AWAY.
  • mapped_home encodes pages the same way as resolve.
  • A home shown by several view pages is written once, from the last of them. The comparison uses bytes re-read under the lock, so a CPU write made since is not overwritten where the GPU did not change the page.
  • Again holds the fence back, and pages written before the retry are not written twice.
  • submit_prepared_downloads checks download_pages_current again at insertion. A paged texture with no page table is not prepared, instead of falling back to its reserved view.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7366356386 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759#issuecomment-7366356386). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T03:14:40Z. --- **Review** of `0d9a09dd` (code reading only, not a merge-check; draft) · 1 high, 2 medium **In short:** Stacked on #3549 (as the description says); only the top commit `0d9a09dd` (266+/15-) belongs here, which is under the size target. For a paged texture it writes the download to the place where each page is kept, under a non-blocking hold on `AWAY`, clears the writers on success, and keeps them when the pages changed. That closes the gap #3549 leaves on its own (`gpu_written` cleared without the bytes). But any change in where a page is kept between prepare and publish drops the download and still makes the fence visible without the GPU's bytes, including a plain move of the same physical page. #### High 1. **A page move counts as a remap, and the fence is published without the bytes.** - The homes compared in `download_pages_current` (`title_textures.rs` ~3914) and `mapped_home` (~4208) are where a page's bytes are kept, not which physical page the view shows. - When the title maps a physical page at a CPU address, `MapTitlePhysicalPages` copies the page there and calls `page_placed` → `mirrors::page_at` (`kernelx.rs` ~2633, ~694). That changes where the page is kept, but the view still shows the same page. `gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes` does exactly this (~4957). - If a move happens between `prepare_downloads` and the fence completing, `publish_download` returns `Ok(true)` (~4053, or `Moved` at ~4244 / ~4059). `complete_fence_downloads` (~4320) then drops the download and exposes the fence value, with the GPU's bytes at neither place. Fix: record the physical page each view page showed at preparation (`Shown::page`, `kernelx.rs` ~365), compare that, and write where that page is kept now while the lock is held. Add a test that moves the page with `MapTitlePhysicalPages` between `mapped_now` and the write. #### Medium 2. **A page remapped after preparation still loses the GPU's bytes (still open from #3549).** - When `CopyPageMappingsBatchX` points a view page at another page after preparation, `Moved` / not current returns `Ok(true)` (~4053, ~4059). The page the GPU wrote through never gets the bytes, and the fence is published. - The writers are kept, so the next download prepared on that queue writes the PC texture's bytes into the newly mapped page. The remap test asserts exactly that (~7736-7741). The commit message says the opposite: "the GPU's bytes for the earlier mapping never reach a page mapped since". By XCL's own rule in `mapping_changed` (~866-876), a GPU write older than a mapping call gives way. - The fix for finding 1 covers this. If the current behaviour is intended, drop the writers on `Moved` and say in the description that the fence is published without these bytes. 3. **The publish path is not tested.** The four new tests call `write_changed_mapped_pages` and `download_pages_current` directly. Nothing checks: - what `publish_download` returns for `Done`, `Again` and `Moved`; - that writers and `gpu_written` are cleared on `Done` and kept otherwise; - the `?` skip in `prepare_downloads` (~3937). `gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes` (~4808) already sets up a paged texture on a real device and queue and publishes a GPU write to it, so a download through its fence can be built on it. <details><summary>Checked and fine</summary> - The first commit is #3549's head `fc7abe51` unchanged. This PR needs #3549's `settled_uncommitted` and `note_download_page_left_out`, so it does not build on `main` alone. - The #3549 follow-up point is addressed on the normal path: a paged download writes the homes before it clears `gpu_writers` / `gpu_written`, and one that is not current leaves them set. - Locks: `publish_download` holds `TEXTURES` and only `try_lock`s `AWAY` (`settled_mappings`). `shows` / `resolve` take `STATE` and the pages lock after `AWAY`, in the same order as `apply_batches`. `lazy::ensure` does not take `AWAY`. - `mapped_home` encodes pages the same way as `resolve`. - A home shown by several view pages is written once, from the last of them. The comparison uses bytes re-read under the lock, so a CPU write made since is not overwritten where the GPU did not change the page. - `Again` holds the fence back, and pages written before the retry are not written twice. - `submit_prepared_downloads` checks `download_pages_current` again at insertion. A paged texture with no page table is not prepared, instead of falling back to its reserved view. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
BBareth commented 2026-12-03 09:29:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T09:29:41Z.


On the review of 0d9a09dd, pushed 6548204f (the top commit is reworked; #3549's commit fc7abe51 is unchanged):

  1. A page move counts as a remap: confirmed. A download now records which physical page each GPU-view page shows (kernelx::mirrors::resolve_with_pages, from Shown::page), not where it is kept. At publication the pages are resolved again, and each page is written where it is kept now. Under the settled_mappings hold, a page that was mapped or moved since that resolve makes the publication retry with a fresh read.

  2. A remap keeps the writers: a view page that shows another physical page than at preparation gives way to the newer mapping, as in mapping_changed. Its bytes are not written, the other pages are, and the download's writers are retired. A remap before submission is handled the same way: insertion no longer compares the pages, so the unaffected pages still get their bytes. The commit message says this now.

  3. The publish path is not tested: mapped_download_publishes_moved_pages_and_skips_remapped_pages runs a real download on a device and queue through prepare_downloads → submit_prepared_downloads → publish_download. It covers:

    • a retry under a mapping call (the writer is kept);
    • a page moved with MapTitlePhysicalPages (the bytes land at the new place);
    • a remap (the new page keeps its bytes, the unchanged page is written, the writer is retired);
    • no new download once the page table is gone.

    It fails on 0d9a09dd at the moved-page assertion.

Suite on 6548204f: 3013 passed, 0 failed, 52 ignored, 28 SKIPPED. Smoke: 3051 frames, peak commit 32313 MB, no device removal, no crash. The blocks are in the description.

The mapped lib-test filter crashed with 0xc0000005 in 3 of 61 runs on this head. The new GPU test alone passed 30 of 30. The cause is two kernelx tests on main that reserve an address and release it to get one with nothing reserved: a test beside them can be given that address in between, and the page move then writes into its memory. With that fixed (#3781), the filter passed 40 of 40.

AI use: Codex (GPT-6.2-Sol) wrote the rework and the test from a brief; Claude Code (Claude Opus 5.5) checked the review points, reviewed the diff, ran the suite and the smoke runs, and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7373748931 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759#issuecomment-7373748931). Originally posted by [BBareth](https://github.com/BBareth) on 2026-12-03T09:29:41Z. --- On the review of 0d9a09dd, pushed 6548204f (the top commit is reworked; #3549's commit fc7abe51 is unchanged): 1. **A page move counts as a remap**: confirmed. A download now records which physical page each GPU-view page shows (`kernelx::mirrors::resolve_with_pages`, from `Shown::page`), not where it is kept. At publication the pages are resolved again, and each page is written where it is kept now. Under the `settled_mappings` hold, a page that was mapped or moved since that resolve makes the publication retry with a fresh read. 2. **A remap keeps the writers**: a view page that shows another physical page than at preparation gives way to the newer mapping, as in `mapping_changed`. Its bytes are not written, the other pages are, and the download's writers are retired. A remap before submission is handled the same way: insertion no longer compares the pages, so the unaffected pages still get their bytes. The commit message says this now. 3. **The publish path is not tested**: `mapped_download_publishes_moved_pages_and_skips_remapped_pages` runs a real download on a device and queue through `prepare_downloads` → `submit_prepared_downloads` → `publish_download`. It covers: - a retry under a mapping call (the writer is kept); - a page moved with `MapTitlePhysicalPages` (the bytes land at the new place); - a remap (the new page keeps its bytes, the unchanged page is written, the writer is retired); - no new download once the page table is gone. It fails on 0d9a09dd at the moved-page assertion. Suite on 6548204f: 3013 passed, 0 failed, 52 ignored, 28 SKIPPED. Smoke: 3051 frames, peak commit 32313 MB, no device removal, no crash. The blocks are in the description. The `mapped` lib-test filter crashed with 0xc0000005 in 3 of 61 runs on this head. The new GPU test alone passed 30 of 30. The cause is two kernelx tests on main that reserve an address and release it to get one with nothing reserved: a test beside them can be given that address in between, and the page move then writes into its memory. With that fixed (#3781), the filter passed 40 of 40. AI use: Codex (GPT-6.2-Sol) wrote the rework and the test from a brief; Claude Code (Claude Opus 5.5) checked the review points, reviewed the diff, ran the suite and the smoke runs, and wrote this comment.
Foniass commented 2026-12-03 09:34:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T09:34:34Z.


Follow-up review of 6548204f, since 0d9a09dd (code reading only, not a merge-check; draft) · 2 medium

In short: Since 0d9a09dd, a download records which physical page each GPU-view page shows (Shown::page), not where the page is kept. At publication it writes each page where that page is kept now, skips pages that show another page, and retires the writers. A new GPU test drives the download from prepare through publish. The three earlier points are fixed. Two remain: a remap between the GPU write and the signal is not detected, and the new GPU test can crash the test binary until #3781 is in.

Medium

  1. A remap between the GPU write and the signal still writes the earlier mapping's bytes into the new page.

    • CopyPageMappingsBatchX takes effect when the title calls it (q_copy_page_mappings, real.rs ~11852), and the writer and written_call are stamped at the write (title_textures.rs ~951-954).
    • For: a write through view page g showing P, then a remap of g to Q, then SignalX, prepare_downloads (~3927) records Q as what g showed. write_changed_mapped_pages then sees no change (~4215, ~4223), and writes the PC texture's bytes, the GPU's output for P, into Q's page.
    • mapping_changed (~872-886) treats that write as older than the mapping. It clears gpu_written but not gpu_writers, so the download still goes ahead. The commit message says a newer mapping wins "as in mapping_changed", which only holds for a remap after preparation.
    • The same gap lets an unmap and remap of the same physical page through, since only the page number is compared.

    Fix: return Shown::call with the page from resolve_with_pages. Treat a page whose call is newer than the entry's written_call as remapped at preparation, and compare (page, call) at publication; a move keeps call. Add a test that remaps after capture_gpu_write and before prepare_downloads.

  2. The new GPU test needs #3781 first. The description reports 1 failure and 1 access violation (0xc0000005) in 20 runs of cargo test -p xcl --lib mapped at this head, against 20/20 on fc7abe51. The cause is two kernelx tests that release a reservation and then map into it, while mapped_download_publishes_moved_pages_and_skips_remapped_pages can be handed that address in between. #3781 fixes them. Say "Merge after #3781" in the description.

Checked and fine
  • Earlier finding fixed: a page move was taken for a remap. The download now compares the physical page (resolve_with_pages, kernelx.rs ~616) and writes where that page is kept at publication. The GPU test covers a move made with MapTitlePhysicalPages.
  • Earlier finding fixed: a page remapped after preparation is skipped, the other pages are written, and the writers are retired (publish_download ~4048-4063). The description and commit message now say those bytes are not written.
  • Earlier finding fixed: the publish path is tested. The new test checks a retry under a mapping call keeps the writer, a moved page gets the bytes, a remapped page keeps its own and the writer is retired, and the ? skip in prepare_downloads once the page table is gone.
  • Locks: publish_download holds TEXTURES and only try_locks AWAY. The resolve under the hold takes STATE, then the pages lock, as apply_batches does.
  • A mismatch between the pages read and those resolved under the hold makes the publish retry with fresh bytes, and pages written before the retry are not written twice. A view whose table went away writes nothing and publishes, without looping.
  • The top commit is 281+/18-, and the first commit is still #3549's fc7abe51.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7373880935 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759#issuecomment-7373880935). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T09:34:34Z. --- **Follow-up review** of `6548204f`, since `0d9a09dd` (code reading only, not a merge-check; draft) · 2 medium **In short:** Since `0d9a09dd`, a download records which physical page each GPU-view page shows (`Shown::page`), not where the page is kept. At publication it writes each page where that page is kept now, skips pages that show another page, and retires the writers. A new GPU test drives the download from prepare through publish. The three earlier points are fixed. Two remain: a remap between the GPU write and the signal is not detected, and the new GPU test can crash the test binary until #3781 is in. #### Medium 1. **A remap between the GPU write and the signal still writes the earlier mapping's bytes into the new page.** - `CopyPageMappingsBatchX` takes effect when the title calls it (`q_copy_page_mappings`, `real.rs` ~11852), and the writer and `written_call` are stamped at the write (`title_textures.rs` ~951-954). - For: a write through view page `g` showing `P`, then a remap of `g` to `Q`, then `SignalX`, `prepare_downloads` (~3927) records `Q` as what `g` showed. `write_changed_mapped_pages` then sees no change (~4215, ~4223), and writes the PC texture's bytes, the GPU's output for `P`, into `Q`'s page. - `mapping_changed` (~872-886) treats that write as older than the mapping. It clears `gpu_written` but not `gpu_writers`, so the download still goes ahead. The commit message says a newer mapping wins "as in `mapping_changed`", which only holds for a remap after preparation. - The same gap lets an unmap and remap of the same physical page through, since only the page number is compared. Fix: return `Shown::call` with the page from `resolve_with_pages`. Treat a page whose `call` is newer than the entry's `written_call` as remapped at preparation, and compare (page, call) at publication; a move keeps `call`. Add a test that remaps after `capture_gpu_write` and before `prepare_downloads`. 2. **The new GPU test needs #3781 first.** The description reports 1 failure and 1 access violation (`0xc0000005`) in 20 runs of `cargo test -p xcl --lib mapped` at this head, against 20/20 on `fc7abe51`. The cause is two `kernelx` tests that release a reservation and then map into it, while `mapped_download_publishes_moved_pages_and_skips_remapped_pages` can be handed that address in between. #3781 fixes them. Say "Merge after #3781" in the description. <details><summary>Checked and fine</summary> - Earlier finding fixed: a page move was taken for a remap. The download now compares the physical page (`resolve_with_pages`, `kernelx.rs` ~616) and writes where that page is kept at publication. The GPU test covers a move made with `MapTitlePhysicalPages`. - Earlier finding fixed: a page remapped after preparation is skipped, the other pages are written, and the writers are retired (`publish_download` ~4048-4063). The description and commit message now say those bytes are not written. - Earlier finding fixed: the publish path is tested. The new test checks a retry under a mapping call keeps the writer, a moved page gets the bytes, a remapped page keeps its own and the writer is retired, and the `?` skip in `prepare_downloads` once the page table is gone. - Locks: `publish_download` holds `TEXTURES` and only `try_lock`s `AWAY`. The resolve under the hold takes `STATE`, then the pages lock, as `apply_batches` does. - A mismatch between the pages read and those resolved under the hold makes the publish retry with fresh bytes, and pages written before the retry are not written twice. A view whose table went away writes nothing and publishes, without looping. - The top commit is 281+/18-, and the first commit is still #3549's `fc7abe51`. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
BBareth commented 2026-12-03 11:01:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T11:01:18Z.


Both points are addressed in 0d31bf1d.

  1. Remap between the GPU write and the signal: resolve_with_pages now gives each page's (Shown::page, Shown::call). At preparation, a page whose call is newer than Entry::written_call is left out: its bytes are not written, the other pages are, and the writers are retired as before. At publication, a page must still show the same physical page from the same call, so an unmap and remap of the same physical page counts as a remap. A move keeps call (place only sets it when the page appears or goes), so a moved page is still written where it is kept now. New GPU tests: a remap between the write and preparation, and an unmap + remap of the same physical page before and after preparation. With the checks reverted and the tests kept, all three fail at their byte assertions.
  2. Merge order: the description now says "Merge after #3781" at the top.

Suite on 0d31bf1d: 3016 passed, 0 failed, 52 ignored (28 SKIPPED, the same as before). The regression run in the description is of 0d31bf1d.

Claude Code (Claude Opus 5.5); the fix was written by Codex (GPT-6.2-Sol) from a brief and reviewed by Claude.

<!-- greyfinch-sync:ivall/xcl:comment:7376101837 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759#issuecomment-7376101837). Originally posted by [BBareth](https://github.com/BBareth) on 2026-12-03T11:01:18Z. --- Both points are addressed in 0d31bf1d. 1. **Remap between the GPU write and the signal:** `resolve_with_pages` now gives each page's `(Shown::page, Shown::call)`. At preparation, a page whose `call` is newer than `Entry::written_call` is left out: its bytes are not written, the other pages are, and the writers are retired as before. At publication, a page must still show the same physical page *from the same call*, so an unmap and remap of the same physical page counts as a remap. A move keeps `call` (`place` only sets it when the page appears or goes), so a moved page is still written where it is kept now. New GPU tests: a remap between the write and preparation, and an unmap + remap of the same physical page before and after preparation. With the checks reverted and the tests kept, all three fail at their byte assertions. 2. **Merge order:** the description now says "Merge after #3781" at the top. Suite on 0d31bf1d: 3016 passed, 0 failed, 52 ignored (28 SKIPPED, the same as before). The regression run in the description is of 0d31bf1d. <sub>Claude Code (Claude Opus 5.5); the fix was written by Codex (GPT-6.2-Sol) from a brief and reviewed by Claude.</sub>
Foniass commented 2026-12-03 11:03:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T11:03:15Z.


Follow-up review of 0d31bf1d, since 6548204f (code reading only, not a merge-check; draft) · no new findings

In short: This push fixes both points from my last review. A download now records, for each view page, the physical page it shows and the mapping call that last changed it. A page whose call is newer than the GPU write is left out at preparation, so a remap between the write and SignalX gives way to the new mapping as in mapping_changed. At publication, both the page and the call must still match, which also catches an unmap and remap of the same physical page; a move keeps the call and still gets the bytes. Four GPU cases cover this, and the description says to merge after #3781. Nothing blocks it.

Checked and fine
  • Earlier finding fixed: a remap between the GPU write and the signal. prepare_downloads keeps (page, call) only where call <= entry.written_call, and None for a page remapped after the write. write_changed_mapped_pages writes a page only when its snapshot is Some and equals what the view shows under the hold.
  • An unmap and remap of the same physical page gets a newer call, so it is left out both before and after preparation. A MapTitlePhysicalPages move keeps the call, so it is written at the new place. A page never named has call 0, and the test checks that.
  • The new tests cover a move, a remap after preparation, a remap before preparation, and the same page unmapped and restored, before and after preparation.
  • Earlier finding fixed: the description now says to merge after #3781, which fixes the kernelx test race the new GPU test sets off.
  • The writers are still retired when remapped pages are left out, so no later download writes the earlier mapping's bytes into a new page. The commit message now describes this.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7376146936 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759#issuecomment-7376146936). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T11:03:15Z. --- **Follow-up review** of `0d31bf1d`, since `6548204f` (code reading only, not a merge-check; draft) · no new findings **In short:** This push fixes both points from my last review. A download now records, for each view page, the physical page it shows and the mapping call that last changed it. A page whose call is newer than the GPU write is left out at preparation, so a remap between the write and `SignalX` gives way to the new mapping as in `mapping_changed`. At publication, both the page and the call must still match, which also catches an unmap and remap of the same physical page; a move keeps the call and still gets the bytes. Four GPU cases cover this, and the description says to merge after #3781. Nothing blocks it. <details><summary>Checked and fine</summary> - Earlier finding fixed: a remap between the GPU write and the signal. `prepare_downloads` keeps `(page, call)` only where `call <= entry.written_call`, and `None` for a page remapped after the write. `write_changed_mapped_pages` writes a page only when its snapshot is `Some` and equals what the view shows under the hold. - An unmap and remap of the same physical page gets a newer call, so it is left out both before and after preparation. A `MapTitlePhysicalPages` move keeps the call, so it is written at the new place. A page never named has call 0, and the test checks that. - The new tests cover a move, a remap after preparation, a remap before preparation, and the same page unmapped and restored, before and after preparation. - Earlier finding fixed: the description now says to merge after #3781, which fixes the `kernelx` test race the new GPU test sets off. - The writers are still retired when remapped pages are left out, so no later download writes the earlier mapping's bytes into a new page. The commit message now describes this. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
Gevroska commented 2026-12-03 13:44:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Gevroska on 2026-12-03T13:44:37Z.


@BBareth I found a case on 0d31bf1d where mapped-download publication returns true but drops a valid write. The view starts at offset 0x8000 and spans two adjacent 64 KiB view pages. Both map to the same physical page, but the first writes its upper 32 KiB and the second writes its lower 32 KiB. Their destination bytes don’t overlap.

I used a fenced RGBA8 readback from my RTX 3080 as the payload and ran the PR’s publication function against a synthetic mapping. The first slice should have changed from 0x5a to 0x2a. It stayed at 0x5a, while the second slice correctly changed to 0xc5. When I left the second slice unchanged, publication still returned true and wrote zero bytes. The first 32 KiB were lost in both cases. The controls with distinct physical pages or a newer second mapping behaved as expected.

The function keeps the last eligible view-page index for each physical page. A local change that suppresses only the bytes covered by a later eligible slice passed all four cases. An independent replay confirmed both the original failures and the corrected outputs.

AI disclosure: OpenAI Codex GPT-6.2 Sol built and ran the fixture and local correction. A separate Codex review checked the results. GPT-6.2 Astra drafted this comment.

I reviewed and approved this comment before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7380315440 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759#issuecomment-7380315440). Originally posted by [Gevroska](https://github.com/Gevroska) on 2026-12-03T13:44:37Z. --- @BBareth I found a case on `0d31bf1d` where mapped-download publication returns `true` but drops a valid write. The view starts at offset `0x8000` and spans two adjacent 64 KiB view pages. Both map to the same physical page, but the first writes its upper 32 KiB and the second writes its lower 32 KiB. Their destination bytes don’t overlap. I used a fenced RGBA8 readback from my RTX 3080 as the payload and ran the PR’s publication function against a synthetic mapping. The first slice should have changed from `0x5a` to `0x2a`. It stayed at `0x5a`, while the second slice correctly changed to `0xc5`. When I left the second slice unchanged, publication still returned `true` and wrote **zero bytes**. The first 32 KiB were lost in both cases. The controls with distinct physical pages or a newer second mapping behaved as expected. The function keeps the last eligible view-page index for each physical page. A local change that suppresses only the bytes covered by a later eligible slice passed all four cases. An independent replay confirmed both the original failures and the corrected outputs. AI disclosure: OpenAI Codex GPT-6.2 Sol built and ran the fixture and local correction. A separate Codex review checked the results. GPT-6.2 Astra drafted this comment. I reviewed and approved this comment before posting.
BBareth commented 2026-12-03 14:15:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T14:15:27Z.


@Gevroska thanks, confirmed. The last eligible view page won the whole physical page, so a texture starting inside a 64 KiB page lost the first slice whenever the next view page showed the same physical page.

Fixed in 09de2dfd, squashed into the commit: write_changed_mapped_pages now walks the slices last first and records, per physical page, the byte ranges a later eligible slice wrote. An earlier slice writes only the bytes no later one covers. Same-byte overlaps keep the last-page rule; disjoint halves each get written.

  • New test a_download_writes_both_halves_of_a_home_shown_twice_at_different_offsets covers your layout, a texture at view offset 0x8000 spanning two view pages of one physical page, with the second slice changed and unchanged. On 0d31bf1d it fails at the first-half assertion; on 09de2dfd it passes. uncovered_leaves_out_the_taken_ranges tests the range helper.
  • Suite on 09de2dfd: 3018 passed, 0 failed, 52 ignored, 28 SKIPPED. The smoke block in the description was rerun on this head.

AI use: Claude Code (Claude Opus 5.5) wrote the fix, the tests and this reply, and ran the suite and smoke.

<!-- greyfinch-sync:ivall/xcl:comment:7381145108 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759#issuecomment-7381145108). Originally posted by [BBareth](https://github.com/BBareth) on 2026-12-03T14:15:27Z. --- @Gevroska thanks, confirmed. The last eligible view page won the whole physical page, so a texture starting inside a 64 KiB page lost the first slice whenever the next view page showed the same physical page. Fixed in 09de2dfd, squashed into the commit: `write_changed_mapped_pages` now walks the slices last first and records, per physical page, the byte ranges a later eligible slice wrote. An earlier slice writes only the bytes no later one covers. Same-byte overlaps keep the last-page rule; disjoint halves each get written. - New test `a_download_writes_both_halves_of_a_home_shown_twice_at_different_offsets` covers your layout, a texture at view offset `0x8000` spanning two view pages of one physical page, with the second slice changed and unchanged. On 0d31bf1d it fails at the first-half assertion; on 09de2dfd it passes. `uncovered_leaves_out_the_taken_ranges` tests the range helper. - Suite on 09de2dfd: 3018 passed, 0 failed, 52 ignored, 28 SKIPPED. The smoke block in the description was rerun on this head. AI use: Claude Code (Claude Opus 5.5) wrote the fix, the tests and this reply, and ran the suite and smoke.
Foniass commented 2026-12-03 14:17:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T14:17:55Z.


Follow-up review of 09de2dfd, since 0d31bf1d (code reading only, not a merge-check) · no new findings

In short: Since 0d31bf1d, only the top commit changed, in write_changed_mapped_pages. When several view pages of a texture show one physical page, the earlier code let the last eligible page write the whole home. Now each page writes only its own part of the home, and a later page wins only on the bytes they share. This fixes the case raised in the thread, a texture that starts inside a 64 KiB page, where the first page's bytes were lost. The earlier review had no open points, and this push adds no new problem.

Checked and fine
  • No earlier point is open: the review of 0d31bf1d had no findings.
  • The texture is split into one slice per 64 KiB page, and the slices are walked from last to first (title_textures.rs ~4215-4258). For each home, the in-page ranges that later eligible pages cover are recorded in taken, keyed on home & !1. An earlier slice writes only what uncovered leaves. Pages that are not eligible, and pages whose home is 0, cover nothing, so an earlier eligible page still writes those bytes. This keeps the earlier "last eligible page" rule.
  • The offsets agree:
    • to = (home & !1) + off;
    • live is read through PageMap::new(a, vec![home]) for the same bytes;
    • each run from changed_page_runs is moved into page offsets, clipped by uncovered, and moved back.
    • live[..n] stays in bounds, because n <= PAGE.min(new.len()).
  • A later slice records its range even when nothing in it changed. So an earlier slice never writes bytes that the later page also shows, the same rule a_download_writes_a_home_shown_twice_from_its_last_page asserts. A failed write still returns false, so the caller retries with a fresh read.
  • uncovered (~4261) handles taken ranges that are unsorted, overlapping, adjacent or partly outside the request. uncovered_leaves_out_the_taken_ranges covers those cases.
  • a_download_writes_both_halves_of_a_home_shown_twice_at_different_offsets sets up the reported layout: a texture at view offset PAGE / 2, with both view pages showing one pool page. It covers both the changed and the unchanged second half, and its first-half assertion fails with the old code.
  • Nothing else changed since 0d31bf1d: #3549's fc7abe51 is the same, and the rest of the diff is title_textures.rs only (78+/16-).

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7381213209 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759#issuecomment-7381213209). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T14:17:55Z. --- **Follow-up review** of `09de2dfd`, since `0d31bf1d` (code reading only, not a merge-check) · no new findings **In short:** Since `0d31bf1d`, only the top commit changed, in `write_changed_mapped_pages`. When several view pages of a texture show one physical page, the earlier code let the last eligible page write the whole home. Now each page writes only its own part of the home, and a later page wins only on the bytes they share. This fixes the case raised in the thread, a texture that starts inside a 64 KiB page, where the first page's bytes were lost. The earlier review had no open points, and this push adds no new problem. <details><summary>Checked and fine</summary> - No earlier point is open: the review of `0d31bf1d` had no findings. - The texture is split into one slice per 64 KiB page, and the slices are walked from last to first (`title_textures.rs` ~4215-4258). For each home, the in-page ranges that later eligible pages cover are recorded in `taken`, keyed on `home & !1`. An earlier slice writes only what `uncovered` leaves. Pages that are not eligible, and pages whose home is 0, cover nothing, so an earlier eligible page still writes those bytes. This keeps the earlier "last eligible page" rule. - The offsets agree: - `to = (home & !1) + off`; - `live` is read through `PageMap::new(a, vec![home])` for the same bytes; - each run from `changed_page_runs` is moved into page offsets, clipped by `uncovered`, and moved back. - `live[..n]` stays in bounds, because `n <= PAGE.min(new.len())`. - A later slice records its range even when nothing in it changed. So an earlier slice never writes bytes that the later page also shows, the same rule `a_download_writes_a_home_shown_twice_from_its_last_page` asserts. A failed write still returns `false`, so the caller retries with a fresh read. - `uncovered` (~4261) handles taken ranges that are unsorted, overlapping, adjacent or partly outside the request. `uncovered_leaves_out_the_taken_ranges` covers those cases. - `a_download_writes_both_halves_of_a_home_shown_twice_at_different_offsets` sets up the reported layout: a texture at view offset `PAGE / 2`, with both view pages showing one pool page. It covers both the changed and the unchanged second half, and its first-half assertion fails with the old code. - Nothing else changed since `0d31bf1d`: #3549's `fc7abe51` is the same, and the rest of the diff is `title_textures.rs` only (78+/16-). </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
Gevroska commented 2026-12-03 15:51:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Gevroska on 2026-12-03T15:51:54Z.


@BBareth Thanks, I reran both cases from my earlier report on 09de2dfd. The revised writer restored all 32,768 missing bytes in both cases, including the one where the later slice was already unchanged.

I replayed the same saved 64 KiB RTX 3080 readback against controlled mappings on Windows. All backing bytes matched in all four cases, including the distinct-page and stale-mapping controls. A separate byte-by-byte check also passed for 223,608 interval combinations.

That resolves the data loss I reported on 0d31bf1d. This was a replay of the publication function with the original payload.

AI disclosure: OpenAI Codex GPT-6.2 Sol ran the replay. An independent Codex reviewer checked the results. GPT-6.2 Astra drafted this comment.

I reviewed and approved this comment before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7383860449 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3759#issuecomment-7383860449). Originally posted by [Gevroska](https://github.com/Gevroska) on 2026-12-03T15:51:54Z. --- @BBareth Thanks, I reran both cases from my earlier report on `09de2dfd`. **The revised writer restored all 32,768 missing bytes in both cases**, including the one where the later slice was already unchanged. I replayed the same saved 64 KiB RTX 3080 readback against controlled mappings on Windows. All backing bytes matched in all four cases, including the distinct-page and stale-mapping controls. A separate byte-by-byte check also passed for 223,608 interval combinations. That resolves the data loss I reported on `0d31bf1d`. This was a replay of the publication function with the original payload. AI disclosure: OpenAI Codex GPT-6.2 Sol ran the replay. An independent Codex reviewer checked the results. GPT-6.2 Astra drafted this comment. I reviewed and approved this comment before posting.
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/3759:upstream-pr/3759'
git switch 'upstream-pr/3759'

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/3759'
git switch 'upstream-pr/3759'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3759'
git switch 'upstream-pr/3759'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3759'
git switch 'main'
git merge --squash 'upstream-pr/3759'
git switch 'main'
git merge --ff-only 'upstream-pr/3759'
git switch 'main'
git merge 'upstream-pr/3759'
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!3759
No description provided.