shader: test that s_sext_i32_i8 and s_sext_i32_i16 keep SCC #148

Manually merged
github merged 3 commits from github-bot/gh-148 into main 2026-11-27 01:32:03 +00:00 AGit
Owner

@⁠lautarocherro on GitHub · 2026-11-26 21:02 UTC · original
lautarocherro:fix/shader-sext → main · +32 −1 · 2 files · 3 commits · merged 2026-11-27 00:57 UTC

What this changes

main already lowers s_sext_i32_i8 and s_sext_i32_i16 (974ffc8). This branch now merges main and drops its own lowering, its translation test and its docs section. Part of #4.

What is left is one check main does not have: neither instruction sets SCC (RDNA2 ISA, SOP1), so a compare before them still decides a select after them. writes_scc already leaves them out. The test pins that down.

How it was tested

  • cargo test -p victory-shader: passes (274 tests).
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings: passes, also with --all-features.
  • cargo xtask policy: passes.
  • Ran the game, or not needed: not needed. Test-only change.

New test:

  • valu_tests::scalar_sign_extensions_keep_scc (Windows only): runs both forms on the GPU and WARP and checks SCC after them. Non-zero results with SCC 0, and a zero result with SCC 1 in both forms, catch an extension that sets SCC. It checks only SCC: victory-gpu's addr_tests::scalar_sign_extensions_on_the_gpu already checks the values on Metal. I could not run it here (Mac). It compiles under the Windows clippy gate, and CI runs it.

The docs change is one sentence in main's note on the mesh programs.

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none: the RDNA2 ISA documents both)
  • New diagnostics are behind a VICTORY_* variable and documented (none)
**@⁠lautarocherro** on GitHub · 2026-11-26 21:02 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/148) `lautarocherro:fix/shader-sext` → `main` · +32 −1 · 2 files · 3 commits · merged 2026-11-27 00:57 UTC ## What this changes main already lowers `s_sext_i32_i8` and `s_sext_i32_i16` (974ffc8). This branch now merges main and drops its own lowering, its translation test and its docs section. Part of #4. What is left is one check main does not have: neither instruction sets SCC (RDNA2 ISA, SOP1), so a compare before them still decides a select after them. `writes_scc` already leaves them out. The test pins that down. ## How it was tested - [x] `cargo test -p victory-shader`: passes (274 tests). - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings`: passes, also with `--all-features`. - [x] `cargo xtask policy`: passes. - [x] Ran the game, or not needed: not needed. Test-only change. New test: - `valu_tests::scalar_sign_extensions_keep_scc` (Windows only): runs both forms on the GPU and WARP and checks SCC after them. Non-zero results with SCC 0, and a zero result with SCC 1 in both forms, catch an extension that sets SCC. It checks only SCC: `victory-gpu`'s `addr_tests::scalar_sign_extensions_on_the_gpu` already checks the values on Metal. I could not run it here (Mac). It compiles under the Windows clippy gate, and CI runs it. The docs change is one sentence in main's note on the mesh programs. ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none: the RDNA2 ISA documents both) - [x] New diagnostics are behind a `VICTORY_*` variable and documented (none)
Both were decoded but refused ("s_sext_i32_i16 is not supported", one
compute program in the story-load log of #140). They are now the RDNA2
ISA's SOP1 operations: the low 8 or 16 bits of S0, sign-extended to 32
bits. Neither sets SCC, so a compare before them still decides a select
after them.

gfx_refusal_tests checks that both translate. valu_tests runs them on
the GPU and WARP on Windows, values and SCC both.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:12:27 +00:00
github-bot changed title from shader: lower s_sext_i32_i8 and s_sext_i32_i16 to shader: test that s_sext_i32_i8 and s_sext_i32_i16 keep SCC 2026-11-27 00:55:10 +00:00
main already lowers s_sext_i32_i8 and s_sext_i32_i16 (974ffc8). This
branch's lowering arm would be a second, unreachable match arm, which
fails the clippy gate. The merge takes main's lower.rs,
gfx_refusal_tests.rs and docs, so the arm, the translation test and the
docs section of this branch are gone.
main's Metal test (addr_tests::scalar_sign_extensions_on_the_gpu)
already checks the values of s_sext_i32_i8 and s_sext_i32_i16, so the
Windows test now checks only that both keep SCC. A new last case
extends to 0 in both forms with SCC 1. The docs sentence moves into
main's note on the mesh programs.
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 22:36 UTC · original · requested changes

Thanks! main already lowers s_sext_i32_i8 and s_sext_i32_i16 (974ffc84, the arm near lower.rs:5304), so after merging main this branch adds a second identical match arm. That is an unreachable pattern and fails the Windows clippy gate (-D warnings); I hit it testing the open PRs together. Could you merge main, drop the lower.rs hunk, and keep only what main doesn't already cover? The SCC-preservation check in valu_tests may still be worth having. The docs section can then be folded into whatever main says about it.

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 22:36 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/148#pullrequestreview-6081172028) · **requested changes** Thanks! main already lowers `s_sext_i32_i8` and `s_sext_i32_i16` (974ffc84, the arm near lower.rs:5304), so after merging main this branch adds a second identical match arm. That is an unreachable pattern and fails the Windows clippy gate (`-D warnings`); I hit it testing the open PRs together. Could you merge main, drop the lower.rs hunk, and keep only what main doesn't already cover? The SCC-preservation check in `valu_tests` may still be worth having. The docs section can then be folded into whatever main says about it.
github manually merged commit 9658f81cc2 into main 2026-11-27 01:32:03 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-27 00:57 UTC · original · approved these changes

Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!

**@⁠LakshanSivakumar** on GitHub · 2026-11-27 00:57 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/148#pullrequestreview-6082113570) · **approved these changes** Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.