Shaders: lower v_add_nc_i32, v_sub_nc_i32, v_add_nc_i16, and v_sub_nc_i16 in pure 32-bit DXIL #2094

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

@⁠geiyiliyabumo on GitHub · 2026-11-25 04:43 UTC · original
geiyiliyabumo:feat/shader-v-add-sub-nc-i → main · +148 −3 · 2 files · 1 commits · open

Summary

  • Lowers GFX10 VOP3 signed no-carry integer instructions v_add_nc_i32 (0x37f), v_sub_nc_i32 (0x376), v_add_nc_i16 (0x30d), and v_sub_nc_i16 (0x30e) in crates/victory-shader/src/emit/lower.rs using pure 32-bit DXIL without enabling Int64 / WIDE_OPS.
  • Unclamped (clamp = 0) forms wrap naturally; clamped (clamp = 1) forms saturate to signed i32::MIN..=i32::MAX / i16::MIN..=i16::MAX.
  • The 16-bit forms honor op_sel for source and destination half selection while preserving the untouched half of vdst.
  • Adds synthetic DXIL-validation and GPU execution tests in crates/victory-shader/src/emit/valu_tests.rs covering normal results, positive and negative signed overflow, both clamp modes, op_sel half preservation, and verifying Int64 is not set.

Verification

  • cargo xtask policy: passed
  • cargo clippy -p victory-shader --tests -- -D warnings: passed
  • cargo test -p victory-shader --lib v_add_sub_nc_i -- --test-threads=1 with Microsoft dxil.dll: 2/2 passed on AMD Radeon RX 9060 XT (RDNA4) and Microsoft Basic Render Driver (WARP)
  • Zero game files or game-derived data used (synthetic tests only).
**@⁠geiyiliyabumo** on GitHub · 2026-11-25 04:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094) `geiyiliyabumo:feat/shader-v-add-sub-nc-i` → `main` · +148 −3 · 2 files · 1 commits · open ## Summary - Lowers GFX10 VOP3 signed no-carry integer instructions `v_add_nc_i32` (`0x37f`), `v_sub_nc_i32` (`0x376`), `v_add_nc_i16` (`0x30d`), and `v_sub_nc_i16` (`0x30e`) in `crates/victory-shader/src/emit/lower.rs` using pure 32-bit DXIL without enabling `Int64` / `WIDE_OPS`. - Unclamped (`clamp = 0`) forms wrap naturally; clamped (`clamp = 1`) forms saturate to signed `i32::MIN..=i32::MAX` / `i16::MIN..=i16::MAX`. - The 16-bit forms honor `op_sel` for source and destination half selection while preserving the untouched half of `vdst`. - Adds synthetic DXIL-validation and GPU execution tests in `crates/victory-shader/src/emit/valu_tests.rs` covering normal results, positive and negative signed overflow, both `clamp` modes, `op_sel` half preservation, and verifying `Int64` is not set. ## Verification - `cargo xtask policy`: passed - `cargo clippy -p victory-shader --tests -- -D warnings`: passed - `cargo test -p victory-shader --lib v_add_sub_nc_i -- --test-threads=1` with Microsoft `dxil.dll`: 2/2 passed on **AMD Radeon RX 9060 XT (RDNA4)** and **Microsoft Basic Render Driver (WARP)** - Zero game files or game-derived data used (synthetic tests only).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:54:38 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 05:01 UTC · original

Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at ab4db4d. victory-shader: 245 passed, 4 failed, 3 ignored. Three are #1744's NVIDIA failures on main. The fourth is this PR's new test:

emit::valu_tests::v_add_sub_nc_i16_wrap_and_saturate_with_op_sel
hardware: VOP3 0x30d, clamp true, op_sel 0b0000, case 1
  left: 0xFFFFFFE9   right: 0xA5A5FFE9

The low half is right (-20 + -3 = -23). The high half should be the destination's old 0xA5A5 but comes back sign-extended. The unclamped cases and clamped case 0 (a positive result) pass.

What I checked:

  • The DXIL is right. dxc -dumpbin of that shader shows the clamp select chain, then and %32, 65535, then and %old, -65536, then or, the same tail as the unclamped shader, which passes.
  • WARP passes on this machine. I swapped run_cases to run WARP first, locally. That matches your RX 9060 XT and WARP results. It fails alone, too, without the i32 test in the process.
  • Only NVIDIA drops the mask. Clamping with dx.op IMax/IMin (37/38) instead of compare/select, or clamping on r + 0x8000 in [0, 0xFFFF] and flipping the sign bit back, give the same 0xFFFFFFE9. NVIDIA's compiler appears to fold any of these into a saturating 16-bit add, and then drops write_half's 0xFFFF mask on its sign-extended result. It's a driver bug, but titles run on NVIDIA, so it's worth avoiding.
  • This form passes on NVIDIA and WARP: the selects choose the 16-bit patterns, never a clamped i32. With it, both of your tests pass and the full victory-shader suite is 246 passed with only #1744's 3, the same as main:
@@ -6514,10 +6514,16 @@ impl<'a> Lower<'a> {
                         let r = self.s.m.bin(c, op, a, b);
                         if v.clamp {
+                            // The selects pick the 16-bit patterns, never a clamped i32: NVIDIA
+                            // (616.56) turns a clamped i32 into a saturating 16-bit add whose
+                            // sign-extended result then skips write_half's 0xFFFF mask.
                             let lo = self.s.m.i32(i32::from(i16::MIN) as u32);
                             let hi = self.s.m.i32(i16::MAX as u32);
+                            let mask = self.s.m.i32(0xFFFF);
+                            let low = self.s.m.bin(c, Bin::And, r, mask);
                             let below = self.s.m.cmp(c, pred::SLT, r, lo);
-                            let r = self.s.m.select(c, below, lo, r);
+                            let min = self.s.m.i32(0x8000);
+                            let x = self.s.m.select(c, below, min, low);
                             let above = self.s.m.cmp(c, pred::SGT, r, hi);
-                            self.s.m.select(c, above, hi, r)
+                            self.s.m.select(c, above, hi, x)
                         } else {
                             r

Overlap, from reading: #92 (open, conflicting) lowers v_add_nc_i32 / v_sub_nc_i32 and the signed 16-bit add and sub too.

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-25 05:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#issuecomment-7153371416) Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at `ab4db4d`. `victory-shader`: 245 passed, **4** failed, 3 ignored. Three are #1744's NVIDIA failures on `main`. The fourth is this PR's new test: ``` emit::valu_tests::v_add_sub_nc_i16_wrap_and_saturate_with_op_sel hardware: VOP3 0x30d, clamp true, op_sel 0b0000, case 1 left: 0xFFFFFFE9 right: 0xA5A5FFE9 ``` The low half is right (-20 + -3 = -23). The high half should be the destination's old `0xA5A5` but comes back sign-extended. The unclamped cases and clamped case 0 (a positive result) pass. What I checked: - **The DXIL is right.** `dxc -dumpbin` of that shader shows the clamp select chain, then `and %32, 65535`, then `and %old, -65536`, then `or`, the same tail as the unclamped shader, which passes. - **WARP passes** on this machine. I swapped `run_cases` to run WARP first, locally. That matches your RX 9060 XT and WARP results. It fails alone, too, without the i32 test in the process. - **Only NVIDIA drops the mask.** Clamping with `dx.op` IMax/IMin (37/38) instead of compare/select, or clamping on `r + 0x8000` in [0, 0xFFFF] and flipping the sign bit back, give the same `0xFFFFFFE9`. NVIDIA's compiler appears to fold any of these into a saturating 16-bit add, and then drops `write_half`'s `0xFFFF` mask on its sign-extended result. It's a driver bug, but titles run on NVIDIA, so it's worth avoiding. - **This form passes on NVIDIA and WARP:** the selects choose the 16-bit patterns, never a clamped i32. With it, both of your tests pass and the full `victory-shader` suite is 246 passed with only #1744's 3, the same as `main`: ```diff @@ -6514,10 +6514,16 @@ impl<'a> Lower<'a> { let r = self.s.m.bin(c, op, a, b); if v.clamp { + // The selects pick the 16-bit patterns, never a clamped i32: NVIDIA + // (616.56) turns a clamped i32 into a saturating 16-bit add whose + // sign-extended result then skips write_half's 0xFFFF mask. let lo = self.s.m.i32(i32::from(i16::MIN) as u32); let hi = self.s.m.i32(i16::MAX as u32); + let mask = self.s.m.i32(0xFFFF); + let low = self.s.m.bin(c, Bin::And, r, mask); let below = self.s.m.cmp(c, pred::SLT, r, lo); - let r = self.s.m.select(c, below, lo, r); + let min = self.s.m.i32(0x8000); + let x = self.s.m.select(c, below, min, low); let above = self.s.m.cmp(c, pred::SGT, r, hi); - self.s.m.select(c, above, hi, r) + self.s.m.select(c, above, hi, x) } else { r ``` Overlap, from reading: #92 (open, conflicting) lowers `v_add_nc_i32` / `v_sub_nc_i32` and the signed 16-bit add and sub too. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 08:53 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head ab4db4db onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 08:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#issuecomment-7157600840) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head ab4db4db onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 09:21 UTC · original

Same failure on Ada, and the suggested fix passes there too

On an RTX 4070 SUPER (Ada, driver 32.0.16.1088, default adapter, VICTORY_WARP unset), with head ab4db4d merged onto main 940d32f, cargo test --locked -p victory-shader --lib gives 245 passed and 4 failed. Three failures are the NVIDIA ones from #1835 that main has too. The fourth is this PR's test, with the same values as on the RTX 3070 above:

hardware: VOP3 0x30d, clamp true, op_sel 0b0000, case 1
  left: 4294967273 (0xFFFFFFE9)   right: 2779119593 (0xA5A5FFE9)

So it is not limited to Ampere or to driver 616.56.

Then I applied @⁠upipibi's change from the comment above (mask the low 16 bits first; the selects pick 0x8000, i16::MAX or the masked value). With it, both valu_tests::v_add_sub_nc_i32_wrap_and_saturate and valu_tests::v_add_sub_nc_i16_wrap_and_saturate_with_op_sel pass on this card.

Offline, on the retail dump, this PR does not change the counts (posted above).

AI-assisted (Claude Code). Synthetic tests only.

**@⁠sinan-cmyk** on GitHub · 2026-11-25 09:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#issuecomment-7158227753) ### Same failure on Ada, and the suggested fix passes there too On an RTX 4070 SUPER (Ada, driver 32.0.16.1088, default adapter, `VICTORY_WARP` unset), with head ab4db4d merged onto `main` 940d32f, `cargo test --locked -p victory-shader --lib` gives 245 passed and 4 failed. Three failures are the NVIDIA ones from #1835 that `main` has too. The fourth is this PR's test, with the same values as on the RTX 3070 above: ``` hardware: VOP3 0x30d, clamp true, op_sel 0b0000, case 1 left: 4294967273 (0xFFFFFFE9) right: 2779119593 (0xA5A5FFE9) ``` So it is not limited to Ampere or to driver 616.56. Then I applied @⁠upipibi's change from the comment above (mask the low 16 bits first; the selects pick `0x8000`, `i16::MAX` or the masked value). With it, both `valu_tests::v_add_sub_nc_i32_wrap_and_saturate` and `valu_tests::v_add_sub_nc_i16_wrap_and_saturate_with_op_sel` pass on this card. Offline, on the retail dump, this PR does not change the counts (posted above). AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 10:35 UTC · original · edited 2026-11-25 14:48 UTC

Automated triage for the maintainers.

Merge candidate. This lowers v_add_nc_i32/v_sub_nc_i32 (VOP3 0x37f/0x376) and v_add_nc_i16/v_sub_nc_i16 (0x30d/0x30e) in emit/lower.rs, with clamp as signed saturation, in 32-bit DXIL (the tests assert Int64 stays off). The i32 overflow test is (a^r)&(b^r) for add and (a^r)&(a^b) for sub, saturating toward the sign of a. The i16 operands are sign-extended by the existing _i16 path, and the clamped form now uses the mask-before-select shape, so the selects pick 0x8000, 0x7fff or the masked low half. At 4859090 the NVIDIA failure is gone: the RTX 3070 re-run posted here passes both new tests, and the rest of the suite matches main. CI check: passing.

Overlap: #92 covers the same opcodes but conflicts with main. This one merges cleanly.

Reply to @⁠geiyiliyabumo: thanks, the workaround is in as asked. The credit to upipibi (and to andrewpozdnakov7-jpg's d3df9ee, which carried it first) is worth keeping in the commit message.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 10:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#issuecomment-7159904350) · edited 2026-11-25 14:48 UTC <!-- victory-triage v1 head=48590903d4ce14cb3c1d2e9de12b86339ce8dd48 verdict=merge-candidate at=2026-11-25T14:50:30Z --> Automated triage for the maintainers. **Merge candidate.** This lowers `v_add_nc_i32`/`v_sub_nc_i32` (VOP3 0x37f/0x376) and `v_add_nc_i16`/`v_sub_nc_i16` (0x30d/0x30e) in `emit/lower.rs`, with clamp as signed saturation, in 32-bit DXIL (the tests assert `Int64` stays off). The i32 overflow test is `(a^r)&(b^r)` for add and `(a^r)&(a^b)` for sub, saturating toward the sign of `a`. The i16 operands are sign-extended by the existing `_i16` path, and the clamped form now uses the mask-before-select shape, so the selects pick `0x8000`, `0x7fff` or the masked low half. At `4859090` the NVIDIA failure is gone: the RTX 3070 re-run posted here passes both new tests, and the rest of the suite matches `main`. CI check: passing. Overlap: #92 covers the same opcodes but conflicts with `main`. This one merges cleanly. Reply to @⁠geiyiliyabumo: thanks, the workaround is in as asked. The credit to upipibi (and to andrewpozdnakov7-jpg's `d3df9ee`, which carried it first) is worth keeping in the commit message. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 11:51 UTC · original

I put @⁠upipibi's mask-before-select workaround in d3df9ee, directly on top of ab4db4d. The commit credits @⁠upipibi for the workaround and expands the readback test to all eight source and destination half selections.

Both expanded tests passed on software WARP on ab4db4d and on d3df9ee (192 signed 16-bit cases and 28 signed 32-bit cases). With the workaround, all 30 VALU tests passed with DXIL validation, and strict shader Clippy and the asset policy passed. The RTX 3070 and 4070 SUPER results in this thread are the hardware evidence for the masking change.

The commit is ready to cherry-pick. Please keep the Git authorship and co-author trailer if you take it. Claim. AI-assisted with Codex. Synthetic shaders only.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 11:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#issuecomment-7161589292) I put @⁠upipibi's [mask-before-select workaround](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2094) in [d3df9ee](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/d3df9ee0cb5d2c428dba77188c38406072c3e61e), directly on top of `ab4db4d`. The commit credits @⁠upipibi for the workaround and expands the readback test to all eight source and destination half selections. Both expanded tests passed on software WARP on `ab4db4d` and on `d3df9ee` (192 signed 16-bit cases and 28 signed 32-bit cases). With the workaround, all 30 VALU tests passed with DXIL validation, and strict shader Clippy and the asset policy passed. The RTX 3070 and 4070 SUPER results in this thread are the hardware evidence for the masking change. The commit is ready to cherry-pick. Please keep the Git authorship and co-author trailer if you take it. [Claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633). AI-assisted with Codex. Synthetic shaders only.
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-25 13:20 UTC · original

Applied @⁠upipibi's mask-before-select workaround for clamped \ _add_nc_i16\ / \ _sub_nc_i16\ (head $sha) so the selects pick 16-bit masked patterns (\

**@⁠geiyiliyabumo** on GitHub · 2026-11-25 13:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#issuecomment-7163637464) Applied @⁠upipibi's mask-before-select workaround for clamped \ _add_nc_i16\ / \ _sub_nc_i16\ (head \$sha\) so the selects pick 16-bit masked patterns (\
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 13:54 UTC · original

@⁠geiyiliyabumo Re-run at 4859090 (as-is, on main 940d32f), RTX 3070 (616.56) plus WARP, Windows 11, debug, cargo test -p victory-shader --locked: the failure I reported is gone.

  • v_add_sub_nc_i16_wrap_and_saturate_with_op_sel and v_add_sub_nc_i32_wrap_and_saturate both pass.
  • The suite gives 246 passed, 3 failed, 3 ignored. The 3 are #1744's NVIDIA failures that main has too (a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, a_heap_buffer_read_by_element_takes_the_views_stride, gathers_at_a_level_match_the_hardware).

One run only. Thanks also to andrewpozdnakov7-jpg, whose d3df9ee carried the workaround first.

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-25 13:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#issuecomment-7164466819) @⁠geiyiliyabumo Re-run at `4859090` (as-is, on `main` `940d32f`), RTX 3070 (616.56) plus WARP, Windows 11, debug, `cargo test -p victory-shader --locked`: the failure I reported is gone. - `v_add_sub_nc_i16_wrap_and_saturate_with_op_sel` and `v_add_sub_nc_i32_wrap_and_saturate` both pass. - The suite gives 246 passed, 3 failed, 3 ignored. The 3 are #1744's NVIDIA failures that `main` has too (`a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `a_heap_buffer_read_by_element_takes_the_views_stride`, `gathers_at_a_level_match_the_hardware`). One run only. Thanks also to andrewpozdnakov7-jpg, whose `d3df9ee` carried the workaround first. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 04:49 UTC · original · approved these changes

Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with dxil.dll validator):

  • cargo test -p victory-shader --lib v_add_sub_nc_ — 2 passed, 0 failed on both RTX 5090 hardware and VICTORY_D3D12_WARP=1 (v_add_sub_nc_i32_wrap_and_saturate and v_add_sub_nc_i16_wrap_and_saturate_with_op_sel, both verified INT64-free)
  • cargo clippy -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean pure-32-bit DXIL lowering of v_add_nc_i32, v_sub_nc_i32, v_add_nc_i16, and v_sub_nc_i16 with saturation and op_sel, verified end-to-end on hardware and WARP. Looks good.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 04:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#pullrequestreview-6052017335) · **approved these changes** Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with `dxil.dll` validator): - `cargo test -p victory-shader --lib v_add_sub_nc_` — **2 passed, 0 failed** on both RTX 5090 hardware and `VICTORY_D3D12_WARP=1` (`v_add_sub_nc_i32_wrap_and_saturate` and `v_add_sub_nc_i16_wrap_and_saturate_with_op_sel`, both verified `INT64`-free) - `cargo clippy -p victory-shader --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean pure-32-bit DXIL lowering of `v_add_nc_i32`, `v_sub_nc_i32`, `v_add_nc_i16`, and `v_sub_nc_i16` with saturation and `op_sel`, verified end-to-end on hardware and WARP. Looks good. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 05:16 UTC · original · approved these changes

Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked.

144 passed / 0 failed / 2 ignored. v_add_nc_i32/v_sub_nc_i32/v_add_nc_i16 lowered — no-carry add/sub variants; check the NC (no-carry-out) semantics match the ISA.

**@⁠catminou4** on GitHub · 2026-11-25 05:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#pullrequestreview-6052205273) · **approved these changes** Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked`. 144 passed / 0 failed / 2 ignored. v_add_nc_i32/v_sub_nc_i32/v_add_nc_i16 lowered — no-carry add/sub variants; check the NC (no-carry-out) semantics match the ISA.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 17:23 UTC · original · approved these changes

Verified head 48590903d4ce14cb3c1d2e9de12b86339ce8dd48 merged onto main (63bcca43) on Windows 11 (RTX 5090 Blackwell + WARP, Rust 1.98.1 MSVC, SDK dxil.dll).

  • Clean merge onto main; crates/victory-shader/src/emit/lower.rs is 523,385 bytes (under the 512 KiB limit; also co-merges cleanly with #465 at 523,479 bytes, passing cargo xtask policy).
  • cargo xtask policy (191 files ok), cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features), and both new v_add_sub_nc_i* tests pass on RTX 5090 and WARP with dxil.dll validation and SFI0 INT64 clear.
  • Checked the pure 32-bit overflow formulas ((a ^ r) & (b ^ r) for add, (a ^ r) & (b ^ a) for sub, saturating toward a's sign) and mask-before-select 16-bit clamping (emit/lower.rs:6522) with an expanded probe on RTX 5090 and WARP:
    • 484/484 i32 corner pairs (0, ±1, ±2, i32::MIN/MAX, MIN+1, MAX-1, ±0x4000_0000 x add/sub x clamp 0/1), all INT64-free.
    • 448/448 i16 cases covering all 8 (opsel[0], opsel[1], opsel[3]) combinations x clamp 0/1 x 14 boundary pairs (including 0 - i16::MIN, i16::MIN + i16::MIN, i16::MAX - i16::MIN, and negative non-overflowing sums), confirming the mask-before-select workaround preserves the untouched destination half on Blackwell as well.
    • 20/20 modifier rejection checks (omod, abs, neg) across all four opcodes.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 17:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2094#pullrequestreview-6078300344) · **approved these changes** Verified head `48590903d4ce14cb3c1d2e9de12b86339ce8dd48` merged onto `main` (`63bcca43`) on Windows 11 (RTX 5090 Blackwell + WARP, Rust 1.98.1 MSVC, SDK `dxil.dll`). - Clean merge onto `main`; `crates/victory-shader/src/emit/lower.rs` is `523,385` bytes (under the 512 KiB limit; also co-merges cleanly with `#465` at `523,479` bytes, passing `cargo xtask policy`). - `cargo xtask policy` (`191 files ok`), `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`), and both new `v_add_sub_nc_i*` tests pass on RTX 5090 and WARP with `dxil.dll` validation and `SFI0` `INT64` clear. - Checked the pure 32-bit overflow formulas (`(a ^ r) & (b ^ r)` for add, `(a ^ r) & (b ^ a)` for sub, saturating toward `a`'s sign) and mask-before-select 16-bit clamping (`emit/lower.rs:6522`) with an expanded probe on RTX 5090 and WARP: - 484/484 `i32` corner pairs (`0, ±1, ±2, i32::MIN/MAX, MIN+1, MAX-1, ±0x4000_0000` x add/sub x `clamp` 0/1), all `INT64`-free. - 448/448 `i16` cases covering all 8 `(opsel[0], opsel[1], opsel[3])` combinations x `clamp` 0/1 x 14 boundary pairs (including `0 - i16::MIN`, `i16::MIN + i16::MIN`, `i16::MAX - i16::MIN`, and negative non-overflowing sums), confirming the mask-before-select workaround preserves the untouched destination half on Blackwell as well. - 20/20 modifier rejection checks (`omod`, `abs`, `neg`) across all four opcodes.
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/2094/head:github-bot/gh-2094'
git switch 'github-bot/gh-2094'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2094'
git switch 'github-bot/gh-2094'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2094'
git switch 'github-bot/gh-2094'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2094'
git switch 'main'
git merge --squash 'github-bot/gh-2094'
git switch 'main'
git merge --ff-only 'github-bot/gh-2094'
git switch 'main'
git merge 'github-bot/gh-2094'
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!2094
No description provided.