Shaders: hardware test for v_cvt_f16_u16 and v_cvt_f16_i16 #990

Merged
LouisRiverstone merged 2 commits from upstream-pr/990 into main 2026-11-25 00:17:09 +00:00
LouisRiverstone commented 2026-11-24 14:43:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LouisRiverstone on 2026-11-24T14:43:24Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6584374238 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/990). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-11-24T14:43:24Z. --- 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)
Zipettte commented 2026-11-24 15:04:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T14:54:48Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135152555 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/990#issuecomment-7135152555). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T14:54:48Z. --- 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)._
DeerSilver commented 2026-11-24 19:04:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DeerSilver on 2026-11-24T18:39:27Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140952477 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/990#issuecomment-7140952477). Originally posted by [DeerSilver](https://github.com/DeerSilver) on 2026-11-24T18:39:27Z. --- 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).
upstream-sync closed this pull request 2026-11-25 01:05:09 +00:00
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!990
No description provided.