Shaders: hardware test for the 16-bit integer ops #1877

Open
github-bot wants to merge 2 commits from github-bot/gh-1877 into main AGit
Owner

@⁠LouisRiverstone on GitHub · 2026-11-24 23:58 UTC · original
LouisRiverstone:shaders/v-int16-test → main · +46 −0 · 1 files · 2 commits · open

v_add_nc_u16, v_sub_nc_u16, v_mul_lo_u16, v_lshrrev_b16, v_ashrrev_i16, v_lshlrev_b16, v_max_u16, v_max_i16, v_min_u16 and v_min_i16 (VOP3 0x303..0x30c, 0x314) are lowered in lower.rs through one arm that works on the low halves, sign-extending for the i16 forms and masking the shift amount to four bits. No hardware test ran them.

New test v_16_bit_integer_ops_match_rdna2 runs all 64 ordered pairs of eight 16-bit values (the sign boundary, shift amounts 16 and 17, all-ones) through each op, with garbage in the high halves of the sources. The result's low half is compared with u16 operations in Rust.

Test only, no production change.

Verify: cargo test -p victory-shader v_16_bit_integer (Windows, hardware GPU or WARP). I type-checked it with clippy for x86_64-pc-windows-msvc, but could not run it locally: the shader test module is Windows-only.

🤖 Generated with Claude Code

**@⁠LouisRiverstone** on GitHub · 2026-11-24 23:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/1877) `LouisRiverstone:shaders/v-int16-test` → `main` · +46 −0 · 1 files · 2 commits · open `v_add_nc_u16`, `v_sub_nc_u16`, `v_mul_lo_u16`, `v_lshrrev_b16`, `v_ashrrev_i16`, `v_lshlrev_b16`, `v_max_u16`, `v_max_i16`, `v_min_u16` and `v_min_i16` (VOP3 0x303..0x30c, 0x314) are lowered in `lower.rs` through one arm that works on the low halves, sign-extending for the `i16` forms and masking the shift amount to four bits. No hardware test ran them. New test `v_16_bit_integer_ops_match_rdna2` runs all 64 ordered pairs of eight 16-bit values (the sign boundary, shift amounts 16 and 17, all-ones) through each op, with garbage in the high halves of the sources. The result's low half is compared with `u16` operations in Rust. Test only, no production change. **Verify:** `cargo test -p victory-shader v_16_bit_integer` (Windows, hardware GPU or WARP). I type-checked it with clippy for `x86_64-pc-windows-msvc`, but could not run it locally: the shader test module is Windows-only. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:26 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 08:18 UTC · original · edited 2026-11-26 02:18 UTC

Automated triage for the maintainers.

Merge candidate (recommending a look, not an approval). Reviewed at 9520cf3, which merges cleanly into main. Test only: v_16_bit_integer_ops_match_rdna2 in crates/victory-shader/src/emit/valu_tests.rs.

The ten opcodes match gfx10/opcodes.rs, and the expected values follow the RDNA2 definitions: low halves only, i16 forms signed, and the shifts take a 4-bit amount from the first operand with the value in the second. That is what the _ => 16-bit arm of emit/lower.rs implements. The high halves of the sources are filled with garbage, and only the low half of the result is compared. CI: check passing.

Nit, not blocking: vop3(...) is built twice per op to take [0] and [1]. Binding it once would read better.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 08:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/1877#issuecomment-7156872433) · edited 2026-11-26 02:18 UTC <!-- victory-triage v1 head=9520cf3a4e3043d3199b31248fbe7d5aa084c17d verdict=merge-candidate at=2026-11-26T02:18:00Z --> Automated triage for the maintainers. **Merge candidate** (recommending a look, not an approval). Reviewed at `9520cf3`, which merges cleanly into `main`. Test only: `v_16_bit_integer_ops_match_rdna2` in `crates/victory-shader/src/emit/valu_tests.rs`. The ten opcodes match `gfx10/opcodes.rs`, and the expected values follow the RDNA2 definitions: low halves only, `i16` forms signed, and the shifts take a 4-bit amount from the first operand with the value in the second. That is what the `_ =>` 16-bit arm of `emit/lower.rs` implements. The high halves of the sources are filled with garbage, and only the low half of the result is compared. CI: `check` passing. Nit, not blocking: `vop3(...)` is built twice per op to take `[0]` and `[1]`. Binding it once would read better. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

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

Offline measurement on a retail dump

Result: no count change against main.

I merged head 85af2ca2 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 11:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/1877#issuecomment-7161692026) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 85af2ca2 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

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

Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (940d32f), cargo test → 144 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows.

victory-shader. Hardware test for the 16-bit integer ops: RDNA2-matched (Windows-gated).

**@⁠catminou4** on GitHub · 2026-11-25 02:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/1877#pullrequestreview-6050606005) · **approved these changes** Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (940d32f), cargo test → 144 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows. victory-shader. Hardware test for the 16-bit integer ops: RDNA2-matched (Windows-gated).
Author
Owner

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

Looks good to me — solid test coverage for the 10 lowered VOP3 16-bit integer ops, with the first Windows hardware + WARP run confirming they pass.

Verified locally on Windows 11 with head 9520cf3a cleanly merged onto main (63bcca43):

  • Audited v_16_bit_integer_ops_match_rdna2 (crates/victory-shader/src/emit/valu_tests.rs:1313-1356) against gfx10/opcodes.rs and RDNA2 ISA: all 10 opcodes (0x303..=0x305, 0x307..=0x30C, 0x314), operand ordering (src0 = v1 shift count / left operand, src1 = v2 shifted value / right operand), sign-extension for i16 forms, 4-bit shift masking (& 15), and high-half source garbage (0xABCD_0000 | a, 0x1234_0000 | b) match expected semantics.
  • Formatting check (rustfmt --edition 2024 --config skip_children=true) shows no diffs on the added lines.
  • cargo run -p xtask -- policy (191 files ok) and cargo clippy --locked -p victory-shader --all-targets -- -D warnings (both default and --all-features) pass.
  • cargo test --locked -p victory-shader --lib v_16_bit_integer_ops_match_rdna2 passes on both VICTORY_WARP=0 (RTX 5090, 32.57s) and VICTORY_WARP=1 (WARP, 0.56s): 1 passed; 0 failed (305 filtered out).

Two minor non-blocking notes:

  • v0 is zero-initialized (vop1(0x001, 0, 128)) and the assertion masks got & 0xFFFF, so upper-half preservation in v0[31:16] is left untested here.
  • The comment at valu_tests.rs:1314 writes 0x303..0x30c, which spans 0x306 (not present in gfx10/opcodes.rs or tested).
**@⁠fuzeofficlal** on GitHub · 2026-11-26 19:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1877#pullrequestreview-6079607127) · **approved these changes** Looks good to me — solid test coverage for the 10 lowered VOP3 16-bit integer ops, with the first Windows hardware + WARP run confirming they pass. Verified locally on Windows 11 with head `9520cf3a` cleanly merged onto `main` (`63bcca43`): - Audited `v_16_bit_integer_ops_match_rdna2` (`crates/victory-shader/src/emit/valu_tests.rs:1313-1356`) against `gfx10/opcodes.rs` and RDNA2 ISA: all 10 opcodes (`0x303..=0x305`, `0x307..=0x30C`, `0x314`), operand ordering (`src0 = v1` shift count / left operand, `src1 = v2` shifted value / right operand), sign-extension for `i16` forms, 4-bit shift masking (`& 15`), and high-half source garbage (`0xABCD_0000 | a`, `0x1234_0000 | b`) match expected semantics. - Formatting check (`rustfmt --edition 2024 --config skip_children=true`) shows no diffs on the added lines. - `cargo run -p xtask -- policy` (`191 files ok`) and `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (both default and `--all-features`) pass. - `cargo test --locked -p victory-shader --lib v_16_bit_integer_ops_match_rdna2` passes on both `VICTORY_WARP=0` (RTX 5090, `32.57s`) and `VICTORY_WARP=1` (WARP, `0.56s`): `1 passed; 0 failed` (`305 filtered out`). Two minor non-blocking notes: - `v0` is zero-initialized (`vop1(0x001, 0, 128)`) and the assertion masks `got & 0xFFFF`, so upper-half preservation in `v0[31:16]` is left untested here. - The comment at `valu_tests.rs:1314` writes `0x303..0x30c`, which spans `0x306` (not present in `gfx10/opcodes.rs` or tested).
This pull request can be merged automatically.
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/1877/head:github-bot/gh-1877'
git switch 'github-bot/gh-1877'

Merge

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