GPU: keep old title bytes out of buffer ranges a compute pass is still writing (VICTORY_MERGE_AFTER_LANDING, #90) #357
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/357"
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?
Imported from TaynanGT/Vice-Tay. Originally posted by cafeoh on 2026-11-27T19:39:30Z.
What it fixes
The stretched-triangle spikes ("wedges") of #90. On by default:
VICTORY_MERGE_AFTER_LANDING=3when unset;=0gives the merge as it was.The cause
Some buffers are written both by the title (CPU) and by the card (compute passes, for example the skinning output the vertices are drawn from). When the title wrote a page of such a buffer while a compute pass writing the same range had not landed yet, our merge (
merge_under_writes/stale_under_writes) put the title's bytes into that range. They were older than the card's results, and at the landing a byte both had written was taken from the title. That frame drew from old skinned vertices: a wedge.It was never the descriptor heaps. Pacing (the first version of this PR) only hid it: the card had always landed before we merged. The same goes for
VICTORY_LATE_WAIT=2andVICTORY_THIN=0in #90: both make the overlap rarer by timing, not impossible.What it does
VICTORY_MERGE_AFTER_LANDING=2, and also refreshes of a copy outside the ranges the flights declared (shaders that store where they didn't say): again only the title's changed bytes.No CPU wait anywhere. The frame line counts what was merged, skipped and left for the landing.
VICTORY_WEDGE_TRACE=1(diagnostics builds) logs the paths that can still put old bytes in front of the card.Numbers (RTX 2080 Ti, Ryzen 7 7800X3D, Win10, Series S, café -> cell, 40 s window)
=1=2=3=3covers every path we found that could put old bytes under a card write, and we saw no wedges with it in three free runs (our tree, this branch with the switch set, and unset). That's one PC, though, so confirmations from other setups are welcome. Measured on our tree with the same changes; this branch is the port.A trap we hit on the way (kept out of
=3): holding the title's changes back from card-written dwords in the gaps for longer than one landing made the title crash (6 of 11 runs, 0 of 9 without it). The card kept old pointers and wrote through them into memory the title had freed.=3puts the title's changes in at once there.Why on by default
It costs nothing measurable (table above) and never waits for the card, so there's little reason to leave the bug on. If something looks wrong with it,
VICTORY_MERGE_AFTER_LANDING=0brings the old merge back. If you see wedges, we'd be thankful if you could try this branch (no switch needed) and say whether they're gone (card, console profile, a rough count).VICTORY_HEAP_SYNC_PACE=1stays opt-in; it's no longer needed for the wedges.Tests
This branch, built and run (RTX 2080 Ti, Series S): with
=2to the cell and 5 min there, no crash; with=3(set, then unset as the default) free runs to the cell, no wedges seen, no crash.cargo test -p victory-gpu shadow::: new tests for the range subtraction, deferred parts, the byte choice, the undeclared-store put, the dword map and the dword widening.Imported from TaynanGT/Vice-Tay. Originally posted by hamdanpor-ctrl on 2026-11-27T22:42:00Z.
Build and test check on a laptop, no game run (default settings, so the opt-in pacing itself is not exercised):
6d20a25against its merge base) applied onmainat0148258--all-features: cleancargo test -p victory-gpu --locked, parallel: 9 of 10 runs passed (527 tests each). The one failure washost::refresh_tests::raw_title_copy_keeps_write_watch_and_resends_equal_bytes, which also fails now and then onmain(#354, addressed in #382), so not from this change.AI-assisted (Claude Code).
Imported from TaynanGT/Vice-Tay. Originally posted by cafeoh on 2026-11-28T12:23:32Z.
Correction to this PR: further testing with ray tracing on (and longer free play) shows
VICTORY_MERGE_AFTER_LANDING=3does not fix the wedges or the black flashing skin; earlier clean runs were luck in timing. On our RTX 2080 Ti,VICTORY_LATE_WAIT=2removes both (2 of 2 RT runs, plus earlier raster runs), matching @CristianCiubancan's 0/106 in #90. The cause looks like the title writing the next frame's per-frame data while the current frame is still being prepared.We're converting this PR to a draft. We're still hunting the exact cause, and a cheaper fix than
LATE_WAIT=2(about 14% slower here).Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T11:37:52Z.
Thanks for correcting the earlier conclusion and converting this back to a draft. LATE_WAIT=2 is a useful diagnostic control, but its reported cost and the remaining unknown overlap mean we shouldn't treat it as the final fix. Please keep the wedge count, black-skin artifact and frame-time measurements separate.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:11:21Z.
mainhas moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the currentmainand open a new PR; I'll review it there.Pull request closed