notify placed textures at alias views on memory writes #615

Open
RileyW wants to merge 1 commit from RileyW/Darner:pr/alias-texture-writes into Main
First-time contributor

What it changes

  • The problem on main: read from code (crates/darner-gpu/src/watch.rs, writing, kernel_writing, and itle_memory_written).

watch::stream_written already propagates memory-write notifications to aliased virtual addresses via inplace::shown_elsewhere with exact byte-range intersections, but writing, kernel_writing, and itle_memory_written only notified descriptor::remapped(at, len) for the written VA itself. Placed textures bound through an alias VA therefore missed immediate dirty notifications and waited for periodic rechecks.

This change:

  1. Extracts lias_byte_ranges(at, len) and
    emapped_with_aliases(at, len) in crates/darner-gpu/src/watch.rs, reusing stream_written's byte-intersection logic.
  2. Wires alias-range notifications into writing, kernel_writing, and itle_memory_written (in the !pages branch, avoiding double-reporting when xmem::pages_written already enumerates all views).
  3. Adds descriptor::host::page_written_ranges and
    emapped_gathered in crates/darner-gpu/src/descriptor/host.rs so gathered/remapped queues receive exact aliased sub-ranges, plus CPU-only unit test coverage (lias_writes_notify_placed_textures_without_touching_neighbours) verifying both VAs are notified while unaffected neighboring views are untouched.

How it was tested

  • Tested revision: ef809e (based on c8258f9)
  • Commands and results:
    • cargo test -p darner-gpu --lib alias_writes_notify_placed_textures_without_touching_neighbours --locked -> 1 passed, 0 failed
    • cargo test -p darner-gpu --lib watch:: --locked -- --test-threads=1 --skip streamed_texture_written_through_an_alias_reaches_a_full_queue -> 89 passed, 0 failed
    • cargo clippy --workspace --all-targets --locked -- -D warnings -> 0 warnings
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings -> 0 warnings
    • cargo xtask policy and cargo xtask policy --staged -> ok
  • Changes a default: yes, for all hosts (extends existing alias-write propagation from stream_written to writing/kernel_writing/ itle_memory_written).
  • A/B result: correctness fix (eliminates missed alias texture refreshes); not a speed claim.
  • Gates run on that revision: cargo clippy --workspace --all-targets --locked -- -D warnings, cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, cargo xtask policy, plus darner-gpu watch:: tests.
  • Gameplay, when relevant: not yet re-run in-game on this Darner branch (previously verified on RTX 3080 in a downstream fork, eliminating delayed placed-texture refresh warnings).
  • Shader wave sizes tested, when relevant: n/a.
  • Hardware dependence: likely general (CPU watch/descriptor tracking).
  • Coverage gaps: On this Windows 10 22H2 machine, streamed_texture_written_through_an_alias_reaches_a_full_queue aborts (exit code 3) because test binaries without Agility SDK exports only see SM 0x65 from system d3d12.dll; the new alias-write test exercises Spans, REMAPPED, and PAGE_WRITTEN on CPU directly so it runs on Windows 10 and headless CI.

Checklist

  • I ran this change in the game, or say below why it can't be (CPU unit tests run on this revision; in-game Darner run pending).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #563, #565, #600 (touch descriptor/host.rs or watch.rs in unrelated areas).
  • Replaces or overlaps: none found.
## What it changes - The problem on main: read from code (crates/darner-gpu/src/watch.rs, writing, kernel_writing, and itle_memory_written). watch::stream_written already propagates memory-write notifications to aliased virtual addresses via inplace::shown_elsewhere with exact byte-range intersections, but writing, kernel_writing, and itle_memory_written only notified descriptor::remapped(at, len) for the written VA itself. Placed textures bound through an alias VA therefore missed immediate dirty notifications and waited for periodic rechecks. This change: 1. Extracts lias_byte_ranges(at, len) and emapped_with_aliases(at, len) in crates/darner-gpu/src/watch.rs, reusing stream_written's byte-intersection logic. 2. Wires alias-range notifications into writing, kernel_writing, and itle_memory_written (in the !pages branch, avoiding double-reporting when xmem::pages_written already enumerates all views). 3. Adds descriptor::host::page_written_ranges and emapped_gathered in crates/darner-gpu/src/descriptor/host.rs so gathered/remapped queues receive exact aliased sub-ranges, plus CPU-only unit test coverage (lias_writes_notify_placed_textures_without_touching_neighbours) verifying both VAs are notified while unaffected neighboring views are untouched. ## How it was tested - Tested revision: ef809e (based on c8258f9) - Commands and results: - cargo test -p darner-gpu --lib alias_writes_notify_placed_textures_without_touching_neighbours --locked -> 1 passed, 0 failed - cargo test -p darner-gpu --lib watch:: --locked -- --test-threads=1 --skip streamed_texture_written_through_an_alias_reaches_a_full_queue -> 89 passed, 0 failed - cargo clippy --workspace --all-targets --locked -- -D warnings -> 0 warnings - cargo clippy --workspace --all-targets --all-features --locked -- -D warnings -> 0 warnings - cargo xtask policy and cargo xtask policy --staged -> ok - Changes a default: yes, for all hosts (extends existing alias-write propagation from stream_written to writing/kernel_writing/ itle_memory_written). - A/B result: correctness fix (eliminates missed alias texture refreshes); not a speed claim. - Gates run on that revision: cargo clippy --workspace --all-targets --locked -- -D warnings, cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, cargo xtask policy, plus darner-gpu watch:: tests. - Gameplay, when relevant: not yet re-run in-game on this Darner branch (previously verified on RTX 3080 in a downstream fork, eliminating delayed placed-texture refresh warnings). - Shader wave sizes tested, when relevant: n/a. - Hardware dependence: likely general (CPU watch/descriptor tracking). - Coverage gaps: On this Windows 10 22H2 machine, streamed_texture_written_through_an_alias_reaches_a_full_queue aborts (exit code 3) because test binaries without Agility SDK exports only see SM 0x65 from system d3d12.dll; the new alias-write test exercises Spans, REMAPPED, and PAGE_WRITTEN on CPU directly so it runs on Windows 10 and headless CI. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (CPU unit tests run on this revision; in-game Darner run pending). - [x] This PR contains one change based on main. - [x] The diff follows docs/asset-policy.md. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #563, #565, #600 (touch descriptor/host.rs or watch.rs in unrelated areas). - Replaces or overlaps: none found.
Contributor

Independent hardware result for the alias-to-full-queue case on aef809e3. I ran it on native Windows 11 Pro (build 26300) with an RTX 4060 and driver 621.40. A local assertion in the test required a physical D3D12 adapter and verified that it selected the RTX 4060.

watch::tests::streamed_texture_written_through_an_alias_reaches_a_full_queue passed with the default flat queue and with DARNER_DUE_INDEX=1. In each run, both alias writes raised the backlog from 8,192 to 8,193. The matching slot came first (0, then 1), all 1,024 GPU pixels read back correctly for each page, and the fixture's checks on the untouched neighbour and previous page passed. The new CPU test alias_writes_notify_placed_textures_without_touching_neighbours also passed.

I ran the three checks individually with cargo test --locked --offline -p darner-gpu --lib <full test name> -- --exact --nocapture.

Independent hardware result for the alias-to-full-queue case on `aef809e3`. I ran it on native Windows 11 Pro (build 26300) with an RTX 4060 and driver 621.40. A local assertion in the test required a physical D3D12 adapter and verified that it selected the RTX 4060. `watch::tests::streamed_texture_written_through_an_alias_reaches_a_full_queue` passed with the default flat queue and with `DARNER_DUE_INDEX=1`. In each run, both alias writes raised the backlog from 8,192 to 8,193. The matching slot came first (0, then 1), all 1,024 GPU pixels read back correctly for each page, and the fixture's checks on the untouched neighbour and previous page passed. The new CPU test `alias_writes_notify_placed_textures_without_touching_neighbours` also passed. I ran the three checks individually with `cargo test --locked --offline -p darner-gpu --lib <full test name> -- --exact --nocapture`.
TrustNo1 changed title from [pr-fix][memory][rendering] notify placed textures at alias views on memory writes to notify placed textures at alias views on memory writes 2026-12-06 03:26:13 +00:00
Owner

Test needed — commit aef809e3; what to check:

  • The problem on main: read from code (crates/darner-gpu/src/watch.rs, writing, kernel_writing, and itle_memory_written).

watch::stream_written already propagates memory-write notifications to aliased virtual addresses via inplace::shown_elsewhere with exact byte-range intersections, but writing, kernel_writing, and itle_memory_written only notified descriptor::remapped(at, len) for the written VA itself. Placed textures bound through an alias VA therefore missed immediate dirty notifications and waited for periodic rechecks.

This change:

  1. Extracts lias_byte_ranges(at, len) and
    emapped_with_aliases(at, len) in crates/darner-gpu/src/watch.rs, reusing stream_written's byte-intersection logic.
  2. Wires alias-range notifications into writing, kernel_writing, and itle_memory_written (in the !pages branch, avoiding double-reporting when xmem::pages_written already enumerates all views).
  3. Adds descriptor::host::page_written_ranges and
    emapped_gathered in crates/darner-gpu/src/descriptor/host.rs so gathered/remapped queues receive exact aliased sub-ranges, plus CPU-only unit test coverage (lias_writes_notify_placed_textures_without_touching_neighbours) verifying both VAs are n

Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.

Reply testing to take this run; it's free again after 24 h with no results.

**Test needed** — commit `aef809e3`; what to check: - The problem on main: read from code (crates/darner-gpu/src/watch.rs, writing, kernel_writing, and itle_memory_written). watch::stream_written already propagates memory-write notifications to aliased virtual addresses via inplace::shown_elsewhere with exact byte-range intersections, but writing, kernel_writing, and itle_memory_written only notified descriptor::remapped(at, len) for the written VA itself. Placed textures bound through an alias VA therefore missed immediate dirty notifications and waited for periodic rechecks. This change: 1. Extracts lias_byte_ranges(at, len) and emapped_with_aliases(at, len) in crates/darner-gpu/src/watch.rs, reusing stream_written's byte-intersection logic. 2. Wires alias-range notifications into writing, kernel_writing, and itle_memory_written (in the !pages branch, avoiding double-reporting when xmem::pages_written already enumerates all views). 3. Adds descriptor::host::page_written_ranges and emapped_gathered in crates/darner-gpu/src/descriptor/host.rs so gathered/remapped queues receive exact aliased sub-ranges, plus CPU-only unit test coverage (lias_writes_notify_placed_textures_without_touching_neighbours) verifying both VAs are n Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture. Reply `testing` to take this run; it's free again after 24 h with no results.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'pr/alias-texture-writes:RileyW-pr/alias-texture-writes'
git switch 'RileyW-pr/alias-texture-writes'

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 'RileyW-pr/alias-texture-writes'
git switch 'RileyW-pr/alias-texture-writes'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'RileyW-pr/alias-texture-writes'
git switch 'RileyW-pr/alias-texture-writes'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'RileyW-pr/alias-texture-writes'
git switch 'Main'
git merge --squash 'RileyW-pr/alias-texture-writes'
git switch 'Main'
git merge --ff-only 'RileyW-pr/alias-texture-writes'
git switch 'Main'
git merge 'RileyW-pr/alias-texture-writes'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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!615
No description provided.