Shaders: hardware test for the 16-bit integer ops #1875
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1877"
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 LouisRiverstone on 2026-11-24T23:58:53Z.
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_u16andv_min_i16(VOP3 0x303..0x30c, 0x314) are lowered inlower.rsthrough one arm that works on the low halves, sign-extending for thei16forms and masking the shift amount to four bits. No hardware test ran them.New test
v_16_bit_integer_ops_match_rdna2runs 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 withu16operations 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 forx86_64-pc-windows-msvc, but could not run it locally: the shader test module is Windows-only.🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:09:55Z.
Review: APPROVED
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).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T08:18:53Z.
Automated triage for the maintainers.
Merge candidate (recommending a look, not an approval). Reviewed at
9520cf3, which merges cleanly intomain. Test only:v_16_bit_integer_ops_match_rdna2incrates/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,i16forms 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 ofemit/lower.rsimplements. The high halves of the sources are filled with garbage, and only the low half of the result is compared. CI:checkpassing.Nit, not blocking:
vop3(...)is built twice per op to take[0]and[1]. Binding it once would read better.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T11:55:45Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
85af2ca2ontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 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).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T19:35:50Z.
Review: APPROVED
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
9520cf3acleanly merged ontomain(63bcca43):v_16_bit_integer_ops_match_rdna2(crates/victory-shader/src/emit/valu_tests.rs:1313-1356) againstgfx10/opcodes.rsand RDNA2 ISA: all 10 opcodes (0x303..=0x305,0x307..=0x30C,0x314), operand ordering (src0 = v1shift count / left operand,src1 = v2shifted value / right operand), sign-extension fori16forms, 4-bit shift masking (& 15), and high-half source garbage (0xABCD_0000 | a,0x1234_0000 | b) match expected semantics.rustfmt --edition 2024 --config skip_children=true) shows no diffs on the added lines.cargo run -p xtask -- policy(191 files ok) andcargo 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_rdna2passes on bothVICTORY_WARP=0(RTX 5090,32.57s) andVICTORY_WARP=1(WARP,0.56s):1 passed; 0 failed(305 filtered out).Two minor non-blocking notes:
v0is zero-initialized (vop1(0x001, 0, 128)) and the assertion masksgot & 0xFFFF, so upper-half preservation inv0[31:16]is left untested here.valu_tests.rs:1314writes0x303..0x30c, which spans0x306(not present ingfx10/opcodes.rsor tested).Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T23:48:52Z.
Review: APPROVED
LGTM — verified on RTX 5090 and
VICTORY_WARP=1(Windows / D3D12) againstorigin/main(63bcca4).v_16_bit_integer_ops_match_rdna2passes cleanly on both discrete NVIDIA hardware and WARP.cargo test -p victory-shader --lib v_16_bit_integer_ops_match_rdna2 -- --test-threads=1: passed on RTX 5090 andVICTORY_WARP=1.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T01:00:40Z.
I ran the exact
9520cf3test on Windows with app-local WARP 1.0.22 and DXIL validation. All ten instructions and 64 ordered input pairs passed in three fresh processes.The test-only follow-up exercises all eight selections of source and destination halves. It initializes the destination with two different sentinels and compares the full 32-bit result, so a write to the wrong half or a clobbered neighboring half fails. All 5,120 comparisons passed per run in three WARP processes. The 37 VALU tests, strict clippy in both configurations, and asset policy also passed. AMD lists these operations under VOP3 OPSEL support.
@LouisRiverstone the test is ready to pick up. A native RDNA2 run would provide an independent check of the same words. Please retain the Git author or add
Co-authored-by: andrewpozdnakov7-jpgif folding the change.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.