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

Open
sandie69p wants to merge 1 commit from upstream-pr/180 into main
sandie69p commented 2026-11-24 22:17:24 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by sandie69p on 2026-11-24T22:17:24Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6592517958 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/180). Originally posted by [sandie69p](https://github.com/sandie69p) on 2026-11-24T22:17:24Z. --- 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.
juliptree commented 2026-11-25 11:10:35 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by juliptree on 2026-11-25T10:16:43Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7159475840 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/180#issuecomment-7159475840). Originally posted by [juliptree](https://github.com/juliptree) on 2026-11-25T10:16:43Z. --- 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 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/180:upstream-pr/180'
git switch 'upstream-pr/180'

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/180'
git switch 'upstream-pr/180'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/180'
git switch 'upstream-pr/180'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/180'
git switch 'main'
git merge --squash 'upstream-pr/180'
git switch 'main'
git merge --ff-only 'upstream-pr/180'
git switch 'main'
git merge 'upstream-pr/180'
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!180
No description provided.