fix(gpu): count only descriptor header changes as missed writes (#519) #530
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!530
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-530"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@hajduzsolt on GitHub · 2026-11-27 09:52 UTC · original
hajduzsolt:fix/issue-519-descriptor-diagnostics→a-publier· +205 −57 · 4 files · 2 commits · openCloses #519.
The port 2 fallback previously counted a change anywhere in a 32-byte slot as a missed view write. Both compare paths now distinguish the 12-byte view header from its trailing bytes. The fallback reports unmarked tail changes separately. Slots still follow the existing refresh path, and the in-place scan uses a reusable bit mask for the current range.
This gives RX 9070 XT descriptor and FSR investigations a cleaner count of missed view writes without a second per-slot shadow map. No in-game frame-time claim is made.
Verification against a-publier at
4eb6cfd: all-targets check, strict Clippy with and without diagnostics, and asset policy passed. All 396 default and 445 diagnostics victory-gpu tests passed. The full workspace runs reproduced only the recorded baseline failures in the HLE loopback test and the shader test process.AI assistance: ChatGPT 6.2 Sol Extra High.
@gw1337x on GitHub · 2026-11-27 11:29 UTC · original
In-game numbers on RDNA 3 with
VICTORY_PORT_DESCRIPTORS=1. Memory Integrity was off.PC: Ryzen 7 9800X3D, RX 7800 XT, 32 GB. Test: 270 s hands-off boat scene, RT off, Belobug launcher settings plus the 5 port switches. #530 on
4eb6cfdvs4eb6cfd, interleaved (PR, base, PR). Values are per frame, averaged over every port 2 line in the run (about 255 lines each).In this scene almost all of what the base counts as missed writes (about 170 a frame) are tail-only changes. The count of real header misses is about 2.4 a frame. Frame rate is unchanged, as expected from a counting change.
@MamaLeVrai on GitHub · 2026-11-27 11:40 UTC · original
Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At
71dd7ca:victory-gpu396 passed, 0 failed, 34 ignored.AI-assisted (Claude Code); no game data.
@adrianmjim on GitHub · 2026-11-27 11:41 UTC · original
Thanks for picking up #519. I tested
71dd7caon Windows 11 with an RX 7900 XT (RDNA3).Tests. I ran the full
cargo test --locked -p victory-gpu --lib20 times, with #462's test fix (4ed2b5f,281b850) cherry-picked so its race doesn't mix in:watch::tests::freed_memory_leaves_no_notes, watch.rs:4324)4eb6cfdwatch::tests::a_write_opens_the_view_it_goes_through, watch.rs:4789)Both failures are in
watchtests, which #530 doesn't touch. Even with #462's fix in, the watch tests still fail now and then.Reading the diff. It does what #519 suggested, and I could not find a case where it changes which slots are made, waited or nulled.
same_headonly reachesmissed(). Things I checked:[rsp + 40]on entry, the Win64 slot, and before anything touches the stack. The new instructions sit outside thechanged_at..changed_afterfault window.and eax, 0xFFF / cmpon thevpmovmskbequality mask means bytes 0..11 are equal, and thejebefore it means some byte differs. So the bit is set exactly for a tail-only change.changed_records.copied_begin, so a view seen for the first time still counts as missed.I had a version of this locally that kept a separate 8-byte head per slot. Yours is better: it needs no extra memory, and it has no blind spot right after the heap is adopted.
Small things, none blocking:
CHECKED[1]andMISSED_ALL(port_descriptors.rs:531-537) say "view records no mark told of", andmissed()'s comment (:408-409) says such a record "is counted and said". Both now apply only to records whose head changed.view records missedwould show the split for a whole run in the last line.Copied::changes_in_place's mapping of thesame_headbits back to indices, orsafecopy::changedwith a mask and a page that faults part-way.In-game. One measured run of a
diagbuild of71dd7ca, after a warm-up launch of the same build. Route and settings as in #519: title screen, then the opening cutscene with no input, all fiveVICTORY_PORT_*=1. Window fromthe first frame of 500 draws or moretowindow closed: 267.9 s, 4,169 frames, median 16.4 fps. No ERROR, panic or device removal.cd8dfc0+ #354)4eb6cfd+ #530)view records no store told of, medianview records misseddeltaThe missed count now means what it says, and it matches the per-slot head check in #519. This agrees with gw1337x's boat-scene numbers above, on another RDNA3 card. The memcpy/memmove hook still marked 0 records.
Not tested: gameplay, other GPUs, repeat runs.
@hajduzsolt on GitHub · 2026-11-27 12:04 UTC · original
Thanks for the RX 7800 XT, RX 7900 XT, and RX 6950 XT checks. The two RDNA 3 reports agree that the old counter mostly included changes outside the view header.
All three follow-ups are in
3568ef0.crates/victory-gpu/src/port_descriptors.rs:410and:531describe what counts as a missed header write. The frame line reports a separate since-start total for tail-only changes, and its test checks that the interval counter can reset independently.crates/victory-gpu/src/descriptor/host.rs:4928checks the in-place mask mapping at a nonzero heap offset and across 64-bit mask boundaries.crates/victory-gpu/src/safecopy.rs:507checks both masks when the next page is unreadable and verifies that the rest of the mirror is untouched.The diagnostic build, strict Clippy, and the three targeted tests passed. The workspace test results match
4eb6cfdin default and diagnostics builds, with the baseline HLE loopback failure and shader test process access violation.AI assistance from ChatGPT 6.2 Sol Extra High.
@adrianmjim on GitHub · 2026-11-27 14:14 UTC · original
Tested
3568ef0on the same machine (RX 7900 XT).in_place_changes_map_header_bits_to_heap_slots, the 12safecopytests and the 4port_descriptorstests.cargo test --locked -p victory-gpu --lib, 3 runs while other builds were running on the machine: 1 clean. The other two failed once each, inno_write_is_lost_with_port_7andunchanged_ranges_are_known, the pair from #534 (which #539 fixes). Both pass on their own 5 times out of 5.On the memcpy/memmove hook that marked 0 records in my run above. I measured whether turning it off loses anything and what it costs. I used a local switch that leaves the title's memcpy/memmove unwrapped; it is not part of this PR.
diagbuild as above, after a warm-up, alternating off and on, two pairs:view records no store told ofmedian 2.05 / 2.06 with it off, 2.06 / 1.91 with it on. Turning it off misses nothing more here. About 19,000 calls a frame go through the wrapper, about 2,900 of them into the heap, and it marked 0 records in every run.COPIEScounters make it about +115 ns a call.Not tested: gameplay, other GPUs.
@hajduzsolt on GitHub · 2026-11-27 15:25 UTC · original
Thanks for the
3568ef0retest and for measuring both sides of the memcpy/memmove hook. The targeted passes help validate the descriptor change. The two watch-test failures match #534, which #539 addresses. The two A/B pairs and their run-to-run variation are a useful reason to keep the hook enabled while we collect a trace from a scene where it might mark writes.AI assistance from ChatGPT 6.2 Sol Extra High.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.