Shaders: take the wave-wide form as a last resort on 32-lane hosts #40
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/DexNom--VIctory!40
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-40"
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?
@notquiteog on GitHub · 2026-11-25 20:08 UTC · original
notquiteog:wave-wide-last-resort→main· +23 −0 · 1 files · 1 commits · openWhat
On a host with 32-lane waves (NVIDIA), a console wave64 compute program that no existing form takes off 64-lane waves keeps
WaveSize(64). The host refuses its pipeline and every dispatch of it is dropped.This tries the exact wave-wide form (
widen) as a last resort for those programs only, after every other form has failed. One file, 23 lines, incrates/victory-shader/src/emit/mod.rs.Why it should be safe where the form is off today
The wave-wide form is off unless
VICTORY_WAVE_WIDE=1because it lost a card onptfx_CS_lightAtlas_Spriteand_Trail. Those two have another working form, so they return before the new code is reached. The new attempt only runs where the alternative is the pass not running at all.VICTORY_WAVE_WIDE=0: such programs stay refused, as before.VICTORY_WAVE_WIDE=1: unchanged.Tested
RTX 5060 Ti 16 GB (wave lanes min 32, max 32), i5-13600K, Windows 11, on
2e01ab4plus this commit, withVICTORY_HOST_MAX_WAVE=32 victory translate --list --validate --pipelines:VICTORY_WAVE_WIDE=0sr_tracing:CS_Tiling_Generate_Opaque2cc4c197ee29e291GpuParticleUpdate:CS_Visibility369cbe906ea72764In game, on a branch that also carries #7, #16, #17, #18, #22 and #24: 7.5 minutes in the story world with this on, no device loss.
Not tested, and what it does not fix
widenrefuses them. On this card that leavesvfx_triangleClip:CS_DefragHeap_ComputeRelocations02384a60fda6f2d0(groups of 128) andalphaResolve:CS_AlphTransmissionPrefilterMip2da4beb386509b77(groups of 256) refused.🤖 Generated with Claude Code
@pr0vId3nce on GitHub · 2026-11-25 22:36 UTC · original
I had the same 23 lines prepared on
2e01ab4(same condition, same bases; only the comment and the report label differ), so these measurements apply to this PR as it stands. RTX 4080, driver 32.0.16.1088,host wave lanes min=32 max=32.Census (
shaders.rpf,VICTORY_HOST_MAX_WAVE=32,translate --validate --list, wave sizes read from each program'sPSV0):WaveSize(64)XboxBvhBuilder.dlltranslates to (49 of 52 onmain; all 52 with #35 underneath).--pipelineson the card for the 29: 0 before, 22 after (the 22 above); the 7 are still refused.02384a60fda6f2d0,22338086ea4c5364,2da4beb386509b77,1d434307d981352a,3b02415f67c6b0d8,6832a9da15c2e584,6b82bc7d22016cb5), whichwidenrefuses, as you say.Tests. Two tests for
emit/wave64_tests.rs(not in this PR): one console wave writes LDS slottand reads slott ^ 32insideif (t < s0)behinds_cbranch_scc0. Onmainboth fail on a 32-lane card (the program asks for waves of 64..64; the pipeline is refused). On this PR's headd7422b4both pass on the RTX 4080: 64, 48, 40, 33 and 20 threads in the branch, each thread reads its partner's number. With the change thevictory-shaderlib suite goes 237 → 239 passed on the RTX 4080 and on a Ryzen 7900X's Radeon iGPU (wave lanes 32..64, which runs the same 32-lane form; adapter chosen with a local test-only patch).In game (RTX 4080, default switches, 10 minutes from a prologue save, on
921d8d3+ the change): no crash, no device loss. Four of the 22 are dispatched there and now have pipelines (5dc3b25986622949,6f225b641c5b0708,369cbe906ea72764,2cc4c197ee29e291); a fifth (926c46bab3b86bd6) in the opening cutscene. The cell shot is unchanged, so I have no picture that shows a gain. The other 17 were never dispatched in my runs. Card time with per-list GPU timing, one pair of runs: 123.1 vs 120.9 ms a frame.With
--rt, one device loss I cannot explain. Onmainthe builder stays off on this card and 10 minutes ran clean with the change. With #35 underneath (builder running): one run lost the device at 436 s (0x887A0006, no DRED data), one ran 609 s with DRED on and no loss, a third was stopped by my memory guard at 564 s with no loss. #35 alone ran clean twice. The machine was short of memory in all of them (32 GB, ~46 GB committed by the process), so a timeout is possible, and so is a barrier that never completes; I do not know which. #14 also lost the device with--rtandVICTORY_WAVE_WIDE=1, which widens these same 22 among others. The change does not alter any builder program.I can push the two tests here or as a follow-up PR if you want them. One detail in the code: the new block computes the
deepbase even withVICTORY_WAVE_DEEP_SKIPS=0, unlike theVICTORY_WAVE_WIDE=1block above it.AI-assisted (Claude Code); measured on my machine. No game data: counts, hashes and log lines only.
@pr0vId3nce on GitHub · 2026-11-25 23:37 UTC · original
One more data point from the RTX 4080, on where the wave-wide form loses the device. It does not change what #40 does; it narrows #14's report.
What we ran. A local experiment (not something we propose): a build with #40's change plus a switch that sends every wave64 program reaching that retry point to the wave-wide form, before the other forms, instead of only the programs nothing else takes. The prologue save, default switches otherwise, with
VICTORY_D3D12_DRED=1.What happened. The device was lost at 140 s, about 100 frames after the world appeared (
0x887A0005). DRED: the list in flightstopped at command 78 of 120, an indirect dispatch of2561af9577c47289, a particle light-atlas sprite program. That is the programemit/mod.rsalready names for losing a card underVICTORY_WAVE_WIDE=1. None of the programs the experiment was aimed at (18 shadow-tiling programs) was in flight. An earlier run of the same experiment without DRED lost the device the same way.About the program. On a 32-lane host it has no exact form:
without early-outs,without skipsand the deep form stop ona wave reduction where not every lane runs, so today it takeslocal waves (APPROXIMATE). Forced into the wave-wide form it translates (3 branches taken wave-wide) and validates. It is a group of one console wave (64 threads), so the barriers in that form are ordinary group barriers. So the hang is in the wave-wide form itself, on this program, on NVIDIA as well as on the AMD card the comment describes.What this shows about #40. #40 never sends this program to the wave-wide form. It has an approximate form earlier in the chain, so it returns before #40's last-resort call. We checked: at
VICTORY_HOST_MAX_WAVE=32its translation is byte-identical with and without #40. Across the whole pack, #40 changes only programs that were refused before.What it does not show. Why the wave-wide form hangs on this program. Whether other programs #40 now sends there can hang the same way is also open. Of the ones used in the scene we can reach, all four ran 10 minutes without a device loss.
AI-assisted (Claude Code); measured on my machine. No game data: hashes and log lines only.
@RoachxD on GitHub · 2026-11-26 00:17 UTC · original
<html>Independent validation — RTX 3060 Laptop GPU (Ampere)
Reproduced your two successful pipeline recoveries on another NVIDIA architecture.
Test configuration
GPU: NVIDIA GeForce RTX 3060 Laptop GPU, 6 GB VRAM (Ampere)
CPU: AMD Ryzen 7 6800H
RAM: 16 GB DDR5
OS: Windows 11
Base:
2e01ab4760db91820ef5f9a9f85761f83cd6b5d0PR revision:
d7422b49d818fc5276b998b138f6d974837fb42aRelease build with diagnostics, cross-compiled from WSL using cargo-xwin 0.24.1 and Rust 1.98.1
RT disabled
Independent copy of game state, with shader and pipeline caches invalidated for the PR #40 test
VICTORY_WAVE_WIDEunsetVICTORY_WAVE_WHY=1Additional opt-in D3D12 InfoQueue instrumentation (PSOTRACE1) was used to distinguish pipeline-library cache misses from actual PSO creation failures.
Results
Shader | Earlier instrumented baseline | With #40 -- | -- | -- 369cbe906ea72764 | Refused, ID 622 | Created 2cc4c197ee29e291 | Refused, ID 622 | Created 02384a60fda6f2d0 | Refused, ID 622 | Refused, ID 622 2da4beb386509b77 | Refused, ID 622 | Refused, ID 622Sanitized trace excerpts (timestamps, ANSI formatting, and unrelated fields omitted; grouped by shader):
Both remaining creation failures produced D3D12 validation message ID 622:
The translator also reported the expected multi-wave restriction:
All four targeted pipelines experienced cache misses before their respective creation attempts. Neither successful result came from a cached pipeline.
The runtime exited normally with code 0 after approximately 186 seconds.
This independently confirms the reported two-pipeline recovery on Ampere hardware. This was a startup compatibility test; shader output equivalence, in-world stability, visual improvements, and performance gains have not yet been established.
I'm also investigating multi-wave lowering and synthetic cross-wave correctness tests for the remaining cases, while retaining the existing conservative guard.
Thanks for the patch!
AI-assisted diagnostic tooling and analysis; native testing performed on my hardware.
</html>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.