Tests: 16-bit VALU results keep the other half of VDST #1115

Open
github-bot wants to merge 1 commit from github-bot/gh-1115 into main AGit
Owner

@⁠4usphs on GitHub · 2026-11-24 11:56 UTC · original
4usphs:tests/16-bit-results-keep-other-half → main · +101 −0 · 1 files · 1 commits · open

A 16-bit VALU result goes into D[15:0] and leaves D[31:16] as it was, or with VOP3 op_sel[3] into D[31:16] leaving D[15:0]. op_sel[0..2] read the sources' high halves. valu16 does this ((cur & 0xFFFF0000u) | t, emit.rs ~3051), but only v_add_f16 has a check of it in gpu_valu_16_and_64_bit. The other 16-bit tests, including #638 and #639, compare D[15:0] alone. A change that zeroed or overwrote the other half would pass all of them.

The expected behaviour is measured on RDNA2 silicon, the console's generation, not taken from the ISA text: https://github.com/ivall/xcl/pull/638#issuecomment-7127672871, plus the op_sel forms below.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: gpu_16_bit_results_keep_the_other_half. Every VDST starts at 0xCAFE_BABE. Each source has different values in its two halves. 24 rows:
    • the 16-bit integer ops of valu16 that RDNA2 has, plain VOP3: v_add/sub_nc_u16/i16, v_mul_lo_u16, v_lshlrev/lshrrev_b16, v_ashrrev_i16, v_min/max_u16/i16, v_mad_u16/i16. v_subrev_nc_u16 is left out: the RDNA2 / RDNA4 assembler refuses it.
    • the op_sel forms the RDNA2 assembler takes (v_add/sub_nc_u16/i16, v_mad_u16/i16): writing D[31:16], reading the high halves, both.
    • v_cvt_u16_f16 / v_cvt_i16_f16 (VOP1), f16 source with 0xBEEF in its high half.

Tested

  • Two GPUs in one PC, picked with XCL_ADAPTER: AMD Radeon iGPU of a Ryzen 7 9800X3D (gfx1036, RDNA2, native wave64, driver 32.0.21045.29003) and AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32029.2010). Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on a8133ad: 742 passed, 0 failed, 41 ignored on each GPU, no SKIPPED (main 47efa2e: 741 / 0 / 41 on each).
  • The new test with XCL_REQUIRE_GPU=wave64: 3 / 3 passed on each GPU.
  • Negative controls on the RDNA2 iGPU, each a one-line local change to valu16, reverted after:
    • D[31:16] not kept (t written alone): 108 failing rows, e.g. V_ADD_NC_I16 … got 0x00000000, want 0xcafe0000.
    • op_sel[3] ignored: 36 failing rows (got 0xcafef777, want 0xf777babe).
    • op_sel source bits ignored: 35 failing rows.
  • Hardware reference: each instruction and op_sel form above ran as inline assembly in OpenCL (the #518 / #772 method) on both GPUs, VDST preset to 0xCAFEBABE, wave32 and wave64. Every form the assembler accepted matches the rule above on both GPUs.

Regression run

  • Test-only change (tests.rs), no runtime regression run.

Not tested

  • NVIDIA / wave32-only GPUs (the split wave64 form), so the test ran only in native wave64 here.
  • op_sel on the VOP2-origin ops (v_mul_lo_u16, the shifts, min / max): the RDNA2 assembler refuses it, so there is no hardware reference for it.
  • SDWA forms, clamp, the console itself (gfx1036 is a desktop RDNA2 APU of the same generation).

AI use

  • Claude Code (Claude Opus 5.5) wrote the test, the OpenCL probes and this description, and ran the tests and the controls on my PC.

🤖 Generated with Claude Code

**@⁠4usphs** on GitHub · 2026-11-24 11:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/1115) `4usphs:tests/16-bit-results-keep-other-half` → `main` · +101 −0 · 1 files · 1 commits · open A 16-bit VALU result goes into D[15:0] and leaves D[31:16] as it was, or with VOP3 `op_sel[3]` into D[31:16] leaving D[15:0]. `op_sel[0..2]` read the sources' high halves. `valu16` does this (`(cur & 0xFFFF0000u) | t`, `emit.rs` ~3051), but only `v_add_f16` has a check of it in `gpu_valu_16_and_64_bit`. The other 16-bit tests, including #638 and #639, compare D[15:0] alone. A change that zeroed or overwrote the other half would pass all of them. The expected behaviour is measured on RDNA2 silicon, the console's generation, not taken from the ISA text: https://github.com/ivall/xcl/pull/638#issuecomment-7127672871, plus the op_sel forms below. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_16_bit_results_keep_the_other_half`. Every VDST starts at `0xCAFE_BABE`. Each source has different values in its two halves. 24 rows: - the 16-bit integer ops of `valu16` that RDNA2 has, plain VOP3: `v_add/sub_nc_u16/i16`, `v_mul_lo_u16`, `v_lshlrev/lshrrev_b16`, `v_ashrrev_i16`, `v_min/max_u16/i16`, `v_mad_u16/i16`. `v_subrev_nc_u16` is left out: the RDNA2 / RDNA4 assembler refuses it. - the op_sel forms the RDNA2 assembler takes (`v_add/sub_nc_u16/i16`, `v_mad_u16/i16`): writing D[31:16], reading the high halves, both. - `v_cvt_u16_f16` / `v_cvt_i16_f16` (VOP1), f16 source with `0xBEEF` in its high half. **Tested** - Two GPUs in one PC, picked with `XCL_ADAPTER`: AMD Radeon iGPU of a Ryzen 7 9800X3D (`gfx1036`, RDNA2, native wave64, driver 32.0.21045.29003) and AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32029.2010). Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `a8133ad`: **742 passed, 0 failed, 41 ignored** on each GPU, no `SKIPPED` (`main` `47efa2e`: 741 / 0 / 41 on each). - The new test with `XCL_REQUIRE_GPU=wave64`: 3 / 3 passed on each GPU. - Negative controls on the RDNA2 iGPU, each a one-line local change to `valu16`, reverted after: - D[31:16] not kept (`t` written alone): 108 failing rows, e.g. `V_ADD_NC_I16 … got 0x00000000, want 0xcafe0000`. - `op_sel[3]` ignored: 36 failing rows (`got 0xcafef777, want 0xf777babe`). - `op_sel` source bits ignored: 35 failing rows. - Hardware reference: each instruction and op_sel form above ran as inline assembly in OpenCL (the #518 / #772 method) on both GPUs, VDST preset to `0xCAFEBABE`, wave32 and wave64. Every form the assembler accepted matches the rule above on both GPUs. **Regression run** - Test-only change (`tests.rs`), no runtime regression run. **Not tested** - NVIDIA / wave32-only GPUs (the split wave64 form), so the test ran only in native wave64 here. - op_sel on the VOP2-origin ops (`v_mul_lo_u16`, the shifts, min / max): the RDNA2 assembler refuses it, so there is no hardware reference for it. - SDWA forms, `clamp`, the console itself (`gfx1036` is a desktop RDNA2 APU of the same generation). **AI use** - Claude Code (Claude Opus 5.5) wrote the test, the OpenCL probes and this description, and ran the tests and the controls on my PC. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A 16-bit VALU result goes into D[15:0] and leaves D[31:16] as it was, or
with VOP3 op_sel[3] into D[31:16] leaving D[15:0], and op_sel[0..2] read the
sources' high halves. valu16 does this (`(cur & 0xFFFF0000u) | t`), but only
v_add_f16 had a check of it: the other 16-bit tests compare D[15:0] alone.

gpu_16_bit_results_keep_the_other_half presets every VDST to 0xCAFE_BABE and
runs the 16-bit integer ops of valu16 that RDNA2 has, the op_sel forms the
RDNA2 assembler takes (v_add/sub_nc_u16/i16, v_mad_u16/i16), and
v_cvt_u16_f16 / v_cvt_i16_f16. The expected values follow what RDNA2
(gfx1036) and RDNA4 (gfx1201) silicon gave for the same instructions as
inline assembly through OpenCL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:43:52 +00:00
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-24 12:26 UTC · original

NVIDIA (32-lane) run, since Not tested lists NVIDIA.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (32-lane waves only), driver 32.0.16.1088; AMD Ryzen 7 5700X; native Windows 11 Pro 26H2 (build 26300.9974), Graphics Tools installed; rustc 1.100.0 stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug
  • Exact head a8133adca5c6ea5cd768b966f66383efd06e861c, which is on current main 47efa2e (so also the merged result): cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • gpu_16_bit_results_keep_the_other_half alone, 10 runs: 10 of 10 passed on this card. All 24 rows give the RDNA2-measured values here, including the op_sel forms and the two VOP1 conversions.
  • It catches a broken merge (local edits to emit.rs, reverted after):
    • valu16's low-half write changed from ({cur} & 0xFFFF0000u) | {t} to {t}: the new test fails with clear rows, e.g. V_ADD_NC_I16 op_sel=0b0000 … got 0x00000004, want 0xcafe0004.
    • the op_sel[3] write changed from ({cur} & 0xFFFFu) | ({t} << 16) to ({t} << 16): the new test fails, e.g. V_ADD_NC_I16 op_sel=0b1010 … got 0xabd20000, want 0xabd2babe.
    • For completeness: in both cases the existing gpu_valu_16_and_64_bit fails too, on its v_add_f16 keeps the high half checks (lines 2707 and 2708), because all these ops share that one merge in valu16. So these two mutations were already caught by v_add_f16. The new test adds per-opcode and per-op_sel coverage, which matters for a change to one op's path, and failure messages that name the op and form.

Not tested

  • Native wave64 (this card has 32-lane waves only), RDNA silicon comparisons, release build.

AI use

  • Claude Code (Claude Opus 5.5) ran the build, tests and the two local mutations on the machine above and wrote this report from the output.
**@⁠fromthemoonx** on GitHub · 2026-11-24 12:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1115#issuecomment-7131432435) NVIDIA (32-lane) run, since **Not tested** lists NVIDIA. **Tested** - NVIDIA GeForce RTX 3060 12 GB (32-lane waves only), driver 32.0.16.1088; AMD Ryzen 7 5700X; native Windows 11 Pro 26H2 (build 26300.9974), Graphics Tools installed; rustc 1.100.0 `stable-x86_64-pc-windows-msvc`; DXC 1.9.2602.17; debug - **Exact head `a8133adca5c6ea5cd768b966f66383efd06e861c`**, which is on current `main` `47efa2e` (so also the merged result): `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4`: **742 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - `gpu_16_bit_results_keep_the_other_half` alone, 10 runs: **10 of 10 passed** on this card. All 24 rows give the RDNA2-measured values here, including the op_sel forms and the two VOP1 conversions. - **It catches a broken merge** (local edits to `emit.rs`, reverted after): - `valu16`'s low-half write changed from `({cur} & 0xFFFF0000u) | {t}` to `{t}`: the new test fails with clear rows, e.g. `V_ADD_NC_I16 op_sel=0b0000 … got 0x00000004, want 0xcafe0004`. - the op_sel[3] write changed from `({cur} & 0xFFFFu) | ({t} << 16)` to `({t} << 16)`: the new test fails, e.g. `V_ADD_NC_I16 op_sel=0b1010 … got 0xabd20000, want 0xabd2babe`. - For completeness: in both cases the existing `gpu_valu_16_and_64_bit` fails too, on its `v_add_f16 keeps the high half` checks (lines 2707 and 2708), because all these ops share that one merge in `valu16`. So these two mutations were already caught by `v_add_f16`. The new test adds per-opcode and per-op_sel coverage, which matters for a change to one op's path, and failure messages that name the op and form. **Not tested** - Native wave64 (this card has 32-lane waves only), RDNA silicon comparisons, release build. **AI use** - Claude Code (Claude Opus 5.5) ran the build, tests and the two local mutations on the machine above and wrote this report from the output.
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-24 13:45 UTC · original

A run on Linux with vkd3d-proton, where the shaders go through dxil-spirv to Vulkan instead of a Windows driver's DXIL compiler.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. a8133ad as it is (based on 47efa2e), no uncommitted changes. The lib test binary runs under Wine.
  • gpu::recomp::tests::gpu_16_bit_results_keep_the_other_half (--exact, one process): ok, no SKIPPED. DXC compiled it and it ran on the GPU in about 0.8 s.

Not tested

  • the rest of the suite on this head; native Windows; AMD / native wave64.

AI use

  • Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-24 13:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/1115#issuecomment-7133289353) A run on Linux with vkd3d-proton, where the shaders go through dxil-spirv to Vulkan instead of a Windows driver's DXIL compiler. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `a8133ad` as it is (based on `47efa2e`), no uncommitted changes. The lib test binary runs under Wine. - `gpu::recomp::tests::gpu_16_bit_results_keep_the_other_half` (`--exact`, one process): **ok**, no SKIPPED. DXC compiled it and it ran on the GPU in about 0.8 s. **Not tested** - the rest of the suite on this head; native Windows; AMD / native wave64. **AI use** - Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
Author
Owner

@⁠wanchudao on GitHub · 2026-11-24 15:41 UTC · original

Tested — a8133ad on Windows 11 Pro build 26300, RTX 3070 Ti (driver 610.88),
rustc 1.100.0, MSVC 14.44.35207, and DXC 1.9.2602.17.

cargo test -p xcl --lib gpu_16_bit_results_keep_the_other_half -- --nocapture

Result with the default adapter: 1 passed, 0 failed, 0 ignored, 719 filtered out.
The same test provided an additional result for xcl's split-wave64 path on this card:

  • With XCL_ADAPTER=definitely-not-a-gpu, it printed SKIPPED ...: no GPU (0.03 s).
  • The default rerun printed no SKIPPED line (0.39 s). The first default run took 0.47 s.
  • With XCL_REQUIRE_GPU=wave64, a skip in this test would fail it. The test passed (0.47 s).

Not tested — AMD reference hardware, native wave64, or op_sel on the VOP2-origin ops.

AI use — DeepSeek Harness (DeepSeek V4.1 Flash) ran the tests and drafted this report.
OpenAI Codex (GPT-6.2 Sol) checked the archived results and revised it.

**@⁠wanchudao** on GitHub · 2026-11-24 15:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/1115#issuecomment-7136443568) **Tested** — a8133ad on Windows 11 Pro build 26300, RTX 3070 Ti (driver 610.88), rustc 1.100.0, MSVC 14.44.35207, and DXC 1.9.2602.17. `cargo test -p xcl --lib gpu_16_bit_results_keep_the_other_half -- --nocapture` Result with the default adapter: 1 passed, 0 failed, 0 ignored, 719 filtered out. The same test provided an additional result for xcl's split-wave64 path on this card: - With `XCL_ADAPTER=definitely-not-a-gpu`, it printed `SKIPPED ...: no GPU` (0.03 s). - The default rerun printed no `SKIPPED` line (0.39 s). The first default run took 0.47 s. - With `XCL_REQUIRE_GPU=wave64`, a skip in this test would fail it. The test passed (0.47 s). **Not tested** — AMD reference hardware, native wave64, or `op_sel` on the VOP2-origin ops. **AI use** — DeepSeek Harness (DeepSeek V4.1 Flash) ran the tests and drafted this report. OpenAI Codex (GPT-6.2 Sol) checked the archived results and revised it.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 08:16 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 08:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/1115#issuecomment-7156815249) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/gpu/recomp/tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1115/head:github-bot/gh-1115'
git switch 'github-bot/gh-1115'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1115'
git switch 'github-bot/gh-1115'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1115'
git switch 'github-bot/gh-1115'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1115'
git switch 'main'
git merge --squash 'github-bot/gh-1115'
git switch 'main'
git merge --ff-only 'github-bot/gh-1115'
git switch 'main'
git merge 'github-bot/gh-1115'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.