Diagnostics: renderer port 1, CPU reads too early and memory changed under the card (#379) #408

Open
github-bot wants to merge 2 commits from github-bot/gh-408 into main AGit
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-27 00:40 UTC · original
Jesper-Andersson:diag-port1-reads → main · +318 −0 · 3 files · 2 commits · draft

Two diagnostics for renderer port 1 (title memory the card reads and writes in place), from looking into #379's artifacting: port 1 together with VICTORY_SUBMIT_FRAMES=2. Diagnostics builds only. Nothing changes what is drawn or when.

What they count

Both are logged per frame next to port 1's own line.

1. CPU steps that read port 1's memory before our shaders' writes there have run (renderer port 1, reads too early (#379))

  • Shader writes into memory in place are declared nowhere (Shadow::gpu_writes returns early for place), so no CPU fill or copy waits for them.
  • Each list now notes those ranges, and flights keep them until the card passes their fence value.
  • Host::in_place_stale counts the CPU steps of a submission that read them while an unfinished flight writes them, or while a list ahead in the same submission does. The CPU's steps all run before any of the submission's lists.

2. Port 1's memory changing under the card (renderer port 1, memory in place changed under the card (#379))

  • When a flight's submission is prepared, the small ranges in place that its lists read on the card are fingerprinted. That's 64 KiB or less (VICTORY_PORT_WATCH_KB), at most 4 MB per submission. Ranges our shaders write are skipped.
  • At each later submission, ranges of flights not yet finished are fingerprinted again. A change no shader write of ours explains is a CPU write, the title's, made while the card may still read the bytes.
  • Title memory is read through the kernel (copy_mapped), so pages that aren't mapped read as zeros instead of faulting.

Measured

RTX 2070 SUPER 8 GB, Ryzen 7 5800X, 32 GB, Series S + DLSS. Port 1 on, with xmem's half off.

  • Counter 1 was 0 in every frame line at both SUBMIT_FRAMES=1 (190 lines) and =2 (156 lines). Each time a submission was prepared, about 5-7 flights writing in place were unfinished. Artifacts showed as in #379's run I.
    • So the CPU steps reading too early isn't the cause. Details: #379 comment 7205456361.
  • Counter 2 is built but not run yet.

Cost

  • Counter 1: a few range checks per CPU step that touches memory in place, about 300-350 a frame.
  • Counter 2: up to 4 MB fingerprinted per submission.
  • Both are only active with port 1 on (VICTORY_PORT_CONSTANTS=1 / VICTORY_PORT_ALL=1), and only in diagnostics builds.

Checks

  • cargo build --profile diag -p victory --features diagnostics on main 014d52d: builds. The one warning, in texture.rs, was there before this change.
  • cargo xtask policy: asset policy ok, 272 files.
  • No unit tests: both are counters over a live title's memory.

Refs #379.

AI use: written with AI assistance (Claude Code). The runs are my own.

**@⁠Jesper-Andersson** on GitHub · 2026-11-27 00:40 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/408) `Jesper-Andersson:diag-port1-reads` → `main` · +318 −0 · 3 files · 2 commits · draft Two diagnostics for renderer port 1 (title memory the card reads and writes in place), from looking into #379's artifacting: port 1 together with `VICTORY_SUBMIT_FRAMES=2`. Diagnostics builds only. Nothing changes what is drawn or when. ## What they count Both are logged per frame next to port 1's own line. **1. CPU steps that read port 1's memory before our shaders' writes there have run** (`renderer port 1, reads too early (#379)`) - Shader writes into memory in place are declared nowhere (`Shadow::gpu_writes` returns early for `place`), so no CPU fill or copy waits for them. - Each list now notes those ranges, and flights keep them until the card passes their fence value. - `Host::in_place_stale` counts the CPU steps of a submission that read them while an unfinished flight writes them, or while a list ahead in the same submission does. The CPU's steps all run before any of the submission's lists. **2. Port 1's memory changing under the card** (`renderer port 1, memory in place changed under the card (#379)`) - When a flight's submission is prepared, the small ranges in place that its lists read on the card are fingerprinted. That's 64 KiB or less (`VICTORY_PORT_WATCH_KB`), at most 4 MB per submission. Ranges our shaders write are skipped. - At each later submission, ranges of flights not yet finished are fingerprinted again. A change no shader write of ours explains is a CPU write, the title's, made while the card may still read the bytes. - Title memory is read through the kernel (`copy_mapped`), so pages that aren't mapped read as zeros instead of faulting. ## Measured RTX 2070 SUPER 8 GB, Ryzen 7 5800X, 32 GB, Series S + DLSS. Port 1 on, with xmem's half off. - **Counter 1** was **0** in every frame line at both `SUBMIT_FRAMES=1` (190 lines) and `=2` (156 lines). Each time a submission was prepared, about 5-7 flights writing in place were unfinished. Artifacts showed as in #379's run I. - So the CPU steps reading too early isn't the cause. Details: #379 comment 7205456361. - **Counter 2** is built but not run yet. ## Cost - Counter 1: a few range checks per CPU step that touches memory in place, about 300-350 a frame. - Counter 2: up to 4 MB fingerprinted per submission. - Both are only active with port 1 on (`VICTORY_PORT_CONSTANTS=1` / `VICTORY_PORT_ALL=1`), and only in diagnostics builds. ## Checks - `cargo build --profile diag -p victory --features diagnostics` on main `014d52d`: builds. The one warning, in `texture.rs`, was there before this change. - `cargo xtask policy`: asset policy ok, 272 files. - No unit tests: both are counters over a live title's memory. Refs #379. AI use: written with AI assistance (Claude Code). The runs are my own.
Shader writes into title memory in place are declared nowhere (Shadow::gpu_writes), so no CPU
fill or copy waits for them. Each list now notes those ranges; flights keep them until the card
passes their fence value, and Host::in_place_stale counts the CPU steps of a submission that
read them while a flight not finished writes them or a list ahead in the same submission does.
Logged per frame beside renderer port 1's line.
When a flight's submission is prepared, the small ranges of title memory in place that its lists
read on the card (64 KiB or less, VICTORY_PORT_WATCH_KB; 4 MB per submission) are fingerprinted, but
for ranges shaders of ours write. At each later submission those of flights not finished are
fingerprinted again: a change no shader write of ours explains is a CPU write (the title's) under
the card. Logged per frame beside renderer port 1's line.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:56:47 +00:00
This pull request can be merged automatically.
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 origin '+refs/pull/408/head:github-bot/gh-408'
git switch 'github-bot/gh-408'

Merge

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