Tests: check scalar ALU results and SCC on the GPU against the ISA #620
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!620
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-620"
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:35 UTC · original
acaracargo:fork/salu-gpu-tests→main· +206 −0 · 1 files · 1 commits · openAbout 80 SALU instructions are translated in
emit.rsbut never run in a GPU test. This adds one test for 46 of them, each on edge values (sign, carry and overflow boundaries, shift counts past 31 / 63, all-ones and all-zero inputs). It compares the destination and SCC with a small model of the RDNA2 pseudo-code (salu_reference). For instructions that do not write SCC, it checks that SCC keeps both of its earlier values. Test only, no runtime change.A search of open and closed PRs for "scalar", "SALU", "SCC" and the opcode names found no overlapping coverage. #445, #519, #545 and #590 cover VALU instructions only.
What is in it
crates/xcl/src/gpu/recomp/tests.rs:SaluCase,salu_referenceandgpu_scalar_alu_results_and_scc, 68 cases in programs of 30. s[0:5] hold the operands and the destination, and s[8..97] hold each result and its SCC.Tested
x86_64-pc-windows-msvc; DXC 1.9.2602.17 from the Windows SDK; debug.cargo test --workspace -- --test-threads=4on0e158e4: 685 passed, 0 failed, 41 ignored. Onmain9ce2070: 684 / 0 / 41.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).s_ff0_i32_b32scanning the wrong bits, ands_pack_hh_b32_b16writing SCC.Regression run
Not tested
AI use
@MesshM on GitHub · 2026-11-24 02:46 UTC · original
Test run of
0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40on AMD RDNA4; the PR was tested on NVIDIA only. I merged it onto currentmain3db536elocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 687 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 647 passed, 0 failed, 21 ignoredSKIPPED;gpu_scalar_alu_results_and_sccpasses.Review: I spot-checked
salu_referenceagainst the RDNA2 pseudo-code: SCC = result ≠ 0 fors_abs,s_absdiff,s_bcnt0,s_wqmand thenand/nor/xnor/orn2/andn2cases; no SCC write fors_bfm,s_brev,s_sext,s_mul_hi,s_pack_*;s_bitcmp0/1test bitS1[4:0];s_ff0gives −1 with no zero bit;s_pack_hhis{S1[31:16], S0[31:16]}. All match. I did not check every one of the 46 opcodes.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.
@caua-an on GitHub · 2026-11-24 02:47 UTC · original
Tested: Clean head
0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40; Windows 11 Home build 26200, Core Ultra 9 185H, Rust 1.100.0 MSVC x64, debug build,XCL_REQUIRE_GPU=1. Intel Arc integrated graphics driver 32.0.101.8860; RTX 4070 Laptop driver 616.92.cargo test --offline --locked -p xcl --lib gpu_scalar_alu_results_and_scc -- --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored, no skips with each ofXCL_ADAPTER=intelandXCL_ADAPTER=nvidia. DXC 1.9.2602.17 was loaded.Not tested: Full workspace suite, release builds, retail titles, or game-data samples (
XCL_SAMPLE_*unset).AI use: OpenCode with GPT-6.2 Sol ran the tests and drafted this report.
@4usphs on GitHub · 2026-11-24 09:35 UTC · original
Measured on RDNA2 hardware, for the two points under Not tested: console-generation hardware instead of the ISA text, and
s_min/s_maxSCC on equal operands.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 case is one inline-assembly block in an OpenCL C kernel (the #518 / #772 method):s_cmp_eq_u32 0, 0|1sets SCC, the instruction runs on SGPR operands with the destination preset to the case'sd, ands_cselect_b32 1, 0reads SCC back. All cases run 6 times, 3 in wave32 and 3 in wave64, with identical output. The reference is a line-by-line Python port ofsalu_referencefrom this PR.Result.
gpu_scalar_alu_results_and_sccmatch the hardware, results and SCC, including SCC kept by the instructions that do not write it.s_min/s_maxon equal operands: SCC = 0, whatever SCC was before. This holds fors_min_i32,s_max_i32,s_min_u32ands_max_u32, each with 5 values (5,0,-3,0x80000000,0xFFFFFFFF) and SCC 0 and 1 before (40 cases). That is the strict</>thatemit.rsuses (lines 1262–1265 onmain077ce40) and this test's reference. Non-ties in both orders (16 cases) give SCC = 1 exactly when S0 is the one selected. So the cases left out by the comment aboveS_MIN_U32could be added with SCC = 0.For comparison, the same probe on an RX 9070 XT (
gfx1201, RDNA4, OpenCL3686.0) gives the same results. The exception iss_ff0_i32_b32, which RDNA4's assembler refuses (removed there), so 66 of the 68 cases ran on it.Not tested: the console itself (
gfx1036is a desktop RDNA2 APU of the same generation), RDNA1, this PR's D3D12 test on this GPU.Kernel shape (one case)
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 (
0e158e4b)Hardware / environment
0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40, verified on a clean detached checkout.Commands and results
cargo test -p xcl --lib --no-runexited 0 in 1m 03s outside the Arc lock. Cargo built the library test executable and emitted one deprecation warning forAtomicU32::fetch_update. This command only compiled the tests.Bypass. The variables identify the Arc lock script and the executable emitted by Cargo.^SKIPPEDcount).Observed behavior
The test compared the GPU destination register values and scalar condition code (SCC) against the test's RDNA2 ISA reference for 68 cases across 48 opcodes. All comparisons matched, including cases for arithmetic carry and overflow, masked shift counts, and SCC preservation. The wrapper acquired and released the Arc lock.
Not tested
Full GPU workspace suite and game smoke runs were omitted.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr620-focused.log and published.
@DavidM1911 on GitHub · 2026-11-25 12:46 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). 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.