Publish the remap cursor when a texture heap is created #547

Open
holoslicer wants to merge 1 commit from holoslicer/Darner:fix/publish-texture-remap-cursor into Main
Contributor

Refs #539 and #542.

Contributor role (optional)

Fluxer ID 1577921940104949761. Please grant the Contributor role when this merges.

What it changes

A new texture heap starts its remap cursor at the latest write. On upstream main this read leaves older entries eligible for extension or compaction. A later write can therefore put a pre-existing span under a new sequence number. A heap watching the narrow write sees extra slots from that older span.

Publish the initial cursor under the existing journal lock. Older heaps can still consume their pending ranges. The test covers a broad range written before the heap exists, a later narrow write and the same broad range recorded after the heap exists. Separate coverage checks that an older heap can still see its pending writes and that a stale completion cannot cancel a newer upload.

How it was tested

  • Upstream baseline c8258f9. Tested revision 0ea931e9. Windows x64 and RTX 3090, driver 617.42.

  • Run cargo test --locked -p darner-gpu --lib a_full_texture_queue_only_replays_remaps_after_its_heap_was_created and cargo test --locked -p darner-gpu --lib publishing_a_remap_cursor_preserves_pending_ranges_for_older_heaps. Both pass on the fix. The first fixture uses an isolated journal so the input order is repeatable.

  • Native A/B used the existing full-queue alias test and a synthetic predecessor heap. Register two live mapped views, submit overlapping remaps through remapped_ranges before creating the test heap, and perform its two narrow writes with 8,192 unrelated uploads waiting. Upstream and this change each ran in three fresh processes. On upstream, all three first-page reads selected slot 2 with 8,194 pending and matched 0/1,024 pixels. On this revision, all three selected slot 0 then slot 1 with 8,193 pending each time. Both pages matched 1,024/1,024 pixels and left 8,192 uploads queued. The neighbouring slot kept its original write generation.

  • In a separate model check, the production journal was compared with an independent bitset of writes since each subscriber's cursor. Three consumers, 512 seeds at each of five queue limits (1, 2, 4, 8, 32), 409,600 total operations. Each input stream was identical between revisions.

    Journal outcome Upstream This change
    Precise reads containing an excess span 5,153 0
    Precise reads missing a span 0 0
    Full-rescan fallbacks 30,862 29,441
  • Verification on this revision used both strict workspace Clippy commands (default features and all features), cargo xtask policy, and the full serial cargo test --workspace --locked --offline --no-fail-fast suite with --config profile.test.package.darner-shader.opt-level=3. All exited 0. Top-level harness totals were 3,521 passed, 0 failed and 121 ignored. The synthetic regression and the ordinary two-page GPU readback both passed in the full suite.

  • With the default settings, every new heap observes the publication boundary. No configuration change. Shader and gameplay performance were outside this test. The earlier suite failure lacked a trace identifying its original journal input.

Checklist

  • Verified offline with synthetic inputs. No game data required.
  • One change based on upstream main.
  • The diff follows the asset policy.
  • This change has no prerequisites.

Checked for overlap

  • Searched open and closed PRs/issues plus the open PRs touching the descriptor heap.
  • #539 changes the texture wake path. #542 records a suite failure of the alias test on an app-only change. #528, #508, #380, #335 and #292 also touch the descriptor heap. I found no competing change for the heap's initial cursor.
Refs #539 and #542. ## Contributor role (optional) Fluxer ID `1577921940104949761`. Please grant the Contributor role when this merges. ## What it changes A new texture heap starts its remap cursor at the latest write. On upstream main this read leaves older entries eligible for extension or compaction. A later write can therefore put a pre-existing span under a new sequence number. A heap watching the narrow write sees extra slots from that older span. Publish the initial cursor under the existing journal lock. Older heaps can still consume their pending ranges. The test covers a broad range written before the heap exists, a later narrow write and the same broad range recorded after the heap exists. Separate coverage checks that an older heap can still see its pending writes and that a stale completion cannot cancel a newer upload. ## How it was tested - Upstream baseline `c8258f9`. Tested revision `0ea931e9`. Windows x64 and RTX 3090, driver 617.42. - Run `cargo test --locked -p darner-gpu --lib a_full_texture_queue_only_replays_remaps_after_its_heap_was_created` and `cargo test --locked -p darner-gpu --lib publishing_a_remap_cursor_preserves_pending_ranges_for_older_heaps`. Both pass on the fix. The first fixture uses an isolated journal so the input order is repeatable. - Native A/B used the existing full-queue alias test and a synthetic predecessor heap. Register two live mapped views, submit overlapping remaps through `remapped_ranges` before creating the test heap, and perform its two narrow writes with 8,192 unrelated uploads waiting. Upstream and this change each ran in three fresh processes. On upstream, all three first-page reads selected slot 2 with 8,194 pending and matched 0/1,024 pixels. On this revision, all three selected slot 0 then slot 1 with 8,193 pending each time. Both pages matched 1,024/1,024 pixels and left 8,192 uploads queued. The neighbouring slot kept its original write generation. - In a separate model check, the production journal was compared with an independent bitset of writes since each subscriber's cursor. Three consumers, 512 seeds at each of five queue limits (1, 2, 4, 8, 32), 409,600 total operations. Each input stream was identical between revisions. | Journal outcome | Upstream | This change | |---|---:|---:| | Precise reads containing an excess span | 5,153 | 0 | | Precise reads missing a span | 0 | 0 | | Full-rescan fallbacks | 30,862 | 29,441 | - Verification on this revision used both strict workspace Clippy commands (default features and all features), cargo xtask policy, and the full serial cargo test --workspace --locked --offline --no-fail-fast suite with --config profile.test.package.darner-shader.opt-level=3. All exited 0. Top-level harness totals were 3,521 passed, 0 failed and 121 ignored. The synthetic regression and the ordinary two-page GPU readback both passed in the full suite. - With the default settings, every new heap observes the publication boundary. No configuration change. Shader and gameplay performance were outside this test. The earlier suite failure lacked a trace identifying its original journal input. ## Checklist - [x] Verified offline with synthetic inputs. No game data required. - [x] One change based on upstream main. - [x] The diff follows the asset policy. - [x] This change has no prerequisites. ## Checked for overlap - [x] Searched open and closed PRs/issues plus the open PRs touching the descriptor heap. - #539 changes the texture wake path. #542 records a suite failure of the alias test on an app-only change. #528, #508, #380, #335 and #292 also touch the descriptor heap. I found no competing change for the heap's initial cursor.
holoslicer changed title from WIP: [pr-fix][rendering][memory] Publish the remap cursor when a texture heap is created to [pr-fix][rendering][memory] Publish the remap cursor when a texture heap is created 2026-12-05 11:59:26 +00:00
First-time contributor

Tested merged onto c8258f95 (release), head 0ea931e9. RTX 3090 24 GB, driver 621.24, i5-10600K, 32 GB, Windows 11.

One unattended run, 60 s in the world: exit code 0, no device removed, no new kind of WARN or ERROR line compared with main.

Note: #547 and #563 seem to make the same fix (the remap cursor is published when HostHeap::new sets it up). I tested both and saw no difference between them in this run. Only one of them is probably needed.

AI-assisted testing (Claude Code, Claude Opus 5.5); results and text reviewed by me.

Tested merged onto `c8258f95` (release), head `0ea931e9`. RTX 3090 24 GB, driver 621.24, i5-10600K, 32 GB, Windows 11. One unattended run, 60 s in the world: exit code 0, no device removed, no new kind of WARN or ERROR line compared with `main`. Note: #547 and #563 seem to make the same fix (the remap cursor is published when `HostHeap::new` sets it up). I tested both and saw no difference between them in this run. Only one of them is probably needed. _AI-assisted testing (Claude Code, Claude Opus 5.5); results and text reviewed by me._
TrustNo1 changed title from [pr-fix][rendering][memory] Publish the remap cursor when a texture heap is created to Publish the remap cursor when a texture heap is created 2026-12-06 03:27:25 +00:00
This pull request has changes conflicting with the target branch.
  • crates/darner-gpu/src/descriptor/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/publish-texture-remap-cursor:holoslicer-fix/publish-texture-remap-cursor'
git switch 'holoslicer-fix/publish-texture-remap-cursor'

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 'holoslicer-fix/publish-texture-remap-cursor'
git switch 'holoslicer-fix/publish-texture-remap-cursor'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'holoslicer-fix/publish-texture-remap-cursor'
git switch 'holoslicer-fix/publish-texture-remap-cursor'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'holoslicer-fix/publish-texture-remap-cursor'
git switch 'Main'
git merge --squash 'holoslicer-fix/publish-texture-remap-cursor'
git switch 'Main'
git merge --ff-only 'holoslicer-fix/publish-texture-remap-cursor'
git switch 'Main'
git merge 'holoslicer-fix/publish-texture-remap-cursor'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!547
No description provided.