Shaders: take the wave-wide form as a last resort on 32-lane hosts #1176
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!1176
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1176"
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 22:48 UTC · original
notquiteog:fx-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. The same change is open against DexNom's tree as DexNom/VIctory#40.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
9c184b3plus 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 DexNom-based branch that also carries your commits up to
ca8829f: several sessions of 7 to 40 minutes in the story world with this on, no device loss.A tester on the DexNom pull request reports, on an RTX 4080 over the whole
shaders.rpf: compute programs requiringWaveSize(64)29 → 7, 22 more pipelines created, every other program's DXIL byte-identical, and 10 minutes in game without a loss. Those are their measurements, not mine. They also report one device loss they could not explain with--rtand the structure builder running.Not tested, and what it does not fix
widenrefuses them; #1124 is the pull request that extendswidento those, and the two stack.🤖 Generated with Claude Code
@HLVM04 on GitHub · 2026-11-25 22:56 UTC · original
On "what the recovered passes change in the picture", one data point from an RTX 5070 Ti (32-lane waves, driver 616.64). It comes from a similar last-resort wide form, not this PR's code.
9376fd6, Series X profile: when only the otherwise-refused programs took a wave-wide form, 4 of the 7 refused pipelines were built. It cost frame rate and did not visibly reduce artifacts. One machine, few runs, picture judged by eye.2cc4c197ee29e291,369cbe906ea72764) are also built on the same card by #799's loose-LDS fallback, which builds 5 of the 7 (Series S,9376fd6+ #798/#783/#799). There's more detail in my comment on #1141, which has the same idea: #1141@ishan-2025 on GitHub · 2026-11-26 00:42 UTC · original
An in-game A/B on current main, on a 32-lane 8 GB card: the pipelines are made and nothing is lost, but the frame gets slower and the card goes over its budget here.
Machine: RTX 3070 Ti Laptop GPU 8 GB (7,249 MB budget,
host wave lanes min=32 max=32), NVIDIA 621.40, i9-12900H, 32 GB RAM, Windows 11 26200.Tree:
dc4c0fc, anddc4c0fc+ this PR's diff (applies cleanly). Diagnostics builds, Series X, shader cache warmed again for the PR's tree withVICTORY_HOST_WAVE=32 VICTORY_VIEW_LIMIT=999999. New game by scripted Enter presses into the prologue, 400 s per run, "world" is everything after 250 s.VICTORY_WAVE_WIDEunset. Switches in both:LEVELS_ON_DEMAND=1 ASYNC_SUBMIT=1 QUEUE2=1 INDIRECT_WINDOW=1 TEXTURE_NO_WAIT=1 MERGE_GAP=64 MERGE_RUNS=4096 STAGING_POOL=0 COPY_PLAIN=1 JOIN_PARTS=1 BACK_OWN_VIEW=1 INDIRECT_GATHER=1 CARD_REHASH_RUNS=1.dc4c0fcERRORlines, driver-watch eventsRefused before:
02384a60fda6f2d0 2cc4c197ee29e291 2da4beb386509b77 369cbe906ea72764 5dc3b25986622949 6b82bc7d22016cb5 6f225b641c5b0708.Still refused with the PR:
02384a60fda6f2d0 2da4beb386509b77 6b82bc7d22016cb5. So four are made here, the two in your table and5dc3b25986622949,6f225b641c5b0708.How far to trust the frame time: one run each. The scripted run gets further in the same 400 s when it is faster, so the two windows are not the same shots (4,496 against 6,117 draws a frame in the last line). The direction agrees with HLVM04's note above (pipelines built, frame rate down), and the card's memory crossing its budget is a second, separate cost on 8 GB. I did not compare pictures, so I can't say what the four passes add.
One thing in the diff: the new block builds the
deepform withir::without_skips(p, true)without askingVICTORY_WAVE_DEEP_SKIPS, so withVICTORY_WAVE_DEEP_SKIPS=0the last resort still widens from the form that switch turns off above. Reusing thedeepalready computed in the loop (or the samedeep_ontest) would keep the switch's meaning.Given the cost on this card, an opt-out that is easy to find (it is
VICTORY_WAVE_WIDE=0today) or a memory-budget condition may be worth having before this is the default on 8 GB.Runs on my machine with my own copy; no game data attached. AI-assisted (Claude Code).
@ishan-2025 on GitHub · 2026-11-26 00:57 UTC · original
Correction to my comment above: please disregard its frame-time rows.
I repeated the unmodified
dc4c0fcbaseline at the end of the session, same settings, and it measured 206 ms median (4.9 fps) where the first baseline, 40 minutes earlier, measured 149 ms. The laptop got slower over the session (title-memory copy rate in the log fell from about 2.3 to 1.6 GB/s on the same build; I assume heat, not established). The PR's run sat between the two baselines in time, so its 177 ms says nothing either way about the cost of this change. Card memory also moved between the two baselines (6,924 and 7,094 MB), so the 7,420 MB with the PR is a smaller margin than I made it look.What still stands from that run, because it does not depend on timing:
dc4c0fc(both baseline runs), 3 with this PR; the four now made are2cc4c197ee29e291,369cbe906ea72764,5dc3b25986622949,6f225b641c5b0708;ERRORline and no driver-watch event in 400 s;VICTORY_WAVE_DEEP_SKIPS=0and the last-resort block.I withdraw the suggestion about a memory condition; it rested on the timing. A proper A/B needs interleaved runs, which I have not done.
AI-assisted (Claude Code).
@slauko on GitHub · 2026-11-26 09:05 UTC · original
A case this does not reach, from Wine + RTX 3080 Ti (vkd3d-proton
ec20719, uiliannn's line,VICTORY_WAVE_WIDE=1set for the whole run):The second one is
2da4beb386509b77(user_data=2, samplers=2), the same three lines.VICTORY_WAVE_WIDE=1changes neither: the retry block never prints aWAVE64-RETRYline even withVICTORY_WAVE_WHY=1, and noWAVE64-WHYeither — so the two programs come out of the first lowering withWaveSize(64)andstuckis false for them.My reading of the code:
lowerskips the 32-lane decision when the lowering ispartial(if !partial && wave == 64 && host_max_wave() == 32 && ...), and these two are partially lowered (an instruction the emitter cannot express). That skip is right for a complete program and wrong for the host: the shader is emitted withWaveSize(64)regardless, and a 32-lane host refuses it, so the pass does not run at all.What I would expect a fix to do: a partially lowered program that still declares
WaveSize(64)on a 32-lane host either takes the wave-wide form (a partial lowering is approximate already) or is emitted withoutWaveSizeat all. The two hashes above are a repro; they are the only two refusals in the run, and they are refused identically with and without the switch.@slauko on GitHub · 2026-11-26 10:08 UTC · original
A follow-up with the exact reason, from the same stack (
VICTORY_WAVE_WHY=1on a fresh translation — the shader cache otherwise serves the old DXIL and nothing prints):So the last-resort form is reached (my earlier comment guessed the retry chain did not run — it does, as soon as
stuckisOk((_, Some(64)))), andwidenrefuses it for a reason of its own: the program's group is 128 threads, i.e. two console waves, and the wave-wide branches support one.VICTORY_WAVE_WIDE=1makes no difference (same two refusals).That is the shape I would ask for: a group of N console waves, each console wave split into two host waves, the per-lane branches taken wave-wide per console wave — the same construct, once per 64 threads, with the group barriers already there. Until then this pass does not run at all on a 32-lane host, which is worse than an approximate one.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.