Narrow the wave to 32 for shaders that cannot observe it #988

Open
github-bot wants to merge 2 commits from github-bot/gh-988 into main AGit
Owner

@⁠superboynick on GitHub · 2026-11-25 15:14 UTC · original
superboynick:feat/wave32-rescue → main · +381 −10 · 8 files · 2 commits · open

One of the compute pipelines this build creates is refused with x80070057 because the shader still declares a 64-wide wave after optimization. That particular shader does not use any wave intrinsic at all, so the 64-wide declaration is not carrying meaning: it is a leftover from the source container.

This narrows the wave to 32 for shaders provably in that state, after optimization has decided nothing else needs the wider wave.

Measured effect, retail title on one machine: refused compute pipelines go from five to four. The rescued one is the shader whose 64-wide declaration came with no wave intrinsics. The remaining four do use wave operations and are left alone.

The criterion, now testable. The decision is a predicate over the intrinsic names found after optimization rather than code buried in the emission path, with table-driven cases:

  • wave lane index, ballot, prefix sum, quad reads, barriers and indirect exits keep the 64-wide wave
  • plain intrinsics such as thread id do not block narrowing
  • the default path is unchanged

15 cases across two tests; the shader crate suite is 223 passed, 3 ignored.

What the tests do not cover: they check which shaders are selected, not that the narrowed result is numerically equivalent on the GPU. Group-shared memory without barriers, derivative assumptions tied to lane count, and any indirect access pattern remain the reviewer's call; shaders using them are not narrowed, but the tests cannot prove that list is complete.

**@⁠superboynick** on GitHub · 2026-11-25 15:14 UTC · [original](https://github.com/fxceless/victory-fork/pull/988) `superboynick:feat/wave32-rescue` → `main` · +381 −10 · 8 files · 2 commits · open One of the compute pipelines this build creates is refused with x80070057 because the shader still declares a 64-wide wave after optimization. That particular shader does not use any wave intrinsic at all, so the 64-wide declaration is not carrying meaning: it is a leftover from the source container. This narrows the wave to 32 for shaders provably in that state, after optimization has decided nothing else needs the wider wave. **Measured effect, retail title on one machine:** refused compute pipelines go from five to four. The rescued one is the shader whose 64-wide declaration came with no wave intrinsics. The remaining four do use wave operations and are left alone. **The criterion, now testable.** The decision is a predicate over the intrinsic names found after optimization rather than code buried in the emission path, with table-driven cases: - wave lane index, ballot, prefix sum, quad reads, barriers and indirect exits keep the 64-wide wave - plain intrinsics such as thread id do not block narrowing - the default path is unchanged 15 cases across two tests; the shader crate suite is 223 passed, 3 ignored. **What the tests do not cover:** they check which shaders are selected, not that the narrowed result is numerically equivalent on the GPU. Group-shared memory without barriers, derivative assumptions tied to lane count, and any indirect access pattern remain the reviewer's call; shaders using them are not narrowed, but the tests cannot prove that list is complete.
Pulls the decision out of the emission path into a predicate over the
intrinsic names found after optimization, so what gets narrowed and what
keeps its 64-wide wave can be read and tested without synthesizing DXIL.

Table-driven cases cover wave lane indices, ballots and prefix sums,
barriers, quad reads and indirect exits as blocking, plain intrinsics as
allowing, and the default path. 15 cases, two tests; the shader crate
suite is 223 passed with 3 ignored.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:55:14 +00:00
Author
Owner

@⁠superboynick on GitHub · 2026-11-25 20:27 UTC · original

End-to-end evidence from a real run, rather than a count. With this change on top of 0b0074e plus the PSO trace, the shader this PR was written for now reaches a pipeline and gets bound:

shader translated stage="compute" hash=369cbe906ea72764
host pipeline shaders=[compute 369cbe906ea72764]
first bind pipeline=0x24a483223a0 frame=1408 stage="compute" size=2180 hash=369cbe906ea72764

Before the change the same hash appears among the failures; after it, it does not, and the refused set is four compute programs plus one mesh program instead of five compute.

Two honest limits. The run still reports five refusals (four compute, one mesh), so this fixes one case rather than the class. And "creates and binds" is not "produces the same numbers": nothing here checks the output, only that the pipeline exists and is used at frame 1408.

**@⁠superboynick** on GitHub · 2026-11-25 20:27 UTC · [original](https://github.com/fxceless/victory-fork/pull/988#issuecomment-7173691766) End-to-end evidence from a real run, rather than a count. With this change on top of `0b0074e` plus the PSO trace, the shader this PR was written for now reaches a pipeline and gets bound: ``` shader translated stage="compute" hash=369cbe906ea72764 host pipeline shaders=[compute 369cbe906ea72764] first bind pipeline=0x24a483223a0 frame=1408 stage="compute" size=2180 hash=369cbe906ea72764 ``` Before the change the same hash appears among the failures; after it, it does not, and the refused set is four compute programs plus one mesh program instead of five compute. Two honest limits. The run still reports five refusals (four compute, one mesh), so this fixes one case rather than the class. And "creates and binds" is not "produces the same numbers": nothing here checks the output, only that the pipeline exists and is used at frame 1408.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/lower.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/988/head:github-bot/gh-988'
git switch 'github-bot/gh-988'

Merge

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