Shaders: probe v_cvt_f32_i32 at its rounding midpoints #3479

Open
noobezlol wants to merge 2 commits from upstream-pr/3479 into main
noobezlol commented 2026-11-27 07:15:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by noobezlol on 2026-11-27T07:15:20Z.


Tests only, one file (crates/victory-shader/src/emit/semantics_tests.rs).

Picks up the remaining part of #1602 (by @vladbondarenko97, credited as co-author) and includes @andrewpozdnakov7-jpg's follow-up commit (91795cd) probing both sides of the signed endpoint ties; claimed in #1633.

#1602 added f32/int conversion tests but has needed a rebase since 2026-11-25. Most of it is now covered on main by conversion_probes: i32/u32 truncation, saturation and NaN-as-zero (F32_EDGES), v_cvt_f32_u32 round-to-even (#2186), and the ubyte forms. The one gap left is v_cvt_f32_i32 above 2^24. This extends its probe with #2186's midpoint pattern, in both signs, plus the halfway points and neighbours next to i32::MAX/MIN. It checks the hardware adapter and WARP against a reference model.

Tested on Windows 11, NVIDIA GeForce RTX 3060 (driver 32.0.16.2140, 32 lanes), Rust 1.98.1:

  • cargo test -p victory-shader --lib -- emit::semantics_tests --test-threads=1 --nocapture: 34 passed, 0 failed, 1 ignored (existing defect marker); in conversions_match_the_hardware, v_cvt_f32_i32 gets 124 inputs with 0 mismatches on hardware and WARP (including @andrewpozdnakov7-jpg's endpoint neighbours, 91795cd)
  • VICTORY_WARP=1 cargo test -p victory-shader --lib -- --exact emit::semantics_tests::conversions_match_the_hardware --test-threads=1 --nocapture: passes (124 inputs, 0 mismatches)
  • cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo xtask policy: 192 files ok

No game files used. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:issue:5522757193 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3479). Originally posted by [noobezlol](https://github.com/noobezlol) on 2026-11-27T07:15:20Z. --- Tests only, one file (`crates/victory-shader/src/emit/semantics_tests.rs`). Picks up the remaining part of #1602 (by @vladbondarenko97, credited as co-author) and includes @andrewpozdnakov7-jpg's follow-up commit (`91795cd`) probing both sides of the signed endpoint ties; claimed in #1633. #1602 added f32/int conversion tests but has needed a rebase since 2026-11-25. Most of it is now covered on `main` by `conversion_probes`: i32/u32 truncation, saturation and NaN-as-zero (`F32_EDGES`), `v_cvt_f32_u32` round-to-even (#2186), and the ubyte forms. The one gap left is `v_cvt_f32_i32` above 2^24. This extends its probe with #2186's midpoint pattern, in both signs, plus the halfway points and neighbours next to i32::MAX/MIN. It checks the hardware adapter and WARP against a reference model. Tested on Windows 11, NVIDIA GeForce RTX 3060 (driver 32.0.16.2140, 32 lanes), Rust 1.98.1: - `cargo test -p victory-shader --lib -- emit::semantics_tests --test-threads=1 --nocapture`: 34 passed, 0 failed, 1 ignored (existing defect marker); in `conversions_match_the_hardware`, `v_cvt_f32_i32` gets 124 inputs with 0 mismatches on hardware and WARP (including @andrewpozdnakov7-jpg's endpoint neighbours, `91795cd`) - `VICTORY_WARP=1 cargo test -p victory-shader --lib -- --exact emit::semantics_tests::conversions_match_the_hardware --test-threads=1 --nocapture`: passes (124 inputs, 0 mismatches) - `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo xtask policy`: 192 files ok No game files used. AI-assisted (Claude Code).
andrewpozdnakov7-jpg commented 2026-11-27 08:24:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T08:24:33Z.


@noobezlol I verified c3ffec5 on app-local WARP. The signed conversion matched the reference for all 122 inputs. At the signed endpoints the fixture included the tie and one neighbour on each side of zero, but left out the other neighbour at each tie (0x7fff_ffc1 and 0x8000_003f).

91795cd adds both by testing the midpoint and its two neighbours with both signs. All 124 signed inputs matched bit for bit on WARP, the conversion and floor-conversion tests passed, and strict shader Clippy passed with default and all features.

If you take the test, please retain Git authorship when cherry-picking or rebasing. If folded into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

AI-assisted with Codex. Synthetic shader tests only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7213505153 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3479#issuecomment-7213505153). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T08:24:33Z. --- @noobezlol I verified `c3ffec5` on app-local WARP. The signed conversion matched the reference for all 122 inputs. At the signed endpoints the fixture included the tie and one neighbour on each side of zero, but left out the other neighbour at each tie (`0x7fff_ffc1` and `0x8000_003f`). [91795cd](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/91795cdc6840df4574250c2c6b55d576d916027b) adds both by testing the midpoint and its two neighbours with both signs. All 124 signed inputs matched bit for bit on WARP, the conversion and floor-conversion tests passed, and strict shader Clippy passed with default and all features. If you take the test, please retain Git authorship when cherry-picking or rebasing. If folded into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with Codex. Synthetic shader tests only.
noobezlol commented 2026-11-27 08:49:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by noobezlol on 2026-11-27T08:49:03Z.


thank you! I pulled in 91795cd (retaining your Git authorship) and re-verified on my RTX 3060 + WARP: all 124 v_cvt_f32_i32 inputs passed with 0 mismatches, and clippy -- -D warnings and xtask policy are clean

<!-- greyfinch-sync:Marvisak/VIctory:comment:7213954504 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3479#issuecomment-7213954504). Originally posted by [noobezlol](https://github.com/noobezlol) on 2026-11-27T08:49:03Z. --- thank you! I pulled in `91795cd` (retaining your Git authorship) and re-verified on my RTX 3060 + WARP: all 124 `v_cvt_f32_i32` inputs passed with 0 mismatches, and `clippy -- -D warnings` and `xtask policy` are clean
futurepro62 commented 2026-11-27 18:27:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-27T18:27:58Z.


Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head 91795cd (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 866 passed, 0 failed, 10 ignored.
  • No new #[test] functions in the diff.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7225516221 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3479#issuecomment-7225516221). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-27T18:27:58Z. --- Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `91795cd` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **866 passed, 0 failed, 10 ignored**. - No new `#[test]` functions in the diff. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3479:upstream-pr/3479'
git switch 'upstream-pr/3479'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3479'
git switch 'upstream-pr/3479'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3479'
git switch 'upstream-pr/3479'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3479'
git switch 'main'
git merge --squash 'upstream-pr/3479'
git switch 'main'
git merge --ff-only 'upstream-pr/3479'
git switch 'main'
git merge 'upstream-pr/3479'
git push origin 'main'
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!3479
No description provided.