Tests: check scalar ALU results and SCC on the GPU against the ISA #615

Open
acaracargo wants to merge 1 commit from upstream-pr/620 into main
acaracargo commented 2026-11-24 02:35:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by acaracargo on 2026-11-24T02:35:21Z.


About 80 SALU instructions are translated in emit.rs but 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_reference and gpu_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.
  • Opcodes: s_abs / s_absdiff, the SOPK s_addk / s_mulk / s_movk / s_cmovk, s_bcnt0, s_bfm, s_bitcmp0/1, s_bitset0, s_brev (32 and 64), s_cmov (32 and 64), s_ff0, s_lshl1..4_add, s_mul_hi (u32 and i32), s_pack_ll / lh / hh, s_sext (i8, i16), s_wqm (32 and 64), s_nand / nor / xnor / orn2 / andn2 / xor / or / not, s_ashr (i32 and i64), s_lshr_b64, s_min / s_max (i32, u32), s_sub_i32, s_cselect_b64 and s_cmp_lg_u64.
  • s_min / s_max get no equal operands. The RDNA2 ISA only says "set SCC iff the first value is selected", which does not say what a tie selects.

Tested

  • NVIDIA GeForce RTX 4060 (32-lane waves only), driver 610.88; Intel Core i5-13400F; Windows 11 Pro 26300; Rust 1.100.0 x86_64-pc-windows-msvc; DXC 1.9.2602.17 from the Windows SDK; debug.
  • cargo test --workspace -- --test-threads=4 on 0e158e4: 685 passed, 0 failed, 41 ignored. On main 9ce2070: 684 / 0 / 41.
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).
  • Two local mutation checks caused the test to fail as expected (reverted): s_ff0_i32_b32 scanning the wrong bits, and s_pack_hh_b32_b16 writing SCC.

Regression run

  • Test-only change, no runtime regression run.

Not tested

  • AMD GPUs and native wave64. Here the programs ran in the split wave64 form.
  • Console hardware. The expected values come from the ISA's descriptions, not from a console.
  • s_min / s_max SCC on equal operands.

AI use

  • Claude Code (Claude Fable) wrote the test and the original description and ran the tests and the mutation checks.
<!-- greyfinch-sync:ivall/xcl:issue:5465012888 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/620). Originally posted by [acaracargo](https://github.com/acaracargo) on 2026-11-24T02:35:21Z. --- About 80 SALU instructions are translated in `emit.rs` but 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_reference` and `gpu_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. - Opcodes: s_abs / s_absdiff, the SOPK s_addk / s_mulk / s_movk / s_cmovk, s_bcnt0, s_bfm, s_bitcmp0/1, s_bitset0, s_brev (32 and 64), s_cmov (32 and 64), s_ff0, s_lshl1..4_add, s_mul_hi (u32 and i32), s_pack_ll / lh / hh, s_sext (i8, i16), s_wqm (32 and 64), s_nand / nor / xnor / orn2 / andn2 / xor / or / not, s_ashr (i32 and i64), s_lshr_b64, s_min / s_max (i32, u32), s_sub_i32, s_cselect_b64 and s_cmp_lg_u64. - s_min / s_max get no equal operands. The RDNA2 ISA only says "set SCC iff the first value is selected", which does not say what a tie selects. **Tested** - NVIDIA GeForce RTX 4060 (32-lane waves only), driver 610.88; Intel Core i5-13400F; Windows 11 Pro 26300; Rust 1.100.0 `x86_64-pc-windows-msvc`; DXC 1.9.2602.17 from the Windows SDK; debug. - `cargo test --workspace -- --test-threads=4` on `0e158e4`: 685 passed, 0 failed, 41 ignored. On `main` `9ce2070`: 684 / 0 / 41. - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64). - Two local mutation checks caused the test to fail as expected (reverted): `s_ff0_i32_b32` scanning the wrong bits, and `s_pack_hh_b32_b16` writing SCC. **Regression run** - Test-only change, no runtime regression run. **Not tested** - AMD GPUs and native wave64. Here the programs ran in the split wave64 form. - Console hardware. The expected values come from the ISA's descriptions, not from a console. - s_min / s_max SCC on equal operands. **AI use** - Claude Code (Claude Fable) wrote the test and the original description and ran the tests and the mutation checks.
MesshM commented 2026-11-24 07:05:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T02:46:37Z.


Test run of 0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40 on AMD RDNA4; the PR was tested on NVIDIA only. I merged it onto current main 3db536e locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 687 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 647 passed, 0 failed, 21 ignored
  • 0 SKIPPED; gpu_scalar_alu_results_and_scc passes.

Review: I spot-checked salu_reference against the RDNA2 pseudo-code: SCC = result ≠ 0 for s_abs, s_absdiff, s_bcnt0, s_wqm and the nand/nor/xnor/orn2/andn2 cases; no SCC write for s_bfm, s_brev, s_sext, s_mul_hi, s_pack_*; s_bitcmp0/1 test bit S1[4:0]; s_ff0 gives −1 with no zero bit; s_pack_hh is {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 onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

<!-- greyfinch-sync:ivall/xcl:comment:7120468512 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/620#issuecomment-7120468512). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T02:46:37Z. --- Test run of `0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40` on AMD RDNA4; the PR was tested on NVIDIA only. I merged it onto current `main` `3db536e` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **687 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 647 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `gpu_scalar_alu_results_and_scc` passes. **Review:** I spot-checked `salu_reference` against the RDNA2 pseudo-code: SCC = result ≠ 0 for `s_abs`, `s_absdiff`, `s_bcnt0`, `s_wqm` and the `nand`/`nor`/`xnor`/`orn2`/`andn2` cases; no SCC write for `s_bfm`, `s_brev`, `s_sext`, `s_mul_hi`, `s_pack_*`; `s_bitcmp0/1` test bit `S1[4:0]`; `s_ff0` gives −1 with no zero bit; `s_pack_hh` is `{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 onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
caua-an commented 2026-11-24 07:05:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by caua-an on 2026-11-24T02:47:29Z.


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 of XCL_ADAPTER=intel and XCL_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.

<!-- greyfinch-sync:ivall/xcl:comment:7120481962 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/620#issuecomment-7120481962). Originally posted by [caua-an](https://github.com/caua-an) on 2026-11-24T02:47:29Z. --- **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 of `XCL_ADAPTER=intel` and `XCL_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 commented 2026-11-24 10:04:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by 4usphs on 2026-11-24T09:35:23Z.


Measured on RDNA2 hardware, for the two points under Not tested: console-generation hardware instead of the ISA text, and s_min / s_max SCC 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 OpenCL 3652.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|1 sets SCC, the instruction runs on SGPR operands with the destination preset to the case's d, and s_cselect_b32 1, 0 reads 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 of salu_reference from this PR.

Result.

  • All 68 cases in gpu_scalar_alu_results_and_scc match the hardware, results and SCC, including SCC kept by the instructions that do not write it.
  • s_min / s_max on equal operands: SCC = 0, whatever SCC was before. This holds for s_min_i32, s_max_i32, s_min_u32 and s_max_u32, each with 5 values (5, 0, -3, 0x80000000, 0xFFFFFFFF) and SCC 0 and 1 before (40 cases). That is the strict < / > that emit.rs uses (lines 1262–1265 on main 077ce40) 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 above S_MIN_U32 could be added with SCC = 0.

For comparison, the same probe on an RX 9070 XT (gfx1201, RDNA4, OpenCL 3686.0) gives the same results. The exception is s_ff0_i32_b32, which RDNA4's assembler refuses (removed there), so 66 of the 68 cases ran on it.

Not tested: the console itself (gfx1036 is a desktop RDNA2 APU of the same generation), RDNA1, this PR's D3D12 test on this GPU.

Kernel shape (one case)
{ uint d = 0x0u; uint sc; uint a = 0x5u; uint b = 0x5u;
  __asm__ volatile("s_cmp_eq_u32 0, 1\ns_min_i32 %0, %2, %3\ns_cselect_b32 %1, 1, 0"
                   : "+s"(d), "=&s"(sc) : "s"(a), "s"(b));
  o[4*i] = d; o[4*i+2] = sc; }

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.

<!-- greyfinch-sync:ivall/xcl:comment:7127621114 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/620#issuecomment-7127621114). Originally posted by [4usphs](https://github.com/4usphs) on 2026-11-24T09:35:23Z. --- Measured on RDNA2 hardware, for the two points under **Not tested**: console-generation hardware instead of the ISA text, and `s_min` / `s_max` SCC 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 OpenCL `3652.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|1` sets SCC, the instruction runs on SGPR operands with the destination preset to the case's `d`, and `s_cselect_b32 1, 0` reads 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 of `salu_reference` from this PR. **Result.** - **All 68 cases in `gpu_scalar_alu_results_and_scc` match the hardware**, results and SCC, including SCC kept by the instructions that do not write it. - **`s_min` / `s_max` on equal operands: SCC = 0**, whatever SCC was before. This holds for `s_min_i32`, `s_max_i32`, `s_min_u32` and `s_max_u32`, each with 5 values (`5`, `0`, `-3`, `0x80000000`, `0xFFFFFFFF`) and SCC 0 and 1 before (40 cases). That is the strict `<` / `>` that `emit.rs` uses (lines 1262–1265 on `main` `077ce40`) 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 above `S_MIN_U32` could be added with SCC = 0. For comparison, the same probe on an RX 9070 XT (`gfx1201`, RDNA4, OpenCL `3686.0`) gives the same results. The exception is `s_ff0_i32_b32`, which RDNA4's assembler refuses (removed there), so 66 of the 68 cases ran on it. **Not tested:** the console itself (`gfx1036` is a desktop RDNA2 APU of the same generation), RDNA1, this PR's D3D12 test on this GPU. <details><summary>Kernel shape (one case)</summary> ```c { uint d = 0x0u; uint sc; uint a = 0x5u; uint b = 0x5u; __asm__ volatile("s_cmp_eq_u32 0, 1\ns_min_i32 %0, %2, %3\ns_cselect_b32 %1, 1, 0" : "+s"(d), "=&s"(sc) : "s"(a), "s"(b)); o[4*i] = d; o[4*i+2] = sc; } ``` </details> **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 commented 2026-11-25 07:05:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T06:36:59Z.


Empirical test report (0e158e4b)

Hardware / environment

  • PR #620 head: 0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40, verified on a clean detached checkout.
  • Intel Arc A770 Graphics, driver 32.0.101.9175. AMD Ryzen 7 3800X 8-Core Processor. Windows x64, OS build 26200 (10.0.26200.0).
  • Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), unoptimized test profile with debug info and incremental compilation disabled. DXC and DXIL 1.9.2609.5, compiler revision 01b62ad4, confirmed in the focused run.

Commands and results

  • cargo test -p xcl --lib --no-run exited 0 in 1m 03s outside the Arc lock. Cargo built the library test executable and emitted one deprecation warning for AtomicU32::fetch_update. This command only compiled the tests.
  • Ran the following in PowerShell with execution policy Bypass. The variables identify the Arc lock script and the executable emitted by Cargo.
$env:XCL_ADAPTER = 'A770'
$env:RUST_TEST_NOCAPTURE = '1'
& $env:XCL_PR620_ARC_WRAPPER -Test {
    & $env:XCL_PR620_TEST_EXE gpu::recomp::tests::gpu_scalar_alu_results_and_scc --exact --nocapture --test-threads=1
}
  • The lock wrapper exited 0. Rust reported 1 passed, 0 failed, 0 ignored and 665 filtered out in 0.40 s. The UTF-8 log contained 0 skipped (case-sensitive ^SKIPPED count).

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.

<!-- greyfinch-sync:ivall/xcl:comment:7154976897 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/620#issuecomment-7154976897). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T06:36:59Z. --- ### Empirical test report (0e158e4b) **Hardware / environment** - PR #620 head: `0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40`, verified on a clean detached checkout. - Intel Arc A770 Graphics, driver 32.0.101.9175. AMD Ryzen 7 3800X 8-Core Processor. Windows x64, OS build 26200 (10.0.26200.0). - Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), unoptimized test profile with debug info and incremental compilation disabled. DXC and DXIL 1.9.2609.5, compiler revision 01b62ad4, confirmed in the focused run. **Commands and results** - `cargo test -p xcl --lib --no-run` exited 0 in 1m 03s outside the Arc lock. Cargo built the library test executable and emitted one deprecation warning for `AtomicU32::fetch_update`. This command only compiled the tests. - Ran the following in PowerShell with execution policy `Bypass`. The variables identify the Arc lock script and the executable emitted by Cargo. ```powershell $env:XCL_ADAPTER = 'A770' $env:RUST_TEST_NOCAPTURE = '1' & $env:XCL_PR620_ARC_WRAPPER -Test { & $env:XCL_PR620_TEST_EXE gpu::recomp::tests::gpu_scalar_alu_results_and_scc --exact --nocapture --test-threads=1 } ``` - The lock wrapper exited 0. Rust reported **1 passed, 0 failed, 0 ignored** and 665 filtered out in 0.40 s. The UTF-8 log contained **0 skipped** (case-sensitive `^SKIPPED ` count). **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 commented 2026-11-25 13:05:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T12:46:00Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7162825248 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/620#issuecomment-7162825248). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T12:46:00Z. --- 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!
afpruivo commented 2026-11-28 12:05:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by afpruivo on 2026-11-28T12:05:15Z.


Test report on RTX 3090: gpu_scalar_alu_results_and_scc passes, on the PR's head and merged onto current main.

Tested

  • NVIDIA GeForce RTX 3090 24 GB, driver 621.40, i5-13600K, Windows 11 Pro 26300, Rust 1.99.1, debug.
  • PR head 0e158e4b: cargo test -p xcl --lib gpu_scalar -- --test-threads=4: 3 passed, 0 failed.
  • Merged onto main e429936c (no conflicts; local merge 80607879):
    • cargo test -p xcl --lib gpu_scalar_alu: 1 passed.
    • cargo test --workspace --no-fail-fast -- --test-threads=4: 2127 passed, 10 failed, 48 ignored. Lib: 1996 passed, 6 failed, 28 ignored.
  • All the failures also fail on main e429936c on this card, so none comes from this PR:
    • split::tests::dispatch_chain_{oversized_loop_matches_whole,wave32_live_loops,wave64_live_loops_and_exchange}, gpu_heap_flat_reads_match_guarded_and_root_output, gpu_compute_mode_dispatch_abi, gpu_float_cas_uses_ieee_equality and test_title_runs_and_game_folder_is_untouched fail on every run.
    • incomplete_discovered_corpus_blocks_headless_title_entry and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs are flaky on both trees. Across three runs of the pair, main failed in one run and the merged tree failed in all three.
  • SKIPPED: mostly "no wave64". Also: three f16 / conversion cases the per-lane form refuses, two debug-layer cases (no d3d12SDKLayers.dll), and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).

Review. I checked salu_reference against the RDNA2 ISA guide (PDF, §12.1 SOP2 and §12.2 SOPK):

  • S_BFM_B32: no SCC write, D = ((1 << S0[4:0]) - 1) << S1[4:0]. S_LSHLn_ADD_U32: SCC = unsigned carry. S_ABS / S_ABSDIFF / S_BCNT0 / the n-logic ops and the shifts: SCC = (D != 0). S_ADDK: overflow with a sign-extended SIMM16. S_MULK, S_MOVK, S_CMOVK and S_MUL_HI don't write SCC. All agree with the guide.
  • Min / max ties: the PDF guide's pseudo-code does settle them. It gives S_MAX_U32 as D.u = (S0.u > S1.u) ? S0.u : S1.u; SCC = (S0.u > S1.u), a strict compare, so equal operands give SCC = 0, and min follows the same pattern with <. That matches salu_reference as written, so tie cases (5, 5) could be added if you want them.

Not tested: AMD, and wave64 hardware. I only reviewed the scalar part; this card can't cover wave64-only paths.

AI use: Claude Code (Claude Opus 5.5) ran the tests, checked the reference against the guide and drafted this. I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7238984198 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/620#issuecomment-7238984198). Originally posted by [afpruivo](https://github.com/afpruivo) on 2026-11-28T12:05:15Z. --- **Test report on RTX 3090: `gpu_scalar_alu_results_and_scc` passes, on the PR's head and merged onto current `main`.** **Tested** - NVIDIA GeForce RTX 3090 24 GB, driver 621.40, i5-13600K, Windows 11 Pro 26300, Rust 1.99.1, debug. - PR head `0e158e4b`: `cargo test -p xcl --lib gpu_scalar -- --test-threads=4`: 3 passed, 0 failed. - Merged onto `main` `e429936c` (no conflicts; local merge `80607879`): - `cargo test -p xcl --lib gpu_scalar_alu`: 1 passed. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 2127 passed, 10 failed, 48 ignored. Lib: 1996 passed, 6 failed, 28 ignored. - All the failures also fail on `main` `e429936c` on this card, so none comes from this PR: - `split::tests::dispatch_chain_{oversized_loop_matches_whole,wave32_live_loops,wave64_live_loops_and_exchange}`, `gpu_heap_flat_reads_match_guarded_and_root_output`, `gpu_compute_mode_dispatch_abi`, `gpu_float_cas_uses_ieee_equality` and `test_title_runs_and_game_folder_is_untouched` fail on every run. - `incomplete_discovered_corpus_blocks_headless_title_entry` and `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` are flaky on both trees. Across three runs of the pair, `main` failed in one run and the merged tree failed in all three. - SKIPPED: mostly "no wave64". Also: three f16 / conversion cases the per-lane form refuses, two debug-layer cases (no `d3d12SDKLayers.dll`), and `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). **Review.** I checked `salu_reference` against the RDNA2 ISA guide (PDF, §12.1 SOP2 and §12.2 SOPK): - S_BFM_B32: no SCC write, D = ((1 << S0[4:0]) - 1) << S1[4:0]. S_LSHLn_ADD_U32: SCC = unsigned carry. S_ABS / S_ABSDIFF / S_BCNT0 / the n-logic ops and the shifts: SCC = (D != 0). S_ADDK: overflow with a sign-extended SIMM16. S_MULK, S_MOVK, S_CMOVK and S_MUL_HI don't write SCC. All agree with the guide. - **Min / max ties:** the PDF guide's pseudo-code does settle them. It gives S_MAX_U32 as `D.u = (S0.u > S1.u) ? S0.u : S1.u; SCC = (S0.u > S1.u)`, a strict compare, so equal operands give SCC = 0, and min follows the same pattern with `<`. That matches `salu_reference` as written, so tie cases (`5, 5`) could be added if you want them. **Not tested:** AMD, and wave64 hardware. I only reviewed the scalar part; this card can't cover wave64-only paths. AI use: Claude Code (Claude Opus 5.5) ran the tests, checked the reference against the guide and drafted this. I checked it before posting.
saintwolf commented 2026-11-30 02:57:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T02:57:41Z.


merge-check claim
head: 0e158e4bed

<!-- greyfinch-sync:ivall/xcl:comment:7267465782 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/620#issuecomment-7267465782). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T02:57:41Z. --- merge-check claim head: 0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40
relativespace2K commented 2026-11-30 03:03:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by relativespace2K on 2026-11-30T03:03:17Z.


merge-check
base: 53e85fb1
head: 0e158e4bed
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2789 passed, 6 failed, 49 ignored; failing: gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form, gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, ram_budget::tests::windows_takes_a_working_set_maximum_and_lifts_it, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (in --test gpu_two_pass_cache_e2e, so 5 failing tests give 6 failures). The same five fail on base 53e85fb1 alone (2788 passed, 6 failed, 49 ignored there), so none comes from this PR; its new GPU test passed here and is not among the SKIPPED lines, so it really ran on the RX 6800 XT. 13 SKIPPED lines, all environmental: no D3D12 debug layer / d3d12SDKLayers.dll, no heap windows, no GPU_UPLOAD, per-lane f16/f32 forms refused.
review: no blocking finding; one file, every line read. The reference is written in the test from the ISA's pseudo-code rather than borrowed from the translator, which is what makes it a check and not an echo: salu_reference computes result and SCC per instruction, w32 keeps the untouched upper half of a 64-bit destination, and every case carries the SCC going in so an instruction that does not write SCC is checked for leaving it alone. The cases pick the edges that matter (sign, carry, 0x8000_0000, shift counts past 31 and 63, all-ones, all-zero) and SCC is read back into a register with S_CSELECT_B32, so the assertion covers the flag and not only the value. Ties are deliberately left out of S_MIN_*/S_MAX_* with a comment saying the ISA does not define which operand a tie selects, which is the right call for a test that must not encode a guess. No duplicate: #1576, #1057 and #1206 are the other GPU op coverage PRs and none of them runs these SALU instructions.
performance: none: tests only.
verdict: safe to merge
hardware / tool and model: AMD Radeon RX 6800 XT 16 GB (RDNA2, wave64), driver 32.0.21045.29003; Ryzen 5 5600, 32 GB RAM; Windows 10 IoT Enterprise LTSC 2024, 10.0.26100 build 26100.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build. DeepSeek Harness coding agent, model DeepSeek V4.1 Flash.

<!-- greyfinch-sync:ivall/xcl:comment:7267545451 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/620#issuecomment-7267545451). Originally posted by [relativespace2K](https://github.com/relativespace2K) on 2026-11-30T03:03:17Z. --- merge-check base: 53e85fb1 head: 0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2789 passed, 6 failed, 49 ignored; failing: gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form, gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, ram_budget::tests::windows_takes_a_working_set_maximum_and_lifts_it, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (in `--test gpu_two_pass_cache_e2e`, so 5 failing tests give 6 failures). The same five fail on base 53e85fb1 alone (2788 passed, 6 failed, 49 ignored there), so none comes from this PR; its new GPU test passed here and is not among the SKIPPED lines, so it really ran on the RX 6800 XT. 13 SKIPPED lines, all environmental: no D3D12 debug layer / d3d12SDKLayers.dll, no heap windows, no GPU_UPLOAD, per-lane f16/f32 forms refused. review: no blocking finding; one file, every line read. The reference is written in the test from the ISA's pseudo-code rather than borrowed from the translator, which is what makes it a check and not an echo: `salu_reference` computes result and SCC per instruction, `w32` keeps the untouched upper half of a 64-bit destination, and every case carries the SCC going in so an instruction that does not write SCC is checked for leaving it alone. The cases pick the edges that matter (sign, carry, `0x8000_0000`, shift counts past 31 and 63, all-ones, all-zero) and SCC is read back into a register with `S_CSELECT_B32`, so the assertion covers the flag and not only the value. Ties are deliberately left out of `S_MIN_*`/`S_MAX_*` with a comment saying the ISA does not define which operand a tie selects, which is the right call for a test that must not encode a guess. No duplicate: #1576, #1057 and #1206 are the other GPU op coverage PRs and none of them runs these SALU instructions. performance: none: tests only. verdict: safe to merge hardware / tool and model: AMD Radeon RX 6800 XT 16 GB (RDNA2, wave64), driver 32.0.21045.29003; Ryzen 5 5600, 32 GB RAM; Windows 10 IoT Enterprise LTSC 2024, 10.0.26100 build 26100.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build. DeepSeek Harness coding agent, model DeepSeek V4.1 Flash.
saintwolf commented 2026-11-30 03:03:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T03:03:29Z.


merge-check
base: 53e85fb124
head: 0e158e4bed
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2793 passed, 1 failed, 49 ignored; SKIPPED: 30 (22 no wave64, 3 per-lane #1426 refused, 2 no heap windows, 2 no xgameruntime.dll, 1 cannot disable the driver cache 0x887A002D); failing: hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline (also fails on base 53e85fb1 alone)
review: none (read the full +206/-0 diff in crates/xcl/src/gpu/recomp/tests.rs: test-only addition covering 46 SALU instructions across 68 edge cases against salu_reference, checking both destination registers (including upper-half preservation for 32-bit writes) and SCC preservation/updates; gpu_scalar_alu_results_and_scc passed on RTX 4070 SUPER; no duplicates found; not tested: AMD/native wave64 or s_min/s_max equal-operand ties)
performance: none (test-only PR, no runtime changes)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4070 SUPER (32.0.16.2140), AMD Ryzen 7 7800X3D, Windows 11 Pro 26300, rustc 1.100.0, debug / Antigravity (Gemini 4 Hydrogen)

<!-- greyfinch-sync:ivall/xcl:comment:7267548206 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/620#issuecomment-7267548206). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-30T03:03:29Z. --- merge-check base: 53e85fb124eae624641e9884517e4f3c4a7d8794 head: 0e158e4bedb6314e5f8ba5b9490d8171e2d8fe40 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2793 passed, 1 failed, 49 ignored; SKIPPED: 30 (22 no wave64, 3 per-lane #1426 refused, 2 no heap windows, 2 no xgameruntime.dll, 1 cannot disable the driver cache 0x887A002D); failing: hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline (also fails on base 53e85fb1 alone) review: none (read the full +206/-0 diff in crates/xcl/src/gpu/recomp/tests.rs: test-only addition covering 46 SALU instructions across 68 edge cases against salu_reference, checking both destination registers (including upper-half preservation for 32-bit writes) and SCC preservation/updates; gpu_scalar_alu_results_and_scc passed on RTX 4070 SUPER; no duplicates found; not tested: AMD/native wave64 or s_min/s_max equal-operand ties) performance: none (test-only PR, no runtime changes) verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 4070 SUPER (32.0.16.2140), AMD Ryzen 7 7800X3D, Windows 11 Pro 26300, rustc 1.100.0, debug / Antigravity (Gemini 4 Hydrogen)
Foniass commented 2026-12-01 03:49:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:49:25Z.


Triage (#1607) – head 0e158e4

No open or merged PR tests these SALU opcodes against the ISA. #2091 runs many of the same opcodes, but compares the direct DXIL backend with the HLSL one rather than with a reference, so it is a different test.
No problems found in the diff: the reference results and SCC rules in salu_reference match the RDNA2 pseudo-code for each opcode (signed overflow for S_ADDK_I32 / S_SUB_I32, carry for S_LSHL*_ADD_U32, SCC kept for opcodes that do not write it), and ties for min/max are avoided as the comment says.
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:7300098994 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/620#issuecomment-7300098994). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:49:25Z. --- **Triage (#1607)** – head 0e158e4 No open or merged PR tests these SALU opcodes against the ISA. #2091 runs many of the same opcodes, but compares the direct DXIL backend with the HLSL one rather than with a reference, so it is a different test. No problems found in the diff: the reference results and SCC rules in `salu_reference` match the RDNA2 pseudo-code for each opcode (signed overflow for S_ADDK_I32 / S_SUB_I32, carry for S_LSHL*_ADD_U32, SCC kept for opcodes that do not write it), and ties for min/max are avoided as the comment says. 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/620:upstream-pr/620'
git switch 'upstream-pr/620'

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