Recompiler: implement S_QUADMASK_B32 and S_QUADMASK_B64 #1473

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

@⁠hajduzsolt on GitHub · 2026-11-24 16:38 UTC · original
hajduzsolt:fix/recomp-quadmask → main · +59 −0 · 2 files · 1 commits · open

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs:
  • Implements s_quadmask_b32 in salu, computing an 8-bit quad mask from SSRC0 into SDST and setting SCC if non-zero.
  • Implements s_quadmask_b64 in salu64, packing low and high 8-bit quad masks into the low dword of the 64-bit SDST with the high dword cleared to 0 and SCC set if non-zero.
  • Adds quadmask branchless bit-compression helper in the HLSL preamble.
  • crates/xcl/src/gpu/recomp/tests.rs:
  • Adds scalar_quadmask_b32_and_b64 unit test verifying generated HLSL translation and DXC compilation.
  • Adds gpu_scalar_quadmask hardware execution test on AMD Radeon RX 9070 XT verifying zero masks, multi-quad bit patterns, full masks, 64-bit pair packing, and SCC flags.

Tested

  • Hardware: AMD Radeon RX 9070 XT 16GB, AMD Ryzen 7 9800X3D, Windows 11 x64, rustc 1.98.1, debug
  • cargo test --workspace -- --test-threads=2: passed
  • cargo test -p xcl --lib quadmask: 2 passed, 0 failed

Regression run

main:

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1679 (PresentX 1679)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14840 MB

PR:

xcl-smoke v1
commit: be1fa02b4d90d43cdcd9ad5dfb3d32e2c5e9973e
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14842 MB

Not tested

  • RDNA3 / Wave32 fallback configurations.

AI use

  • Antigravity (Gemini) wrote the implementation and synthetic unit tests.
**@⁠hajduzsolt** on GitHub · 2026-11-24 16:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/1473) `hajduzsolt:fix/recomp-quadmask` → `main` · +59 −0 · 2 files · 1 commits · open **What is in it** - `crates/xcl/src/gpu/recomp/emit.rs`: - Implements `s_quadmask_b32` in `salu`, computing an 8-bit quad mask from SSRC0 into SDST and setting SCC if non-zero. - Implements `s_quadmask_b64` in `salu64`, packing low and high 8-bit quad masks into the low dword of the 64-bit SDST with the high dword cleared to 0 and SCC set if non-zero. - Adds `quadmask` branchless bit-compression helper in the HLSL preamble. - `crates/xcl/src/gpu/recomp/tests.rs`: - Adds `scalar_quadmask_b32_and_b64` unit test verifying generated HLSL translation and DXC compilation. - Adds `gpu_scalar_quadmask` hardware execution test on AMD Radeon RX 9070 XT verifying zero masks, multi-quad bit patterns, full masks, 64-bit pair packing, and SCC flags. **Tested** - Hardware: AMD Radeon RX 9070 XT 16GB, AMD Ryzen 7 9800X3D, Windows 11 x64, rustc 1.98.1, debug - `cargo test --workspace -- --test-threads=2`: passed - `cargo test -p xcl --lib quadmask`: 2 passed, 0 failed **Regression run** main: ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1679 (PresentX 1679) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14840 MB ``` PR: ``` xcl-smoke v1 commit: be1fa02b4d90d43cdcd9ad5dfb3d32e2c5e9973e gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1677 (PresentX 1677) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14842 MB ``` **Not tested** - RDNA3 / Wave32 fallback configurations. **AI use** - Antigravity (Gemini) wrote the implementation and synthetic unit tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:54:54 +00:00
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-24 16:43 UTC · original

Quad-mask results on native and split waves at be1fa02

Both new quad-mask tests passed on integrated AMD Radeon graphics and the RTX 5090. I also ran a temporary probe that compared both opcodes with a CPU implementation of AMD’s quad-mask rule. It checked each of the 64 single-bit positions plus six other masks, including zero, all ones, and a high-word-only pattern. The probe checked result bits, SCC, and clearing the upper destination dword for S_QUADMASK_B64.

Tested

  • Clean head be1fa02b4d90d43cdcd9ad5dfb3d32e2c5e9973e, Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, Radeon(TM) Graphics (32.0.21042.62), RTX 5090 (617.42), Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug/test profiles.
  • cargo test --locked -p xcl --lib quadmask -- --nocapture --test-threads=1 reported 2 passed, 0 failed on each adapter, with no skips.
  • The temporary probe_quadmask_all_input_bit_positions using the same Cargo test invocation passed 70 input patterns per mode. AMD ran wave32 and native wave64. NVIDIA ran wave32 and split wave64. All results matched the CPU reference.
  • cargo build --workspace --locked and cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output passed on the RTX 5090. Total 772 passed, 0 failed, 41 ignored. The count includes two no wave64 skips: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware.

Not tested

  • Retail-title smoke runs, performance, or the original instructions on Xbox hardware. The GPU checks used shaders translated by XCL.

AI use

  • OpenAI Codex (GPT-6, exact model variant unavailable) ran the tests, wrote the temporary probe, and prepared this report.
**@⁠nnonno91** on GitHub · 2026-11-24 16:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1473#issuecomment-7138114534) ### Quad-mask results on native and split waves at `be1fa02` Both new quad-mask tests passed on integrated AMD Radeon graphics and the RTX 5090. I also ran a temporary probe that compared both opcodes with a CPU implementation of AMD’s quad-mask rule. It checked each of the 64 single-bit positions plus six other masks, including zero, all ones, and a high-word-only pattern. The probe checked result bits, SCC, and clearing the upper destination dword for `S_QUADMASK_B64`. **Tested** - Clean head `be1fa02b4d90d43cdcd9ad5dfb3d32e2c5e9973e`, Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, Radeon(TM) Graphics (32.0.21042.62), RTX 5090 (617.42), Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug/test profiles. - `cargo test --locked -p xcl --lib quadmask -- --nocapture --test-threads=1` reported **2 passed, 0 failed** on each adapter, with no skips. - The temporary `probe_quadmask_all_input_bit_positions` using the same Cargo test invocation passed **70 input patterns per mode**. AMD ran wave32 and native wave64. NVIDIA ran wave32 and split wave64. All results matched the CPU reference. - `cargo build --workspace --locked` and `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output` passed on the RTX 5090. Total **772 passed, 0 failed, 41 ignored**. The count includes two `no wave64` skips: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware`. **Not tested** - Retail-title smoke runs, performance, or the original instructions on Xbox hardware. The GPU checks used shaders translated by XCL. **AI use** - OpenAI Codex (GPT-6, exact model variant unavailable) ran the tests, wrote the temporary probe, and prepared this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 18:53 UTC · original

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

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

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 18:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1473#issuecomment-7141289524) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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