Diagnostics: renderer port 2 trace watches a missed record's writers (VICTORY_PORT_DESCRIPTORS_TRACE=1) #385

Closed
Sr-0w wants to merge 2 commits from upstream-pr/385 into main
Sr-0w commented 2026-11-26 21:55:56 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Sr-0w on 2026-11-26T21:55:56Z.


Stacked on #359: it uses #359's place(), which names an address by module and offset. Until #359 is merged, this branch carries its commit 8436b3f. This PR's own change is the last commit, 5c1c9be.

Port 2's fallback (VICTORY_PORT_DESCRIPTORS=1) names the writer of a view record no mark told of by the last fault on the record's 64 KiB block. That is a hint only. The title's frame allocator puts descriptor records, constants, list nodes and vertex data in the same blocks, so any write to the block counts. For example, title+0x3368420 fills 24-byte vertices from the same allocator, and its stores show up as "writers" of descriptor slots. Finding the code that writes a missed record needs a watch on the record itself.

Change (diagnostics builds only, VICTORY_PORT_DESCRIPTORS_TRACE=1, off by default)

  • When the fallback finds a view record unmarked, that slot gets four hardware write watches (DR0-3, 8 bytes each, covering its 32 bytes) in every thread of the process. One slot is watched at a time.
  • Each write traps once. The log gets the instruction after the store, which 8 bytes of the record it wrote, the thread, and the code addresses on the writer's stack (by module and offset, through #359's place()).
  • The watch stands until the fallback finds the same slot unmarked again. The writes are then logged in order, the last one as CONFIRMED: a write the marks miss. If that does not happen within 20 s, the writes are logged as candidates.
  • Threads made after the arming are not watched. Nothing changes without the switch or in release builds.
  • README: the switch is listed under the port switches.

What it showed

RX 7800 XT, Series X, ray tracing on, renderer ports 1, 2, 5, 6, 7 on, #359 + #273, a retail game's boat scene, 300 s runs.

  • About 100 slots watched a run, 2-16 writes each. All writes to slots that held view records came from the stores #359 patches (stub code near the title) or from VCRUNTIME140!memcpy called through port 2's own wrapper. No other title code wrote them.
  • The wrapper's copies marked no record (#359's 0 records they marked), so the misses had to come from those copies. That led to #384: a copy that rewrites a record's later words marks nothing. With #384, misses fall from 101 to 6 a frame.
  • With #384 in, no write is confirmed in 300 s. The 6 misses a frame left are rare enough that a slot found missed is seldom missed again within 20 s.

Checks

  • cargo clippy -p victory-gpu --features diagnostics --all-targets --locked -- -D warnings: nothing in the changed code.
  • cargo test -p victory-gpu --locked --lib port_descriptors: passed.
  • In game: the runs above, no crash or device loss, about 1 fps lower while the trace is on.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5517680082 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/385). Originally posted by [Sr-0w](https://github.com/Sr-0w) on 2026-11-26T21:55:56Z. --- **Stacked on #359**: it uses #359's `place()`, which names an address by module and offset. Until #359 is merged, this branch carries its commit 8436b3f. This PR's own change is the last commit, 5c1c9be. Port 2's fallback (`VICTORY_PORT_DESCRIPTORS=1`) names the writer of a view record no mark told of by the last fault on the record's 64 KiB block. That is a hint only. The title's frame allocator puts descriptor records, constants, list nodes and vertex data in the same blocks, so any write to the block counts. For example, `title+0x3368420` fills 24-byte vertices from the same allocator, and its stores show up as "writers" of descriptor slots. Finding the code that writes a missed record needs a watch on the record itself. ## Change (diagnostics builds only, `VICTORY_PORT_DESCRIPTORS_TRACE=1`, off by default) - When the fallback finds a view record unmarked, that slot gets four hardware write watches (DR0-3, 8 bytes each, covering its 32 bytes) in every thread of the process. One slot is watched at a time. - Each write traps once. The log gets the instruction after the store, which 8 bytes of the record it wrote, the thread, and the code addresses on the writer's stack (by module and offset, through #359's `place()`). - The watch stands until the fallback finds the same slot unmarked again. The writes are then logged in order, the last one as `CONFIRMED`: a write the marks miss. If that does not happen within 20 s, the writes are logged as candidates. - Threads made after the arming are not watched. Nothing changes without the switch or in release builds. - README: the switch is listed under the port switches. ## What it showed RX 7800 XT, Series X, ray tracing on, renderer ports 1, 2, 5, 6, 7 on, #359 + #273, a retail game's boat scene, 300 s runs. - About 100 slots watched a run, 2-16 writes each. All writes to slots that held view records came from the stores #359 patches (stub code near the title) or from `VCRUNTIME140!memcpy` called through port 2's own wrapper. No other title code wrote them. - The wrapper's copies marked no record (#359's `0 records they marked`), so the misses had to come from those copies. That led to #384: a copy that rewrites a record's later words marks nothing. With #384, misses fall from 101 to 6 a frame. - With #384 in, no write is confirmed in 300 s. The 6 misses a frame left are rare enough that a slot found missed is seldom missed again within 20 s. ## Checks - `cargo clippy -p victory-gpu --features diagnostics --all-targets --locked -- -D warnings`: nothing in the changed code. - `cargo test -p victory-gpu --locked --lib port_descriptors`: passed. - In game: the runs above, no crash or device loss, about 1 fps lower while the trace is on. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull request closed

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
avatarmanz/VIctory-7900XTX!385
No description provided.