Shaders: name the instruction that ended a whole-wave section #2363

Closed
Calvix2k wants to merge 2 commits from upstream-pr/2365 into main
Calvix2k commented 2026-11-25 11:57:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T11:57:13Z.


A whole-wave section (s_or_saveexec -1 … s_and_saveexec, the console's way of running one operation with every lane active) is simulated lane by lane to know what its wave operations mean once the host runs them. The simulation follows EXEC when it is set to a constant (s_mov_b*), and stops at anything else; every value read after that point is refused with

a whole-wave section step the simulation does not follow

which names nothing, so each case had to be found by hand — three compute shaders of this title (the once-per-frame post-processing passes) are stuck behind it.

What this does

wave::Section records the instruction that ended the simulation (ended: Option<&'static str>), and Lower::section_inst uses it as the reason a shapeless value is refused. The message becomes the instruction name — s_and_b32 or whatever it was — which is the one thing a reader needs before teaching the simulation that step.

No behaviour changes: the same programs translate and fail as before, with a better reason.

Verification

  • victory translate --list over shaders.rpf (26,503 containers): same program set, the reasons now name the instruction.
  • cargo test -p victory-shader --lib: 247 passed, 0 failed, 3 ignored; clippy -D warnings clean.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6603932844 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2365). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T11:57:13Z. --- A whole-wave section (`s_or_saveexec -1 … s_and_saveexec`, the console's way of running one operation with every lane active) is simulated lane by lane to know what its wave operations mean once the host runs them. The simulation follows `EXEC` when it is set to a constant (`s_mov_b*`), and stops at anything else; every value read after that point is refused with ``` a whole-wave section step the simulation does not follow ``` which names nothing, so each case had to be found by hand — three compute shaders of this title (the once-per-frame post-processing passes) are stuck behind it. ### What this does `wave::Section` records the instruction that ended the simulation (`ended: Option<&'static str>`), and `Lower::section_inst` uses it as the reason a shapeless value is refused. The message becomes the instruction name — `s_and_b32` or whatever it was — which is the one thing a reader needs before teaching the simulation that step. No behaviour changes: the same programs translate and fail as before, with a better reason. ### Verification - `victory translate --list` over `shaders.rpf` (26,503 containers): same program set, the reasons now name the instruction. - `cargo test -p victory-shader --lib`: 247 passed, 0 failed, 3 ignored; clippy `-D warnings` clean.
Melow-code commented 2026-11-25 13:02:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-25T12:27:11Z.

Review: COMMENTED


The diagnostic improvement is clear: naming the instruction that stopped the section is better than the generic refusal. One point:

The ended name is per section, applied to every value without a shape. The message names the instruction that ended the simulation but not the value that failed. The developer still has to find which value. Could the error carry both — the instruction and the value's register or IR node?

Assisted-by: DeepSeek V4 Pro (OpenCode)
🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:review:6057579726 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2365#pullrequestreview-6057579726). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-25T12:27:11Z. **Review:** COMMENTED --- The diagnostic improvement is clear: naming the instruction that stopped the section is better than the generic refusal. One point: The `ended` name is per section, applied to every value without a shape. The message names the instruction that ended the simulation but not the value that failed. The developer still has to find which value. Could the error carry both — the instruction and the value's register or IR node? Assisted-by: DeepSeek V4 Pro (OpenCode) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
catminou4 commented 2026-11-25 13:02:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T12:35:54Z.

Review: APPROVED


Tested locally: merged into main 940d32f69b, cargo test -p victory-shader --locked on macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — the instruction that ended a whole-wave section is named.

<!-- greyfinch-sync:Marvisak/VIctory:review:6057695036 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2365#pullrequestreview-6057695036). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T12:35:54Z. **Review:** APPROVED --- Tested locally: merged into main 940d32f69b, `cargo test -p victory-shader --locked` on macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — the instruction that ended a whole-wave section is named.
welisonzika14-jpg commented 2026-11-25 13:02:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by welisonzika14-jpg on 2026-11-25T12:25:08Z.


First run on NVIDIA hardware here, as far as I can see. RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head c3435ec merged onto main 940d32f, cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.

The PR adds no test that runs here, so this only shows it breaks nothing. The rest is the same as main on this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests in victory-gpu, 3 in victory-shader), nothing new.

One run, unit tests only, title not run.

Written with AI help (Claude/Kiro); the numbers are from runs on my machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162345595 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2365#issuecomment-7162345595). Originally posted by [welisonzika14-jpg](https://github.com/welisonzika14-jpg) on 2026-11-25T12:25:08Z. --- First run on NVIDIA hardware here, as far as I can see. RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head `c3435ec` merged onto `main` `940d32f`, `cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast`. The PR adds no test that runs here, so this only shows it breaks nothing. The rest is the same as `main` on this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests in `victory-gpu`, 3 in `victory-shader`), nothing new. One run, unit tests only, title not run. Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
Marvisak commented 2026-11-25 15:04:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T14:49:06Z.


Automated triage for the maintainers.

Merge candidate.

When a whole-wave section leaves a value with no shape, the shader translator now names the step that caused it. simulate in crates/victory-shader/src/emit/wave.rs returns the step that stopped the simulation, and sections records the last writer of each unshaped value. Lower::section_inst in lower.rs puts these in the refusal instead of the generic reason.

Changed since the last review (new head 1c94500, rebased onto 67e8ae1): the reason keeps its category. section_step builds "a whole-wave section step: ", made once per name and cached, so the table can only be as large as the opcode set. A translate --list line can no longer be mistaken for a bare unlowered instruction. The new test a_section_step_keeps_its_category pins the reason for an s_not_b32 EXEC write. It also merges cleanly with #2382, which edits the same simulate.

On your reply: confirmed, that was the change asked for.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7165862011 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2365#issuecomment-7165862011). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T14:49:06Z. --- <!-- victory-triage v1 head=1c94500fb80b7ffbfaa9eff1ea7ad31ecb8aa186 verdict=merge-candidate at=2026-11-25T16:44:54Z --> Automated triage for the maintainers. **Merge candidate.** When a whole-wave section leaves a value with no shape, the shader translator now names the step that caused it. `simulate` in `crates/victory-shader/src/emit/wave.rs` returns the step that stopped the simulation, and `sections` records the last writer of each unshaped value. `Lower::section_inst` in `lower.rs` puts these in the refusal instead of the generic reason. Changed since the last review (new head `1c94500`, rebased onto `67e8ae1`): the reason keeps its category. `section_step` builds "a whole-wave section step: <name>", made once per name and cached, so the table can only be as large as the opcode set. A `translate --list` line can no longer be mistaken for a bare unlowered instruction. The new test `a_section_step_keeps_its_category` pins the reason for an `s_not_b32` EXEC write. It also merges cleanly with #2382, which edits the same `simulate`. On your reply: confirmed, that was the change asked for. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Calvix2k commented 2026-11-25 17:05:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T16:17:15Z.


The category is back in the reason, in 1c94500 (rebased onto main 67e8ae1): wave::section_step turns the step's name into "a whole-wave section step: ", made once per name (the names are static, so the table is bounded by the opcode set). Section::ended and Section::reasons store that form, so neither path can be mistaken for a bare "instruction not lowered" again.

a_section_step_keeps_its_category builds a section whose EXEC write is s_not_b32 and pins "a whole-wave section step: s_not_b32". It fails on the old form, which stored the bare name. Local wave tests 7/7 and clippy clean; the rest of the shader suite's GPU cases need SM 6.6 and run in CI.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167755668 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2365#issuecomment-7167755668). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T16:17:15Z. --- The category is back in the reason, in `1c94500` (rebased onto `main 67e8ae1`): `wave::section_step` turns the step's name into "a whole-wave section step: <name>", made once per name (the names are static, so the table is bounded by the opcode set). `Section::ended` and `Section::reasons` store that form, so neither path can be mistaken for a bare "instruction not lowered" again. `a_section_step_keeps_its_category` builds a section whose EXEC write is `s_not_b32` and pins `"a whole-wave section step: s_not_b32"`. It fails on the old form, which stored the bare name. Local wave tests 7/7 and clippy clean; the rest of the shader suite's GPU cases need SM 6.6 and run in CI.
upstream-sync closed this pull request 2026-11-25 23:04:22 +00:00
Marvisak commented 2026-11-25 23:05:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:08:57Z.


Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing in favour of #2344, which does the same job with fixed classes for every kind of step. Here the per-value reasons are attached only to values that never leave the section, which nothing reads, so the only step ever named is an EXEC write that stopped the simulation, and values that were already unknown before it are attributed to it.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175997642 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2365#issuecomment-7175997642). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:08:57Z. --- Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing in favour of #2344, which does the same job with fixed classes for every kind of step. Here the per-value reasons are attached only to values that never leave the section, which nothing reads, so the only step ever named is an EXEC write that stopped the simulation, and values that were already unknown before it are attributed to it. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

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
Marvisak/VIctory!2363
No description provided.