Shaders/own_bits: fix STALE taint propagation for control-dependent a… #516

Open
pug205gti6 wants to merge 1 commit from upstream-pr/516 into main
pug205gti6 commented 2026-11-25 01:57:18 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by pug205gti6 on 2026-11-25T01:57:18Z.


…nd loop-carried mask phis

In own_bits::Ctx::site, the STALE check missed test-dependent lane masks that outlived their round in three ways:

  1. dep propagation over st.phi_masks only checked the BDD support of incoming edge values, missing control-dependent mask phis whose per-edge given(m, edge) folded to constants (TRUE/FALSE) across a tainted branch or path.
  2. The block check skipped every block in lp dominated by a test block tb. Because the own-bit test normally lives in the loop header (tb == h), self.dominates(tb, b) skipped every block in lp, including guards/uses before ti in tb and loop-carried mask phis at h.
  3. The st.masks user check only flagged User::Phi(b2, k2) when !lp[b2], ignoring live loop-header phis at b2 == h.

Propagate control-dependent taint into st.phi_masks when incoming edge values differ and a predecessor's reachability or branch condition is tainted, reject tainted loop-header mask phis at h, check guards and instruction mask users against instruction-level dominance after (tb, ti), and treat live phi users at h as leaving the round. Add synthetic unit tests covering control-dependent loop-carried, control-dependent post-loop, and direct data-dependent loop-carried tainted masks.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6595371309 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/516). Originally posted by [pug205gti6](https://github.com/pug205gti6) on 2026-11-25T01:57:18Z. --- …nd loop-carried mask phis In `own_bits::Ctx::site`, the `STALE` check missed test-dependent lane masks that outlived their round in three ways: 1. `dep` propagation over `st.phi_masks` only checked the BDD support of incoming edge values, missing control-dependent mask phis whose per-edge `given(m, edge)` folded to constants (`TRUE`/`FALSE`) across a tainted branch or path. 2. The block check skipped every block in `lp` dominated by a test block `tb`. Because the own-bit test normally lives in the loop header (`tb == h`), `self.dominates(tb, b)` skipped every block in `lp`, including guards/uses before `ti` in `tb` and loop-carried mask phis at `h`. 3. The `st.masks` user check only flagged `User::Phi(b2, k2)` when `!lp[b2]`, ignoring live loop-header phis at `b2 == h`. Propagate control-dependent taint into `st.phi_masks` when incoming edge values differ and a predecessor's reachability or branch condition is tainted, reject tainted loop-header mask phis at `h`, check guards and instruction mask users against instruction-level dominance after `(tb, ti)`, and treat live phi users at `h` as leaving the round. Add synthetic unit tests covering control-dependent loop-carried, control-dependent post-loop, and direct data-dependent loop-carried tainted masks.
Revens2 commented 2026-11-25 08:09:00 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Revens2 on 2026-11-25T07:36:17Z.


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

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

<!-- greyfinch-sync:fxceless/victory-fork:comment:7156047195 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/516#issuecomment-7156047195). Originally posted by [Revens2](https://github.com/Revens2) on 2026-11-25T07:36:17Z. --- Duplicate of #441: @AscilCH opened this patch 65 minutes earlier, and `gh pr diff` returns the same bytes for both (+181/-10 on 1 file(s), same title). Please continue in #441 so the review history and any test data stay in one place. Thanks.
Headache3318 commented 2026-11-25 08:09:05 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Headache3318 on 2026-11-25T07:51:48Z.


Independent verification: PR #516 (Shaders/own_bits: fix STALE taint propagation for control-dependent and loop-carried mask phis) merges cleanly onto main (8dd30ab). Build: success. Tests: 172/172 shader tests pass; full workspace tests fail on Linux due to known Windows-only dependency issue (unrelated to PR). Only 1 file modified: crates/victory-shader/src/emit/own_bits.rs (+181, -10). PR is clean and ready to merge. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7156336176 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/516#issuecomment-7156336176). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-25T07:51:48Z. --- Independent verification: PR #516 (Shaders/own_bits: fix STALE taint propagation for control-dependent and loop-carried mask phis) merges cleanly onto main (8dd30ab). Build: success. Tests: 172/172 shader tests pass; full workspace tests fail on Linux due to known Windows-only dependency issue (unrelated to PR). Only 1 file modified: crates/victory-shader/src/emit/own_bits.rs (+181, -10). PR is clean and ready to merge. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.
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/516:upstream-pr/516'
git switch 'upstream-pr/516'

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