Renderer port 2: a copy into a record's later words marks its slot (missed view records 101 -> 6 a frame) #384

Closed
github-bot wants to merge 1 commit from github-bot/gh-384 into main AGit
Owner

@⁠Sr-0w on GitHub · 2026-11-26 21:52 UTC · original
port2/copies-mid-record → main · +28 −6 · 1 files · 1 commits · closed without merging

With VICTORY_PORT_DESCRIPTORS=1 (renderer port 2), the title's imported memcpy/memmove into the marked heap marked a slot only when the copy wrote the slot's first word and that word was a view record's tag. A copy that rewrites a record's later words (its address, its size) and leaves the tag as it was marked nothing. That record kept the old view until port 2's fallback reached its page, which is every 8th frame for 16 pages. #359 notes that the wrapper's copies marked no record (0 records they marked). These copies are where that goes.

Change

  • copied() looks at every slot the copy writes into, including the one it begins in, and marks the ones that hold a view record after the copy. The slot range is slots_touched(), which covers only slots whose tag word lies inside the heap.
  • It also looks at copies of 1-3 bytes; before, copies under 4 bytes were skipped.
  • No new switch. All of this runs only under VICTORY_PORT_DESCRIPTORS=1, which is off by default.

Measured

RX 7800 XT 16 GB, i9-12900K, 64 GB, Windows 11. Series X, ray tracing on (VICTORY_BVH_BUILDER=1), renderer ports 1, 2, 5, 6, 7 on, warm cache, diagnostics build. A retail game's boat scene; figures are the averages of port 2's line over the last 90 s of a 480 s run.

missed view records / frame records the copies marked / frame fallback ms / frame fps
main 2de9980 + #359 + #273 101 0 5.37 9.7
same + this PR 6 1,844 3.96 8.3 *

* That run waited on the card more than any other run of the evening (48.7 ms a frame vs 13.7), so the lower fps is not from this change. The extra marks cost about 0.04 ms a frame of taking. A main-only before/after follows in a comment.

  • How the writer was found: hardware write watches (DR0-3) armed on the 32 bytes of slots the fallback had just found missed. Every write they caught came from the patched stores or from VCRUNTIME140!memcpy through port 2's wrapper. The per-block writer hint pointed the same way: VCRUNTIME140.dll+0x1234f, 79,258 of 202,580 misses.
  • Picture: the boat scene is complete; no new defect seen.

Checks

  • cargo test -p victory-gpu --locked --lib port_descriptors: 3 passed. The new test a_copy_into_a_record_marks_the_slot_it_begins_in covers whole records, a copy into a record's later words only, a copy across two records, a one-byte copy, and a heap whose last slot holds no whole tag.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: nothing in the changed code.
  • #359 (more patched sites) and #273 (fallback pages let go) touch other parts of port_descriptors.rs. This PR applies on top of both; the measured build carries all three.
  • #301: the missed records.

🤖 Generated with Claude Code

**@⁠Sr-0w** on GitHub · 2026-11-26 21:52 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/384) `port2/copies-mid-record` → `main` · +28 −6 · 1 files · 1 commits · closed without merging With `VICTORY_PORT_DESCRIPTORS=1` (renderer port 2), the title's imported `memcpy`/`memmove` into the marked heap marked a slot only when the copy wrote the slot's first word and that word was a view record's tag. A copy that rewrites a record's later words (its address, its size) and leaves the tag as it was marked nothing. That record kept the old view until port 2's fallback reached its page, which is every 8th frame for 16 pages. #359 notes that the wrapper's copies marked no record (`0 records they marked`). These copies are where that goes. ## Change - `copied()` looks at every slot the copy writes into, including the one it begins in, and marks the ones that hold a view record after the copy. The slot range is `slots_touched()`, which covers only slots whose tag word lies inside the heap. - It also looks at copies of 1-3 bytes; before, copies under 4 bytes were skipped. - No new switch. All of this runs only under `VICTORY_PORT_DESCRIPTORS=1`, which is off by default. ## Measured RX 7800 XT 16 GB, i9-12900K, 64 GB, Windows 11. Series X, ray tracing on (`VICTORY_BVH_BUILDER=1`), renderer ports 1, 2, 5, 6, 7 on, warm cache, diagnostics build. A retail game's boat scene; figures are the averages of port 2's line over the last 90 s of a 480 s run. | | missed view records / frame | records the copies marked / frame | fallback ms / frame | fps | |---|---|---|---|---| | main 2de9980 + #359 + #273 | 101 | 0 | 5.37 | 9.7 | | same + this PR | **6** | 1,844 | 3.96 | 8.3 * | \* That run waited on the card more than any other run of the evening (48.7 ms a frame vs 13.7), so the lower fps is not from this change. The extra marks cost about 0.04 ms a frame of taking. A main-only before/after follows in a comment. - How the writer was found: hardware write watches (DR0-3) armed on the 32 bytes of slots the fallback had just found missed. Every write they caught came from the patched stores or from `VCRUNTIME140!memcpy` through port 2's wrapper. The per-block writer hint pointed the same way: `VCRUNTIME140.dll+0x1234f`, 79,258 of 202,580 misses. - Picture: the boat scene is complete; no new defect seen. ## Checks - `cargo test -p victory-gpu --locked --lib port_descriptors`: 3 passed. The new test `a_copy_into_a_record_marks_the_slot_it_begins_in` covers whole records, a copy into a record's later words only, a copy across two records, a one-byte copy, and a heap whose last slot holds no whole tag. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: nothing in the changed code. ## Related - #359 (more patched sites) and #273 (fallback pages let go) touch other parts of `port_descriptors.rs`. This PR applies on top of both; the measured build carries all three. - #301: the missed records. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title's memcpy/memmove into the marked heap marked a slot only when
the copy wrote the slot's first word. A copy that rewrites a record's
address or size and leaves its tag as it was marked nothing, and the
record kept showing the old view until the fallback reached its page.

Every slot the copy writes into is now looked at, the one it begins in
too; a slot is marked when it holds a view record after the copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:56:21 +00:00
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-26 22:23 UTC · original

Hold on reviewing this one: on a second check, whole-run flicker counts in the same scene are higher with this change (10.9 vs 4.8 local flicker events per 100 frames on 126acb3, one run each). Marking a slot as soon as any part of a record is copied may let the layer rebuild a half-updated record. I'm checking with more runs and will report back before asking for review.

**@⁠Sr-0w** on GitHub · 2026-11-26 22:23 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/384#issuecomment-7204636352) Hold on reviewing this one: on a second check, whole-run flicker counts in the same scene are higher with this change (10.9 vs 4.8 local flicker events per 100 frames on 126acb3, one run each). Marking a slot as soon as any part of a record is copied may let the layer rebuild a half-updated record. I'm checking with more runs and will report back before asking for review.
Author
Owner

@⁠YeokiNoewChi on GitHub · 2026-11-26 23:53 UTC · original

A data point from NVIDIA: RTX 3070 Ti 8 GB, Ryzen 5 5600X, Windows 11, Series S, diagnostics build. This was not on your main. It was a cool_fox-based tree with renderer ports 1, 2, 6 and 7, so I applied the change by hand behind a switch. I A/B'd it within one run at the boat save, in 10 s phases, about 60 phases in total.

without with
records the heap copies marked / frame 0 ~1,600
port 2 fallback: view records no store told of / frame ~70 ~30 (9 to 49 per line)
frame, median of phase medians 56.4 / 56.5 ms 55.2 / 55.6 ms

The picture looked the same, and there was no cost in frame time on this card. More of the misses are left here than in your run (about 30 against your 6). At least some of what remains is written from outside the title's image; the fallback's warning names writer=… (not the title's).

**@⁠YeokiNoewChi** on GitHub · 2026-11-26 23:53 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/384#issuecomment-7205958058) A data point from NVIDIA: RTX 3070 Ti 8 GB, Ryzen 5 5600X, Windows 11, Series S, diagnostics build. This was not on your main. It was a cool_fox-based tree with renderer ports 1, 2, 6 and 7, so I applied the change by hand behind a switch. I A/B'd it within one run at the boat save, in 10 s phases, about 60 phases in total. | | without | with | |---|---|---| | records the heap copies marked / frame | 0 | ~1,600 | | port 2 fallback: view records no store told of / frame | ~70 | ~30 (9 to 49 per line) | | frame, median of phase medians | 56.4 / 56.5 ms | 55.2 / 55.6 ms | The picture looked the same, and there was no cost in frame time on this card. More of the misses are left here than in your run (about 30 against your 6). At least some of what remains is written from outside the title's image; the fallback's warning names `writer=… (not the title's)`.
github-bot closed this pull request 2026-11-27 14:52:48 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.