Shaders: keep lane-mask restores apart across reads of first register #180

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

@⁠sandie69p on GitHub · 2026-11-24 22:17 UTC · original
sandie69p:fix/wave32-rt-or-compute → main · +24 −0 · 1 files · 1 commits · open

In ir::unspill, the look-ahead that coalesces two separated v_readlane_b32 restores into a pair s_mov_b64 at the first instruction checked read[j].contains(&(code + 1)) but omitted read[j].contains(&code), overwriting the first register early when an intermediate instruction reads it.

Adds read[j].contains(&code) to the interference check and a regression unit test (unspill_does_not_pair_restore_across_read_of_first_register).

Related to #75.

**@⁠sandie69p** on GitHub · 2026-11-24 22:17 UTC · [original](https://github.com/fxceless/victory-fork/pull/180) `sandie69p:fix/wave32-rt-or-compute` → `main` · +24 −0 · 1 files · 1 commits · open In `ir::unspill`, the look-ahead that coalesces two separated `v_readlane_b32` restores into a pair `s_mov_b64` at the first instruction checked `read[j].contains(&(code + 1))` but omitted `read[j].contains(&code)`, overwriting the first register early when an intermediate instruction reads it. Adds `read[j].contains(&code)` to the interference check and a regression unit test (`unspill_does_not_pair_restore_across_read_of_first_register`). Related to #75.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:40 +00:00
Author
Owner

@⁠juliptree on GitHub · 2026-11-25 10:16 UTC · original

I tested base 2119b0e and PR head 4a6d4f7 with the same synthetic fixtures on an RTX 5060 Ti and WARP. Reading s4 between restores returned 0x11223344 on both builds. The base paired the restores and the PR did not. Reading s5 returned its pre-restore value 0x00000003 on both builds, and neither paired. Since the paired move is emitted at the first restore, only the s5 restore moves earlier. Is there a fixture where reading s4 produces a different value on the base? The PR’s current test checks whether pairing occurred, so it passes even though both builds return the same values.

**@⁠juliptree** on GitHub · 2026-11-25 10:16 UTC · [original](https://github.com/fxceless/victory-fork/pull/180#issuecomment-7159475840) I tested base 2119b0e and PR head 4a6d4f7 with the same synthetic fixtures on an RTX 5060 Ti and WARP. Reading s4 between restores returned 0x11223344 on both builds. The base paired the restores and the PR did not. Reading s5 returned its pre-restore value 0x00000003 on both builds, and neither paired. Since the paired move is emitted at the first restore, only the s5 restore moves earlier. Is there a fixture where reading s4 produces a different value on the base? The PR’s current test checks whether pairing occurred, so it passes even though both builds return the same values.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/180/head:github-bot/gh-180'
git switch 'github-bot/gh-180'

Merge

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