Tests: check packed u8, i16/u16, f16 RTZ, and norm f32 conversions on GPU #1546

Open
thiagocalile wants to merge 1 commit from upstream-pr/1556 into main
thiagocalile commented 2026-11-24 17:39:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thiagocalile on 2026-11-24T17:39:09Z.


Add GPU recompiler tests covering v_cvt_pk_u8_f32, v_cvt_pk_i16_i32, v_cvt_pk_u16_u32, v_cvt_pkrtz_f16_f32, and v_cvt_pknorm_u16_f32 / v_cvt_pknorm_i16_f32 on both wave64 and wave32.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: gpu_cvt_pk_u8_i16_u16_edges covers v_cvt_pk_u8_f32 (byte slots 0..3 + wrapped indices, untouched-byte preservation, round-to-nearest-even ties, saturation, subnormals, ±Inf, ±qNaN, ABS/NEG/-ABS modifiers, 4-byte chaining, EXEC masking), v_cvt_pk_i16_i32 (signed 32→16 clamping boundaries, scalar source, EXEC masking), and v_cvt_pk_u16_u32 (unsigned 32→16 clamping boundaries, scalar source, EXEC masking)
  • crates/xcl/src/gpu/recomp/tests.rs: gpu_cvt_pkrtz_f16_and_pknorm_f32_edges covers v_cvt_pkrtz_f16_f32 (VOP2 + VOP3 ABS/NEG, RTZ vs RNE ties, finite overflow clamping to ±65504 rather than ±Inf, ±Inf, ±0.0, subnormals, ±qNaN, EXEC masking) and v_cvt_pknorm_u16_f32 / v_cvt_pknorm_i16_f32 (saturation, rounding ties, ±Inf, ±qNaN, NEG/ABS modifiers, EXEC masking)

Tested

  • Hardware: AMD Radeon RX 6600 (8146 MiB VRAM, driver 32.0.21045.29003; XCL_ADAPTER=radeon, native wave64 + wave32), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (26200), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.8.2502.11, debug build
  • XCL_ADAPTER=radeon cargo test -p xcl --lib gpu_cvt_pk_u8_i16_u16_edges -- --nocapture: 1 passed, 0 failed, 0 ignored
  • XCL_ADAPTER=radeon cargo test -p xcl --lib gpu_cvt_pkrtz_f16_and_pknorm_f32_edges -- --nocapture: 1 passed, 0 failed, 0 ignored
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 775 passed, 3 failed, 41 ignored (the 3 failures are pre-existing on main 9e3831e on this RX 6600: placed_title_textures_share_vram_and_preserve_pixels + 2 mutex-poison cascades, covered by #1028). 1 GPU test skipped inside the passing count: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)

Not tested

  • NVIDIA / Intel / WARP adapters, D3D12 debug layer (no d3d12SDKLayers.dll), Linux / Wine.

AI use

  • Antigravity (Gemini 4 Neon) wrote the tests, ran them on my RX 6600, and drafted this description; I reviewed the diff and test output.
<!-- greyfinch-sync:ivall/xcl:issue:5477267323 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1556). Originally posted by [thiagocalile](https://github.com/thiagocalile) on 2026-11-24T17:39:09Z. --- Add GPU recompiler tests covering `v_cvt_pk_u8_f32`, `v_cvt_pk_i16_i32`, `v_cvt_pk_u16_u32`, `v_cvt_pkrtz_f16_f32`, and `v_cvt_pknorm_u16_f32` / `v_cvt_pknorm_i16_f32` on both wave64 and wave32. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_cvt_pk_u8_i16_u16_edges` covers `v_cvt_pk_u8_f32` (byte slots 0..3 + wrapped indices, untouched-byte preservation, round-to-nearest-even ties, saturation, subnormals, ±Inf, ±qNaN, `ABS`/`NEG`/`-ABS` modifiers, 4-byte chaining, EXEC masking), `v_cvt_pk_i16_i32` (signed 32→16 clamping boundaries, scalar source, EXEC masking), and `v_cvt_pk_u16_u32` (unsigned 32→16 clamping boundaries, scalar source, EXEC masking) - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_cvt_pkrtz_f16_and_pknorm_f32_edges` covers `v_cvt_pkrtz_f16_f32` (VOP2 + VOP3 `ABS`/`NEG`, RTZ vs RNE ties, finite overflow clamping to ±65504 rather than ±Inf, ±Inf, ±0.0, subnormals, ±qNaN, EXEC masking) and `v_cvt_pknorm_u16_f32` / `v_cvt_pknorm_i16_f32` (saturation, rounding ties, ±Inf, ±qNaN, `NEG`/`ABS` modifiers, EXEC masking) **Tested** - Hardware: AMD Radeon RX 6600 (8146 MiB VRAM, driver 32.0.21045.29003; `XCL_ADAPTER=radeon`, native wave64 + wave32), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (26200), Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.8.2502.11, debug build - `XCL_ADAPTER=radeon cargo test -p xcl --lib gpu_cvt_pk_u8_i16_u16_edges -- --nocapture`: 1 passed, 0 failed, 0 ignored - `XCL_ADAPTER=radeon cargo test -p xcl --lib gpu_cvt_pkrtz_f16_and_pknorm_f32_edges -- --nocapture`: 1 passed, 0 failed, 0 ignored - `XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4`: 775 passed, 3 failed, 41 ignored (the 3 failures are pre-existing on `main` `9e3831e` on this RX 6600: `placed_title_textures_share_vram_and_preserve_pixels` + 2 mutex-poison cascades, covered by #1028). 1 GPU test skipped inside the passing count: `heap_window_out_of_memory_falls_back_to_the_switch_form` (`no heap windows`) **Not tested** - NVIDIA / Intel / WARP adapters, D3D12 debug layer (no `d3d12SDKLayers.dll`), Linux / Wine. **AI use** - Antigravity (Gemini 4 Neon) wrote the tests, ran them on my RX 6600, and drafted this description; I reviewed the diff and test output.
DarkPanda69 commented 2026-11-24 19:07:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-24T18:11:47Z.


NVIDIA run, which this PR lists as not tested (it was run on an RX 6600), plus an RDNA4 one.

Tested: pass, head 3eced4c applied on its base main 9e3831e, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.
cargo test -p xcl --lib -- gpu::recomp --test-threads=4:

  • NVIDIA RTX 3060, driver 32.0.16.1088, waves 32 only: 194 passed, 0 failed, 18 ignored, 2 SKIPPED (no wave64). gpu_cvt_pk_u8_i16_u16_edges and gpu_cvt_pkrtz_f16_and_pknorm_f32_edges ok.
  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 194 passed, 0 failed, 18 ignored, 0 SKIPPED. Both ok.

Not tested: Intel, WARP, the D3D12 debug layer; the whole workspace suite.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7140295942 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1556#issuecomment-7140295942). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-24T18:11:47Z. --- NVIDIA run, which this PR lists as not tested (it was run on an RX 6600), plus an RDNA4 one. **Tested:** pass, head `3eced4c` applied on its base `main` `9e3831e`, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17. `cargo test -p xcl --lib -- gpu::recomp --test-threads=4`: - NVIDIA RTX 3060, driver 32.0.16.1088, waves 32 only: 194 passed, 0 failed, 18 ignored, 2 SKIPPED (no wave64). `gpu_cvt_pk_u8_i16_u16_edges` and `gpu_cvt_pkrtz_f16_and_pknorm_f32_edges` ok. - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 194 passed, 0 failed, 18 ignored, 0 SKIPPED. Both ok. **Not tested:** Intel, WARP, the D3D12 debug layer; the whole workspace suite. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Daydream3r commented 2026-11-24 19:07:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Daydream3r on 2026-11-24T18:13:40Z.


Independent NVIDIA verification of exact head 3eced4cb07, tested on 2026-11-24 without rebasing, merging or source edits.

Tested

  • NVIDIA GeForce RTX 5070 Ti (16303 MiB reported VRAM), driver 621.01; Ryzen 7 9800X3D, 64 GB RAM; Windows 11 Pro 25H2 26200.6584; Rust 1.100.0 (stable-x86_64-pc-windows-msvc), MSVC Build Tools 2022 17.14.37906.3, Windows SDK 10.0.26100.0; DXC/DXIL 1.9.2609.5 from the official DirectXShaderCompiler release.
  • Debug tests, XCL_ADAPTER=RTX 5070 Ti, XCL_DXC_DIR set to this DXC's bin/x64.
  • cargo build --workspace --locked: exit 0.
  • With XCL_REQUIRE_GPU=mesh, cargo test --locked -p xcl --lib gpu_cvt_pk -- --nocapture --test-threads=1: 2 passed, 0 failed, 0 ignored, no skips, exit 0. Both gpu_cvt_pk_u8_i16_u16_edges and gpu_cvt_pkrtz_f16_and_pknorm_f32_edges executed and passed.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4: 778 passed, 0 failed, 41 ignored, exit 0.
  • Same full-suite command on clean baseline main 9e3831e1f5: 776 passed, 0 failed, 41 ignored, exit 0. This is also the PR's merge-base.
  • Synthetic-title e2e test_title_runs_and_game_folder_is_untouched passed on both revisions.

Not tested / skips

The two new tests select wave32 only through gpu_waves() on this NVIDIA adapter. Their native-wave64 path was not exercised.

Each full suite contains the same three explicit GPU skips inside its passing count:

  • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
  • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
  • heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows

All XCL_SAMPLE_* inputs listed by scripts/test.ps1 were unset, so game-data-dependent successful returns are not sample coverage. No retail title/smoke run, AMD/Intel/WARP, D3D12 debug-layer run, or PR release build. This PR adds tests only; this report makes no retail regression or merge-approval claim. XCL_REQUIRE_GPU=mesh made no-GPU/no-DXC skips fail for the targeted command; it was unset for the full suites.

AI use

Codex desktop, GPT-6 inspected the diff, built and ran the commands on this PC, and drafted this report from the logs. No source changes.

<!-- greyfinch-sync:ivall/xcl:comment:7140341770 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1556#issuecomment-7140341770). Originally posted by [Daydream3r](https://github.com/Daydream3r) on 2026-11-24T18:13:40Z. --- Independent NVIDIA verification of exact head **3eced4cb07635a71151e2d991b930bb592ada46c**, tested on 2026-11-24 without rebasing, merging or source edits. **Tested** - NVIDIA GeForce RTX 5070 Ti (16303 MiB reported VRAM), driver **621.01**; Ryzen 7 9800X3D, 64 GB RAM; Windows 11 Pro 25H2 **26200.6584**; Rust **1.100.0** (`stable-x86_64-pc-windows-msvc`), MSVC Build Tools 2022 17.14.37906.3, Windows SDK 10.0.26100.0; DXC/DXIL **1.9.2609.5** from the official DirectXShaderCompiler release. - Debug tests, `XCL_ADAPTER=RTX 5070 Ti`, `XCL_DXC_DIR` set to this DXC's `bin/x64`. - `cargo build --workspace --locked`: exit 0. - With `XCL_REQUIRE_GPU=mesh`, `cargo test --locked -p xcl --lib gpu_cvt_pk -- --nocapture --test-threads=1`: **2 passed, 0 failed, 0 ignored**, **no skips**, exit 0. Both `gpu_cvt_pk_u8_i16_u16_edges` and `gpu_cvt_pkrtz_f16_and_pknorm_f32_edges` executed and passed. - `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`: **778 passed, 0 failed, 41 ignored**, exit 0. - Same full-suite command on clean baseline `main` **9e3831e1f570d3646e53ab753b19ec07eb8f1485**: **776 passed, 0 failed, 41 ignored**, exit 0. This is also the PR's merge-base. - Synthetic-title e2e `test_title_runs_and_game_folder_is_untouched` passed on both revisions. **Not tested / skips** The two new tests select **wave32 only** through `gpu_waves()` on this NVIDIA adapter. Their native-wave64 path was not exercised. Each full suite contains the same three explicit GPU skips inside its passing count: - `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64` - `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` - `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows` All `XCL_SAMPLE_*` inputs listed by `scripts/test.ps1` were unset, so game-data-dependent successful returns are not sample coverage. No retail title/smoke run, AMD/Intel/WARP, D3D12 debug-layer run, or PR release build. This PR adds tests only; this report makes no retail regression or merge-approval claim. `XCL_REQUIRE_GPU=mesh` made no-GPU/no-DXC skips fail for the targeted command; it was unset for the full suites. **AI use** Codex desktop, GPT-6 inspected the diff, built and ran the commands on this PC, and drafted this report from the logs. No source changes.
DavidM1911 commented 2026-11-24 21:08:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:32:25Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7142243380 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1556#issuecomment-7142243380). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T19:32:25Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
JJAutoCompare commented 2026-11-25 05:08:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T04:54:07Z.


Tested

Clean detached PR head 3eced4cb07635a71151e2d991b930bb592ada46c. STOR-WINLAB, Windows 11 Enterprise Evaluation 25H2 x64 (26200.9974), Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust/Cargo 1.100.0 x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5, unoptimized test profile.

Prebuilt outside the lock with cargo +stable-x86_64-pc-windows-msvc test --locked -p xcl --lib --no-run --message-format=json (exit 0). The Cargo-reported test executable ran under Invoke-ArcTest.ps1 -Test with XCL_ADAPTER=A770, XCL_DIRECT_DXIL=0, and XCL_REQUIRE_GPU=wave64. The wrapper and both fixtures exited 0.

& $exe gpu::recomp::tests::gpu_cvt_pk_u8_i16_u16_edges --exact --nocapture --test-threads=1
& $exe gpu::recomp::tests::gpu_cvt_pkrtz_f16_and_pknorm_f32_edges --exact --nocapture --test-threads=1

2 passed, 0 failed, 0 ignored, 0 skipped. Each filter ran one HLSL/DXC fixture and excluded 749 tests. The first passed 384 readback assertions across 32 lanes (clamps, rounding, byte selection, source modifiers, and EXEC masking). The second passed 288 across 32 lanes (FP16 round toward zero, signed zero, subnormals, Inf/NaN classification, normalized packing, and EXEC masking).

Not tested

Native or split wave64, direct DXIL, release builds, the workspace suite, retail smoke, and other adapters.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixtures and prepared this report.

<!-- greyfinch-sync:ivall/xcl:comment:7153266893 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1556#issuecomment-7153266893). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T04:54:07Z. --- **Tested** Clean detached PR head `3eced4cb07635a71151e2d991b930bb592ada46c`. STOR-WINLAB, Windows 11 Enterprise Evaluation 25H2 x64 (26200.9974), Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust/Cargo 1.100.0 x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5, unoptimized test profile. Prebuilt outside the lock with `cargo +stable-x86_64-pc-windows-msvc test --locked -p xcl --lib --no-run --message-format=json` (exit 0). The Cargo-reported test executable ran under `Invoke-ArcTest.ps1 -Test` with `XCL_ADAPTER=A770`, `XCL_DIRECT_DXIL=0`, and `XCL_REQUIRE_GPU=wave64`. The wrapper and both fixtures exited 0. ```powershell & $exe gpu::recomp::tests::gpu_cvt_pk_u8_i16_u16_edges --exact --nocapture --test-threads=1 & $exe gpu::recomp::tests::gpu_cvt_pkrtz_f16_and_pknorm_f32_edges --exact --nocapture --test-threads=1 ``` **2 passed, 0 failed, 0 ignored, 0 skipped**. Each filter ran one HLSL/DXC fixture and excluded 749 tests. The first passed 384 readback assertions across 32 lanes (clamps, rounding, byte selection, source modifiers, and EXEC masking). The second passed 288 across 32 lanes (FP16 round toward zero, signed zero, subnormals, Inf/NaN classification, normalized packing, and EXEC masking). **Not tested** Native or split wave64, direct DXIL, release builds, the workspace suite, retail smoke, and other adapters. **AI use** T3 Code / Codex (`gpt-6.2-sol`) ran the checked-in fixtures and prepared this report.
github-actions[bot] commented 2026-11-28 20:18:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:18:00Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7245184242 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1556#issuecomment-7245184242). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T20:18:00Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 06:06:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:06:21Z.


Triage (#1607) – head 3eced4c

No open PR adds the same tests; main only uses these ops incidentally (one v_cvt_pk_u8_f32, v_cvt_pkrtz_f16_f32, v_cvt_pknorm_u16_f32 line each in larger tests).
Problem: in gpu_cvt_pkrtz_f16_and_pknorm_f32_edges the rne_u16 / rne_i16 references compute (x * 65535.0).round_ties_even() in f32, so they round twice. For NORM_CASES[6] / [7] (1.5/65535, 1.5/32767) the exact product is 1.4999999..., which the f32 product rounds to 1.5 and then to 2; rounding once gives 1. The test therefore pins the current HLSL's double rounding, and it will fail if #683 (round normalized f32 conversions once) is merged. Compute the reference in f64, or drop those two cases.
The branch conflicts with main and needs a rebase.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302485894 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1556#issuecomment-7302485894). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:06:21Z. --- **Triage (#1607)** – head 3eced4c No open PR adds the same tests; main only uses these ops incidentally (one `v_cvt_pk_u8_f32`, `v_cvt_pkrtz_f16_f32`, `v_cvt_pknorm_u16_f32` line each in larger tests). Problem: in `gpu_cvt_pkrtz_f16_and_pknorm_f32_edges` the `rne_u16` / `rne_i16` references compute `(x * 65535.0).round_ties_even()` in f32, so they round twice. For `NORM_CASES[6]` / `[7]` (1.5/65535, 1.5/32767) the exact product is 1.4999999..., which the f32 product rounds to 1.5 and then to 2; rounding once gives 1. The test therefore pins the current HLSL's double rounding, and it will fail if #683 (round normalized f32 conversions once) is merged. Compute the reference in f64, or drop those two cases. The branch conflicts with main and needs a rebase. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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/1556:upstream-pr/1556'
git switch 'upstream-pr/1556'

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/1556'
git switch 'upstream-pr/1556'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1556'
git switch 'upstream-pr/1556'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1556'
git switch 'main'
git merge --squash 'upstream-pr/1556'
git switch 'main'
git merge --ff-only 'upstream-pr/1556'
git switch 'main'
git merge 'upstream-pr/1556'
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
xcl-dev/xcl!1546
No description provided.