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

Open
superboynick wants to merge 2 commits from upstream-pr/988 into main
superboynick commented 2026-11-25 15:14:29 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by superboynick on 2026-11-25T15:14:29Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6607685126 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/988). Originally posted by [superboynick](https://github.com/superboynick) on 2026-11-25T15:14:29Z. --- 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 commented 2026-11-25 21:05:54 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by superboynick on 2026-11-25T20:27:07Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7173691766 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/988#issuecomment-7173691766). Originally posted by [superboynick](https://github.com/superboynick) on 2026-11-25T20:27:07Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/988:upstream-pr/988'
git switch 'upstream-pr/988'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/988'
git switch 'upstream-pr/988'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/988'
git switch 'upstream-pr/988'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/988'
git switch 'main'
git merge --squash 'upstream-pr/988'
git switch 'main'
git merge --ff-only 'upstream-pr/988'
git switch 'main'
git merge 'upstream-pr/988'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!986
No description provided.