Recompiler: lower V_MIN_U32, V_MAX_U32, V_MIN_I32, and V_MAX_I32 in p… #2321

Manually merged
github merged 1 commit from gh-pr/2321/head into gh-pr/2321/base 2026-11-26 05:27:23 +00:00
Owner

@⁠siam4201 on GitHub · 2026-11-25 14:09 UTC · original
siam4201:per-lane-int-minmax → main · +27 −1 · 1 files · 1 commits · merged 2026-11-25 18:37 UTC

Lower V_MIN_U32, V_MAX_U32, V_MIN_I32, and V_MAX_I32 in the per-lane Direct DXIL recompiler (recomp::lower).

What is in it

  • crates/xcl/src/gpu/recomp/lower.rs: added V_MIN_U32, V_MAX_U32, V_MIN_I32, and V_MAX_I32 to TWO_SOURCE and lowered them via icmp (Ult/Ugt/Slt/Sgt) + select
  • crates/xcl/src/gpu/recomp/lower.rs: added unit test integer_min_and_max covering signed/unsigned min and max edge cases

Tested

  • Hardware: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2101), AMD Ryzen 9 7900X, Windows, Rust 1.97.1
  • cargo test -p xcl --lib gpu::recomp::lower: 54 passed, 0 failed (including integer_min_and_max and integer_programs_on_the_gpu)
  • .\scripts\test.ps1 (cargo test --workspace -- --test-threads=4): 1095 passed, 4 failed (pre-existing fuzz_validate_and_gpu_0..3 E_OUTOFMEMORY #1905, same as main 568e7db), 26 ignored
  • Skipped GPU tests on this adapter: 14 no wave64, 3 per-lane form: refused (V_CVT_F16_F32, V_MUL_F16, V_PK_MUL_F16)

Regression run
main:

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 30
exit: 0x0
frames shown: 740 (PresentX 740)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15434 MB

PR head:

xcl-smoke v1
commit: 1b017c18138183a2a6d8dfff68b6a3dd259a5fec
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 30
exit: 0x0
frames shown: 735 (PresentX 735)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14734 MB

Not tested

  • Not tested on AMD RDNA / wave64 GPUs

AI use

  • Antigravity (Gemini 4 Neon)
**@⁠siam4201** on GitHub · 2026-11-25 14:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/2321) `siam4201:per-lane-int-minmax` → `main` · +27 −1 · 1 files · 1 commits · merged 2026-11-25 18:37 UTC Lower `V_MIN_U32`, `V_MAX_U32`, `V_MIN_I32`, and `V_MAX_I32` in the per-lane Direct DXIL recompiler (`recomp::lower`). **What is in it** - `crates/xcl/src/gpu/recomp/lower.rs`: added `V_MIN_U32`, `V_MAX_U32`, `V_MIN_I32`, and `V_MAX_I32` to `TWO_SOURCE` and lowered them via `icmp` (`Ult`/`Ugt`/`Slt`/`Sgt`) + `select` - `crates/xcl/src/gpu/recomp/lower.rs`: added unit test `integer_min_and_max` covering signed/unsigned min and max edge cases **Tested** - Hardware: NVIDIA GeForce RTX 5070 Ti (driver `32.0.16.2101`), AMD Ryzen 9 7900X, Windows, Rust `1.97.1` - `cargo test -p xcl --lib gpu::recomp::lower`: 54 passed, 0 failed (including `integer_min_and_max` and `integer_programs_on_the_gpu`) - `.\scripts\test.ps1` (`cargo test --workspace -- --test-threads=4`): 1095 passed, 4 failed (pre-existing `fuzz_validate_and_gpu_0..3` `E_OUTOFMEMORY` #1905, same as `main` `568e7db`), 26 ignored - Skipped GPU tests on this adapter: 14 `no wave64`, 3 `per-lane form: refused` (`V_CVT_F16_F32`, `V_MUL_F16`, `V_PK_MUL_F16`) **Regression run** `main`: ``` xcl-smoke v1 commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb gpu: NVIDIA GeForce RTX 5070 Ti title: 9cc6a39e seconds: 30 exit: 0x0 frames shown: 740 (PresentX 740) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15434 MB ``` PR head: ``` xcl-smoke v1 commit: 1b017c18138183a2a6d8dfff68b6a3dd259a5fec gpu: NVIDIA GeForce RTX 5070 Ti title: 9cc6a39e seconds: 30 exit: 0x0 frames shown: 735 (PresentX 735) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14734 MB ``` **Not tested** - Not tested on AMD RDNA / wave64 GPUs **AI use** - Antigravity (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:27:21 +00:00
github manually merged commit 1b017c1813 into gh-pr/2321/base 2026-11-26 05:27:23 +00:00
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-25 14:17 UTC · original

Independent GPU readback of all four per-lane integer min/max instructions on 1b017c18138183a2a6d8dfff68b6a3dd259a5fec.

Tested

  • Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC, unoptimized profiles. AMD Radeon(TM) Graphics driver 32.0.21042.62 and GeForce RTX 5090 driver 32.0.16.1742. Windows SDK DXC/DXIL 1.8.2502.11.
  • cargo test --locked -p xcl --lib integer_min_and_max -- --nocapture --test-threads=1 gave 1 passed, 0 failed on the unchanged head.
  • I added a temporary local_integer_min_max_gpu fixture in recomp/lower_dxil.rs. It invoked the per-lane DXIL kernel directly, then checked all four GPU outputs for each of 32 lanes against Rust signed and unsigned min/max. Inputs included signed extremes, both argument orders, equal values and all-ones versus zero. cargo test --locked -p xcl --lib gpu::recomp::lower_dxil::tests::local_integer_min_max_gpu -- --exact --nocapture --test-threads=1 gave 1 passed, 0 failed with each of XCL_ADAPTER=AMD Radeon and XCL_ADAPTER=NVIDIA GeForce RTX 5090. The runner confirmed the selected adapters and all 128 readbacks matched on each. No ignores or skips. The fixture was removed afterward.

Not tested

Native wave64 execution of this fixture, a retail title, and the full workspace suite.

AI use

OpenAI Codex (GPT-6.2 Sol) ran the checks, verified the logs and wrote this report.

**@⁠nnonno91** on GitHub · 2026-11-25 14:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7165043618) Independent GPU readback of all four per-lane integer min/max instructions on `1b017c18138183a2a6d8dfff68b6a3dd259a5fec`. **Tested** - Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC, unoptimized profiles. AMD Radeon(TM) Graphics driver 32.0.21042.62 and GeForce RTX 5090 driver 32.0.16.1742. Windows SDK DXC/DXIL 1.8.2502.11. - `cargo test --locked -p xcl --lib integer_min_and_max -- --nocapture --test-threads=1` gave 1 passed, 0 failed on the unchanged head. - I added a temporary `local_integer_min_max_gpu` fixture in `recomp/lower_dxil.rs`. It invoked the per-lane DXIL kernel directly, then checked all four GPU outputs for each of 32 lanes against Rust signed and unsigned min/max. Inputs included signed extremes, both argument orders, equal values and all-ones versus zero. `cargo test --locked -p xcl --lib gpu::recomp::lower_dxil::tests::local_integer_min_max_gpu -- --exact --nocapture --test-threads=1` gave 1 passed, 0 failed with each of `XCL_ADAPTER=AMD Radeon` and `XCL_ADAPTER=NVIDIA GeForce RTX 5090`. The runner confirmed the selected adapters and all 128 readbacks matched on each. No ignores or skips. The fixture was removed afterward. **Not tested** Native wave64 execution of this fixture, a retail title, and the full workspace suite. **AI use** OpenAI Codex (GPT-6.2 Sol) ran the checks, verified the logs and wrote this report.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-25 14:28 UTC · original

Independent RDNA2 native-wave64 verification of exact PR head 1b017c18138183a2a6d8dfff68b6a3dd259a5fec.

Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver 30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=wave64; isolated debug Cargo target.

Clean-head tests: gpu::recomp::lower::tests::integer_min_and_max passed 1/0/0 (the four new signed/unsigned operations in the CPU-side unit fixture). gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu passed 1/0/0, with no SKIPPED line. That GPU fixture executes native wave64 and wave32, checks the HLSL path, and compares per-lane DXIL register readback against it. In the unchanged fixture, its integer program includes V_MIN_I32 and V_MAX_U32.

Local fixture extension: I inserted V_MIN_U32 and V_MAX_I32 into INT_ARITHMETIC as two additional output registers, leaving production code untouched. The same GPU test again passed 1/0/0 without skips on the selected RX 6800M, comparing all four new operations on wave32 and native wave64. This second result is from a local test-only change, separate from the clean-head results. I removed the two lines and verified the worktree is clean afterward.

Limits: Focused synthetic tests only. I did not run the full workspace suite, a title smoke pair, or GPU timing on this head.

AI use: OpenAI Codex (GPT-6; exact variant unavailable in this session) ran the native Windows checks, made and restored the test-only extension, and drafted this report. No game data was used.

**@⁠luckyteagirl** on GitHub · 2026-11-25 14:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7165336926) Independent RDNA2 native-wave64 verification of exact PR head `1b017c18138183a2a6d8dfff68b6a3dd259a5fec`. **Environment:** Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver `30.0.13002.13003`; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. `XCL_ADAPTER=6800M`, `XCL_REQUIRE_GPU=wave64`; isolated debug Cargo target. **Clean-head tests:** `gpu::recomp::lower::tests::integer_min_and_max` passed **1/0/0** (the four new signed/unsigned operations in the CPU-side unit fixture). `gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu` passed **1/0/0**, with no `SKIPPED` line. That GPU fixture executes native wave64 and wave32, checks the HLSL path, and compares per-lane DXIL register readback against it. In the unchanged fixture, its integer program includes `V_MIN_I32` and `V_MAX_U32`. **Local fixture extension:** I inserted `V_MIN_U32` and `V_MAX_I32` into `INT_ARITHMETIC` as two additional output registers, leaving production code untouched. The same GPU test again passed **1/0/0** without skips on the selected RX 6800M, comparing all four new operations on wave32 and native wave64. This second result is from a local test-only change, separate from the clean-head results. I removed the two lines and verified the worktree is clean afterward. **Limits:** Focused synthetic tests only. I did not run the full workspace suite, a title smoke pair, or GPU timing on this head. **AI use:** OpenAI Codex (GPT-6; exact variant unavailable in this session) ran the native Windows checks, made and restored the test-only extension, and drafted this report. No game data was used.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 14:38 UTC · original

Wine/vkd3d-proton lane: verified, clean (RDNA3).

Tested: current PR head merged onto current origin/main (auto-merge, clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

  • gpu_ suite (--release --locked, --test-threads=2): 142 passed / 3 failed / 1 ignored, identical to plain origin/main on this rig (the 3 are the rig's known baseline: fuzz seed 1003 of #2115, gpu_nonfused_mad_and_mac_prevent_fma_contraction, gpu_depth_buffer_created_for_unordered_access_is_placed).
  • Targeted rerun of the new test: integer_min_and_max passes on this lane too.

Complements the NVIDIA and Windows RDNA2 rows with the Wine/vkd3d-proton data point; the lowering behaves the same under RADV translated through the XCL patch.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-25 14:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7165590479) **Wine/vkd3d-proton lane: verified, clean (RDNA3).** **Tested**: current PR head merged onto current `origin/main` (auto-merge, clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target `x86_64-pc-windows-gnu` run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29). - `gpu_` suite (`--release --locked`, `--test-threads=2`): 142 passed / 3 failed / 1 ignored, identical to plain `origin/main` on this rig (the 3 are the rig's known baseline: fuzz seed 1003 of #2115, `gpu_nonfused_mad_and_mac_prevent_fma_contraction`, `gpu_depth_buffer_created_for_unordered_access_is_placed`). - Targeted rerun of the new test: `integer_min_and_max` passes on this lane too. Complements the NVIDIA and Windows RDNA2 rows with the Wine/vkd3d-proton data point; the lowering behaves the same under RADV translated through the XCL patch. **Not tested**: retail titles (no title data on this lane, counts only). **AI use**: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 15:26 UTC · original

Independent AMD report for 1b017c18138183a2a6d8dfff68b6a3dd259a5fec.

Tested

  • AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 build 26200, rustc 1.100.0, debug profile for tests, release for smoke. Tested at the exact PR head (not a local merge onto main).
  • cargo test -p xcl --lib integer_min_and_max: 1 passed, 0 failed.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1154 passed, 1 failed, 46 ignored. The one failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722: res[30] = 0x1, CPU 0x7fffffff). It fails identically on main 06c9f550 on this adapter (cargo test -p xcl --lib fuzz_validate_and_gpu_1), so it is not caused by this PR.
  • SKIPPED lines in the log: 7 (6 of them f16_programs_on_the_gpu / f32_programs_on_the_gpu per-lane cases refused for V_MUL_F16, V_PK_MUL_F16 or V_CVT_F16_F32, plus heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • scripts/smoke.ps1 -Seconds 60 on a real title (same title, same time), release build. main 06c9f550: 1531 frames, last presents per 2 s 60 36 38, peak commit 17752 MB, no device removal, no crash. PR head 1b017c18: 1523 frames, last presents per 2 s 60 60 60, peak commit 17127 MB, no device removal, no crash. Both exit 0x0.

Not tested

Per-lane GPU readback of the four instructions beyond the PR's own test, a title that reaches these instructions, other adapters.

AI use

Claude Code (Claude Sonnet 5.5) ran the tests and the smoke runs and wrote this report. No game files, dumps or shader names are included.

**@⁠oni-swr** on GitHub · 2026-11-25 15:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7166842420) Independent AMD report for `1b017c18138183a2a6d8dfff68b6a3dd259a5fec`. **Tested** - AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 build 26200, rustc 1.100.0, debug profile for tests, release for smoke. Tested at the exact PR head (not a local merge onto `main`). - `cargo test -p xcl --lib integer_min_and_max`: 1 passed, 0 failed. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1154 passed, 1 failed, 46 ignored. The one failure is `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` (seed 722: `res[30] = 0x1, CPU 0x7fffffff`). It fails identically on `main` `06c9f550` on this adapter (`cargo test -p xcl --lib fuzz_validate_and_gpu_1`), so it is not caused by this PR. - SKIPPED lines in the log: 7 (6 of them `f16_programs_on_the_gpu` / `f32_programs_on_the_gpu` per-lane cases refused for `V_MUL_F16`, `V_PK_MUL_F16` or `V_CVT_F16_F32`, plus `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `scripts/smoke.ps1 -Seconds 60` on a real title (same title, same time), release build. main `06c9f550`: 1531 frames, last presents per 2 s 60 36 38, peak commit 17752 MB, no device removal, no crash. PR head `1b017c18`: 1523 frames, last presents per 2 s 60 60 60, peak commit 17127 MB, no device removal, no crash. Both exit 0x0. **Not tested** Per-lane GPU readback of the four instructions beyond the PR's own test, a title that reaches these instructions, other adapters. **AI use** Claude Code (Claude Sonnet 5.5) ran the tests and the smoke runs and wrote this report. No game files, dumps or shader names are included.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 17:55 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!

**@⁠DavidM1911** on GitHub · 2026-11-25 17:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7170183512) 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!
This discussion has been locked. Commenting is limited to contributors.
No description provided.