shader: lower s_absdiff_i32 #128

Manually merged
github merged 1 commit from github-bot/gh-128 into main 2026-11-26 18:09:27 +00:00 AGit
Owner

@⁠Olima34 on GitHub · 2026-11-26 17:57 UTC · original
Olima34:fix/shader-absdiff → main · +77 −0 · 4 files · 1 commits · merged 2026-11-26 18:09 UTC

s_absdiff_i32 was decoded but refused ("s_absdiff_i32": 1 unique compute shader in the #123 story-load log, commit 182c14f).

What. It is lowered as the RDNA2 ISA's SOP2 operation: D = S0 - S1 as a wrapping 32-bit difference, negated when it is negative as a signed number, and SCC = D != 0. The arm sits next to s_abs_i32.

Tests.

  • gfx_refusal_tests::absdiff_translates: an FSPX compute program translates. It is refused on main.
  • victory-gpu addr_tests::absdiff_is_the_magnitude_of_the_signed_difference_on_the_gpu runs on Metal. It checks D and SCC for (5, 9), (9, 5), (-3, 4), (7, 7), (MIN, 1), (1, MIN) and (MIN, 0). The wrapping cases are the hardware's magnitudes: 1 - MIN gives i32::MAX, and |MIN - 0| gives 0x8000_0000.

The old refusal text appears nowhere else in crates/. victory-shader and victory-gpu tests (arm64, Metal), Windows clippy and cargo xtask policy pass.

**@⁠Olima34** on GitHub · 2026-11-26 17:57 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/128) `Olima34:fix/shader-absdiff` → `main` · +77 −0 · 4 files · 1 commits · merged 2026-11-26 18:09 UTC `s_absdiff_i32` was decoded but refused ("s_absdiff_i32": 1 unique compute shader in the #123 story-load log, commit 182c14f). **What.** It is lowered as the RDNA2 ISA's SOP2 operation: `D = S0 - S1` as a wrapping 32-bit difference, negated when it is negative as a signed number, and `SCC = D != 0`. The arm sits next to `s_abs_i32`. **Tests.** - `gfx_refusal_tests::absdiff_translates`: an FSPX compute program translates. It is refused on main. - `victory-gpu` `addr_tests::absdiff_is_the_magnitude_of_the_signed_difference_on_the_gpu` runs on Metal. It checks D and SCC for (5, 9), (9, 5), (-3, 4), (7, 7), (MIN, 1), (1, MIN) and (MIN, 0). The wrapping cases are the hardware's magnitudes: `1 - MIN` gives `i32::MAX`, and `|MIN - 0|` gives `0x8000_0000`. The old refusal text appears nowhere else in `crates/`. victory-shader and victory-gpu tests (arm64, Metal), Windows clippy and `cargo xtask policy` pass.
s_absdiff_i32 was decoded but refused. It is now the RDNA2 ISA's SOP2 operation: the wrapping 32-bit difference S0 - S1, negated when negative as a signed number, with SCC set when the result is not 0. A Metal test runs it on the GPU, wrapping cases included.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 17:58:51 +00:00
github manually merged commit 0953e5646b into main 2026-11-26 18:09:27 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 18:10 UTC · original

Merged, thanks. s_absdiff_i32 lowers, and the GPU test covers the wrapping cases.

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 18:10 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/128#issuecomment-7200129867) Merged, thanks. `s_absdiff_i32` lowers, and the GPU test covers the wrapping cases.
This discussion has been locked. Commenting is limited to contributors.
No description provided.