Shaders/ir: keep skips when body can resurrect EXEC or has scalar sid… #517

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

@⁠pug205gti6 on GitHub · 2026-11-25 01:57 UTC · original
pug205gti6:pr/443-shaders-ir-skips → main · +429 −7 · 1 files · 1 commits · open

…e effects

In ir::without_skips, removing s_cbranch_execz causes waves with EXEC == 0 to fall through and execute the skipped region inside. Previously skipped() exempted Reg::S(126 | 127) (EXEC_LO/EXEC_HI) from join-phi checks without verifying that inside keeps EXEC == 0, and did not check inside for EXEC-independent scalar side effects.

  1. Reject skipping regions containing EXEC-independent scalar side effects (s_store_*, s_buffer_store_*, s_scratch_store_*, s_atomic_*, s_buffer_atomic_*, s_sendmsg, s_sendmsghalt, s_barrier, s_round_mode, s_denorm_mode).
  2. Compute a least fixpoint of values inside inside that may be nonzero when EXEC enters as 0 (seeded with external values other than the skip branch's own EXEC dwords), propagating zero through narrowing v_cmpx_*, s_and*/s_andn2*, s_mov_b32/s_mov_b64, and pure whole-wave sections (s_or_saveexec/s_nand_saveexec paired with an exact full-width restore). Reject if any EXEC write or phi inside inside (outside a pure whole-wave section) or incoming EXEC phi at target can become nonzero, or if a live VGPR phi at target takes a value written inside a whole-wave section.
  3. Add synthetic unit tests verifying outer-EXEC restores, s_or_b64/s_andn2_b64 EXEC widening, inner narrowing (still allowed), s_sendmsg, s_barrier, and s_buffer_store_dword.
**@⁠pug205gti6** on GitHub · 2026-11-25 01:57 UTC · [original](https://github.com/fxceless/victory-fork/pull/517) `pug205gti6:pr/443-shaders-ir-skips` → `main` · +429 −7 · 1 files · 1 commits · open …e effects In `ir::without_skips`, removing `s_cbranch_execz` causes waves with `EXEC == 0` to fall through and execute the skipped region `inside`. Previously `skipped()` exempted `Reg::S(126 | 127)` (`EXEC_LO`/`EXEC_HI`) from join-phi checks without verifying that `inside` keeps `EXEC == 0`, and did not check `inside` for EXEC-independent scalar side effects. 1. Reject skipping regions containing EXEC-independent scalar side effects (`s_store_*`, `s_buffer_store_*`, `s_scratch_store_*`, `s_atomic_*`, `s_buffer_atomic_*`, `s_sendmsg`, `s_sendmsghalt`, `s_barrier`, `s_round_mode`, `s_denorm_mode`). 2. Compute a least fixpoint of values inside `inside` that may be nonzero when `EXEC` enters as `0` (seeded with external values other than the skip branch's own `EXEC` dwords), propagating zero through narrowing `v_cmpx_*`, `s_and*`/`s_andn2*`, `s_mov_b32`/`s_mov_b64`, and pure whole-wave sections (`s_or_saveexec`/`s_nand_saveexec` paired with an exact full-width restore). Reject if any `EXEC` write or phi inside `inside` (outside a pure whole-wave section) or incoming `EXEC` phi at `target` can become nonzero, or if a live VGPR phi at `target` takes a value written inside a whole-wave section. 3. Add synthetic unit tests verifying outer-EXEC restores, `s_or_b64`/`s_andn2_b64` EXEC widening, inner narrowing (still allowed), `s_sendmsg`, `s_barrier`, and `s_buffer_store_dword`.
In `ir::without_skips`, removing `s_cbranch_execz` causes waves with `EXEC == 0` to fall through and execute the skipped region `inside`. Previously `skipped()` exempted `Reg::S(126 | 127)` (`EXEC_LO`/`EXEC_HI`) from join-phi checks without verifying that `inside` keeps `EXEC == 0`, and did not check `inside` for EXEC-independent scalar side effects.

1. Reject skipping regions containing EXEC-independent scalar side effects (`s_store_*`, `s_buffer_store_*`, `s_scratch_store_*`, `s_atomic_*`, `s_buffer_atomic_*`, `s_sendmsg`, `s_sendmsghalt`, `s_barrier`, `s_round_mode`, `s_denorm_mode`).
2. Compute a least fixpoint of values inside `inside` that may be nonzero when `EXEC` enters as `0` (seeded with external values other than the skip branch's own `EXEC` dwords), propagating zero through narrowing `v_cmpx_*`, `s_and*`/`s_andn2*`, `s_mov_b32`/`s_mov_b64`, and pure whole-wave sections (`s_or_saveexec`/`s_nand_saveexec` paired with an exact full-width restore). Reject if any `EXEC` write or phi inside `inside` (outside a pure whole-wave section) or incoming `EXEC` phi at `target` can become nonzero, or if a live VGPR phi at `target` takes a value written inside a whole-wave section.
3. Add synthetic unit tests verifying outer-EXEC restores, `s_or_b64`/`s_andn2_b64` EXEC widening, inner narrowing (still allowed), `s_sendmsg`, `s_barrier`, and `s_buffer_store_dword`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:45:09 +00:00
Author
Owner

@⁠Revens2 on GitHub · 2026-11-25 07:36 UTC · original

Duplicate of #443: @⁠AscilCH opened this patch 65 minutes earlier, and gh pr diff returns the same bytes for both (+429/-7 on 1 file(s), same title).

Please continue in #443 so the review history and any test data stay in one place.
Thanks.

**@⁠Revens2** on GitHub · 2026-11-25 07:36 UTC · [original](https://github.com/fxceless/victory-fork/pull/517#issuecomment-7156049009) Duplicate of #443: @⁠AscilCH opened this patch 65 minutes earlier, and `gh pr diff` returns the same bytes for both (+429/-7 on 1 file(s), same title). Please continue in #443 so the review history and any test data stay in one place. Thanks.
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-25 07:51 UTC · original

Independent verification: PR #517 merges cleanly onto main, touches only crates/victory-shader/src/ir.rs. Build: success. Tests: 252 passed, 1 failed, 6 ignored. Single failure (modules::net::tests::only_loopback_is_reachable) is pre-existing Wine environment issue (ws2_32.dll lacks WSAConnectByList) unrelated to the PRs shader IR changes. PR builds and passes all relevant tests. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.

**@⁠Headache3318** on GitHub · 2026-11-25 07:51 UTC · [original](https://github.com/fxceless/victory-fork/pull/517#issuecomment-7156335872) Independent verification: PR #517 merges cleanly onto main, touches only crates/victory-shader/src/ir.rs. Build: success. Tests: 252 passed, 1 failed, 6 ignored. Single failure (modules::net::tests::only_loopback_is_reachable) is pre-existing Wine environment issue (ws2_32.dll lacks WSAConnectByList) unrelated to the PRs shader IR changes. PR builds and passes all relevant tests. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/ir.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/517/head:github-bot/gh-517'
git switch 'github-bot/gh-517'

Merge

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