GPU: refresh view-memory textures that host-side writers changed #555

Open
github-bot wants to merge 1 commit from github-bot/gh-555 into main AGit
Owner

@⁠pug205gti6 on GitHub · 2026-11-25 02:08 UTC · original
pug205gti6:pr/438-gpu-refresh-vmt → main · +659 −52 · 10 files · 1 commits · open

A texture in view memory is guarded (made read-only, a write faults once) and otherwise hashed only every eighth frame, so a write the guard does not see leaves it up to eight frames stale. Two kinds were unseen: the title fills physical pages through its pool while the same pages are sampled through its tiled heap, and the runtime writes physical pages through views of its own (DirectStorage page destinations, xmem's write_physical). Neither faults at the guarded address.

  • Blocks of another view that show a guarded block's pages are made read-only as well, and a write there marks the guarded block written (VICTORY_GUARD_ALIASES=0 turns this off).
  • The runtime's physical-page writes are reported with physical_written.
  • kernel_will_write now returns a hold. Until it is dropped the blocks are not guarded again through either view, so the kernel write cannot fail on them. write_mapped takes the hold itself.
  • An old view is kept in place of a new one only when the two differ in their mips. A view of another array slice, plane or format (a video's ring of pictures) would show an older picture.

The intro flicker had this cause: with every view-memory texture hashed at each check (VICTORY_TEXTURE_GUARD=0), or with no views kept (VICTORY_KEEP_VIEWS=0), the flickering tiles went from 317 to 2 of 480. The fix itself is tested on WARP only and has not been confirmed in a game run yet. A runtime writer that neither faults nor reports its writes (its media code may be one) is still unseen.

AI-assisted (Claude Code)

**@⁠pug205gti6** on GitHub · 2026-11-25 02:08 UTC · [original](https://github.com/fxceless/victory-fork/pull/555) `pug205gti6:pr/438-gpu-refresh-vmt` → `main` · +659 −52 · 10 files · 1 commits · open A texture in view memory is guarded (made read-only, a write faults once) and otherwise hashed only every eighth frame, so a write the guard does not see leaves it up to eight frames stale. Two kinds were unseen: the title fills physical pages through its pool while the same pages are sampled through its tiled heap, and the runtime writes physical pages through views of its own (DirectStorage page destinations, xmem's write_physical). Neither faults at the guarded address. - Blocks of another view that show a guarded block's pages are made read-only as well, and a write there marks the guarded block written (VICTORY_GUARD_ALIASES=0 turns this off). - The runtime's physical-page writes are reported with physical_written. - kernel_will_write now returns a hold. Until it is dropped the blocks are not guarded again through either view, so the kernel write cannot fail on them. write_mapped takes the hold itself. - An old view is kept in place of a new one only when the two differ in their mips. A view of another array slice, plane or format (a video's ring of pictures) would show an older picture. The intro flicker had this cause: with every view-memory texture hashed at each check (VICTORY_TEXTURE_GUARD=0), or with no views kept (VICTORY_KEEP_VIEWS=0), the flickering tiles went from 317 to 2 of 480. The fix itself is tested on WARP only and has not been confirmed in a game run yet. A runtime writer that neither faults nor reports its writes (its media code may be one) is still unseen. AI-assisted (Claude Code)
A texture in view memory is guarded (made read-only, a write faults
once) and otherwise hashed only every eighth frame, so a write the
guard does not see leaves it up to eight frames stale. Two kinds were
unseen: the title fills physical pages through its pool while the same
pages are sampled through its tiled heap, and the runtime writes
physical pages through views of its own (DirectStorage page
destinations, xmem's write_physical). Neither faults at the guarded
address.

- Blocks of another view that show a guarded block's pages are made
  read-only as well, and a write there marks the guarded block written
  (VICTORY_GUARD_ALIASES=0 turns this off).
- The runtime's physical-page writes are reported with
  physical_written.
- kernel_will_write now returns a hold. Until it is dropped the blocks
  are not guarded again through either view, so the kernel write
  cannot fail on them. write_mapped takes the hold itself.
- An old view is kept in place of a new one only when the two differ
  in their mips. A view of another array slice, plane or format (a
  video's ring of pictures) would show an older picture.

The intro flicker had this cause: with every view-memory texture
hashed at each check (VICTORY_TEXTURE_GUARD=0), or with no views kept
(VICTORY_KEEP_VIEWS=0), the flickering tiles went from 317 to 2 of 480.
The fix itself is tested on WARP only and has not been confirmed in a
game run yet. A runtime writer that neither faults nor reports its
writes (its media code may be one) is still unseen.

AI-assisted (Claude Code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:46:15 +00:00
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-25 03:07 UTC · original

Independent integration check: PR #555 + #550 stack cleanly onto current main (c96b4f2). One content conflict in victory-gpu/src/resource.rs (room_percent/ranges_overlap) — resolved by keeping both. Build: success. Tests: failure, but pre-existing platform issues (windows_sys not found, cfg-gated host modules) identical on upstream/main without the PRs. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, AI-assisted. These two PRs can be merged together.

**@⁠Headache3318** on GitHub · 2026-11-25 03:07 UTC · [original](https://github.com/fxceless/victory-fork/pull/555#issuecomment-7151618689) Independent integration check: PR #555 + #550 stack cleanly onto current main (c96b4f2). One content conflict in victory-gpu/src/resource.rs (room_percent/ranges_overlap) — resolved by keeping both. Build: success. Tests: failure, but pre-existing platform issues (windows_sys not found, cfg-gated host modules) identical on upstream/main without the PRs. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, AI-assisted. These two PRs can be merged together.
Author
Owner

@⁠Pin0d1 on GitHub · 2026-11-25 03:57 UTC · original

I tested 5af49b5 with two independent Shadow resources backed by the same Windows section. After writing through the second mapping, both GPU readbacks returned 0x11223344. I also checked a synchronous four-byte file read into a held destination. Refreshing the sibling mapping and dropping the first of two overlapping holders preserved the bytes TEST and the dirty-page notification.

All three added tests passed twice in fresh processes on Windows 11. The third test checks that both consumers observe the same write in the page journal. The test commit applies directly on top of this PR. From that commit, run cargo test --locked -p victory-gpu --lib watch:: -- --test-threads=1. Test-only commit

Prepared with the help of Codex 6.2 Astra Max.

**@⁠Pin0d1** on GitHub · 2026-11-25 03:57 UTC · [original](https://github.com/fxceless/victory-fork/pull/555#issuecomment-7152402929) I tested `5af49b5` with two independent Shadow resources backed by the same Windows section. After writing through the second mapping, both GPU readbacks returned `0x11223344`. I also checked a synchronous four-byte file read into a held destination. Refreshing the sibling mapping and dropping the first of two overlapping holders preserved the bytes `TEST` and the dirty-page notification. All three added tests passed twice in fresh processes on Windows 11. The third test checks that both consumers observe the same write in the page journal. The test commit applies directly on top of this PR. From that commit, run `cargo test --locked -p victory-gpu --lib watch:: -- --test-threads=1`. [Test-only commit](https://github.com/Pin0d1/victory-fork/commit/b63010881edd8d98e2eef0754bf38e474b0ce35b) Prepared with the help of Codex 6.2 Astra Max.
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-25 04:47 UTC · original

Independent verification: PR #555 merges cleanly onto main (no conflicts), 10 files changed. Build: success (19.32s). Tests: fail to compile on Linux due to pre-existing windows_sys/cfg-gated issues in victory-loader — unrelated to this GPU-only PR. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.

**@⁠Headache3318** on GitHub · 2026-11-25 04:47 UTC · [original](https://github.com/fxceless/victory-fork/pull/555#issuecomment-7153168465) Independent verification: PR #555 merges cleanly onto main (no conflicts), 10 files changed. Build: success (19.32s). Tests: fail to compile on Linux due to pre-existing windows_sys/cfg-gated issues in victory-loader — unrelated to this GPU-only PR. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.
Author
Owner

@⁠SantannaCarlos on GitHub · 2026-11-25 06:26 UTC · original

In-game result for this PR, since it was tested on WARP only: RTX 4070, 310c6eb + this PR (5af49b5), default settings, a save that loads into the cell, two 15-minute runs, with a local scan that counts host-copy pages the guard reports clean but that differ from title memory three checks in a row (described on #62).

  • Cell walls at the window: drawn in 2 of 2 runs.
  • Stale clean pages on pages shown by several views: 0 in both (c96b4f2 alone: 3,824 and 4,204 a run; with #571 alone: 536 and 3,477).
  • No dstorage: request failed, no title stop, no device removal.

So it does what the #115 + Spexivus/victory-fork#1 + Spexivus/victory-fork#2 line does, in one PR, with the same hold on kernel writes. The two overlap almost entirely; whichever goes in, the other can be closed or rebased onto it.

Frame time isn't comparable yet: these runs are on 310c6eb and my runs of the other line on c96b4f2. I'm running both on 310c6eb and will post the numbers here, together with a follow-up that cuts the alias lookups during loading (it measured about 12–15% less preparation in the first minute in the world on the other line) and should apply to this one as well.

**@⁠SantannaCarlos** on GitHub · 2026-11-25 06:26 UTC · [original](https://github.com/fxceless/victory-fork/pull/555#issuecomment-7154786104) In-game result for this PR, since it was tested on WARP only: RTX 4070, `310c6eb` + this PR (`5af49b5`), default settings, a save that loads into the cell, two 15-minute runs, with a local scan that counts host-copy pages the guard reports clean but that differ from title memory three checks in a row (described on #62). - Cell walls at the window: drawn in **2 of 2** runs. - Stale clean pages on pages shown by several views: **0** in both (`c96b4f2` alone: 3,824 and 4,204 a run; with #571 alone: 536 and 3,477). - No `dstorage: request failed`, no title stop, no device removal. So it does what the #115 + Spexivus/victory-fork#1 + Spexivus/victory-fork#2 line does, in one PR, with the same hold on kernel writes. The two overlap almost entirely; whichever goes in, the other can be closed or rebased onto it. Frame time isn't comparable yet: these runs are on `310c6eb` and my runs of the other line on `c96b4f2`. I'm running both on `310c6eb` and will post the numbers here, together with a follow-up that cuts the alias lookups during loading (it measured about 12–15% less preparation in the first minute in the world on the other line) and should apply to this one as well.
Author
Owner

@⁠Revens2 on GitHub · 2026-11-25 07:38 UTC · original

Duplicate of #438: @⁠sennecools opened this patch 79 minutes earlier, and gh pr diff returns the same bytes for both (+659/-52 on 10 file(s), same title).

Both PRs are CONFLICTING, so this copy does not resolve the conflict it was probably made for.

Please continue in #438 so the review history and any test data stay in one place.
Thanks.

**@⁠Revens2** on GitHub · 2026-11-25 07:38 UTC · [original](https://github.com/fxceless/victory-fork/pull/555#issuecomment-7156085736) Duplicate of #438: @⁠sennecools opened this patch 79 minutes earlier, and `gh pr diff` returns the same bytes for both (+659/-52 on 10 file(s), same title). Both PRs are CONFLICTING, so this copy does not resolve the conflict it was probably made for. Please continue in #438 so the review history and any test data stay in one place. Thanks.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/inplace.rs
  • crates/victory-gpu/src/lib.rs
  • crates/victory-gpu/src/shadow.rs
  • crates/victory-gpu/src/watch.rs
  • crates/victory-hle/src/modules/dstorage.rs
  • crates/victory-hle/src/modules/files.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 origin '+refs/pull/555/head:github-bot/gh-555'
git switch 'github-bot/gh-555'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-555'
git switch 'github-bot/gh-555'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-555'
git switch 'github-bot/gh-555'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-555'
git switch 'main'
git merge --squash 'github-bot/gh-555'
git switch 'main'
git merge --ff-only 'github-bot/gh-555'
git switch 'main'
git merge 'github-bot/gh-555'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.