shader: refuse reads of the carry s_lshlN_add_u32 leaves in SCC #2811
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2813"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by spy0eye-beep on 2026-11-25T21:14:40Z.
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_u32fell 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_refusedbuilds each of the four ops followed bys_cselect_b32on 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
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T21:19:06Z.
Review: COMMENTED
Correct per ISA:
s_lshl1-4_add_u32set SCC to the add's carry-out, notresult != 0— reading it through the generic SCC path silently produced the wrong predicate. Refusing it alongside the add/sub carries is the honest behavior until carry tracking lands. The pattern is precise (s_lshlprefix AND_add_u32suffix, so plains_lshl_b32shifts still fall through), and the test covers all four ops 0x2e-0x31 reading SCC vias_cselect. LGTM.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T21:30:47Z.
Verified
0e193dbdon Windows 11 (RTX 5090 + WARP + Windows SDK10.0.26100.0dxil.dll):cargo xtask policy: 184 files ok.lshl_add_carry_read_is_refused+carries_match_the_hardware): 2/2 passed; WARP +dxil.dll: 268 passed, 0 failed.name.starts_with("s_lshl") && name.ends_with("_add_u32")targetss_lshl1_add_u32..s_lshl4_add_u32without affectings_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). Replacingrefused.err().expect("refused")withrefused.expect_err("refused")will clear CI.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:14:37Z.
Automated triage for the maintainers.
This PR no longer merges cleanly into
main: it conflicts incrates/victory-shader/src/emit/valu_tests.rs. Its content will be reviewed once it is rebased onto currentmain.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.