Shaders: VICTORY_WAVE_WIDE_ONLY turns the wave-wide form on for named programs (the two water volumetrics computes on NVIDIA) #695

Open
github-bot wants to merge 1 commit from github-bot/gh-695 into main AGit
Owner

@⁠FrancescoGelosoEterea on GitHub · 2026-11-25 04:37 UTC · original
FrancescoGelosoEterea:wave-wide-only → main · +46 −3 · 3 files · 1 commits · open

Why

On current main (310c6eb), two water_shading compute programs translate but stay at WaveSize(64), so a 32-lane host refuses them:

host pipeline refused error=0x80070057 shaders=[compute 5dc3b25986622949]
host pipeline refused error=0x80070057 shaders=[compute 6f225b641c5b0708]

They are CS_TransmissionVolumetrics_Tiled and CS_TransmissionVolumetrics_Tiled_LocalLights. Their thread groups are one console wave (64 threads). VICTORY_WAVE_WHY gives LDS in a group over 32, an LDS read and write in one lane-branch region, v_readlane. The forms tried after that stop at "a first-lane read where not every lane runs" and "a wave reduction where not every lane runs".

The wave-wide form (widen) handles exactly this case: it takes the lane branches around that code with the whole wave. With it, the two programs lower to WaveSize(32), with 4 and 7 branches taken wave-wide. Since e9765a7, that form is off unless VICTORY_WAVE_WIDE=1, because it left the particle light-atlas programs standing on the card. So it can only be turned on for every program at once.

What

VICTORY_WAVE_WIDE_ONLY=<hash prefix>,... turns the wave-wide form on only for the containers it names. A container is named by the hash the log uses: the first 16 hex digits of the container's BLAKE3.

  • emit::wave_wide_only(hash) reads the list.
  • emit::with_wave_wide(on, f) sets a thread-local flag around one translation, which the retry ladder reads next to VICTORY_WAVE_WIDE.
  • Both the game's translation (shader_cache::host_shader) and victory translate use it.
  • VICTORY_WAVE_WIDE_ONLY is part of the shader cache key, as VICTORY_WAVE_WIDE is.

Without the variable nothing changes.

Tested

RTX 5070 Ti, driver 621.24, Ryzen 7 9800X3D, Windows 11. Own 1.0.2.1 copy.

  • Offline (translate --pipelines --validate --list on shaders.rpf, VICTORY_HOST_MAX_WAVE=32, this branch):
    • without the variable: both programs pipeline: E_INVALIDARG;
    • with VICTORY_WAVE_WIDE_ONLY=5dc3b259,6f225b64: both pipeline created, and both validate.
  • In game: prologue, 7 minutes in the world, scripted Enter input, camera at rest. The branch was 310c6eb plus this change and other open PRs (#51, #158, #368, #522, #592 among them), with VICTORY_WAVE_WIDE_ONLY=5dc3b259,6f225b64.
    • Both pipelines are created and bound (first bind at frame 1702). No dispatch of theirs is dropped.
    • No device removal, hang or crash.
    • 4.50 fps median, against 4.30 for the same branch without the variable. That is one run each, so within run-to-run noise.
    • The computes still refused there are 02384a60… and 6b82bc7d…. Their thread groups are 128 and 1024 threads (several console waves), where the wave-wide form does not apply.
  • Tests: cargo test -p victory-shader --lib: 214 passed. cargo test -p victory-gpu --lib: 118 passed. cargo clippy -p victory-shader --all-targets -- -D warnings: clean.

Not tested

  • That the volumetrics look right. The room scene does not show much water, and I have not compared frames with the programs off and on.
  • Any program other than these two under the wave-wide form.
  • AMD: a 64-lane host never reaches this path.

🤖 Generated with Claude Code

**@⁠FrancescoGelosoEterea** on GitHub · 2026-11-25 04:37 UTC · [original](https://github.com/fxceless/victory-fork/pull/695) `FrancescoGelosoEterea:wave-wide-only` → `main` · +46 −3 · 3 files · 1 commits · open ## Why On current `main` (`310c6eb`), two `water_shading` compute programs translate but stay at `WaveSize(64)`, so a 32-lane host refuses them: ``` host pipeline refused error=0x80070057 shaders=[compute 5dc3b25986622949] host pipeline refused error=0x80070057 shaders=[compute 6f225b641c5b0708] ``` They are `CS_TransmissionVolumetrics_Tiled` and `CS_TransmissionVolumetrics_Tiled_LocalLights`. Their thread groups are one console wave (64 threads). `VICTORY_WAVE_WHY` gives `LDS in a group over 32, an LDS read and write in one lane-branch region, v_readlane`. The forms tried after that stop at "a first-lane read where not every lane runs" and "a wave reduction where not every lane runs". The wave-wide form (`widen`) handles exactly this case: it takes the lane branches around that code with the whole wave. With it, the two programs lower to `WaveSize(32)`, with 4 and 7 branches taken wave-wide. Since `e9765a7`, that form is off unless `VICTORY_WAVE_WIDE=1`, because it left the particle light-atlas programs standing on the card. So it can only be turned on for every program at once. ## What `VICTORY_WAVE_WIDE_ONLY=<hash prefix>,...` turns the wave-wide form on only for the containers it names. A container is named by the hash the log uses: the first 16 hex digits of the container's BLAKE3. - `emit::wave_wide_only(hash)` reads the list. - `emit::with_wave_wide(on, f)` sets a thread-local flag around one translation, which the retry ladder reads next to `VICTORY_WAVE_WIDE`. - Both the game's translation (`shader_cache::host_shader`) and `victory translate` use it. - `VICTORY_WAVE_WIDE_ONLY` is part of the shader cache key, as `VICTORY_WAVE_WIDE` is. Without the variable nothing changes. ## Tested RTX 5070 Ti, driver 621.24, Ryzen 7 9800X3D, Windows 11. Own 1.0.2.1 copy. - **Offline** (`translate --pipelines --validate --list` on `shaders.rpf`, `VICTORY_HOST_MAX_WAVE=32`, this branch): - without the variable: both programs `pipeline: E_INVALIDARG`; - with `VICTORY_WAVE_WIDE_ONLY=5dc3b259,6f225b64`: both `pipeline created`, and both validate. - **In game**: prologue, 7 minutes in the world, scripted Enter input, camera at rest. The branch was `310c6eb` plus this change and other open PRs (#51, #158, #368, #522, #592 among them), with `VICTORY_WAVE_WIDE_ONLY=5dc3b259,6f225b64`. - Both pipelines are created and bound (`first bind` at frame 1702). No dispatch of theirs is dropped. - No device removal, hang or crash. - 4.50 fps median, against 4.30 for the same branch without the variable. That is one run each, so within run-to-run noise. - The computes still refused there are `02384a60…` and `6b82bc7d…`. Their thread groups are 128 and 1024 threads (several console waves), where the wave-wide form does not apply. - **Tests:** `cargo test -p victory-shader --lib`: 214 passed. `cargo test -p victory-gpu --lib`: 118 passed. `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. ## Not tested - That the volumetrics look right. The room scene does not show much water, and I have not compared frames with the programs off and on. - Any program other than these two under the wave-wide form. - AMD: a 64-lane host never reaches this path. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:49:09 +00:00
Author
Owner

@⁠VibeClauding on GitHub · 2026-11-25 12:10 UTC · original

Note for the two water volumetrics this PR puts in VICTORY_WAVE_WIDE_ONLY: on an RTX 3070, Series S, running them in the wide form washed the view out of the cell window to near white in every frame from 2400 on. The same build without them in the list stayed clear (A/B, runs 82 and 84, numbers on #823). The other two programs (2cc4c197ee29e291, 369cbe906ea72764) showed no such effect.

AI-assisted (Claude Code).

**@⁠VibeClauding** on GitHub · 2026-11-25 12:10 UTC · [original](https://github.com/fxceless/victory-fork/pull/695#issuecomment-7162022706) Note for the two water volumetrics this PR puts in `VICTORY_WAVE_WIDE_ONLY`: on an RTX 3070, Series S, running them in the wide form washed the view out of the cell window to near white in every frame from 2400 on. The same build without them in the list stayed clear (A/B, runs 82 and 84, numbers on #823). The other two programs (`2cc4c197ee29e291`, `369cbe906ea72764`) showed no such effect. AI-assisted (Claude Code).
Author
Owner

@⁠rafaconvaitis on GitHub · 2026-11-26 17:25 UTC · original

I validated the hash-selected path on Windows with an RTX 4070 12 GB and a Cool Fox c3e5c37 integration. The integration adapts this PR, includes #702, and includes the cascade changes from avatarmanz/VIctory-7900XTX#82. With VICTORY_HOST_MAX_WAVE=32 and VICTORY_WAVE_WIDE_ONLY=926c46bab3b86bd6, CS_TransmissionVolumetricsSubmerged went from “no wave32 lowering” on the previous build to emitted wave32 DXIL, validator pass, and D3D12 compute pipeline created. The four cascade shaders also passed validation and pipeline creation in both builds.

The selector was limited to the full 16-digit submerged shader hash. The two tiled transmission shaders discussed above were excluded from the selector. These results cover translation and creation. The mission run is a separate check.

**@⁠rafaconvaitis** on GitHub · 2026-11-26 17:25 UTC · [original](https://github.com/fxceless/victory-fork/pull/695#issuecomment-7198989154) I validated the hash-selected path on Windows with an RTX 4070 12 GB and a Cool Fox `c3e5c37` integration. The integration adapts this PR, includes #702, and includes the cascade changes from avatarmanz/VIctory-7900XTX#82. With `VICTORY_HOST_MAX_WAVE=32` and `VICTORY_WAVE_WIDE_ONLY=926c46bab3b86bd6`, `CS_TransmissionVolumetricsSubmerged` went from “no wave32 lowering” on the previous build to emitted wave32 DXIL, validator pass, and D3D12 compute pipeline created. The four cascade shaders also passed validation and pipeline creation in both builds. The selector was limited to the full 16-digit submerged shader hash. The two tiled transmission shaders discussed above were excluded from the selector. These results cover translation and creation. The mission run is a separate check.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/shader_cache.rs
  • crates/victory-shader/src/emit/mod.rs
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.
git fetch -u origin '+refs/pull/695/head:github-bot/gh-695'
git switch 'github-bot/gh-695'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-695'
git switch 'github-bot/gh-695'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-695'
git switch 'github-bot/gh-695'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-695'
git switch 'main'
git merge --squash 'github-bot/gh-695'
git switch 'main'
git merge --ff-only 'github-bot/gh-695'
git switch 'main'
git merge 'github-bot/gh-695'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.