Skip to content

Shaders: hardware test for v_cvt_f16_u16 and v_cvt_f16_i16 - #990

Merged
Marvisak merged 2 commits into
Marvisak:mainfrom
LouisRiverstone:shaders/cvt-f16-int-test
Nov 25, 2026
Merged

Marvisak merged 2 commits into
Marvisak:mainfrom
LouisRiverstone:shaders/cvt-f16-int-test

Conversation

@LouisRiverstone

@LouisRiverstone LouisRiverstone commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

JMAN730 pushed a commit to JMAN730/project-flamingo that referenced this pull request Nov 24, 2026
@Zipettte

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
KainanP pushed a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…fied together

Merges Marvisak#156 Marvisak#162 Marvisak#168 Marvisak#169 Marvisak#368 Marvisak#379 Marvisak#456 Marvisak#587 Marvisak#990 Marvisak#1021 Marvisak#1048 Marvisak#1052 Marvisak#1053
Marvisak#1095 Marvisak#1142 Marvisak#1190 Marvisak#1211 Marvisak#1223 Marvisak#1259 Marvisak#1293 on top of the bundle of Marvisak#1402
(which is on Marvisak#1319, on main ffe310e), each head unchanged. Hunks that
conflicted in emit/lower.rs, emit/valu_tests.rs and emit/diff_tests.rs were
merged by keeping both sides (additions next to each other); a PR was kept
only if cargo clippy -p victory-shader --all-targets -- -D warnings still
passed with it. No instruction name is handled in two places.

Marvisak#98 is not in this version: an offline measurement on a retail dump showed
it loses 31 programs that validate on Marvisak#1402.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(381 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
@Marvisak
Marvisak merged commit 0299812 into Marvisak:main Nov 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shaders: v_cvt_f16_u16 (0x050) and v_cvt_f16_i16 (0x051) have no hardware test

4 participants