Recompiler: fold finite constant legacyF16ToF32 conversions in direct DXIL #2552

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

@⁠ramon-victor on GitHub · 2026-11-25 22:43 UTC · original
ramon-victor:opt/dxil-const-f16-to-f32 → main · +163 −1 · 2 files · 1 commits · open

Part of #1269.

Problem

RDNA2 mixed-precision and half-conversion instructions (v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16, v_cvt_f32_f16, packed f16 helpers) frequently convert inline or constant-folded 16-bit half operands to f32 via Shader::f16_to_f32 (dx.op.legacyF16ToF32). Even after opt.rs folds the preceding and 0xFFFF / lshr 16 extraction to a constant integer, dx.op.legacyF16ToF32 was left as an intrinsic call and was also absent from opt::removable, preventing constant folding and dead-code elimination.

Fix

  • Add f16_bits_to_f32_bits(h: u16) -> Option<u32> in crates/xcl/src/gpu/dxil/ops.rs, performing exact IEEE-754 binary16 → binary32 conversion for all finite values (±0.0, all subnormals, all normals) while returning None for ±Inf and NaN so DXIL never materializes non-finite float constants.
  • Fold constant operands directly in Shader::f16_to_f32 (ops.rs) and post-SSA/constant-propagation dx.op.legacyF16ToF32 calls in Module::simplify_op (module/opt.rs).
  • Allow DCE of dead dx.op.legacyF16ToF32 calls in Module::removable (module/opt.rs); legacyF16ToF32 is ReadNone, uses no 64-bit types, and sets no DXIL shader feature flags.
  • Add unit, DXIL validator/disassembly, and GPU parity tests in ops::f16_fold_tests covering all 65,536 half bit patterns, finite direct & shift/mask-folded constants (verifying zero remaining legacyF16ToF32), non-finite preservation, and bit-exact RTX 3070 GPU parity with hardware dx.op.legacyF16ToF32.

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 (84f6bdc): 573/573 validated (val_fail=0), 51,074,004 total DXIL bytes (-43,484 B / -0.085%; p50=19,788 us, p95=389,471 us).

Tested

  • Targeted unit + DXIL validation + GPU parity tests (cargo test --lib -p xcl f16_fold): 2 passed, 0 failed (f16_bits_to_f32_bits_exhaustive, f16_to_f32_constant_folding_validates_and_matches_gpu).
  • Full workspace (.\scripts\test.ps1, NVIDIA GeForce RTX 3070, Windows 11): 1425 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 (84f6bdc):

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

AI use

  • Antigravity (Gemini 4 Neon): implementation, exhaustive & GPU parity tests, 573-shader DXIL sweep, and PR drafting.
**@⁠ramon-victor** on GitHub · 2026-11-25 22:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/2552) `ramon-victor:opt/dxil-const-f16-to-f32` → `main` · +163 −1 · 2 files · 1 commits · open Part of #1269. **Problem** RDNA2 mixed-precision and half-conversion instructions (`v_fma_mix_f32`, `v_fma_mixlo_f16`, `v_fma_mixhi_f16`, `v_cvt_f32_f16`, packed f16 helpers) frequently convert inline or constant-folded 16-bit half operands to `f32` via `Shader::f16_to_f32` (`dx.op.legacyF16ToF32`). Even after `opt.rs` folds the preceding `and 0xFFFF` / `lshr 16` extraction to a constant integer, `dx.op.legacyF16ToF32` was left as an intrinsic call and was also absent from `opt::removable`, preventing constant folding and dead-code elimination. **Fix** - Add `f16_bits_to_f32_bits(h: u16) -> Option<u32>` in `crates/xcl/src/gpu/dxil/ops.rs`, performing exact IEEE-754 binary16 → binary32 conversion for all finite values (`±0.0`, all subnormals, all normals) while returning `None` for `±Inf` and `NaN` so DXIL never materializes non-finite float constants. - Fold constant operands directly in `Shader::f16_to_f32` (`ops.rs`) and post-SSA/constant-propagation `dx.op.legacyF16ToF32` calls in `Module::simplify_op` (`module/opt.rs`). - Allow DCE of dead `dx.op.legacyF16ToF32` calls in `Module::removable` (`module/opt.rs`); `legacyF16ToF32` is `ReadNone`, uses no 64-bit types, and sets no DXIL shader feature flags. - Add unit, DXIL validator/disassembly, and GPU parity tests in `ops::f16_fold_tests` covering all 65,536 half bit patterns, finite direct & shift/mask-folded constants (verifying zero remaining `legacyF16ToF32`), non-finite preservation, and bit-exact RTX 3070 GPU parity with hardware `dx.op.legacyF16ToF32`. **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 (`84f6bdc`): `573/573` validated (`val_fail=0`), `51,074,004` total DXIL bytes (`-43,484 B` / `-0.085%`; `p50=19,788 us`, `p95=389,471 us`). **Tested** - Targeted unit + DXIL validation + GPU parity tests (`cargo test --lib -p xcl f16_fold`): 2 passed, 0 failed (`f16_bits_to_f32_bits_exhaustive`, `f16_to_f32_constant_folding_validates_and_matches_gpu`). - Full workspace (`.\scripts\test.ps1`, NVIDIA GeForce RTX 3070, Windows 11): `1425 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 (`84f6bdc`): ``` xcl-smoke v1 commit: 84f6bdc97a46acac6b875e4419facfcd23e650dd gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1611 (PresentX 1611) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14044 MB ``` **AI use** - Antigravity (Gemini 4 Neon): implementation, exhaustive & GPU parity tests, 573-shader DXIL sweep, and PR drafting.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:33:37 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 23:06 UTC · original

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

**@⁠DavidM1911** on GitHub · 2026-11-25 23:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/2552#issuecomment-7177163553) 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
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-25 23:11 UTC · original

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

Head 84f6bdc applied on main e1d84b7, 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; runs the wave64 tests natively) 698 passed, 2 failed, 6 SKIPPED 700 passed, 2 failed, 6 SKIPPED
RTX 3060 (32.0.16.1088) 700 passed, 0 failed, 24 SKIPPED 702 passed, 0 failed, 24 SKIPPED

On both cards, the only result changes against main are the new f16_bits_to_f32_bits_exhaustive and f16_to_f32_constant_folding_validates_and_matches_gpu, both ok, with no new skips. So the wave64 tests that skip on a 32-lane GPU ran over the new folding here and still pass. 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.

**@⁠DarkPanda69** on GitHub · 2026-11-25 23:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/2552#issuecomment-7177255028) Wave64 run (listed as untested; the wave64 GPU tests skipped on the RTX 3070) on an AMD RX 9070 XT, plus an RTX 3060: both new tests pass, and nothing else changes in the direct-DXIL GPU suite. Head `84f6bdc` applied on `main` `e1d84b7`, 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; runs the wave64 tests natively) | 698 passed, 2 failed, 6 SKIPPED | 700 passed, 2 failed, 6 SKIPPED | | RTX 3060 (32.0.16.1088) | 700 passed, 0 failed, 24 SKIPPED | 702 passed, 0 failed, 24 SKIPPED | On both cards, the only result changes against `main` are the new `f16_bits_to_f32_bits_exhaustive` and `f16_to_f32_constant_folding_validates_and_matches_gpu`, both ok, with no new skips. So the wave64 tests that skip on a 32-lane GPU ran over the new folding here and still pass. 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.
Author
Owner

@⁠emirduran707 on GitHub · 2026-11-25 23:17 UTC · original

Independent AMD RDNA4 (native wave64) verification of exact PR head 84f6bdc97a46acac6b875e4419facfcd23e650dd on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver 32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC 1.9.2602.17).

Tested

  • cargo build --workspace (debug): passed (0 errors).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1423 passed, 2 failed, 46 ignored (8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1 heap_window_out_of_memory_falls_back_to_the_switch_form no heap windows, 1 pso_measurement_compiles_an_exact_synthetic_record Windows Developer Mode off).
    • Both new tests passed on this GPU:
      • gpu::dxil::ops::f16_fold_tests::f16_bits_to_f32_bits_exhaustive
      • gpu::dxil::ops::f16_fold_tests::f16_to_f32_constant_folding_validates_and_matches_gpu
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and fuzz_validate_and_gpu_3) are pre-existing on unmodified main on this RX 9060 XT / driver 32.0.31044.16.
  • cargo build --release -p xcl + 60 s retail-title smoke test (scripts/smoke.ps1, offline):
xcl-smoke v1
commit: 84f6bdc97a46acac6b875e4419facfcd23e650dd
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1602 (PresentX 1602)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13929 MB

(Compare against main 68a284a on this machine: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Verification run and report prepared with Antigravity (Gemini 4 Neon); all build, test, and smoke results are from live runs on this machine.
**@⁠emirduran707** on GitHub · 2026-11-25 23:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/2552#issuecomment-7177356943) Independent AMD RDNA4 (native wave64) verification of exact PR head `84f6bdc97a46acac6b875e4419facfcd23e650dd` on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver `32.0.31044.16`, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC `1.9.2602.17`). **Tested** - `cargo build --workspace` (debug): passed (`0` errors). - `cargo test --workspace --no-fail-fast -- --test-threads=4`: `1423 passed, 2 failed, 46 ignored` (`8 SKIPPED`: 6 per-lane DXIL forms refused by host adapter/driver, 1 `heap_window_out_of_memory_falls_back_to_the_switch_form` no heap windows, 1 `pso_measurement_compiles_an_exact_synthetic_record` Windows Developer Mode off). - Both new tests passed on this GPU: - `gpu::dxil::ops::f16_fold_tests::f16_bits_to_f32_bits_exhaustive` - `gpu::dxil::ops::f16_fold_tests::f16_to_f32_constant_folding_validates_and_matches_gpu` - The 2 failures (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` and `fuzz_validate_and_gpu_3`) are pre-existing on unmodified `main` on this RX 9060 XT / driver `32.0.31044.16`. - `cargo build --release -p xcl` + 60 s retail-title smoke test (`scripts/smoke.ps1`, offline): ``` xcl-smoke v1 commit: 84f6bdc97a46acac6b875e4419facfcd23e650dd gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1602 (PresentX 1602) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13929 MB ``` (Compare against `main` `68a284a` on this machine: `1573 frames, 14420 MB peak, 0 device removals, 0 crashes`.) **Not tested** - NVIDIA / Intel GPUs, Linux / Wine. **AI use** - Verification run and report prepared with Antigravity (Gemini 4 Neon); all build, test, and smoke results are from live runs on this machine.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 23:41 UTC · original

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 f16_bits_to_f32_bits_exhaustive (all 65536 f16 patterns) and f16_to_f32_constant_folding_validates_and_matches_gpu: 2 passed; the ..._matches_gpu name sits outside the gpu_ filter, so it ran targeted.

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 23:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/2552#issuecomment-7177909298) **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 `f16_bits_to_f32_bits_exhaustive` (all 65536 f16 patterns) and `f16_to_f32_constant_folding_validates_and_matches_gpu`: 2 passed; the `..._matches_gpu` name sits outside the `gpu_` filter, so it ran targeted. **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

@⁠Decodere on GitHub · 2026-11-27 01:58 UTC · original

Independent desktop NVIDIA (Wave32-only Ada) verification of PR #2552 at head 84f6bdc97a46acac6b875e4419facfcd23e650dd (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 (84f6bdc9)

Command Result
cargo test --release -p xcl --lib f16_bits_to_f32_bits_exhaustive -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1325 filtered out × 3 (0.00s × 3, 0 skipped)
cargo test --release -p xcl --lib f16_to_f32_constant_folding_validates_and_matches_gpu -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1325 filtered out × 3 (0.22s, 0.18s, 0.20s, 0 skipped — live Wave32 GPU parity on RTX 4060)
cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4 (3 consecutive runs) 185 passed; 0 failed; 3 ignored; 1138 filtered out × 3 (3.95s, 3.63s, 3.61s; 184 executed + 1 expected Wave32-only skip dispatch_chain_native_wave64_builds_whole: no wave64)
cargo build --release -p xcl Clean build (1m 12s, 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 #2552 (84f6bdc97a46acac6b875e4419facfcd23e650dd):

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

Runtime log observations (xcl.log)

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

Limits of coverage

  • Exhaustive 16-bit half-to-float bit conversion (f16_bits_to_f32_bits_exhaustive) and direct-DXIL legacyF16ToF32 constant folding were verified end-to-end on desktop Wave32-only NVIDIA RTX 4060 (f16_to_f32_constant_folding_validates_and_matches_gpu × 3, 0 skipped, plus gpu::dxil:: 184 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 and commit deltas vs. cached parent reflect single-run startup variance, not this PR).

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

**@⁠Decodere** on GitHub · 2026-11-27 01:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/2552#issuecomment-7207722867) Independent desktop NVIDIA (Wave32-only Ada) verification of **PR #2552** at head `84f6bdc97a46acac6b875e4419facfcd23e650dd` (`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 (`84f6bdc9`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib f16_bits_to_f32_bits_exhaustive -- --nocapture` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 1325 filtered out` × 3 (`0.00s` × 3, `0` skipped) | | `cargo test --release -p xcl --lib f16_to_f32_constant_folding_validates_and_matches_gpu -- --nocapture` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 1325 filtered out` × 3 (`0.22s`, `0.18s`, `0.20s`, `0` skipped — live Wave32 GPU parity on RTX 4060) | | `cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4` (3 consecutive runs) | `185 passed; 0 failed; 3 ignored; 1138 filtered out` × 3 (`3.95s`, `3.63s`, `3.61s`; `184` executed + `1` expected Wave32-only skip `dispatch_chain_native_wave64_builds_whole: no wave64`) | | `cargo build --release -p xcl` | Clean build (`1m 12s`, 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 #2552 (`84f6bdc97a46acac6b875e4419facfcd23e650dd`): ``` xcl-smoke v1 commit: 84f6bdc97a46acac6b875e4419facfcd23e650dd gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1593 (PresentX 1593) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14014 MB ``` ### Runtime log observations (`xcl.log`) - `9222` log lines, `0` `[ERROR]` / device-removal / panic lines. - Final draw/memory telemetry in log: `19531 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped)`; last memory sample `14013 MB committed by the process; video memory 6114 MB local, 4682 MB non-local`. ### Limits of coverage - Exhaustive 16-bit half-to-float bit conversion (`f16_bits_to_f32_bits_exhaustive`) and direct-DXIL `legacyF16ToF32` constant folding were verified end-to-end on desktop Wave32-only NVIDIA RTX 4060 (`f16_to_f32_constant_folding_validates_and_matches_gpu` × 3, `0` skipped, plus `gpu::dxil::` `184` 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 and commit deltas vs. cached parent reflect single-run startup variance, not this PR). *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
Author
Owner

@⁠SzczepanGrela on GitHub · 2026-11-27 04:23 UTC · original

RX 9070 / RADV / Wine verification of exact head 84f6bdc97a46acac6b875e4419facfcd23e650dd, current main 8b957bec6f82495aec940944c6bf47faa02db590 and the PR applied to that main. This adds direct native-wave64 coverage of finite constant folding and exhaustive dynamic half conversion on this lane.

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, original assertions preserved, test-only readback/container captures. The two-file delta merges automatically onto current main, retaining its optional test-only PHI-CSE branch, which was unset. Main gets the new conversion helper under cfg(test) solely to compile the identical upstream CPU oracle/tests; its production Shader and Module logic remain unchanged.
  • 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> f16_fold_tests --nocapture --test-threads=1, then --test-threads=4.
Source Threads 1 Threads 4
Main + test additions 1 passed, 1 failed 1 passed, 1 failed
Exact head 2 passed, 0 failed 2 passed, 0 failed
Current-main integration 2 passed, 0 failed 2 passed, 0 failed

Main fails the finite-constant IR assertion before that original test dispatches. Head/integration remove the finite calls and preserve all four dynamic/non-finite calls in the second original shader. Full captured readbacks, including unmodified slots and all active lanes, were independently checked. The helper's original exhaustive CPU test covers all 65,536 half bit patterns.

Additional owned filter <unit.exe> workflow_half_conversion_matrix --nocapture --test-threads=1, three fresh processes per source: 1 passed, 0 failed in all nine runs. Each process has 64 dispatches, half native wave32 and half native wave64:

  • 992 finite constant patterns, covering both signs, all finite exponents and 16 mantissa boundary values per exponent. Every pattern is converted both as an immediate with nonzero upper bits and after a constant shift/mask exposes the half. On main, the conversion calls remain; on head/integration, every finite constant call is eliminated. All GPU results agree.
  • All 65,536 half patterns as dynamic inputs, in each wave size, with varying upper-word tags. This covers zeros, subnormals, normals, infinities and NaNs. Dynamic conversion calls and the complete shader containers stay unchanged across all three sources.
  • Every matrix lane stores its actual physical wave width. Each readback includes 16 guard words after the output block.

Across both groups: 584 captured GPU dispatches, including 288 native wave64, and 2,934,784 output/guard words. Python's independent IEEE-half decoder verifies finite/infinite outputs bit-for-bit and NaNs by class; untouched slots, guards and physical widths also match. Matrix payloads repeat byte-for-byte within each source and across source arms, including NaN payloads. Exact head and integration captures match. 0 ignored, 0 skipped.

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, HLSL backend, whole RDNA2 mixed/packed-f16 instructions, guest Compute ABI integration, native Windows, other GPUs, retail workload, scripts/smoke.ps1, timing or FPS. The additional shaders exercise the direct DXIL builder and optimizer.

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 IEEE conversion results, NaN classes, guards, wave widths and source/executable provenance, and drafted this report. Publication authorized by the account owner.

**@⁠SzczepanGrela** on GitHub · 2026-11-27 04:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2552#issuecomment-7209754788) RX 9070 / RADV / Wine verification of exact head `84f6bdc97a46acac6b875e4419facfcd23e650dd`, current main `8b957bec6f82495aec940944c6bf47faa02db590` and the PR applied to that main. This adds direct native-wave64 coverage of finite constant folding and exhaustive dynamic half conversion on this lane. **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, original assertions preserved, test-only readback/container captures. The two-file delta merges automatically onto current main, retaining its optional test-only PHI-CSE branch, which was unset. Main gets the new conversion helper under `cfg(test)` solely to compile the identical upstream CPU oracle/tests; its production Shader and Module logic remain unchanged. - 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> f16_fold_tests --nocapture --test-threads=1`, then `--test-threads=4`. | Source | Threads 1 | Threads 4 | |---|---|---| | Main + test additions | 1 passed, 1 failed | 1 passed, 1 failed | | Exact head | 2 passed, 0 failed | 2 passed, 0 failed | | Current-main integration | 2 passed, 0 failed | 2 passed, 0 failed | Main fails the finite-constant IR assertion before that original test dispatches. Head/integration remove the finite calls and preserve all four dynamic/non-finite calls in the second original shader. Full captured readbacks, including unmodified slots and all active lanes, were independently checked. The helper's original exhaustive CPU test covers all 65,536 half bit patterns. Additional owned filter `<unit.exe> workflow_half_conversion_matrix --nocapture --test-threads=1`, three fresh processes per source: **1 passed, 0 failed** in all nine runs. Each process has 64 dispatches, half native wave32 and half native wave64: - **992 finite constant patterns**, covering both signs, all finite exponents and 16 mantissa boundary values per exponent. Every pattern is converted both as an immediate with nonzero upper bits and after a constant shift/mask exposes the half. On main, the conversion calls remain; on head/integration, every finite constant call is eliminated. All GPU results agree. - **All 65,536 half patterns as dynamic inputs, in each wave size**, with varying upper-word tags. This covers zeros, subnormals, normals, infinities and NaNs. Dynamic conversion calls and the complete shader containers stay unchanged across all three sources. - Every matrix lane stores its actual physical wave width. Each readback includes 16 guard words after the output block. Across both groups: **584 captured GPU dispatches**, including **288 native wave64**, and **2,934,784 output/guard words**. Python's independent IEEE-half decoder verifies finite/infinite outputs bit-for-bit and NaNs by class; untouched slots, guards and physical widths also match. Matrix payloads repeat byte-for-byte within each source and across source arms, including NaN payloads. Exact head and integration captures match. **0 ignored, 0 skipped**. 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, HLSL backend, whole RDNA2 mixed/packed-f16 instructions, guest Compute ABI integration, native Windows, other GPUs, retail workload, `scripts/smoke.ps1`, timing or FPS. The additional shaders exercise the direct DXIL builder and optimizer. **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 IEEE conversion results, NaN classes, guards, wave widths and source/executable provenance, and drafted this report. Publication authorized by the account owner.
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/2552/head:github-bot/gh-2552'
git switch 'github-bot/gh-2552'

Merge

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