Shaders: hardware test for v_cvt_f16_u16 and v_cvt_f16_i16 #990

Manually merged
github merged 2 commits from gh-pr/990/head into gh-pr/990/base 2026-11-26 04:16:09 +00:00
Owner

@⁠LouisRiverstone on GitHub · 2026-11-24 14:43 UTC · original
LouisRiverstone:shaders/cvt-f16-int-test → main · +34 −0 · 1 files · 2 commits · merged 2026-11-25 00:17 UTC

Fixes #866.

v_cvt_f16_u16 (0x050) and v_cvt_f16_i16 (0x051) had no hardware test, while their siblings 0x052/0x053 do. The signed one sign-extends with Shl 16 + AShr 16, which nothing exercised.

New test v_cvt_f16_u16_and_i16_widen_the_integer_first, in the same shape as v_cvt_u16_and_i16_f16_saturate: it runs 7 inputs through both opcodes, covering zero, 1.0, 2047, the sign flip at 0x8000, 64512 / -1024, and the signed -2 / -1 that exercise the Shl 16 + AShr 16 sign-extension.

The cases are limited to integers f16 holds exactly. The first version also asserted round-to-nearest (32767 -> 32768) and failed in CI: on main the f32 -> f16 narrowing truncates (0x77ff), which #422 changes. Rounding cases belong with that fix, so the unsigned 65534/65535 overflow cases are skipped here too.

Test only, no production change. Expected values were checked against IEEE half conversion. The table in #866 lists 0x0001 as 0x0400; that is 2^-14, and 1 is 0x3C00, which is what the test asserts.

Verify: cargo test -p victory-shader v_cvt_f16_u16_and_i16 (Windows, needs a GPU or WARP).

I could not run it locally: the shader test module is Windows-only.

🤖 Generated with Claude Code

**@⁠LouisRiverstone** on GitHub · 2026-11-24 14:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/990) `LouisRiverstone:shaders/cvt-f16-int-test` → `main` · +34 −0 · 1 files · 2 commits · merged 2026-11-25 00:17 UTC Fixes #866. `v_cvt_f16_u16` (0x050) and `v_cvt_f16_i16` (0x051) had no hardware test, while their siblings 0x052/0x053 do. The signed one sign-extends with `Shl 16` + `AShr 16`, which nothing exercised. New test `v_cvt_f16_u16_and_i16_widen_the_integer_first`, in the same shape as `v_cvt_u16_and_i16_f16_saturate`: it runs 7 inputs through both opcodes, covering zero, 1.0, 2047, the sign flip at 0x8000, 64512 / -1024, and the signed -2 / -1 that exercise the `Shl 16` + `AShr 16` sign-extension. The cases are limited to integers f16 holds exactly. The first version also asserted round-to-nearest (32767 -> 32768) and failed in CI: on `main` the f32 -> f16 narrowing truncates (`0x77ff`), which #422 changes. Rounding cases belong with that fix, so the unsigned 65534/65535 overflow cases are skipped here too. Test only, no production change. Expected values were checked against IEEE half conversion. The table in #866 lists `0x0001` as `0x0400`; that is 2^-14, and 1 is `0x3C00`, which is what the test asserts. **Verify:** `cargo test -p victory-shader v_cvt_f16_u16_and_i16` (Windows, needs a GPU or WARP). I 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:16:06 +00:00
github manually merged commit 8d67fa5b00 into gh-pr/990/base 2026-11-26 04:16:09 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 14:54 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 8d67fa5: cargo test -p victory-shader passes, 121 passed / 0 failed, including v_cvt_f16_u16_and_i16_widen_the_integer_first (the hardware test from this PR) on real RDNA3 hardware. Workspace baseline on main (ffe310e) was green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 14:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/990#issuecomment-7135152555) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 8d67fa5: `cargo test -p victory-shader` passes, 121 passed / 0 failed, including `v_cvt_f16_u16_and_i16_widen_the_integer_first` (the hardware test from this PR) on real RDNA3 hardware. Workspace baseline on main (ffe310e) was green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠DeerSilver on GitHub · 2026-11-24 18:39 UTC · original

Tested head 8d67fa5 merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1: pass. No game files: the test suite only.

  • The new test passes on both the RTX 5060 (hardware) and WARP, with no no SM 6.6 skip:
    • v_cvt_f16_u16_and_i16_widen_the_integer_first
  • With the D3D12 debug layer on (Graphics Tools; --all-features so victory-gpu enables it, plus a local, uncommitted EnableDebugLayer in emit::host::Host::new for the shader tests), the run logs no debug-layer message that main doesn't log too.
  • cargo test --workspace --all-features --locked: 347 passed, 0 failed, 6 ignored (main with all features: 346 / 6).
  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean.

AI-assisted (Claude Code).

**@⁠DeerSilver** on GitHub · 2026-11-24 18:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/990#issuecomment-7140952477) Tested head `8d67fa5` merged onto `main` `ffe310e` (clean merge) on **NVIDIA GeForce RTX 5060 Laptop GPU** (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1: **pass.** No game files: the test suite only. - The new test passes on both the RTX 5060 (hardware) and WARP, with no `no SM 6.6` skip: - `v_cvt_f16_u16_and_i16_widen_the_integer_first` - **With the D3D12 debug layer on** (Graphics Tools; `--all-features` so `victory-gpu` enables it, plus a local, uncommitted `EnableDebugLayer` in `emit::host::Host::new` for the shader tests), the run logs no debug-layer message that `main` doesn't log too. - `cargo test --workspace --all-features --locked`: **347 passed, 0 failed, 6 ignored** (`main` with all features: 346 / 6). - `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features`: clean. AI-assisted (Claude Code).
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!990
No description provided.