Ray tracing: the builder's quarantine holds (split out of #935) #1013
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/fxceless--victory-fork!1013
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1013"
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?
@TheoGegout on GitHub · 2026-11-25 16:12 UTC · original
TheoGegout:bvh-quarantine-holds→main· +27 −5 · 2 files · 1 commits · openSplit out of #935, as suggested there: the quarantine fix alone, on top of
main.The bug
VICTORY_BVH_QUARANTINE=1is meant to keep the structure builder's stores out of title memory. It leaked. Copy-backs into title memory (Step::GpuWrite) are declared per list, not per dispatch. A builder stage skipped its own declaration, but any other shader in the same list that declared a write carried the builder's stores back with it.The fix
Deferredgets aquarantinedflag, reset with the rest of the recording.HostList::quarantine()sets it and drops theGpuWritesteps already declared in the list.defer_gpu_writedeclares nothing once the list is quarantined.draw.rscallslist.quarantine()when it records a quarantined builder stage.A list with a quarantined builder stage therefore copies nothing back, before or after that stage.
Effect
On #935's base, with the builder on, the title crashed within seconds; with this fix and
VICTORY_BVH_QUARANTINE=1it ran 74 s with no such crash. The crash itself came from the overrun of dispatches by thread counts, which #994 fixes; this only makes the quarantine do what it says, for testing the builder without its results.Checked
cargo check -p victorywith and without--features diagnostics: pass.cargo xtask policy: pass.cargo clippy -p victory-gpu -- -D warningsreports four lints onmain(inresource.rs,draw.rs:2524,queue.rs,shadow.rs), none in the lines changed here.🤖 Generated with Claude Code
@drchef420 on GitHub · 2026-11-26 05:06 UTC · original
AI-assisted (Claude Code). Numbers and log lines only, no game data.
An independent sighting of the leak this fixes, and what holding every shared copy back costs.
Setup. RTX 5070 12 GB (driver 610.88) beside an RTX 3060 (the game on the 5070 by Windows' per-app GPU preference), Core Ultra 7 270K Plus, 32 GB, Windows 11 26300, Series X profile. Tree: fork
mainata183ea2(ee3475ehere, main merged into a test branch), a new start with no save. Switches:VICTORY_BVH_BUILDER=1 VICTORY_FIRSTLANE_OWN=1 VICTORY_BVH_QUARANTINE=1.Without the fix. The title crashed in the opening cutscene about 8 s after the builder started: one fault at
+0x52eca06, a read reported at0xffffffffffffffff,rdx= all ones. Four earlier runs from a save crashed the same way within seconds (9 and 13 faults, registers holding pairs of float infinities,0x7f8000007f800000). The no-switch run from the same start went past that point and 5 minutes more.With a whole quarantine. Not this PR's form but the same idea, carried further: a host copy that a quarantined builder stage is given to write (a view in its tables, a root view, or any copy numbered for title memory by address) is marked, and from then on none of it is copied back, on any of the four paths (PC copies, relay, card copies, card relay), whichever list or shader declared the write. With that, the title ran past the cutscene and 8 min 37 s more (to frame 3,400) and did not crash there. That agrees with your diagnosis: the builder's stores reached title memory through copy-backs other shaders declared.
What it cost. 2,048 copies marked in the first 83 s (8,590 MB, nearly all 4 MiB windows by address, with
COPIESraised to 8191), over 16,384 copy-backs left out. Shared video memory went from 1.5 to 10.5 GB in the 35 s after the builder started and to 15.7 GB; frames went from ~4/s to one per 23-25 s; at 8.5 min shared and upload buffers failed with0x8007000Eand the title crashed on a null write (+0x23cf683). So a quarantine that holds is a way to test, not to play, as you say; #994 is the fix.We did not run this PR's own form; if useful, we can.
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.