Tests: 16-bit integer VALU ops and the byte / half SADs on the GPU #638
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!638
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-638"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@acaracargo on GitHub · 2026-11-24 02:45 UTC · original
acaracargo:fork/int16-gpu-tests→main· +75 −0 · 1 files · 1 commits · openAdds a GPU test for 20 VOP3 instructions that
emit.rstranslates but no test runs:v_mad_u32_u16andv_mad_i32_i16.v_sad_hi_u8,v_sad_u16andv_sad_u32.v_cvt_pk_i16_i32.Eleven lanes carry edge values: sign and carry boundaries, shift counts past 15, and i16 saturation in both directions. The high half of every 16-bit source holds another value, so a translation that reads the whole register shows up. Each lane is compared with the ISA's pseudo-code. Only D[15:0] of a 16-bit result is compared.
#590 tests the 24-bit and high-half multiplies, so this one leaves them out. #445 has the 16-bit min3 / max3 / med3.
What is in it
crates/xcl/src/gpu/recomp/tests.rs:gpu_valu_16_bit_integer_and_sad.Tested
x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug.cargo test --workspace -- --test-threads=4on253f749: 685 passed, 0 failed, 41 ignored (main9ce2070: 684 / 0 / 41).gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).v_ashrrev_i16into a logical shift, or makingv_sad_u16skip the high half, fails the test (checked locally, reverted).Regression run
Not tested
AI use
@MesshM on GitHub · 2026-11-24 02:55 UTC · original
Test run of
253f74917b147deb949fa9633db1ea88eabd54acon AMD RDNA4; the PR was tested on NVIDIA only. I merged it onto currentmain18c105alocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 690 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 650 passed, 0 failed, 21 ignoredSKIPPED;gpu_valu_16_bit_integer_and_sadpasses.Review: The CPU references match the RDNA2 pseudo-code where I checked:
v_sad_u16sums both half differences plus S2,v_sad_hi_u8shifts the byte SAD by 16 before adding S2,v_mad_u32_u16/v_mad_i32_i16widen before the multiply,v_cvt_pk_i16_i32saturates each word, and the*revshifts take the count from S0[3:0]. Comparing only D[15:0] for the 16-bit results is right, since the high half is not defined by these opcodes withoutop_sel. I found nothing to change.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@marquezinii on GitHub · 2026-11-24 04:31 UTC · original
Test run of
253f74917b147deb949fa9633db1ea88eabd54acon NVIDIA Blackwell with a newer driver than the one in the description. I merged it onto currentmainf4ce27clocally (clean merge, 75 lines intests.rs) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debug; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0)cargo test --workspace -- --test-threads=4: 702 passed, 0 failed, 41 ignored;--test-threads=1: the samegpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)gpu_valu_16_bit_integer_and_sadpassesv_sad_hi_u8shifting the sum by 8 instead of 16 (a=0x12340001 b=0xabcdffff c=0x55550002: got 0x55582f02, want 0x58840002), andv_ashrrev_i16masking the shift count with 31 instead of 15 (a=0xa5a50011 b=0x0f0f8001: got 0xffff, want 0xc000)Not tested
AI use
@4usphs on GitHub · 2026-11-24 09:37 UTC · original
Measured on RDNA2 hardware, for the two points under Not tested: console-generation hardware, and D[31:16] of 16-bit results.
Method. The Radeon iGPU of a Ryzen 7 9800X3D (
gfx1036, RDNA2), Windows 11 Pro 26200, display driver 32.0.21045.29003, AMD OpenCL3652.0 (PAL,LC). Each instruction runs as inline RDNA2 assembly in an OpenCL C kernel (the #518 / #772 method), in its VOP3 form (_e64), on this test's 11 input triples, one per work-item. VDST is preset to0xCAFEBABE. The test runs 6 times, 3 in wave32 and 3 in wave64, with identical output. The reference is a Python port of this test's 20 closures.Result.
0xCAFE, for every input. These arev_add/sub_nc_u16/i16,v_mul_lo_u16, the three*_b16/_i16shifts,v_min/max_u16/i16andv_mad_u16/i16. That is whatvalu16does ((cur & 0xFFFF0000u) | t,emit.rs:3051onmain077ce40). So the test could preset the destinations and compare all 32 bits.v_cvt_u16_f16/v_cvt_i16_f16keep it too (measured for #639). The assembler refuses a VOP2 (_e32) form of these 16-bit instructions ongfx1036, so I could not compare an encoding without op_sel.For comparison, an RX 9070 XT (
gfx1201, RDNA4, OpenCL3686.0) gives the same results and also keeps D[31:16].Not tested: the console itself (
gfx1036is a desktop RDNA2 APU of the same generation), RDNA1, the op_sel forms (writing D[31:16] instead), this PR's D3D12 test on this GPU.AI use: Claude Code (Claude Opus 5.5) wrote the OpenCL probes and the port of the reference, ran them on my PC and wrote this comment. I have not reviewed the code.
@JJAutoCompare on GitHub · 2026-11-25 06:36 UTC · original
Empirical test report (
253f7491)Hardware / environment
253f74917b147deb949fa9633db1ea88eabd54ac, checked out detached.XCL_ADAPTER=A770. Windows x64, build10.0.26200.0. CPU identifierAMD64 Family 23 Model 113 Stepping 0, AuthenticAMD.1.100.0(0ef1bc386,x86_64-pc-windows-msvc). DXC1.9.2609.5(01b62ad4), DXIL1.9.2609.5. Unoptimized test profile with debug info and incremental compilation disabled.Commands and results
cargo test -p xcl --lib --no-runran outside the Arc lock and exited 0. It built the library test executable.xcl-00e28da3621caf64.exe --exact --nocapture --test-threads=1 gpu::recomp::tests::gpu_valu_16_bit_integer_and_sadran underInvoke-ArcTest.ps1withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1. The executable and wrapper both exited 0. Libtest reported 1 passed, 0 failed, 0 ignored, 0 measured, and 665 filtered out in 0.37 s. The captured stdout and stderr contained 0 lines beginning withSKIPPED.Observed behavior
Not tested
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr638-focused.log and published.
@DavidM1911 on GitHub · 2026-11-25 12:43 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!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.