Recompiler: lower 32-bit VALU add/sub with carry without i64 in direct DXIL #2555

Closed
ramon-victor wants to merge 1 commit from upstream-pr/2565 into main
ramon-victor commented 2026-11-25 23:03:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ramon-victor on 2026-11-25T23:03:47Z.


Part of #1269.

Problem

In crates/xcl/src/gpu/dxil/lower_valu.rs, v_add_co_ci_u32, v_sub_co_ci_u32, and v_subrev_co_ci_u32 widened all three 32-bit operands (x, y, cin) to i64 via zext64, performed 64-bit add/sub, unpacked the 64-bit result (unpack64), and tested hi != 0 for carry/borrow out.

Every shader using 64-bit VALU address arithmetic (v_add_co_u32 + v_add_co_ci_u32) was therefore forced to emit i64 instructions and declare Feature::Int64Ops even when no 64-bit integer operations were otherwise needed, and opt.rs could not fold or dead-code-eliminate the i64 carry-out path (because 64-bit instructions are preserved to keep Int64Ops consistent).

Fix

  • Lower v_add_co_ci_u32, v_sub_co_ci_u32, and v_subrev_co_ci_u32 in crates/xcl/src/gpu/dxil/lower_valu.rs using pure 32-bit carry/borrow arithmetic matching s_addc_u32 / s_subb_u32 in lower.rs:
    • Add: t0 = x + y, t = t0 + cin, carry = (t0 < x) | (t < t0).
    • Sub / Subrev: t0 = x - y, t = t0 - cin, borrow = (x < y) | (t0 < cin).
  • Add lower_valu::valu_carry_tests::valu_carry_ops_avoid_i64_and_match_gpu verifying DXIL validation, disassembly (zero 64-Bit integer shader flag and zero zext i32), and wave32 RTX 3070 GPU parity across 32 boundary (x, y, cin) triples for all three opcodes (checking both 32-bit VDST outputs and all 32 carry/borrow-out mask bits).

Measured impact

573-program retail direct-DXIL validation sweep (dxil.dll 1.8.2502.11):

  • Baseline (6d12f58): 573/573 validated (val_fail=0), 51,117,488 total DXIL bytes (p50=22,865 us, p95=408,132 us).
  • This PR (97376ee): 573/573 validated (val_fail=0), 51,110,868 total DXIL bytes (-6,620 B / -0.013%; p50=20,462 us, p95=403,273 us).

Tested

  • Targeted IR disassembly + 32-lane boundary GPU parity test (cargo test --lib -p xcl valu_carry): 1 passed, 0 failed.
  • Full workspace (.\scripts\test.ps1, NVIDIA GeForce RTX 3070, Windows 11): 1424 passed, 0 failed, 46 ignored.
  • 573-shader direct DXIL dxil.dll validation sweep: 573/573 passed, 0 failures.
  • Release build (cargo build --release -p xcl) and 60 s retail smoke run (see below).

Not tested

  • Wave64-only GPU paths (the RTX 3070 runs wave32; wave64 GPU tests skipped automatically on this adapter).

Regression run

Main (f087b99):

xcl-smoke v1
commit: f087b998d0d51a9f11bbfa0761967a63e778edd9
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14467 MB

This PR (97376ee):

xcl-smoke v1
commit: 97376ee13636653cf6d1853dd330fe0290285cab
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1624 (PresentX 1624)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14004 MB

AI use

  • Antigravity (Gemini 4 Neon): implementation, IR & 32-lane GPU parity test, 573-shader DXIL sweep, and PR drafting.
<!-- greyfinch-sync:ivall/xcl:issue:5500686190 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565). Originally posted by [ramon-victor](https://github.com/ramon-victor) on 2026-11-25T23:03:47Z. --- Part of #1269. **Problem** In `crates/xcl/src/gpu/dxil/lower_valu.rs`, `v_add_co_ci_u32`, `v_sub_co_ci_u32`, and `v_subrev_co_ci_u32` widened all three 32-bit operands (`x`, `y`, `cin`) to `i64` via `zext64`, performed 64-bit `add`/`sub`, unpacked the 64-bit result (`unpack64`), and tested `hi != 0` for carry/borrow out. Every shader using 64-bit VALU address arithmetic (`v_add_co_u32` + `v_add_co_ci_u32`) was therefore forced to emit `i64` instructions and declare `Feature::Int64Ops` even when no 64-bit integer operations were otherwise needed, and `opt.rs` could not fold or dead-code-eliminate the `i64` carry-out path (because 64-bit instructions are preserved to keep `Int64Ops` consistent). **Fix** - Lower `v_add_co_ci_u32`, `v_sub_co_ci_u32`, and `v_subrev_co_ci_u32` in `crates/xcl/src/gpu/dxil/lower_valu.rs` using pure 32-bit carry/borrow arithmetic matching `s_addc_u32` / `s_subb_u32` in `lower.rs`: - Add: `t0 = x + y`, `t = t0 + cin`, `carry = (t0 < x) | (t < t0)`. - Sub / Subrev: `t0 = x - y`, `t = t0 - cin`, `borrow = (x < y) | (t0 < cin)`. - Add `lower_valu::valu_carry_tests::valu_carry_ops_avoid_i64_and_match_gpu` verifying DXIL validation, disassembly (zero `64-Bit integer` shader flag and zero `zext i32`), and wave32 RTX 3070 GPU parity across 32 boundary `(x, y, cin)` triples for all three opcodes (checking both 32-bit `VDST` outputs and all 32 carry/borrow-out mask bits). **Measured impact** 573-program retail direct-DXIL validation sweep (`dxil.dll` 1.8.2502.11): - Baseline (`6d12f58`): `573/573` validated (`val_fail=0`), `51,117,488` total DXIL bytes (`p50=22,865 us`, `p95=408,132 us`). - This PR (`97376ee`): `573/573` validated (`val_fail=0`), `51,110,868` total DXIL bytes (`-6,620 B` / `-0.013%`; `p50=20,462 us`, `p95=403,273 us`). **Tested** - Targeted IR disassembly + 32-lane boundary GPU parity test (`cargo test --lib -p xcl valu_carry`): 1 passed, 0 failed. - Full workspace (`.\scripts\test.ps1`, NVIDIA GeForce RTX 3070, Windows 11): `1424 passed, 0 failed, 46 ignored`. - 573-shader direct DXIL `dxil.dll` validation sweep: `573/573` passed, `0` failures. - Release build (`cargo build --release -p xcl`) and 60 s retail smoke run (see below). **Not tested** - Wave64-only GPU paths (the RTX 3070 runs wave32; wave64 GPU tests skipped automatically on this adapter). **Regression run** Main (`f087b99`): ``` xcl-smoke v1 commit: f087b998d0d51a9f11bbfa0761967a63e778edd9 gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14467 MB ``` This PR (`97376ee`): ``` xcl-smoke v1 commit: 97376ee13636653cf6d1853dd330fe0290285cab gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1624 (PresentX 1624) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14004 MB ``` **AI use** - Antigravity (Gemini 4 Neon): implementation, IR & 32-lane GPU parity test, 573-shader DXIL sweep, and PR drafting.
DavidM1911 commented 2026-11-26 00:05:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T23:19:17Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7177404848 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7177404848). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T23:19:17Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 26 ignored. Thanks! — Devin
DarkPanda69 commented 2026-11-26 00:05:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T23:37:31Z.


Wave64 run (listed as untested; the wave64 GPU tests skipped on the RTX 3070) on an AMD RX 9070 XT, plus an RTX 3060: the new test passes, and nothing else changes in the direct-DXIL GPU suite.

Head 97376ee applied on main 08db802, debug, Windows 11 Pro 26200, XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4 on main and with the PR, card chosen with XCL_ADAPTER:

main this PR
RX 9070 XT (RDNA4, 32.0.32029.2010) 704 passed, 2 failed, 6 SKIPPED 705 passed, 2 failed, 6 SKIPPED
RTX 3060 (32.0.16.1088) 706 passed, 0 failed, 24 SKIPPED 707 passed, 0 failed, 24 SKIPPED

On both cards, the only result change against main is the new valu_carry_ops_avoid_i64_and_match_gpu (ok), with no new skips. That test translates with wave64: false, so its own GPU run is wave32. On the RTX 3060, 21 wave64 cases skip, among them the suite's integer carries, wave64 case. On the RX 9070 XT, 18 of them ran with this PR applied, integer carries, wave64 included, and still pass; the other 3 are per-lane forms refused on both cards. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same on main.

Not tested: Intel, a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7177823170 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7177823170). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-25T23:37:31Z. --- Wave64 run (listed as untested; the wave64 GPU tests skipped on the RTX 3070) on an AMD RX 9070 XT, plus an RTX 3060: the new test passes, and nothing else changes in the direct-DXIL GPU suite. Head `97376ee` applied on `main` `08db802`, debug, Windows 11 Pro 26200, `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4` on `main` and with the PR, card chosen with `XCL_ADAPTER`: | | `main` | this PR | |---|---|---| | RX 9070 XT (RDNA4, 32.0.32029.2010) | 704 passed, 2 failed, 6 SKIPPED | 705 passed, 2 failed, 6 SKIPPED | | RTX 3060 (32.0.16.1088) | 706 passed, 0 failed, 24 SKIPPED | 707 passed, 0 failed, 24 SKIPPED | On both cards, the only result change against `main` is the new `valu_carry_ops_avoid_i64_and_match_gpu` (ok), with no new skips. That test translates with `wave64: false`, so its own GPU run is wave32. On the RTX 3060, 21 wave64 cases skip, among them the suite's `integer carries, wave64` case. On the RX 9070 XT, 18 of them ran with this PR applied, `integer carries, wave64` included, and still pass; the other 3 are per-lane forms refused on both cards. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same on `main`. Not tested: Intel, a title. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
SlopTart commented 2026-11-26 00:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T23:41:18Z.


Tested: current PR head merged onto current origin/main (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 (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. This PR does not change the mad/mac red on RADV.
Targeted run of valu_carry_ops_avoid_i64_and_match_gpu (name sits outside the gpu_ filter): passed.

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:7177910370 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7177910370). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-25T23:41:18Z. --- **Tested**: current PR head merged onto current `origin/main` (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 (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. This PR does not change the mad/mac red on RADV. Targeted run of `valu_carry_ops_avoid_i64_and_match_gpu` (name sits outside the `gpu_` filter): passed. **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.
Decodere commented 2026-11-27 01:26:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T01:26:41Z.


Independent desktop NVIDIA (Wave32-only Ada) verification of PR #2565 at head 97376ee13636653cf6d1853dd330fe0290285cab (1 commit; exact parent & merge-base: e1d84b7d9153f86a97d2ec5d209d196046fc0bea, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12, Wave32-only Ada), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted release tests & build (97376ee1)

Command Result
cargo test --release -p xcl --lib valu_carry_ops_avoid_i64_and_match_gpu -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.22s, 0.19s, 0.18s, 0 skipped — live Wave32 GPU parity on RTX 4060)
cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4 (3 consecutive runs) 184 passed; 0 failed; 3 ignored; 1138 filtered out × 3 (3.61s, 3.89s, 3.62s; 183 executed + 1 expected Wave32-only skip dispatch_chain_native_wave64_builds_whole: no wave64)
cargo build --release -p xcl Clean build (1m 07s, exit 0, 0 new warnings)

Paired quiet 60 s retail smoke (title: 29640639)

Exact parent & merge-base (e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13982 MB

PR #2565 (97376ee13636653cf6d1853dd330fe0290285cab):

xcl-smoke v1
commit: 97376ee13636653cf6d1853dd330fe0290285cab
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1604 (PresentX 1605)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13983 MB

Runtime log observations (xcl.log)

  • 9221 log lines, 0 [ERROR] / device-removal / panic lines.
  • Final draw/memory telemetry in log: 19558 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample 13982 MB committed by the process; video memory 6115 MB local, 4651 MB non-local.

Limits of coverage

  • 32-bit VALU add/sub carry lowering without i64 in direct DXIL was verified end-to-end on desktop Wave32-only NVIDIA RTX 4060 via valu_carry_ops_avoid_i64_and_match_gpu (3/3, 0 skipped) and gpu::dxil:: (183 executed + 1 expected no wave64 skip × 3).
  • Native Wave64 GPU execution is not available on this Wave32-only RTX 4060, and the warm-cache 60 s retail smoke on title: 29640639 confirms zero runtime regression rather than re-compiling a cold XCL_DIRECT_DXIL=1 shader set (frame-count delta vs. cached parent reflects single-run startup variance, not this PR).

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

<!-- greyfinch-sync:ivall/xcl:comment:7207292612 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7207292612). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T01:26:41Z. --- Independent desktop NVIDIA (Wave32-only Ada) verification of **PR #2565** at head `97376ee13636653cf6d1853dd330fe0290285cab` (`1` commit; exact parent & merge-base: `e1d84b7d9153f86a97d2ec5d209d196046fc0bea`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12, Wave32-only Ada), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted release tests & build (`97376ee1`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib valu_carry_ops_avoid_i64_and_match_gpu -- --nocapture` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 1324 filtered out` × 3 (`0.22s`, `0.19s`, `0.18s`, `0` skipped — live Wave32 GPU parity on RTX 4060) | | `cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4` (3 consecutive runs) | `184 passed; 0 failed; 3 ignored; 1138 filtered out` × 3 (`3.61s`, `3.89s`, `3.62s`; `183` executed + `1` expected Wave32-only skip `dispatch_chain_native_wave64_builds_whole: no wave64`) | | `cargo build --release -p xcl` | Clean build (`1m 07s`, exit `0`, `0` new warnings) | ### Paired quiet 60 s retail smoke (`title: 29640639`) Exact parent & merge-base (`e1d84b7d9153f86a97d2ec5d209d196046fc0bea`, cached baseline on the same machine): ``` xcl-smoke v1 commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1531 (PresentX 1531) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13982 MB ``` PR #2565 (`97376ee13636653cf6d1853dd330fe0290285cab`): ``` xcl-smoke v1 commit: 97376ee13636653cf6d1853dd330fe0290285cab gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1604 (PresentX 1605) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13983 MB ``` ### Runtime log observations (`xcl.log`) - `9221` log lines, `0` `[ERROR]` / device-removal / panic lines. - Final draw/memory telemetry in log: `19558 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped)`; last memory sample `13982 MB committed by the process; video memory 6115 MB local, 4651 MB non-local`. ### Limits of coverage - 32-bit VALU add/sub carry lowering without `i64` in direct DXIL was verified end-to-end on desktop Wave32-only NVIDIA RTX 4060 via `valu_carry_ops_avoid_i64_and_match_gpu` (`3/3`, `0` skipped) and `gpu::dxil::` (`183` executed + `1` expected `no wave64` skip × 3). - Native Wave64 GPU execution is not available on this Wave32-only RTX 4060, and the warm-cache 60 s retail smoke on `title: 29640639` confirms zero runtime regression rather than re-compiling a cold `XCL_DIRECT_DXIL=1` shader set (frame-count delta vs. cached parent reflects single-run startup variance, not this PR). *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
SzczepanGrela commented 2026-11-27 06:06:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-27T06:06:53Z.


RX 9070 / RADV / Wine check of exact head 97376ee13636653cf6d1853dd330fe0290285cab, current main c2ee10e4e905eb736e56953c52b749e18bcc7ede and the PR automatically applied to that main. This adds direct native-wave64 carry-mask, register-alias and partial-EXEC coverage.

Tested

  • RX 9070 16 GB, RADV GFX1201 / Mesa 26.3.1-arch3.5, Ryzen 7 7700, CachyOS 7.3.0-5-cachyos. Windows GNU release executables, Rust 1.97.1, GE-Proton11-12 / Wine 11.0 Staging, native DXGI/D3D12 through vkd3d-proton 8293130ebe370b1+ (local asserts-disabled build), DXC/DXIL 1.9.2602.17.
  • Separate source copies; conflict-free integration of the one-file delta from actual parent e1d84b7d9153f86a97d2ec5d209d196046fc0bea. Test-only container/readback captures and owned fixtures; production code and original assertions preserved. Main gets the identical original test.
  • Build each: cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics.
  • Original filter through Wine: <unit.exe> valu_carry_ops_avoid_i64_and_match_gpu --nocapture --test-threads=1, then --test-threads=4.
Source Threads 1 Threads 4
Main + identical test 0 passed, 1 failed 0 passed, 1 failed
Exact head 1 passed, 0 failed 1 passed, 0 failed
Current-main integration 1 passed, 0 failed 1 passed, 0 failed

Main fails the Int64 disassembly assertion before the original test dispatches. Head/integration pass both that check and the original 32-lane GPU results/masks.

Additional owned filter <unit.exe> workflow_valu_carry_matrix --nocapture --test-threads=1, three fresh processes per source: 1 passed, 0 failed in all nine runs. Each runs HLSL/DXC and direct DXIL separately in native wave32 and native wave64, with three programs:

  • Independent V_ADD_CO_CI_U32, V_SUB_CO_CI_U32, V_SUBREV_CO_CI_U32, reading one input mask and writing separate output masks.
  • The same operations chained through VCC, with each instruction reading and overwriting that mask; each intermediate mask is captured.
  • A VCC chain whose destination also aliases source v0, under lower-half-only, upper-half-only, alternating and lane-edge EXEC masks. Inactive result registers retain their input sentinels and inactive carry bits are zero, including an all-inactive wave32 configuration.

Inputs: all 24 × 24 boundary operand pairs, plus 448 deterministic overflow/borrow-threshold and mixed pairs, each with both carry-in values: 2,048 triples per program/backend/wave configuration. The first two programs execute every triple; the third applies the stated masks. Native-wave64 low/high input mask words differ, and output checks include both halves.

Results and carry/borrow masks agree with an independent arbitrary-precision integer oracle on all sources. Captured data are byte-identical across all three sources and repeats. Main is functionally correct in this matrix too. The measured change is in the shader requirement: SFI0 Int64 bit 0x8000 is set on baseline direct shaders and clear on all six head/integration direct configurations. HLSL controls retain Int64 on every source.

Across both groups: 5,206 captured GPU dispatches, including 18 physical-width probes and 1,737 native-wave64 dispatches. Independent verification checks 7,752,780 words: results, all output-mask words, 16 SGPR and 16 VGPR guards, inactive lanes, unchanged SCC and the complete flat-memory readbacks. Shader metadata and physical widths match; original and owned programs were independently re-encoded from the public ISA tables. 0 ignored, 0 skipped, no device-removal markers.

Inherited XCL_* cleared; XCL_NETWORK=0, RX 9070 selected, XCL_REQUIRE_GPU=wave64, XCL_DXC_THREADS=1; private enabled caches per process.

Not tested

Full suite, split-wave64 or per-lane translation, guest Compute ABI integration, native Windows, other GPUs, retail workload, scripts/smoke.ps1, timing or FPS.

AI use

OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the owned test-only matrix and captures, ran comparisons, independently verified integer results, masks, aliases, guards, wave widths, shader flags and source/executable provenance, and drafted this report. Publication authorized by the account owner.

<!-- greyfinch-sync:ivall/xcl:comment:7211228607 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7211228607). Originally posted by [SzczepanGrela](https://github.com/SzczepanGrela) on 2026-11-27T06:06:53Z. --- RX 9070 / RADV / Wine check of exact head `97376ee13636653cf6d1853dd330fe0290285cab`, current main `c2ee10e4e905eb736e56953c52b749e18bcc7ede` and the PR automatically applied to that main. This adds direct native-wave64 carry-mask, register-alias and partial-EXEC coverage. **Tested** - RX 9070 16 GB, RADV GFX1201 / Mesa `26.3.1-arch3.5`, Ryzen 7 7700, CachyOS `7.3.0-5-cachyos`. Windows GNU release executables, Rust `1.97.1`, GE-Proton11-12 / Wine 11.0 Staging, native DXGI/D3D12 through vkd3d-proton `8293130ebe370b1+` (local asserts-disabled build), DXC/DXIL `1.9.2602.17`. - Separate source copies; conflict-free integration of the one-file delta from actual parent `e1d84b7d9153f86a97d2ec5d209d196046fc0bea`. Test-only container/readback captures and owned fixtures; production code and original assertions preserved. Main gets the identical original test. - Build each: `cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics`. - Original filter through Wine: `<unit.exe> valu_carry_ops_avoid_i64_and_match_gpu --nocapture --test-threads=1`, then `--test-threads=4`. | Source | Threads 1 | Threads 4 | |---|---|---| | Main + identical test | 0 passed, 1 failed | 0 passed, 1 failed | | Exact head | 1 passed, 0 failed | 1 passed, 0 failed | | Current-main integration | 1 passed, 0 failed | 1 passed, 0 failed | Main fails the Int64 disassembly assertion before the original test dispatches. Head/integration pass both that check and the original 32-lane GPU results/masks. Additional owned filter `<unit.exe> workflow_valu_carry_matrix --nocapture --test-threads=1`, three fresh processes per source: **1 passed, 0 failed** in all nine runs. Each runs HLSL/DXC and direct DXIL separately in native wave32 and native wave64, with three programs: - Independent `V_ADD_CO_CI_U32`, `V_SUB_CO_CI_U32`, `V_SUBREV_CO_CI_U32`, reading one input mask and writing separate output masks. - The same operations chained through VCC, with each instruction reading and overwriting that mask; each intermediate mask is captured. - A VCC chain whose destination also aliases source `v0`, under lower-half-only, upper-half-only, alternating and lane-edge EXEC masks. Inactive result registers retain their input sentinels and inactive carry bits are zero, including an all-inactive wave32 configuration. Inputs: all **24 × 24 boundary operand pairs**, plus **448 deterministic overflow/borrow-threshold and mixed pairs**, each with both carry-in values: **2,048 triples per program/backend/wave configuration**. The first two programs execute every triple; the third applies the stated masks. Native-wave64 low/high input mask words differ, and output checks include both halves. Results and carry/borrow masks agree with an independent arbitrary-precision integer oracle on all sources. Captured data are byte-identical across all three sources and repeats. **Main is functionally correct in this matrix too.** The measured change is in the shader requirement: SFI0 Int64 bit `0x8000` is set on baseline direct shaders and clear on all six head/integration direct configurations. HLSL controls retain Int64 on every source. Across both groups: **5,206 captured GPU dispatches**, including 18 physical-width probes and **1,737 native-wave64 dispatches**. Independent verification checks **7,752,780 words**: results, all output-mask words, 16 SGPR and 16 VGPR guards, inactive lanes, unchanged SCC and the complete flat-memory readbacks. Shader metadata and physical widths match; original and owned programs were independently re-encoded from the public ISA tables. **0 ignored, 0 skipped**, no device-removal markers. Inherited `XCL_*` cleared; `XCL_NETWORK=0`, RX 9070 selected, `XCL_REQUIRE_GPU=wave64`, `XCL_DXC_THREADS=1`; private enabled caches per process. **Not tested** Full suite, split-wave64 or per-lane translation, guest Compute ABI integration, native Windows, other GPUs, retail workload, `scripts/smoke.ps1`, timing or FPS. **AI use** OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the owned test-only matrix and captures, ran comparisons, independently verified integer results, masks, aliases, guards, wave widths, shader flags and source/executable provenance, and drafted this report. Publication authorized by the account owner.
throny commented 2026-11-28 03:16:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:16:33Z.


merge-check claim
head: 97376ee136

<!-- greyfinch-sync:ivall/xcl:comment:7232940719 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7232940719). Originally posted by [throny](https://github.com/throny) on 2026-11-28T03:16:33Z. --- merge-check claim head: 97376ee13636653cf6d1853dd330fe0290285cab
throny commented 2026-11-28 03:30:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:30:28Z.


merge-check
base: 753e8b1a
head: 97376ee136
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1513 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1512 passed, 0 failed, 47 ignored
review: none. The add's carry (the first sum below an input, or the second sum below the first) and the subtract's borrow (the minuend below the subtrahend, or the first difference below the carry-in) equal the high word of the 64-bit form exactly, with the carry-in as 0 or 1; the reversed subtract only swaps the inputs; the carry-out forms without carry-in were already free of 64-bit operations and are untouched.
performance: cheaper or equal (no 64-bit integers); direct-DXIL output is re-translated once (reasoned).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7233128439 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7233128439). Originally posted by [throny](https://github.com/throny) on 2026-11-28T03:30:28Z. --- merge-check base: 753e8b1a head: 97376ee13636653cf6d1853dd330fe0290285cab merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1513 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1512 passed, 0 failed, 47 ignored review: none. The add's carry (the first sum below an input, or the second sum below the first) and the subtract's borrow (the minuend below the subtrahend, or the first difference below the carry-in) equal the high word of the 64-bit form exactly, with the carry-in as 0 or 1; the reversed subtract only swaps the inputs; the carry-out forms without carry-in were already free of 64-bit operations and are untouched. performance: cheaper or equal (no 64-bit integers); direct-DXIL output is re-translated once (reasoned). verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
KOLESNiii commented 2026-11-28 13:23:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T13:23:08Z.


merge-check claim
head: 97376ee136

<!-- greyfinch-sync:ivall/xcl:comment:7239897912 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7239897912). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-28T13:23:08Z. --- merge-check claim head: 97376ee13636653cf6d1853dd330fe0290285cab
KOLESNiii commented 2026-11-28 13:24:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T13:24:12Z.


merge-check
base: e429936c10
head: 97376ee136
merge: clean, but it changes nothing: the PR's one commit (97376ee1, "Recompiler: lower 32-bit VALU add/sub with carry without i64 in direct DXIL") has the same patch (git patch-id --stable 219c8f4b) as aa63928f "Recompiler: keep VALU carry arithmetic in i32", already on main, merged with #2959; git diff base..merge is empty
build: not run (the merge is the base)
tests: not run (no change to test)
review: not repeated: nothing in the merge differs from main.
performance: no change (the merge is the base).
verdict: not yet: nothing to merge, the change is already on main (aa63928f, with #2959)
hardware / tool and model: trial merge 5959f0a7f53569f27c447c58e0369ce9855cb2cf (local, not pushed), tree identical to the base. Claude Code: Claude Opus 5.5 (coordination, draft).

<!-- greyfinch-sync:ivall/xcl:comment:7239910446 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7239910446). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-28T13:24:12Z. --- merge-check base: e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd head: 97376ee13636653cf6d1853dd330fe0290285cab merge: clean, but it changes nothing: the PR's one commit (97376ee1, "Recompiler: lower 32-bit VALU add/sub with carry without i64 in direct DXIL") has the same patch (git patch-id --stable 219c8f4b) as aa63928f "Recompiler: keep VALU carry arithmetic in i32", already on main, merged with #2959; git diff base..merge is empty build: not run (the merge is the base) tests: not run (no change to test) review: not repeated: nothing in the merge differs from main. performance: no change (the merge is the base). verdict: not yet: nothing to merge, the change is already on main (aa63928f, with #2959) hardware / tool and model: trial merge 5959f0a7f53569f27c447c58e0369ce9855cb2cf (local, not pushed), tree identical to the base. Claude Code: Claude Opus 5.5 (coordination, draft).
throny commented 2026-11-30 20:10:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-30T20:10:36Z.


Closing: this change is already on main as commit aa63928f (brought in by b0b041fd Merge pull request #2959 from bmjask/stack/308-benchmark-thre). This PR's diff applies in reverse cleanly on current main (ff0c364b), so merging it would change nothing. If something here is not on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5) checked this; part of the duplicate sweep on #3041.

<!-- greyfinch-sync:ivall/xcl:comment:7290521402 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2565#issuecomment-7290521402). Originally posted by [throny](https://github.com/throny) on 2026-11-30T20:10:36Z. --- Closing: this change is already on `main` as commit aa63928f (brought in by b0b041fd Merge pull request #2959 from bmjask/stack/308-benchmark-thre). This PR's diff applies in reverse cleanly on current `main` (`ff0c364b`), so merging it would change nothing. If something here is not on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5) checked this; part of the duplicate sweep on #3041.

Pull request closed

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!2555
No description provided.