Shader tests: check 125 more instructions on the hardware #2015

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

@⁠astrosteveo on GitHub · 2026-11-25 03:07 UTC · original
astrosteveo:test/semantics-gaps → main · +527 −0 · 1 files · 1 commits · open

The translator lowers 125 instructions that semantics_tests had no probe for (10 of them appear in other test files). This adds five tests that run them on the host GPU against a model of the ISA:

  • more_scalar_alu_matches_the_hardware: logic in both widths with SCC, 64-bit shifts and bit counts, carries and borrows through SCC, SOPK immediates, bit sets and tests, 64-bit compares and selects.
  • more_integers_match_the_hardware: high 24-bit products, v_mad_u64_u32/v_mad_i64_i32, v_sad_*, v_perm_b32, v_swap_b32, the reversed borrows.
  • sixteen_bit_integers_match_the_hardware: add, subtract, multiply, shifts, min and max, with the destination's high half kept.
  • more_floats_match_the_hardware: f16 floor, ceil, trunc and rndne, v_subrev_f16, and the literal f32 multiply-adds over operands whose result is exact.
  • more_compares_match_the_hardware: the i16, u16, i32, u32, i64 and u64 compares, and the f16 ones.

All of them pass, so nothing in the translator changes. To see that they can fail, I broke the lowering seven ways (signedness of v_mad_i64_i32, v_mul_hi_i32_i24 and the compares, s_bitset, v_sad_u16, s_flbit_i32, s_addk_i32); each break fails a test.

Left out: v_msad_u8, whose masking rule I could not settle from a public source, and v_mbcnt, which needs the lane's index in the model.

Tested on 940d32f, RTX 5080 (driver 620.73.04), MinGW build under Wine 11.22 with vkd3d-proton 3.1, no game data:

  • cargo test -p victory-shader --lib -- --test-threads=1: 243 passed, 4 failed on main; 248 passed and the same 4 failed here. One of the 4 is fixed by #1994.
  • Clippy for x86_64-pc-windows-msvc, also with --all-features: clean. cargo xtask policy: ok. The file stays rustfmt-clean.

Not tested on Windows, on WARP (there is none under Wine, so "warp" is the same GPU there) or on AMD.

🌴 AI-assisted, made with Claude Code · from astrosteveo/VIctory

**@⁠astrosteveo** on GitHub · 2026-11-25 03:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2015) `astrosteveo:test/semantics-gaps` → `main` · +527 −0 · 1 files · 1 commits · open The translator lowers 125 instructions that `semantics_tests` had no probe for (10 of them appear in other test files). This adds five tests that run them on the host GPU against a model of the ISA: - `more_scalar_alu_matches_the_hardware`: logic in both widths with SCC, 64-bit shifts and bit counts, carries and borrows through SCC, SOPK immediates, bit sets and tests, 64-bit compares and selects. - `more_integers_match_the_hardware`: high 24-bit products, `v_mad_u64_u32`/`v_mad_i64_i32`, `v_sad_*`, `v_perm_b32`, `v_swap_b32`, the reversed borrows. - `sixteen_bit_integers_match_the_hardware`: add, subtract, multiply, shifts, min and max, with the destination's high half kept. - `more_floats_match_the_hardware`: f16 floor, ceil, trunc and rndne, `v_subrev_f16`, and the literal f32 multiply-adds over operands whose result is exact. - `more_compares_match_the_hardware`: the i16, u16, i32, u32, i64 and u64 compares, and the f16 ones. All of them pass, so nothing in the translator changes. To see that they can fail, I broke the lowering seven ways (signedness of `v_mad_i64_i32`, `v_mul_hi_i32_i24` and the compares, `s_bitset`, `v_sad_u16`, `s_flbit_i32`, `s_addk_i32`); each break fails a test. Left out: `v_msad_u8`, whose masking rule I could not settle from a public source, and `v_mbcnt`, which needs the lane's index in the model. **Tested** on `940d32f`, RTX 5080 (driver 620.73.04), MinGW build under Wine 11.22 with vkd3d-proton 3.1, no game data: - `cargo test -p victory-shader --lib -- --test-threads=1`: 243 passed, 4 failed on `main`; 248 passed and the same 4 failed here. One of the 4 is fixed by #1994. - Clippy for `x86_64-pc-windows-msvc`, also with `--all-features`: clean. `cargo xtask policy`: ok. The file stays rustfmt-clean. Not tested on Windows, on WARP (there is none under Wine, so "warp" is the same GPU there) or on AMD. 🌴 AI-assisted, made with [Claude Code](https://claude.com/claude-code) · from [astrosteveo/VIctory](https://github.com/astrosteveo/VIctory)
Scalar logic in both widths, 64-bit shifts, carries through SCC, SOPK
immediates, bit sets and tests, 16-bit integers, differences, permutes,
64-bit multiply-adds, f16 rounding, the literal multiply-adds, and the
integer, 64-bit and f16 compares: the translator lowers them, and the
semantics tests had no probe for them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:51:40 +00:00
Author
Owner

@⁠chemist6913 on GitHub · 2026-11-25 03:32 UTC · original

Native Windows result, RTX 5090 + WARP

Ran this branch (6c88e38, on 940d32f) natively on Windows 11 (10.0.26300), RTX 5090 (Blackwell, driver 32.0.16.1692), Rust 1.98.1 MSVC:

cargo test -p victory-shader --lib --locked -- --test-threads=1 semantics_tests → 37 passed, 0 failed, 1 ignored.

All five new tests pass on the hardware adapter and on WARP: 0 model mismatches on either, 0 hardware/WARP differences. Validator: Windows SDK dxil.dll 1.6.2112.

No game data; the title was not run. AI-assisted (Claude Code), run on my own machine.

**@⁠chemist6913** on GitHub · 2026-11-25 03:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2015#issuecomment-7152004947) **Native Windows result, RTX 5090 + WARP** Ran this branch (`6c88e38`, on `940d32f`) natively on Windows 11 (10.0.26300), RTX 5090 (Blackwell, driver 32.0.16.1692), Rust 1.98.1 MSVC: `cargo test -p victory-shader --lib --locked -- --test-threads=1 semantics_tests` → 37 passed, 0 failed, 1 ignored. All five new tests pass on the hardware adapter and on WARP: 0 model mismatches on either, 0 hardware/WARP differences. Validator: Windows SDK `dxil.dll` 1.6.2112. No game data; the title was not run. AI-assisted (Claude Code), run on my own machine.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 09:17 UTC · original · edited 2026-11-25 22:21 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: main has moved since the last triage, and the branch now conflicts in crates/victory-shader/src/emit/semantics_tests.rs. It will be reviewed again once it is rebased onto current main.

Previous verdict for this head: merge candidate.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 09:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2015#issuecomment-7158142967) · edited 2026-11-25 22:21 UTC <!-- victory-triage v1 head=6c88e3856fa30cc51e9066f85f5ec650e75dfcff verdict=needs-rebase at=2026-11-25T22:25:00Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main`: `main` has moved since the last triage, and the branch now conflicts in `crates/victory-shader/src/emit/semantics_tests.rs`. It will be reviewed again once it is rebased onto current `main`. Previous verdict for this head: merge candidate. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

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

Offline measurement on a retail dump

Result: no count change against main.

I merged head 6c88e385 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 09:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2015#issuecomment-7158980130) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 6c88e385 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 10:40 UTC · original

more_floats_match_the_hardware fails on Ada with driver 32.0.16.1088

On an RTX 4070 SUPER (Ada, driver 32.0.16.1088, default adapter, VICTORY_WARP unset), with head 6c88e38 merged onto main 940d32f, cargo test --locked -p victory-shader --lib gives 248 passed and 4 failed. Three failures are the NVIDIA ones from #1835 that main has too. The fourth is new in this PR: emit::semantics_tests::more_floats_match_the_hardware.

Only the two probes with the denormal literal 0x00000001 differ. WARP matches the model on all of them:

Probe Hardware mismatches WARP mismatches
v_fmamk_f32 v5, v1, lit(0x00000001), v2 56 of 144 0
v_fmaak_f32 v5, v1, v2, lit(0x00000001) 28 of 144 0

The other literals (0x40400000, 0xbf800000) and the other new probes match on the hardware too.

Every mismatch fits one pattern. The driver seems to flush the literal to 0 and then fold the + 0 away:

  • fmamk (v1 * K + v2): the result is v2 unchanged. For example, v1 = 0, v2 = -0 gives 0x80000000 where the model wants +0. v2 = 0x00000001 comes back as 0x00000001 where the model wants it flushed to 0.
  • fmaak (v1 * v2 + K): the result is the product, with no + 0 applied. For example, 0 * -1 gives -0 (0x80000000) where the model wants +0.

@⁠chemist6913's RTX 5090 with driver 32.0.16.1692 passes all five probes, so this may be fixed in newer drivers. I can't tell from these two runs whether the driver version or the GPU architecture makes the difference. Still, a merged test that fails on a current Ada driver will show up as red in NVIDIA test reports.

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

**@⁠sinan-cmyk** on GitHub · 2026-11-25 10:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2015#issuecomment-7160015353) ### `more_floats_match_the_hardware` fails on Ada with driver 32.0.16.1088 On an RTX 4070 SUPER (Ada, driver **32.0.16.1088**, default adapter, `VICTORY_WARP` unset), with head 6c88e38 merged onto `main` 940d32f, `cargo test --locked -p victory-shader --lib` gives 248 passed and 4 failed. Three failures are the NVIDIA ones from #1835 that `main` has too. The fourth is new in this PR: `emit::semantics_tests::more_floats_match_the_hardware`. Only the two probes with the denormal literal `0x00000001` differ. WARP matches the model on all of them: | Probe | Hardware mismatches | WARP mismatches | |---|---|---| | `v_fmamk_f32 v5, v1, lit(0x00000001), v2` | 56 of 144 | 0 | | `v_fmaak_f32 v5, v1, v2, lit(0x00000001)` | 28 of 144 | 0 | The other literals (`0x40400000`, `0xbf800000`) and the other new probes match on the hardware too. Every mismatch fits one pattern. The driver seems to flush the literal to 0 and then fold the `+ 0` away: - **`fmamk`** (`v1 * K + v2`): the result is `v2` unchanged. For example, `v1 = 0, v2 = -0` gives `0x80000000` where the model wants `+0`. `v2 = 0x00000001` comes back as `0x00000001` where the model wants it flushed to `0`. - **`fmaak`** (`v1 * v2 + K`): the result is the product, with no `+ 0` applied. For example, `0 * -1` gives `-0` (`0x80000000`) where the model wants `+0`. @⁠chemist6913's RTX 5090 with driver 32.0.16.1692 passes all five probes, so this may be fixed in newer drivers. I can't tell from these two runs whether the driver version or the GPU architecture makes the difference. Still, a merged test that fails on a current Ada driver will show up as red in NVIDIA test reports. AI-assisted (Claude Code). Synthetic tests only.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/semantics_tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2015/head:github-bot/gh-2015'
git switch 'github-bot/gh-2015'

Merge

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