Repository navigation
Conversation
The relay (VICTORY_RELAY) lands what shaders wrote on a thread of its own while the submitting thread prepares the next submissions; stage 2 waits only for the flights that declared memory a submission reads. It was off unless switched on. In the world of the test title on an RTX 4090 the frame went from about 230 to 132 ms with VICTORY_RELAY=2 (the card busy about 79 % of the frame instead of 51 %), and a 30-minute run with it had no error or crash at a steady 24-25 GB. VICTORY_RELAY is now read in one place (shadow::relay_level): unset or any other value means stage 2, `1` the first stage, `0` turns it off. The test buffer_data_reaches_the_host_texture checked that the title's list still held the texture after the submission. With the relay the submission takes the host list and the flight lets it go once the card has run it, which on a fast card can be before the check: the hold is now checked before the submission, where both paths keep it, and after it only when the submission is waited for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lj18ajyo1buNyoZcYjnZYC
Flyander
left a comment
There was a problem hiding this comment.
I tested the current PR #187 + #191 merge on an RTX 5070 Ti with VICTORY_RELAY unset: all 9 relay tests pass, and buffer_data_reaches_the_host_texture passes on the D3D12 device. That checks synchronization and a texture transfer, but it does not check rendered title frames.
Issue #168 reports a controlled, same-save RTX 4090 A/B on 4e17478: both default runs rendered the first room's walls; both VICTORY_RELAY=2 runs lost them, and the relay runs also requested roughly 20% fewer mesh groups. The issue predates #191, whose new alias/read-back waits may change the outcome.
Could you rerun the matched warm-cache capture on the current #187 + #191 candidate before making stage 2 the default, and attach the frame/matched mesh-group counts? The unit tests above cannot establish that visual output is intact.
…ge 2 by default Part of #16
|
Thanks @cblomert. I ran this on Linux (RTX 4080, Proton Experimental, 200 s per run at the prison cell window, nobody touching the pad). The tree was Stage 2 changes the picture, though. The cell's left wall is not drawn in either of the two stage-2 runs, and the sky shows through where it should be. With That is three runs in total, so take it as a lead rather than a proof. Still, it seems worth a check before stage 2 becomes the default. |
|
A follow-up from one more run, same binary and same spot, with Across the runs where the texture copy sits in the list, the result is:
So each stage loses some texture the title writes, and which one looks like a matter of timing rather than something specific to stage 2. Fence and wall are scored over the last 8 captured frames of each run: the brightness of the left strip, and the edge density in the window. |
|
I checked whether the textures lost under the relay come from the staging overwrite that #141 (@adritoyalser) and #272 (@fffluffy-dev) deal with. In this scene they don't. I ported #272's wait to #80's prelude model on the same tree. A list notes each staging buffer it or its prelude copies from, every staging buffer the submission read gets that submission's fence once it has gone out ahead, and a detile waits for that fence. With stage 2 and the copy kept in the list, that gave one run with wall and fence, one run with neither plus a stale block over the window, and one run that died at frame 16 with a breakpoint inside the title. With the wait switched off, the wall was missing again. Then I tried the bluntest version: before any detile, wait for every submission that has gone out ahead. It costs up to 15 ms per frame. One run still had no wall, and the other had the wall but no fence. So under the relay something other than the staging buffer drops a title texture, or the geometry that uses it. Which one goes missing changes from run to run. With the relay off, all three runs were clean. |
|
Edit: corrected. My first version of this comment had two rows wrong: my run script set the switches as process environment variables and did not clear them between the runs of a series, so the run I listed as C also had Measurements from another machine, for the default-on question. RTX 5080 16 GB (driver 610.88), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 22631, diag build, rustc 1.98.1. Each run loads the autosaved checkpoint at the prison cell window and nobody touches the pad; frame time is the spacing of the Main at a803c87 (this PR not applied; the relay set by environment):
The relay alone reproduces what @brunofgmag saw: the cell's left wall and the chain-link fence are gone in this scene. The spread within a run is small (none 336-345 ms, relay 234-247, all four 184-190). Further runs on builds of a803c87 with one experimental change of mine each (unrelated to the relay), switched on only in the first run of each switch set below (182 and 192 ms), so the others take main's code paths:
So in this scene the loss is intermittent and not only the relay's: late wait 3 with the wide copy-back and card buffers, with no relay at all, lost the wall or the fence (or drew garbage) in each of 5 runs, while the two runs with all four switches together were intact. Those are small numbers, and one run of the default is not enough to say it never loses them; I can run more of any row if that helps. Nothing else changed between the runs: same checkpoint, one run at a time, 360-400 s each, peak private 23-27 GB. |
|
Thanks @Flyander, @brunofgmag and @larelgit for the runs: three machines agree that the relay is faster and that the prison cell's wall or fence can go missing, and @larelgit's late-wait-3 runs without the relay show the loss is not stage 2's alone. My measurements (RTX 4090) only covered frame time, not the picture, so I am turning this into a draft: stage 2 should not become the default while geometry can drop. I'll look for what the sent-ahead path loses (late wait and relay both) and come back with matched captures and mesh-group counts before asking for a review again. 🤖 Generated with Claude Code |
Turns the relay (
VICTORY_RELAY) on at stage 2 by default. In the world it cut the frame from about 230 to 132 ms on an RTX 4090, and a 30-minute run with it had no error or crash.VICTORY_RELAY=0turns it off,1selects the first stage.What is in it
crates/victory-gpu/src/shadow.rs:relay_level()readsVICTORY_RELAYin one place (unset or any other value: 2;1;0: off);relay()uses it; unit test for the parsing.crates/victory-gpu/src/host.rs:relay_exact()usesrelay_level(); doc comments say what the default is.crates/victory-gpu/src/resource.rs:buffer_data_reaches_the_host_texturechecked that the title's list still held the texture after the submission. With the relay the submission takes the host list and the flight lets it go once the card has run it (execute_late→ relay thread →land/recycle), which on a fast card is before the check: the test failed 2 runs in 3. The hold is now checked before the submission, where both paths keep it, and after it only when the submission is waited for (!host::late()). Letting it go after the fence is safe: the read-backs are done before, and the texture's state lives inHostTexture, not in the list.README.md: the relay is no longer listed among the switches that are off by default.Tested
RTX 4090 (driver 621.40), i9-13900K, 128 GB, Windows 11 Pro 26200, rustc 1.98.1, release build for the game runs.
cargo clippy --workspace --all-targets --locked -- -D warnings: clean. With--all-features: clean.cargo test --workspace --locked --no-fail-fast: 495 passed, 2 failed, 7 ignored. The two failures areemit::rect::tests::the_rectangle_stage_is_a_geometry_shaderandrectangles_are_drawn_whole("Container part 'Pipeline State Validation' does not match"): they fail the same way onmain(4e17478) without this change (issue RTX 4070 Ti SUPER: prologue color vs. same-frame depth, plus a mesh PSV validation fix #12; Shaders: write every PSV0 semantic name again, as DXC does (fixes #12) #61 addresses it). No GPU test skipped.buffer_data_reaches_the_host_texture: 10 of 10 runs pass with the default; passes withVICTORY_RELAY=0.The title, world reached (first mission), median of 36 samples of the window title between 6 and 9 minutes after the start, the Enter pressed 60 s in:
VICTORY_RELAY=2VICTORY_RELAY=2 VICTORY_WIDE_BACK=1(on
mainplus 21 open PRs of this repository merged locally; the relay code is the same as onmainapart from GPU: parallelize CARD_COMPARE (64 threads per 64 KiB piece) #71.) Card busy from the frame line "the card's clock per frame".30 minutes with
VICTORY_RELAY=2in the world: noERRORline, no panic, nocrashes.logentry, private memory steady at 24-25 GB.Not tested
AI use
🤖 Generated with Claude Code
https://claude.ai/code/session_01Lj18ajyo1buNyoZcYjnZYC