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

Merged
siam4201 merged 1 commit from upstream-pr/2321 into main 2026-11-25 18:37:48 +00:00
siam4201 commented 2026-11-25 14:09:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by siam4201 on 2026-11-25T14:09:05Z.


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)
<!-- greyfinch-sync:ivall/xcl:issue:6606382303 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2321). Originally posted by [siam4201](https://github.com/siam4201) on 2026-11-25T14:09:05Z. --- 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)
nnonno91 commented 2026-11-25 15:07:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T14:17:15Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7165043618 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7165043618). Originally posted by [nnonno91](https://github.com/nnonno91) on 2026-11-25T14:17:15Z. --- 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.
luckyteagirl commented 2026-11-25 15:07:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T14:28:36Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7165336926 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7165336926). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-25T14:28:36Z. --- 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.
SlopTart commented 2026-11-25 15:07:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T14:38:25Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7165590479 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7165590479). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-25T14:38:25Z. --- **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.
oni-swr commented 2026-11-25 16:12:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T15:26:19Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7166842420 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7166842420). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T15:26:19Z. --- 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.
DavidM1911 commented 2026-11-25 18:04:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T17:55:12Z.


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:7170183512 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2321#issuecomment-7170183512). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T17:55:12Z. --- 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!
upstream-sync closed this pull request 2026-11-25 19:08:11 +00:00
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!2311
No description provided.