shader: refuse reads of the carry s_lshlN_add_u32 leaves in SCC #2813

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

@⁠spy0eye-beep on GitHub · 2026-11-25 21:14 UTC · original
spy0eye-beep:fix/lshl-add-scc → main · +21 −1 · 2 files · 1 commits · open

Split out of #1483 as requested in review. The s_min/s_max part of that PR is already fixed on main; this is the remaining piece.

s_lshl{1..4}_add_u32 fell through to the default SCC = (result != 0), but the hardware sets the add's carry. Like s_add/s_sub, SCC is now marked unknown, so a shader that reads it is refused instead of silently mistranslated.

Test: lshl_add_carry_read_is_refused builds each of the four ops followed by s_cselect_b32 on SCC and expects the refusal (it fails without the change). cargo test -p victory-shader: the same 9 tests fail on main and on this branch.

🤖 Generated with Claude Code

**@⁠spy0eye-beep** on GitHub · 2026-11-25 21:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2813) `spy0eye-beep:fix/lshl-add-scc` → `main` · +21 −1 · 2 files · 1 commits · open Split out of #1483 as requested in review. The s_min/s_max part of that PR is already fixed on main; this is the remaining piece. `s_lshl{1..4}_add_u32` fell through to the default SCC = (result != 0), but the hardware sets the add's carry. Like s_add/s_sub, SCC is now marked unknown, so a shader that reads it is refused instead of silently mistranslated. Test: `lshl_add_carry_read_is_refused` builds each of the four ops followed by `s_cselect_b32` on SCC and expects the refusal (it fails without the change). `cargo test -p victory-shader`: the same 9 tests fail on main and on this branch. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The default set SCC to result != 0; the hardware sets the add's carry.
Mark it unknown like s_add/s_sub, so a shader reading it is refused
instead of silently mistranslated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:14:52 +00:00
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 21:30 UTC · original

Verified 0e193dbd on Windows 11 (RTX 5090 + WARP + Windows SDK 10.0.26100.0 dxil.dll):

  • cargo xtask policy: 184 files ok.
  • RTX 5090 (lshl_add_carry_read_is_refused + carries_match_the_hardware): 2/2 passed; WARP + dxil.dll: 268 passed, 0 failed.
  • Logic looks spot-on: name.starts_with("s_lshl") && name.ends_with("_add_u32") targets s_lshl1_add_u32..s_lshl4_add_u32 without affecting s_lshl_b32/_b64, and merges cleanly with #2385.

One clippy failure causing CI to fail:

  • crates/victory-shader/src/emit/valu_tests.rs:1821:43: error: called '.err().expect()' on a Result value (-D clippy::err_expect). Replacing refused.err().expect("refused") with refused.expect_err("refused") will clear CI.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 21:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2813#issuecomment-7175175567) Verified `0e193dbd` on Windows 11 (RTX 5090 + WARP + Windows SDK `10.0.26100.0` `dxil.dll`): - `cargo xtask policy`: 184 files ok. - RTX 5090 (`lshl_add_carry_read_is_refused` + `carries_match_the_hardware`): 2/2 passed; WARP + `dxil.dll`: 268 passed, 0 failed. - Logic looks spot-on: `name.starts_with("s_lshl") && name.ends_with("_add_u32")` targets `s_lshl1_add_u32`..`s_lshl4_add_u32` without affecting `s_lshl_b32`/`_b64`, and merges cleanly with #2385. One clippy failure causing CI to fail: - `crates/victory-shader/src/emit/valu_tests.rs:1821:43`: `error: called '.err().expect()' on a Result value` (`-D clippy::err_expect`). Replacing `refused.err().expect("refused")` with `refused.expect_err("refused")` will clear CI.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:14 UTC · original

Automated triage for the maintainers.

This PR no longer merges cleanly into main: it conflicts in crates/victory-shader/src/emit/valu_tests.rs. Its content will be reviewed once it is rebased onto current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2813#issuecomment-7177305982) <!-- victory-triage v1 head=0e193dbd9d1b78c9b3c9b463bcb73d9d81647dd1 verdict=needs-rebase at=2026-11-25T23:13:52Z --> Automated triage for the maintainers. This PR no longer merges cleanly into `main`: it conflicts in `crates/victory-shader/src/emit/valu_tests.rs`. Its content will be reviewed once it is rebased onto current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/valu_tests.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/2813/head:github-bot/gh-2813'
git switch 'github-bot/gh-2813'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2813'
git switch 'github-bot/gh-2813'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2813'
git switch 'github-bot/gh-2813'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2813'
git switch 'main'
git merge --squash 'github-bot/gh-2813'
git switch 'main'
git merge --ff-only 'github-bot/gh-2813'
git switch 'main'
git merge 'github-bot/gh-2813'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2813
No description provided.