Run pixel shader wave operations over helper lanes, as the console does #2373

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

@⁠Vyto-Line on GitHub · 2026-11-25 12:10 UTC · original
Vyto-Line:helper-lane-waves → main · +107 −5 · 7 files · 1 commits · open

The console's wave operations include a pixel shader's helper lanes; the host's leave them out. A loop that serves one lane's value per pass (v_readfirstlane, then the lanes with that value) never serves a helper lane whose value no live lane shares, and a loop over a range taken from a whole-wave min/max gives a helper lane an unreliable range. Such a lane runs to the loop limit; on an RTX 3080 that made single draws of Grand Theft Auto VI's world (PS_VehicleLiveryOff..., PS_Textured_Eight) take longer than the driver allows, which reset the GPU. Each was found with every draw and dispatch made to finish before the next.

Where the host runs shader model 6.7, pixel shaders with wave operations are now emitted as 6.7 with the entry attribute
"waveops-include-helper-lanes" (DXC's [WaveOpsIncludeHelperLanes]); the attribute group is written only into modules that use it, so other shaders' bytes are unchanged. Without 6.7, v_readfirstlane in a pixel shader gives a helper lane its own value: what the console gives it on the pass that serves it.

The setting is part of the translation, so the shader cache keys on it. The RTX 3080 reports 6.7; all of the title's vertex and pixel pipelines build with it. With it, the vehicle draw no longer hangs; another draw (MSR_VS_CascadeShadows_drawskinned) still does.

**@⁠Vyto-Line** on GitHub · 2026-11-25 12:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2373) `Vyto-Line:helper-lane-waves` → `main` · +107 −5 · 7 files · 1 commits · open The console's wave operations include a pixel shader's helper lanes; the host's leave them out. A loop that serves one lane's value per pass (v_readfirstlane, then the lanes with that value) never serves a helper lane whose value no live lane shares, and a loop over a range taken from a whole-wave min/max gives a helper lane an unreliable range. Such a lane runs to the loop limit; on an RTX 3080 that made single draws of Grand Theft Auto VI's world (PS_VehicleLiveryOff..., PS_Textured_Eight) take longer than the driver allows, which reset the GPU. Each was found with every draw and dispatch made to finish before the next. Where the host runs shader model 6.7, pixel shaders with wave operations are now emitted as 6.7 with the entry attribute "waveops-include-helper-lanes" (DXC's [WaveOpsIncludeHelperLanes]); the attribute group is written only into modules that use it, so other shaders' bytes are unchanged. Without 6.7, v_readfirstlane in a pixel shader gives a helper lane its own value: what the console gives it on the pass that serves it. The setting is part of the translation, so the shader cache keys on it. The RTX 3080 reports 6.7; all of the title's vertex and pixel pipelines build with it. With it, the vehicle draw no longer hangs; another draw (MSR_VS_CascadeShadows_drawskinned) still does.
The console's wave operations include a pixel shader's helper lanes; the
host's leave them out. A loop that serves one lane's value per pass
(v_readfirstlane, then the lanes with that value) never serves a helper
lane whose value no live lane shares, and a loop over a range taken
from a whole-wave min/max gives a helper lane an unreliable range. Such
a lane runs to the loop limit; on an RTX 3080 that made single draws of
Grand Theft Auto VI's world (PS_VehicleLiveryOff..., PS_Textured_Eight)
take longer than the driver allows, which reset the GPU. Each was found
with every draw and dispatch made to finish before the next.

Where the host runs shader model 6.7, pixel shaders with wave operations
are now emitted as 6.7 with the entry attribute
"waveops-include-helper-lanes" (DXC's [WaveOpsIncludeHelperLanes]); the
attribute group is written only into modules that use it, so other
shaders' bytes are unchanged. Without 6.7, v_readfirstlane in a pixel
shader gives a helper lane its own value: what the console gives it on
the pass that serves it.

The setting is part of the translation, so the shader cache keys on it.
The RTX 3080 reports 6.7; all of the title's vertex and pixel pipelines
build with it. With it, the vehicle draw no longer hangs; another draw
(MSR_VS_CascadeShadows_drawskinned) still does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:03:49 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:29 UTC · original

Automated triage for the maintainers.

Needs rebase. This PR conflicts with current main (940d32f) in crates/victory-gpu/src/shader_cache.rs and crates/victory-shader/src/emit/lower.rs. Its content will be reviewed once it is rebased.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2373#issuecomment-7162454989) <!-- victory-triage v1 head=58f0be9e8218808d499b04ad4e227d868482bb23 verdict=needs-rebase at=2026-11-25T13:09:00Z --> Automated triage for the maintainers. **Needs rebase.** This PR conflicts with current `main` (`940d32f`) in `crates/victory-gpu/src/shader_cache.rs` and `crates/victory-shader/src/emit/lower.rs`. Its content will be reviewed once it is rebased. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠YaBulochka on GitHub · 2026-11-25 12:47 UTC · original

Regression data point on the full retail dump: this PR gains 808 programs but loses 3,002, so the net is -2,194 validated.

Method: victory translate shaders.rpf --validate --list, Linux/Wine, dxil.dll 1.9.2609.5, x86_64-pc-windows-gnu release.

Build validated
940d32f (baseline) 23,918
this PR 21,724

Program-by-program (comm on the sorted validated lists):

  • lost 3,002, gained 808, net -2,194;
  • every lost program I sampled now fails with emit: a scalar memory read as data - e.g. MSNC_VS_MirrorReflectionPedTransformSkinD_907647ea_Wrapped at 0x22dc, MS_VS_MirrorReflectionPedTransformDecalsD_db76baa6_Wrapped at 0x1474;
  • the lost set is dominated by MSNC_VS_* / MS_VS_* (mesh and vertex stage), not pixel.

So the helper-lane pixel work does what it says for its own stage (that is presumably the +808), but something in the same tree makes scalar memory reads fail to trace in the mesh/vertex lowering. Worth running this exact command before merging; if you want, I can also bisect the PR's commits to say which one introduces the scalar memory read as data path.

Baseline command and dump are the same as in the #1458 reports.

**@⁠YaBulochka** on GitHub · 2026-11-25 12:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2373#issuecomment-7162851737) Regression data point on the full retail dump: this PR gains 808 programs but loses 3,002, so the net is **-2,194** validated. Method: `victory translate shaders.rpf --validate --list`, Linux/Wine, dxil.dll 1.9.2609.5, `x86_64-pc-windows-gnu` release. | Build | validated | |---|---:| | `940d32f` (baseline) | 23,918 | | this PR | **21,724** | Program-by-program (`comm` on the sorted validated lists): - **lost 3,002**, **gained 808**, net -2,194; - every lost program I sampled now fails with **`emit: a scalar memory read as data`** - e.g. `MSNC_VS_MirrorReflectionPedTransformSkinD_907647ea_Wrapped` at `0x22dc`, `MS_VS_MirrorReflectionPedTransformDecalsD_db76baa6_Wrapped` at `0x1474`; - the lost set is dominated by `MSNC_VS_*` / `MS_VS_*` (mesh and vertex stage), not pixel. So the helper-lane pixel work does what it says for its own stage (that is presumably the +808), but something in the same tree makes scalar memory reads fail to trace in the mesh/vertex lowering. Worth running this exact command before merging; if you want, I can also bisect the PR's commits to say which one introduces the `scalar memory read as data` path. Baseline command and dump are the same as in the #1458 reports.
Author
Owner

@⁠YaBulochka on GitHub · 2026-11-25 13:10 UTC · original

Correction to my comment above - the regression is not in this PR, and I compared against the wrong baseline.

The PR's merge-base is ffe310e, not 940d32f. Numbers on the same dump, same command:

Build validated
ffe310e (this PR's base) 21,724
this PR (58f0be9) 21,724
940d32f (current main, unrelated to this PR) 23,918

So on its own base this PR is neutral: 21,724 before, 21,724 after, same lost set (emit: a scalar memory read as data on MSNC_VS_*/MS_VS_*). The 3,002 programs I attributed to this PR were already failing at its base; something between ffe310e and 940d32f fixes them.

Apologies for the noise - the fix is to rebase the PR on current main and re-run, where the expected number is 23,918.

**@⁠YaBulochka** on GitHub · 2026-11-25 13:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2373#issuecomment-7163396559) **Correction to my comment above - the regression is not in this PR, and I compared against the wrong baseline.** The PR's merge-base is `ffe310e`, not `940d32f`. Numbers on the same dump, same command: | Build | validated | |---|---:| | `ffe310e` (this PR's base) | **21,724** | | this PR (`58f0be9`) | **21,724** | | `940d32f` (current main, unrelated to this PR) | 23,918 | So on its own base this PR is **neutral**: 21,724 before, 21,724 after, same lost set (`emit: a scalar memory read as data` on `MSNC_VS_*`/`MS_VS_*`). The 3,002 programs I attributed to this PR were already failing at its base; something between `ffe310e` and `940d32f` fixes them. Apologies for the noise - the fix is to rebase the PR on current main and re-run, where the expected number is 23,918.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/shader_cache.rs
  • crates/victory-shader/src/emit/host.rs
  • 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/2373/head:github-bot/gh-2373'
git switch 'github-bot/gh-2373'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2373'
git switch 'github-bot/gh-2373'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2373'
git switch 'github-bot/gh-2373'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2373'
git switch 'main'
git merge --squash 'github-bot/gh-2373'
git switch 'main'
git merge --ff-only 'github-bot/gh-2373'
git switch 'main'
git merge 'github-bot/gh-2373'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2373
No description provided.