Recompiler: compile translated HLSL with strict IEEE float rules #3778

Open
Raul-Paiva wants to merge 2 commits from upstream-pr/3778 into main
Raul-Paiva commented 2026-12-03 07:35:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-12-03T07:35:32Z.


Fixes two of the wave64 mismatches #3716's reference interpreter found on the HLSL path: 0 − (+0) giving −0, and inf − inf giving 0 instead of NaN.

The cached DXC compiles of translated console programs (dxc::compile_cached, compile_cached_in) passed DXC no arguments, so it compiled them with its default fast math. Fast math lets DXC fold 0 - x to -x and x - x to 0:

  • v_sub_f32 0, +0 gave −0 (0x80000000), not +0;
  • v_sub_f32 inf, inf gave 0, not NaN.

The console's VALU keeps both. The interpreter found them in the split wave64 form (CharlyRien's group 2: 94 seeds; the NaN class: 3 seeds), and the direct DXIL path and the per-lane form got them right on NVIDIA. These compiles now pass -Gis (strict IEEE), like the tests that compare a form with the HLSL one already do. The arguments are part of their cache key, so DXIL compiled with fast math is not reused.

-Gis is not enough on AMD. stijn-boer's RX 9060 XT run (DXC 1.9.2609.5) showed the DXIL given to the GPU keeps fsub float 0.000000e+00, %x and fsub float %x, %x with no fast-math flags. Yet every lane still returned −0 and 0: the driver folds both again. So the second commit translates the forms a compiler can fold on sight differently. A v_sub_f32 / v_subrev_f32 with a constant zero source, or the same source twice, goes through sub_ieee, the same subtraction with these results chosen on the bits with integer compares:

  • the zero cases (−0 only for −0 − +0);
  • a NaN source, quieted;
  • ±inf minus itself, which gives NaN.

No float rule can fold these compares away. Every other subtraction is emitted as before.

Related: #2168 (fast math losing −0 in f16 HLSL) and #105 (an audit that names -Gis); #2183 kept the zero sign in f16 multiplies one at a time.

The fuzz tables of #3716 and #3746 list "-0 for +0" on NVIDIA as a known outcome of the HLSL split form (and, in #3746, the HLSL wave32 form). With this change those outcomes should match, so whichever of these PRs lands second updates those entries.

  • This change does not use code, signatures or documentation from leaked or NDA-only SDKs.

What is in it

  • Recompiler: compile translated HLSL with strict IEEE float rules, in crates/xcl/src/gpu/recomp/dxc.rs:
    • TRANSLATED_ARGS = ["-Gis"], passed by compile_cached_in and compile_generated_in;
    • key_for_toolchain hashes those arguments into the DXIL cache key;
    • test gpu_translated_hlsl_keeps_signed_zero_and_nan (tests.rs).
  • Recompiler: subtractions a driver can fold keep their zeros and NaN, in crates/xcl/src/gpu/recomp/emit.rs:
    • sub_foldable picks the forms;
    • sub_ieee is a new HLSL prelude helper;
    • tests: foldable_subtractions_go_through_sub_ieee, plus NaN − NaN, −0 − (−0) and 0 − 2.5 added to the GPU test.

Tested

  • Hardware: RTX 3070 Laptop GPU 8 GB, driver 621.40, i7-11800H, 32 GB, Windows 10 19045, rustc 1.100.0, release build; DXC 1.8.2502.11 (Windows SDK 10.0.26100.0).
  • On this head (6010258f, on main 0c725d5d):
    • gpu_translated_hlsl_keeps_signed_zero_and_nan runs on this GPU in wave32 and the split wave64 form, not skipped, and passes.
    • foldable_subtractions_go_through_sub_ieee passes. With the first commit's emit.rs it fails (assertion failed: one(("V_SUB_F32", "ENC_VOP2", &[("VDST", 10), ("SRC0", 128), ("VSRC1", 1)]))).
    • DXC with -Gis on the GPU test's program keeps sub_ieee's integer compares and selects around each fsub. It drops only the checks a constant +0 or the same operand makes trivial.
    • cargo test --release -p xcl --lib gpu::recomp -- --test-threads=4: 537 passed, 0 failed, 21 ignored. gpu::dxil: 354 passed, 0 failed, 4 ignored. SKIPPED: all "no wave64" (21 in gpu::recomp, 1 in gpu::dxil).
    • Integration tests (cargo test --release -p xcl --no-fail-fast --test '*' -- --test-threads=4):
      • this head: 150 passed, 1 failed, 20 ignored. The failure, gpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs ("releasing the title PSOs releases their two-pass state", left 1, right 0), passed 2/2 when rerun alone on this head. That test does not reach the subtraction code.
      • main 0c725d5d: 151 passed, 0 failed, 20 ignored.
      • SKIPPED on both: 1 "no heap windows".
  • On the first commit before the rebase onto 0c725d5d (88e8c4fc on main 16c2fd08): integration 151/0/20 on both trees; e2e passed 2/2 on both after one XAudio2 timing failure on the PR.
  • Whole lib suite on the first commit one rebase earlier (3b2f5877 on main 078358a0) against 078358a0, run serially (--test-threads=1) with the 21 tests that end the binary skipped on both:
    • this change: 2820 passed, 14 failed, 32 ignored; main: 2820 passed, 13 failed, 32 ignored;
    • the extra failure, list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list, passes alone 3/3 on both.
    • Not rerun on this head.
  • Cost of -Gis, on 3b2f5877 against 078358a0: xcl shaders <pack> --precompile --limit 1000 with XCL_DIRECT_DXIL=0 and a fresh XCL_DXIL_CACHE each run, two runs each, alternating:
    • compile wall time: 78.7 and 79.5 s on main, 79.7 and 80.3 s with it, within run-to-run noise;
    • DXIL of the same 533 programs: +1.1 %.
    • sub_ieee adds a few integer operations to the subtractions it covers only.
  • On AMD, from stijn-boer's merge-check of this head (RX 9060 XT, driver 32.0.32029.2010, DXC 1.9.2609.5, on main a815de93):
    • gpu_translated_hlsl_keeps_signed_zero_and_nan, foldable_subtractions_go_through_sub_ieee and the DXC cache tests: 16 passed, 0 failed, no skips. Every lane of wave32 and split wave64 gives +0 for 0 − (+0) and NaN for inf − inf; the first commit alone (88e8c4fc) gave −0 and 0 there.
    • cargo test --workspace --no-fail-fast: 3005 passed, 18 failed, 56 ignored with this PR; main: 3003 passed, 18 failed, 56 ignored, the same failures.
  • Gevroska's RTX 3080 run of 88e8c4fc passed with DXC 1.9.2609.5 and 1.8.2502.8.

Regression run
scripts/smoke.ps1 -Seconds 120 -Title 'retail title A', release builds of clean trees, one after the other on the machine in Tested, with XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_WATCH_HOT=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=60000 (XCL_DIRECT_DXIL=1 keeps vertex and pixel shaders on the HLSL path this changes). The title is left on its own, with no input. Each tree had one warm-up run first.

main:

xcl-smoke v1
commit: 0c725d5da298b90797993b568e30e6ff6b16e8b6
gpu: NVIDIA GeForce RTX 3070 Laptop GPU
title: retail title A
seconds: 120
exit: 0x0
frames shown: 3373 (PresentX 3373)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 16732 MB

This PR:

xcl-smoke v1
commit: 6010258fb178ae6322517da55eca215c688f11a0
gpu: NVIDIA GeForce RTX 3070 Laptop GPU
title: retail title A
seconds: 120
exit: 0x0
frames shown: 3393 (PresentX 3393)
presents per 2 s (last 3): 61 60 61
device removals: 0
crashes: 0
peak commit: 14026 MB

Not tested

  • A retail title on AMD, and frame times there.
  • A zero, or the same value on both sides, that reaches the subtraction through other registers is not detected, so a driver could still fold those.
  • The same driver folds on the direct DXIL path (XCL_DIRECT_DXIL, lower.rs), which emits fsub itself. Not checked on AMD, and not changed here.
  • Wave64 hardware, Intel. The split forms ran on NVIDIA only; the native wave64 tests were skipped.
  • #3716's interpreter on this branch: the forms harness and fuzzer are not on main; the test here covers these cases.
  • Frame times in the world: the smoke stays in the title's menu.
  • xcl shaders --compile N (the compile-time sample, shaders.rs compile_samples) still calls dxc::compile without TRANSLATED_ARGS, so its times are without -Gis. Left as it is.

AI use

  • Claude Code (Claude Opus 5.5) wrote both commits, the tests and this description, and ran the tests, the measurements and the smoke runs.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5622084951 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-12-03T07:35:32Z. --- Fixes two of the wave64 mismatches #3716's reference interpreter found on the HLSL path: `0 − (+0)` giving −0, and `inf − inf` giving 0 instead of NaN. The cached DXC compiles of translated console programs (`dxc::compile_cached`, `compile_cached_in`) passed DXC no arguments, so it compiled them with its default fast math. Fast math lets DXC fold `0 - x` to `-x` and `x - x` to 0: - `v_sub_f32 0, +0` gave −0 (0x80000000), not +0; - `v_sub_f32 inf, inf` gave 0, not NaN. The console's VALU keeps both. The interpreter found them in the split wave64 form (CharlyRien's group 2: 94 seeds; the NaN class: 3 seeds), and the direct DXIL path and the per-lane form got them right on NVIDIA. These compiles now pass `-Gis` (strict IEEE), like the tests that compare a form with the HLSL one already do. The arguments are part of their cache key, so DXIL compiled with fast math is not reused. `-Gis` is not enough on AMD. stijn-boer's RX 9060 XT run (DXC 1.9.2609.5) showed the DXIL given to the GPU keeps `fsub float 0.000000e+00, %x` and `fsub float %x, %x` with no fast-math flags. Yet every lane still returned −0 and 0: the driver folds both again. So the second commit translates the forms a compiler can fold on sight differently. A `v_sub_f32` / `v_subrev_f32` with a constant zero source, or the same source twice, goes through `sub_ieee`, the same subtraction with these results chosen on the bits with integer compares: - the zero cases (−0 only for −0 − +0); - a NaN source, quieted; - ±inf minus itself, which gives NaN. No float rule can fold these compares away. Every other subtraction is emitted as before. Related: #2168 (fast math losing −0 in f16 HLSL) and #105 (an audit that names `-Gis`); #2183 kept the zero sign in f16 multiplies one at a time. The fuzz tables of #3716 and #3746 list "-0 for +0" on NVIDIA as a known outcome of the HLSL split form (and, in #3746, the HLSL wave32 form). With this change those outcomes should match, so whichever of these PRs lands second updates those entries. - [x] This change does not use code, signatures or documentation from leaked or NDA-only SDKs. **What is in it** - `Recompiler: compile translated HLSL with strict IEEE float rules`, in `crates/xcl/src/gpu/recomp/dxc.rs`: - `TRANSLATED_ARGS = ["-Gis"]`, passed by `compile_cached_in` and `compile_generated_in`; - `key_for_toolchain` hashes those arguments into the DXIL cache key; - test `gpu_translated_hlsl_keeps_signed_zero_and_nan` (`tests.rs`). - `Recompiler: subtractions a driver can fold keep their zeros and NaN`, in `crates/xcl/src/gpu/recomp/emit.rs`: - `sub_foldable` picks the forms; - `sub_ieee` is a new HLSL prelude helper; - tests: `foldable_subtractions_go_through_sub_ieee`, plus NaN − NaN, −0 − (−0) and 0 − 2.5 added to the GPU test. **Tested** - Hardware: RTX 3070 Laptop GPU 8 GB, driver 621.40, i7-11800H, 32 GB, Windows 10 19045, rustc 1.100.0, release build; DXC 1.8.2502.11 (Windows SDK 10.0.26100.0). - On this head (6010258f, on `main` 0c725d5d): - `gpu_translated_hlsl_keeps_signed_zero_and_nan` runs on this GPU in wave32 and the split wave64 form, not skipped, and passes. - `foldable_subtractions_go_through_sub_ieee` passes. With the first commit's `emit.rs` it fails (`assertion failed: one(("V_SUB_F32", "ENC_VOP2", &[("VDST", 10), ("SRC0", 128), ("VSRC1", 1)]))`). - DXC with `-Gis` on the GPU test's program keeps `sub_ieee`'s integer compares and selects around each `fsub`. It drops only the checks a constant +0 or the same operand makes trivial. - `cargo test --release -p xcl --lib gpu::recomp -- --test-threads=4`: 537 passed, 0 failed, 21 ignored. `gpu::dxil`: 354 passed, 0 failed, 4 ignored. SKIPPED: all "no wave64" (21 in `gpu::recomp`, 1 in `gpu::dxil`). - Integration tests (`cargo test --release -p xcl --no-fail-fast --test '*' -- --test-threads=4`): - this head: 150 passed, 1 failed, 20 ignored. The failure, `gpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` ("releasing the title PSOs releases their two-pass state", left 1, right 0), passed 2/2 when rerun alone on this head. That test does not reach the subtraction code. - `main` 0c725d5d: 151 passed, 0 failed, 20 ignored. - SKIPPED on both: 1 "no heap windows". - On the first commit before the rebase onto 0c725d5d (88e8c4fc on `main` 16c2fd08): integration 151/0/20 on both trees; `e2e` passed 2/2 on both after one XAudio2 timing failure on the PR. - Whole lib suite on the first commit one rebase earlier (3b2f5877 on `main` 078358a0) against 078358a0, run serially (`--test-threads=1`) with the 21 tests that end the binary skipped on both: - this change: 2820 passed, 14 failed, 32 ignored; `main`: 2820 passed, 13 failed, 32 ignored; - the extra failure, `list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list`, passes alone 3/3 on both. - Not rerun on this head. - Cost of `-Gis`, on 3b2f5877 against 078358a0: `xcl shaders <pack> --precompile --limit 1000` with `XCL_DIRECT_DXIL=0` and a fresh `XCL_DXIL_CACHE` each run, two runs each, alternating: - compile wall time: 78.7 and 79.5 s on `main`, 79.7 and 80.3 s with it, within run-to-run noise; - DXIL of the same 533 programs: +1.1 %. - `sub_ieee` adds a few integer operations to the subtractions it covers only. - On AMD, from stijn-boer's [merge-check of this head](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7382051969) (RX 9060 XT, driver 32.0.32029.2010, DXC 1.9.2609.5, on `main` a815de93): - `gpu_translated_hlsl_keeps_signed_zero_and_nan`, `foldable_subtractions_go_through_sub_ieee` and the DXC cache tests: 16 passed, 0 failed, no skips. Every lane of wave32 and split wave64 gives +0 for `0 − (+0)` and NaN for `inf − inf`; the first commit alone (88e8c4fc) gave −0 and 0 there. - `cargo test --workspace --no-fail-fast`: 3005 passed, 18 failed, 56 ignored with this PR; `main`: 3003 passed, 18 failed, 56 ignored, the same failures. - Gevroska's RTX 3080 run of 88e8c4fc passed with DXC 1.9.2609.5 and 1.8.2502.8. **Regression run** `scripts/smoke.ps1 -Seconds 120 -Title 'retail title A'`, release builds of clean trees, one after the other on the machine in **Tested**, with `XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_WATCH_HOT=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=60000` (`XCL_DIRECT_DXIL=1` keeps vertex and pixel shaders on the HLSL path this changes). The title is left on its own, with no input. Each tree had one warm-up run first. `main`: ``` xcl-smoke v1 commit: 0c725d5da298b90797993b568e30e6ff6b16e8b6 gpu: NVIDIA GeForce RTX 3070 Laptop GPU title: retail title A seconds: 120 exit: 0x0 frames shown: 3373 (PresentX 3373) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 16732 MB ``` This PR: ``` xcl-smoke v1 commit: 6010258fb178ae6322517da55eca215c688f11a0 gpu: NVIDIA GeForce RTX 3070 Laptop GPU title: retail title A seconds: 120 exit: 0x0 frames shown: 3393 (PresentX 3393) presents per 2 s (last 3): 61 60 61 device removals: 0 crashes: 0 peak commit: 14026 MB ``` **Not tested** - A retail title on AMD, and frame times there. - A zero, or the same value on both sides, that reaches the subtraction through other registers is not detected, so a driver could still fold those. - The same driver folds on the direct DXIL path (`XCL_DIRECT_DXIL`, `lower.rs`), which emits `fsub` itself. Not checked on AMD, and not changed here. - Wave64 hardware, Intel. The split forms ran on NVIDIA only; the native wave64 tests were skipped. - #3716's interpreter on this branch: the forms harness and fuzzer are not on `main`; the test here covers these cases. - Frame times in the world: the smoke stays in the title's menu. - `xcl shaders --compile N` (the compile-time sample, `shaders.rs` `compile_samples`) still calls `dxc::compile` without `TRANSLATED_ARGS`, so its times are without `-Gis`. Left as it is. **AI use** - Claude Code (Claude Opus 5.5) wrote both commits, the tests and this description, and ran the tests, the measurements and the smoke runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Foniass commented 2026-12-03 07:38:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T07:38:38Z.


Review of 88e8c4fc (code reading only, not a merge-check) · 2 nits

In short: The PR compiles translated HLSL with DXC's -Gis (strict IEEE), so 0 - x no longer folds to -x and x - x no longer folds to 0. A v_sub_f32 0, +0 now gives +0, and inf - inf gives NaN, as on the console. The flag is part of the DXIL cache key, and a GPU test covers both waves. The change is small and right. Two nits; nothing blocks it.

Nit

  1. The first line of the description names the wrong case. It says "x − x giving −0". The body and the test show 0 − (+0) giving −0, and inf − inf giving 0 instead of NaN.
  2. #3716 / #3746 pin the mismatch this fixes. Their EXPECTED tables and fuzz classes list "-0 for +0" on the HLSL split and HLSL wave32 forms as known on NVIDIA. Once this lands, those outcomes become matches, and the pinned KnownMismatch lines will need updating, depending on how the harness treats a known mismatch that went away. Whichever lands second should adjust them. Say so in the description.
Checked and fine
  • TRANSLATED_ARGS goes to compile from compile_cached_in and compile_generated_in, so every cached translated compile gets it. compile passes extra through to both compile_whole and the linked path (compile_linked, which compiles the library with the same extra).
  • key_for_toolchain hashes the arguments, so both the exact and the generated keys change and DXIL built with fast math is not reused. The HLSL path recompiles once, which the description says.
  • XCL's own helper shaders that go through compile_cached (SCALE_ARGS_HLSL, the mesh pass-through, rect_list_gs) also get -Gis, which is harmless for them.
  • -Gis combines with the -O0 / -O1 choice for large sources.
  • gpu_translated_hlsl_keeps_signed_zero_and_nan runs through compile_cached_in in wave32 and in the split wave64 form, checks all lanes, and fails without the change, as Tested says. The precompile timing shows no cost beyond noise, and DXIL grows 1.1 %.
  • 46+/3- in two files.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7371246528 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7371246528). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T07:38:38Z. --- **Review** of `88e8c4fc` (code reading only, not a merge-check) · 2 nits **In short:** The PR compiles translated HLSL with DXC's `-Gis` (strict IEEE), so `0 - x` no longer folds to `-x` and `x - x` no longer folds to 0. A `v_sub_f32 0, +0` now gives +0, and `inf - inf` gives NaN, as on the console. The flag is part of the DXIL cache key, and a GPU test covers both waves. The change is small and right. Two nits; nothing blocks it. #### Nit 1. **The first line of the description names the wrong case.** It says "`x − x` giving −0". The body and the test show `0 − (+0)` giving −0, and `inf − inf` giving 0 instead of NaN. 2. **#3716 / #3746 pin the mismatch this fixes.** Their `EXPECTED` tables and fuzz classes list "-0 for +0" on the HLSL split and HLSL wave32 forms as known on NVIDIA. Once this lands, those outcomes become matches, and the pinned `KnownMismatch` lines will need updating, depending on how the harness treats a known mismatch that went away. Whichever lands second should adjust them. Say so in the description. <details><summary>Checked and fine</summary> - `TRANSLATED_ARGS` goes to `compile` from `compile_cached_in` and `compile_generated_in`, so every cached translated compile gets it. `compile` passes `extra` through to both `compile_whole` and the linked path (`compile_linked`, which compiles the library with the same `extra`). - `key_for_toolchain` hashes the arguments, so both the exact and the generated keys change and DXIL built with fast math is not reused. The HLSL path recompiles once, which the description says. - XCL's own helper shaders that go through `compile_cached` (`SCALE_ARGS_HLSL`, the mesh pass-through, `rect_list_gs`) also get `-Gis`, which is harmless for them. - `-Gis` combines with the `-O0` / `-O1` choice for large sources. - `gpu_translated_hlsl_keeps_signed_zero_and_nan` runs through `compile_cached_in` in wave32 and in the split wave64 form, checks all lanes, and fails without the change, as **Tested** says. The precompile timing shows no cost beyond noise, and DXIL grows 1.1 %. - 46+/3- in two files. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
Raul-Paiva commented 2026-12-03 07:47:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-12-03T07:47:14Z.


Thanks. Both are fixed in the description:

  1. The first line now names 0 − (+0) giving −0 (and inf − inf giving 0 instead of NaN).
  2. It now says that the fuzz tables of #3716 and #3746 list "-0 for +0" on NVIDIA for the HLSL split form (and the HLSL wave32 form in #3746), and that whichever lands second updates those entries.

No code change, so the head (88e8c4fc) and its smoke run stay as they are.

The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.

<!-- greyfinch-sync:ivall/xcl:comment:7371426973 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7371426973). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-12-03T07:47:14Z. --- Thanks. Both are fixed in the description: 1. The first line now names `0 − (+0)` giving −0 (and `inf − inf` giving 0 instead of NaN). 2. It now says that the fuzz tables of #3716 and #3746 list "-0 for +0" on NVIDIA for the HLSL split form (and the HLSL wave32 form in #3746), and that whichever lands second updates those entries. No code change, so the head (88e8c4fc) and its smoke run stay as they are. The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.
stijn-boer commented 2026-12-03 08:00:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-03T08:00:13Z.


merge-check
base: 16c2fd082a
head: 88e8c4fc76
verdict: not yet: the new translated-HLSL regression returned negative zero for zero minus positive zero on AMD in both focused runs.

Windows / AMD RDNA4 — first strict IEEE HLSL check on 88e8c4f

The PR fast-forwarded cleanly from main at 16c2fd08. git diff --check passed. Both builds used separate Cargo target directories.

Setup

AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332, Rust 1.100.0 debug, Agility SDK 1.620.2 with matching debug layer, DXC 1.9.2609.5.

Tested

cargo build --workspace passed on both. cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output exited 101 on both.

Build Passed Failed Ignored SKIPPED notices
main 344 2 23 0
PR head 344 3 23 0

Counts are partial because the library and gpu_compute_e2e exited 0xc0000409 on both builds. Both logged fuzz_validate_and_gpu_3 and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs failures. The additional fuzz_validate_and_gpu_1 failure on the PR also reproduced when run in isolation on base. Both debug-layer E2E tests and the texture-state check passed on both builds.

  • New focused test — cargo test -p xcl --lib gpu_translated_hlsl_keeps_signed_zero_and_nan -- --test-threads=1 --show-output --nocapture failed twice with no skips. Wave32 lane 0 returned 0x80000000 for 0 - (+0), expected 0x00000000. The first assertion stopped both runs.
  • DXC cache tests — cargo test -p xcl --lib gpu::recomp::dxc::cache_tests:: -- --test-threads=1 --show-output --nocapture yielded 14 passed, 0 failed, 0 ignored, 0 skip notices.

Diff review

The sampled runtime compile path passes -Gis and includes that option in the cache key. The focused case still returned negative zero with that path on this configuration. The result does not identify whether the sign changed during translation, DXC optimization, or execution.

Not tested

Remaining tests after the workspace aborts, later NaN and wave64 assertions after the signed-zero failure, and retail smoke (tier 1).

AI use

Codex (GPT-6) prepared the test builds, ran the tests, reviewed the diff, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7371696732 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7371696732). Originally posted by [stijn-boer](https://github.com/stijn-boer) on 2026-12-03T08:00:13Z. --- merge-check base: 16c2fd082ae2e96967a2ab553bc2e1032e491f70 head: 88e8c4fc766142152a5fd5e72d7ce2e878a77817 verdict: not yet: the new translated-HLSL regression returned negative zero for zero minus positive zero on AMD in both focused runs. **Windows / AMD RDNA4 — first strict IEEE HLSL check on `88e8c4f`** The PR fast-forwarded cleanly from `main` at `16c2fd08`. `git diff --check` passed. Both builds used separate Cargo target directories. **Setup** AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332, Rust 1.100.0 debug, Agility SDK 1.620.2 with matching debug layer, DXC 1.9.2609.5. **Tested** `cargo build --workspace` passed on both. `cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output` exited 101 on both. | Build | Passed | Failed | Ignored | `SKIPPED` notices | |---|---:|---:|---:|---:| | `main` | 344 | 2 | 23 | 0 | | PR head | 344 | 3 | 23 | 0 | Counts are partial because the library and `gpu_compute_e2e` exited `0xc0000409` on both builds. Both logged `fuzz_validate_and_gpu_3` and `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` failures. The additional `fuzz_validate_and_gpu_1` failure on the PR also reproduced when run in isolation on base. Both debug-layer E2E tests and the texture-state check passed on both builds. - **New focused test** — `cargo test -p xcl --lib gpu_translated_hlsl_keeps_signed_zero_and_nan -- --test-threads=1 --show-output --nocapture` failed twice with no skips. Wave32 lane 0 returned `0x80000000` for `0 - (+0)`, expected `0x00000000`. The first assertion stopped both runs. - **DXC cache tests** — `cargo test -p xcl --lib gpu::recomp::dxc::cache_tests:: -- --test-threads=1 --show-output --nocapture` yielded 14 passed, 0 failed, 0 ignored, 0 skip notices. **Diff review** The sampled runtime compile path passes `-Gis` and includes that option in the cache key. The focused case still returned negative zero with that path on this configuration. The result does not identify whether the sign changed during translation, DXC optimization, or execution. **Not tested** Remaining tests after the workspace aborts, later NaN and wave64 assertions after the signed-zero failure, and retail smoke (tier 1). **AI use** Codex (GPT-6) prepared the test builds, ran the tests, reviewed the diff, and drafted this report.
Raul-Paiva commented 2026-12-03 09:23:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-12-03T09:23:43Z.


Thanks, that is a real finding. I looked at what DXC makes of the test's program, v_sub_f32 v10, 0, v1, which translates to asfloat(0u) - asfloat(v1). This is with DXC 1.8.2502.11, cs_6_6, -Fc:

  • with no arguments (main before this PR): fsub fast float -0.000000e+00, %26. This is the fold the PR removes.
  • with -Gis (this PR): fsub float 0.000000e+00, %26. No fast-math flags, and the constant is +0.
  • precise on that line instead of -Gis gives the same fsub float 0.000000e+00, %26, so DXIL has nothing stricter to say.

So on NVIDIA the DXIL the GPU gets is already strict, and the test passes. If DXC 1.9.2609.5 gives the same fsub float 0.0, x, then your −0 comes from the AMD driver's own compiler folding 0 - x to -x after DXC. DXIL leaves the shader flag DisableMathRefactoring off (no DXC option I know of sets it), so the driver may be allowed to do that. I cannot check it here: I have no AMD GPU.

Two things would settle it, if you have time:

  1. The fsub line from dxc -T cs_6_6 -E main -Gis -Fc out.ll with your DXC 1.9, on the test's HLSL (t.hlsl in the test, before compile_cached_in).
  2. Whether inf - inf (v11) and -0 - (+0) (v12) are right on your card. The test stops at the first assertion, so they were not reached.

If it is the driver, a change to DXC's arguments cannot fix that 0 - x on AMD, and the test as written would fail on the maintainer's RDNA4 run. Then the PR needs either a translation of v_sub_f32 0, x that a driver cannot fold, or a narrower claim and test. I'd rather know which before changing it.

The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.

<!-- greyfinch-sync:ivall/xcl:comment:7373596008 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7373596008). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-12-03T09:23:43Z. --- Thanks, that is a real finding. I looked at what DXC makes of the test's program, `v_sub_f32 v10, 0, v1`, which translates to `asfloat(0u) - asfloat(v1)`. This is with DXC 1.8.2502.11, `cs_6_6`, `-Fc`: - with no arguments (`main` before this PR): `fsub fast float -0.000000e+00, %26`. This is the fold the PR removes. - with `-Gis` (this PR): `fsub float 0.000000e+00, %26`. No fast-math flags, and the constant is +0. - `precise` on that line instead of `-Gis` gives the same `fsub float 0.000000e+00, %26`, so DXIL has nothing stricter to say. So on NVIDIA the DXIL the GPU gets is already strict, and the test passes. If DXC 1.9.2609.5 gives the same `fsub float 0.0, x`, then your −0 comes from the AMD driver's own compiler folding `0 - x` to `-x` after DXC. DXIL leaves the shader flag `DisableMathRefactoring` off (no DXC option I know of sets it), so the driver may be allowed to do that. I cannot check it here: I have no AMD GPU. Two things would settle it, if you have time: 1. The `fsub` line from `dxc -T cs_6_6 -E main -Gis -Fc out.ll` with your DXC 1.9, on the test's HLSL (`t.hlsl` in the test, before `compile_cached_in`). 2. Whether `inf - inf` (v11) and `-0 - (+0)` (v12) are right on your card. The test stops at the first assertion, so they were not reached. If it is the driver, a change to DXC's arguments cannot fix that `0 - x` on AMD, and the test as written would fail on the maintainer's RDNA4 run. Then the PR needs either a translation of `v_sub_f32 0, x` that a driver cannot fold, or a narrower claim and test. I'd rather know which before changing it. The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.
Gevroska commented 2026-12-03 11:15:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Gevroska on 2026-12-03T11:15:08Z.


@Raul-Paiva I checked the DXC 1.9.2609.5 part of your question. In a separate disassembly probe using the three representative HLSL expressions, -Gis preserved all three fsub operations without fast. The zero operand in +0.0 - x stayed positive. With default optimization, that expression became fsub fast -0.0, x, and x - x folded to a literal zero store.

I also ran your unchanged GPU test on 88e8c4fc on my RTX 3080. With both DXC/DXIL 1.9.2609.5 and 1.8.2502.8, all 32 wave32 lanes and all 64 split-wave64 lanes passed these assertions:

  • 0 - (+0) returned 0x00000000.
  • inf - inf classified as NaN.
  • -0 - (+0) returned 0x80000000.

Both adapter controls and both shader runs passed with zero skips. That confirms the compiler output and all three GPU assertions on Ampere. I don’t have an AMD readback to determine where the reported negative zero is introduced on that adapter.

AI disclosure: OpenAI Codex GPT-6.2 Sol performed the compiler comparison and GPU tests. A separate GPT-6.2 Sol reviewer verified the evidence. GPT-6.2 Astra drafted this comment.

I reviewed and approved this comment before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7376427621 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7376427621). Originally posted by [Gevroska](https://github.com/Gevroska) on 2026-12-03T11:15:08Z. --- @Raul-Paiva I checked the DXC `1.9.2609.5` part of your question. In a separate disassembly probe using the three representative HLSL expressions, `-Gis` preserved all three `fsub` operations without `fast`. The zero operand in `+0.0 - x` stayed positive. With default optimization, that expression became `fsub fast -0.0, x`, and `x - x` folded to a literal zero store. I also ran your unchanged GPU test on `88e8c4fc` on my RTX 3080. With both DXC/DXIL `1.9.2609.5` and `1.8.2502.8`, all 32 wave32 lanes and all 64 split-wave64 lanes passed these assertions: - `0 - (+0)` returned `0x00000000`. - `inf - inf` classified as NaN. - `-0 - (+0)` returned `0x80000000`. Both adapter controls and both shader runs passed with zero skips. That confirms the compiler output and all three GPU assertions on Ampere. I don’t have an AMD readback to determine where the reported negative zero is introduced on that adapter. AI disclosure: OpenAI Codex GPT-6.2 Sol performed the compiler comparison and GPU tests. A separate GPT-6.2 Sol reviewer verified the evidence. GPT-6.2 Astra drafted this comment. I reviewed and approved this comment before posting.
stijn-boer commented 2026-12-03 11:48:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-03T11:48:49Z.


AMD retest of #3778 with #3707 and #3455

The signed-zero failure still reproduces, and the readback also shows inf - inf returning zero. The exact DXIL passed to the GPU runner retains all three strict subtractions in both wave modes.

Setup

AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332, Rust 1.100.0, Agility SDK 1.620.2 with matching debug layer, and DXC/DXIL 1.9.2609.5.

  • Baseline is current main 0c725d5da298b90797993b568e30e6ff6b16e8b6 plus #3707 7b19e27d and #3455 1895d9e8, yielding local merge b52925216.
  • Test build adds #3778 head 88e8c4fc766142152a5fd5e72d7ce2e878a77817, yielding local merge 0b392c0d. The merges and git diff --check were clean. The builds used separate Cargo target directories.

Unchanged regression

cargo test -p xcl --lib gpu_translated_hlsl_keeps_signed_zero_and_nan -- --test-threads=1 --show-output --nocapture reported 0 passed, 1 failed, 0 ignored, 0 skips. Wave32 lane 0 returned 0x80000000 for 0 - (+0), where the assertion expects 0x00000000.

AMD readback and exact DXIL

I reran the same command with temporary instrumentation that dumps the generated t.hlsl and cached compiler output and reports every lane instead of stopping at the first mismatch. One diagnostic execution completed with 0 skips. Every lane in each wave returned the same bits.

Case Expected Wave32 (32/32 lanes) Split wave64 (64/64 lanes)
v10, 0 - (+0) 0x00000000 0x80000000 0x80000000
v11, inf - inf NaN 0x00000000 0x00000000
v12, -0 - (+0) 0x80000000 0x80000000 0x80000000

dxc -T cs_6_6 -E main -Gis -Fc out.ll on the generated HLSL emitted the following v10 instructions. dxc -dumpbin on the actual blob given to the runner showed the same instructions.

; Wave32
%27 = fsub float 0.000000e+00, %26
; Split wave64
%29 = fsub float 0.000000e+00, %28

For v11, both strict blobs also kept the self-subtraction, %35 = fsub float %34, %34 in wave32 and %39 = fsub float %38, %38 in split wave64. With default DXC options, the v10 instructions used fsub fast with a negative-zero operand, and the v11 self-subtraction disappeared. The two incorrect values arise after DXC emits strict DXIL. This is consistent with AMD driver optimization. The driver’s compiled shader was outside the scope of this run.

Workspace comparison

cargo build --workspace passed on both. Both runs of cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output --skip grooming_leaves_a_window_under_1_gib_only_its_hole exited 101. The same test was excluded from both after its subprocess stalled in the initial run.

Build Libtest passed Failed Ignored SKIPPED log notices
Stacked baseline 3004 18 56 459
Stacked baseline + #3778 3005 18 56 460

Both debug-layer integration tests passed on both builds. Many workspace GPU tests reported Agility initialization failures or no GPU, including the new regression. The pass totals include those early returns. The AMD readback above is from the isolated test runs, which used the GPU successfully.

Not tested

Retail smoke and AMD driver machine code.

AI use

OpenAI Codex (GPT-6, exact variant unavailable) prepared the local test builds, ran the tests and diagnostic, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7377212049 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7377212049). Originally posted by [stijn-boer](https://github.com/stijn-boer) on 2026-12-03T11:48:49Z. --- **AMD retest of #3778 with #3707 and #3455** The signed-zero failure still reproduces, and the readback also shows `inf - inf` returning zero. The exact DXIL passed to the GPU runner retains all three strict subtractions in both wave modes. **Setup** AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332, Rust 1.100.0, Agility SDK 1.620.2 with matching debug layer, and DXC/DXIL 1.9.2609.5. - Baseline is current `main` `0c725d5da298b90797993b568e30e6ff6b16e8b6` plus #3707 `7b19e27d` and #3455 `1895d9e8`, yielding local merge `b52925216`. - Test build adds #3778 head `88e8c4fc766142152a5fd5e72d7ce2e878a77817`, yielding local merge `0b392c0d`. The merges and `git diff --check` were clean. The builds used separate Cargo target directories. **Unchanged regression** `cargo test -p xcl --lib gpu_translated_hlsl_keeps_signed_zero_and_nan -- --test-threads=1 --show-output --nocapture` reported 0 passed, 1 failed, 0 ignored, 0 skips. Wave32 lane 0 returned `0x80000000` for `0 - (+0)`, where the assertion expects `0x00000000`. **AMD readback and exact DXIL** I reran the same command with temporary instrumentation that dumps the generated `t.hlsl` and cached compiler output and reports every lane instead of stopping at the first mismatch. One diagnostic execution completed with 0 skips. Every lane in each wave returned the same bits. | Case | Expected | Wave32 (32/32 lanes) | Split wave64 (64/64 lanes) | |---|---|---|---| | v10, `0 - (+0)` | `0x00000000` | `0x80000000` | `0x80000000` | | v11, `inf - inf` | NaN | `0x00000000` | `0x00000000` | | v12, `-0 - (+0)` | `0x80000000` | `0x80000000` | `0x80000000` | `dxc -T cs_6_6 -E main -Gis -Fc out.ll` on the generated HLSL emitted the following v10 instructions. `dxc -dumpbin` on the actual blob given to the runner showed the same instructions. ```llvm ; Wave32 %27 = fsub float 0.000000e+00, %26 ; Split wave64 %29 = fsub float 0.000000e+00, %28 ``` For v11, both strict blobs also kept the self-subtraction, `%35 = fsub float %34, %34` in wave32 and `%39 = fsub float %38, %38` in split wave64. With default DXC options, the v10 instructions used `fsub fast` with a negative-zero operand, and the v11 self-subtraction disappeared. The two incorrect values arise after DXC emits strict DXIL. This is consistent with AMD driver optimization. The driver’s compiled shader was outside the scope of this run. **Workspace comparison** `cargo build --workspace` passed on both. Both runs of `cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output --skip grooming_leaves_a_window_under_1_gib_only_its_hole` exited 101. The same test was excluded from both after its subprocess stalled in the initial run. | Build | Libtest passed | Failed | Ignored | `SKIPPED` log notices | |---|---:|---:|---:|---:| | Stacked baseline | 3004 | 18 | 56 | 459 | | Stacked baseline + #3778 | 3005 | 18 | 56 | 460 | Both debug-layer integration tests passed on both builds. Many workspace GPU tests reported Agility initialization failures or no GPU, including the new regression. The pass totals include those early returns. The AMD readback above is from the isolated test runs, which used the GPU successfully. **Not tested** Retail smoke and AMD driver machine code. **AI use** OpenAI Codex (GPT-6, exact variant unavailable) prepared the local test builds, ran the tests and diagnostic, and drafted this report.
Raul-Paiva commented 2026-12-03 11:54:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-12-03T11:54:25Z.


Thanks, that settles the DXC half. With DXC 1.9.2609.5 and -Gis, +0.0 - x stays a plain fsub with a +0 operand, the same as with 1.8.2502.11 here. The test also passes on your RTX 3080 with both versions, so on NVIDIA what the GPU runs matches the DXIL.

Edited: stijn-boer's AMD retest, posted a few minutes before this reply, answers the other half. The blob given to the runner keeps fsub float 0.000000e+00, %x and fsub float %x, %x, and the RX 9060 XT still returns −0 for 0 - (+0) and 0 for inf - inf in every lane. So the AMD driver folds both after DXC, and -Gis alone cannot fix them there. I'm changing the translation of these two forms to something a driver cannot fold, and will post the new head with its results here.

The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.

<!-- greyfinch-sync:ivall/xcl:comment:7377335221 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7377335221). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-12-03T11:54:25Z. --- Thanks, that settles the DXC half. With DXC 1.9.2609.5 and `-Gis`, `+0.0 - x` stays a plain `fsub` with a +0 operand, the same as with 1.8.2502.11 here. The test also passes on your RTX 3080 with both versions, so on NVIDIA what the GPU runs matches the DXIL. *Edited:* stijn-boer's AMD retest, posted a few minutes before this reply, answers the other half. The blob given to the runner keeps `fsub float 0.000000e+00, %x` and `fsub float %x, %x`, and the RX 9060 XT still returns −0 for `0 - (+0)` and 0 for `inf - inf` in every lane. So the AMD driver folds both after DXC, and `-Gis` alone cannot fix them there. I'm changing the translation of these two forms to something a driver cannot fold, and will post the new head with its results here. The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.
Raul-Paiva commented 2026-12-03 14:15:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-12-03T14:15:37Z.


Thanks for the AMD retest and the per-lane readback. They show the driver folds both forms after DXC, since the blob keeps fsub float 0.000000e+00, %x and fsub float %x, %x. So -Gis alone could not fix them on your card.

The new head 6010258f (rebased onto main 0c725d5d) adds a second commit for that. A v_sub_f32 / v_subrev_f32 with a constant zero source, or the same source twice, now goes through sub_ieee. It is the same subtraction, but these results are chosen on the bits with integer compares, which no float rule can fold:

  • the zero cases (−0 only for −0 − +0);
  • a NaN source, quieted;
  • ±inf minus itself, which gives NaN.

Other subtractions are unchanged. DXC 1.8 with -Gis keeps those compares and selects around each fsub. The GPU test now also checks NaN − NaN, −0 − (−0) and 0 − 2.5.

On my RTX 3070 Laptop the test passes in wave32 and split wave64. I have no AMD card, so whether your RX 9060 XT now gives +0 and NaN is still open. If you can run gpu_translated_hlsl_keeps_signed_zero_and_nan on 6010258f, that would settle it. The description has the rest: tests, the smoke run, and what is not covered, such as a zero reaching the subtraction through another register, and the direct DXIL path.

The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.

<!-- greyfinch-sync:ivall/xcl:comment:7381149675 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7381149675). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-12-03T14:15:37Z. --- Thanks for the AMD retest and the per-lane readback. They show the driver folds both forms after DXC, since the blob keeps `fsub float 0.000000e+00, %x` and `fsub float %x, %x`. So `-Gis` alone could not fix them on your card. The new head 6010258f (rebased onto `main` 0c725d5d) adds a second commit for that. A `v_sub_f32` / `v_subrev_f32` with a constant zero source, or the same source twice, now goes through `sub_ieee`. It is the same subtraction, but these results are chosen on the bits with integer compares, which no float rule can fold: - the zero cases (−0 only for −0 − +0); - a NaN source, quieted; - ±inf minus itself, which gives NaN. Other subtractions are unchanged. DXC 1.8 with `-Gis` keeps those compares and selects around each `fsub`. The GPU test now also checks NaN − NaN, −0 − (−0) and 0 − 2.5. On my RTX 3070 Laptop the test passes in wave32 and split wave64. I have no AMD card, so whether your RX 9060 XT now gives +0 and NaN is still open. If you can run `gpu_translated_hlsl_keeps_signed_zero_and_nan` on 6010258f, that would settle it. The description has the rest: tests, the smoke run, and what is not covered, such as a zero reaching the subtraction through another register, and the direct DXIL path. The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.
Foniass commented 2026-12-03 14:16:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T14:16:53Z.


Follow-up review of 6010258f, since 88e8c4fc (code reading only, not a merge-check) · 2 medium

In short: The new commit 6010258f covers the AMD case that -Gis missed. The driver folds 0 - x and x - x again even in DXIL that has no fast-math flags, so these forms now go through sub_ieee, which works out the zeros and NaN with integer compares. The helper is right even if the driver still folds the fsub inside it. Both earlier nits are fixed. The commit has not yet run on the AMD GPU it targets, and the whole suite is not reported on this head.

Medium

  1. The AMD fix has not run on AMD. The second commit exists for the fold seen on an RX 9060 XT. Not tested says no AMD GPU has run 6010258f. The reasoning holds (see below), but the test that failed on AMD should be run there on this head before merging: gpu_translated_hlsl_keeps_signed_zero_and_nan, ideally with the suite.
  2. The whole suite is not reported on this head. Tested gives gpu::recomp and gpu::dxil and the integration tests on 6010258f. The whole lib suite ran only on the first commit one rebase earlier (3b2f5877). CONTRIBUTING.md asks for cargo test --workspace -- --test-threads=4 on the head under review.
Checked and fine
  • Earlier finding fixed: the first line of the description now names 0 − (+0) giving −0, and inf − inf giving 0 instead of NaN.
  • Earlier finding fixed: the description says that whichever of this PR, #3716 and #3746 lands second updates the pinned "-0 for +0" entries.
  • sub_ieee holds even if the driver folds its a - b, because every case a fold changes is replaced by a select on the bits:
    • both sources zero gives ua & ~ub (−0 only for −0 − +0);
    • ±inf minus itself gives the quiet NaN;
    • a NaN source is quieted, a before b.
    • What remains (0 - x with nonzero x, or x - x with finite nonzero x) has the same value folded or not.
  • sub_foldable compares the full source expressions, modifiers included, so |v| - |v| is covered, and v - (-v) (not foldable to 0) is not. A zero constant with a neg modifier is still caught on the raw source (0u / 0x00000000u / 0x80000000u).
  • v_subrev_f32 swaps the operands before the check and the call. foldable_subtractions_go_through_sub_ieee covers both opcodes, VOP2 and VOP3, and the negative cases.
  • Cost: a few integer operations only on subtractions with a constant zero or the same source twice.
  • The smoke blocks are of main 0c725d5d and this head, on the same title for 120 s.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7381184720 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7381184720). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T14:16:53Z. --- **Follow-up review** of `6010258f`, since `88e8c4fc` (code reading only, not a merge-check) · 2 medium **In short:** The new commit `6010258f` covers the AMD case that `-Gis` missed. The driver folds `0 - x` and `x - x` again even in DXIL that has no fast-math flags, so these forms now go through `sub_ieee`, which works out the zeros and NaN with integer compares. The helper is right even if the driver still folds the `fsub` inside it. Both earlier nits are fixed. The commit has not yet run on the AMD GPU it targets, and the whole suite is not reported on this head. #### Medium 1. **The AMD fix has not run on AMD.** The second commit exists for the fold seen on an RX 9060 XT. **Not tested** says no AMD GPU has run `6010258f`. The reasoning holds (see below), but the test that failed on AMD should be run there on this head before merging: `gpu_translated_hlsl_keeps_signed_zero_and_nan`, ideally with the suite. 2. **The whole suite is not reported on this head.** **Tested** gives `gpu::recomp` and `gpu::dxil` and the integration tests on `6010258f`. The whole lib suite ran only on the first commit one rebase earlier (`3b2f5877`). CONTRIBUTING.md asks for `cargo test --workspace -- --test-threads=4` on the head under review. <details><summary>Checked and fine</summary> - Earlier finding fixed: the first line of the description now names `0 − (+0)` giving −0, and `inf − inf` giving 0 instead of NaN. - Earlier finding fixed: the description says that whichever of this PR, #3716 and #3746 lands second updates the pinned "-0 for +0" entries. - `sub_ieee` holds even if the driver folds its `a - b`, because every case a fold changes is replaced by a `select` on the bits: - both sources zero gives `ua & ~ub` (−0 only for −0 − +0); - ±inf minus itself gives the quiet NaN; - a NaN source is quieted, `a` before `b`. - What remains (`0 - x` with nonzero `x`, or `x - x` with finite nonzero `x`) has the same value folded or not. - `sub_foldable` compares the full source expressions, modifiers included, so `|v| - |v|` is covered, and `v - (-v)` (not foldable to 0) is not. A zero constant with a `neg` modifier is still caught on the raw source (`0u` / `0x00000000u` / `0x80000000u`). - `v_subrev_f32` swaps the operands before the check and the call. `foldable_subtractions_go_through_sub_ieee` covers both opcodes, VOP2 and VOP3, and the negative cases. - Cost: a few integer operations only on subtractions with a constant zero or the same source twice. - The smoke blocks are of `main` `0c725d5d` and this head, on the same title for 120 s. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
stijn-boer commented 2026-12-03 14:47:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-03T14:47:59Z.


merge-check
base: a815de932c
head: 6010258fb1
merge: clean (local merge 9dda203562c5022a39dcc8bf7b1266674e7aa4e8; git diff --check clean)
build: cargo build --workspace passed on both trees
tests: the expanded AMD GPU regression passed without skips in wave32 and split wave64. The lowering check and all 14 DXC cache checks passed. Both filtered workspace runs exited 101 with the same 17 named failures and 18 total failures. No PR-only failure was observed.
review: the updated lowering routes constant-zero and same-source f32 subtracts through sub_ieee. The helper selects signed-zero and NaN results using integer bit tests, and the DXC flag is included in the translated cache key.
performance: outside this focused AMD recompiler retest
verdict: safe to merge: this head fixes both reproduced AMD GPU failures, and the same workspace failures appeared on main. The workspace runs had GPU skips, so the signed-zero and NaN result comes from the isolated GPU test.
hardware / tool and model: AMD Radeon RX 9060 XT (32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332 / OpenAI Codex (GPT-6, exact variant unavailable)

Focused AMD retest

On the prior head, the RX 9060 XT returned negative zero for 0 - (+0) and zero for inf - inf in every tested lane. On 6010258f, the unchanged test passed each assertion in all 32 wave32 lanes and all 64 split-wave64 lanes.

Expression Result checked on GPU
0 - (+0) 0x00000000
inf - inf NaN
-0 - (+0) 0x80000000
NaN - NaN NaN
-0 - (-0) 0x00000000
0 - 2.5 -2.5

Ran cargo test -p xcl --lib <filter> -- --test-threads=1 --show-output --nocapture for gpu_translated_hlsl_keeps_signed_zero_and_nan, foldable_subtractions_go_through_sub_ieee, and gpu::recomp::dxc::cache_tests::. The three runs reported 16 passed, 0 failed, 0 ignored, 0 skips in total. Used Rust 1.100.0, DXC/DXIL 1.9.2609.5, and Agility SDK 1.620.2 with the matching debug layer. Plain main already included #3707. No other PR was added.

Workspace comparison

cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output --skip grooming_leaves_a_window_under_1_gib_only_its_hole

Build Libtest passed Failed Ignored SKIPPED log notices
Main 3,003 18 56 458
Main + #3778 3,005 18 56 459

The named failures matched across the library and two-pass driver-cache E2E. Both debug-layer E2E checks passed on both trees. The grooming test was filtered out on both because it previously stalled on this host. GPU skip notices can repeat in captured output, and libtest pass totals include early returns. The new GPU regression skipped during the workspace run and executed successfully in isolation.

Not tested: the filtered grooming case, retail smoke and performance on this AMD host, zero propagated through a different register, and the equivalent float cases on the direct DXIL backend.

AI use: OpenAI Codex (GPT-6, exact variant unavailable) prepared the test builds, ran the tests, compared the logs, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7382051969 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7382051969). Originally posted by [stijn-boer](https://github.com/stijn-boer) on 2026-12-03T14:47:59Z. --- merge-check base: a815de932c4dc8da3b383ca44f4b094aa406fec9 head: 6010258fb178ae6322517da55eca215c688f11a0 merge: clean (local merge 9dda203562c5022a39dcc8bf7b1266674e7aa4e8; git diff --check clean) build: cargo build --workspace passed on both trees tests: the expanded AMD GPU regression passed without skips in wave32 and split wave64. The lowering check and all 14 DXC cache checks passed. Both filtered workspace runs exited 101 with the same 17 named failures and 18 total failures. No PR-only failure was observed. review: the updated lowering routes constant-zero and same-source f32 subtracts through sub_ieee. The helper selects signed-zero and NaN results using integer bit tests, and the DXC flag is included in the translated cache key. performance: outside this focused AMD recompiler retest verdict: safe to merge: this head fixes both reproduced AMD GPU failures, and the same workspace failures appeared on main. The workspace runs had GPU skips, so the signed-zero and NaN result comes from the isolated GPU test. hardware / tool and model: AMD Radeon RX 9060 XT (32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332 / OpenAI Codex (GPT-6, exact variant unavailable) **Focused AMD retest** On the prior head, the RX 9060 XT returned negative zero for `0 - (+0)` and zero for `inf - inf` in every tested lane. On `6010258f`, the unchanged test passed each assertion in all 32 wave32 lanes and all 64 split-wave64 lanes. | Expression | Result checked on GPU | |---|---| | `0 - (+0)` | `0x00000000` | | `inf - inf` | NaN | | `-0 - (+0)` | `0x80000000` | | `NaN - NaN` | NaN | | `-0 - (-0)` | `0x00000000` | | `0 - 2.5` | `-2.5` | Ran `cargo test -p xcl --lib <filter> -- --test-threads=1 --show-output --nocapture` for `gpu_translated_hlsl_keeps_signed_zero_and_nan`, `foldable_subtractions_go_through_sub_ieee`, and `gpu::recomp::dxc::cache_tests::`. The three runs reported **16 passed, 0 failed, 0 ignored, 0 skips** in total. Used Rust 1.100.0, DXC/DXIL 1.9.2609.5, and Agility SDK 1.620.2 with the matching debug layer. Plain main already included #3707. No other PR was added. **Workspace comparison** `cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output --skip grooming_leaves_a_window_under_1_gib_only_its_hole` | Build | Libtest passed | Failed | Ignored | `SKIPPED` log notices | |---|---:|---:|---:|---:| | Main | 3,003 | 18 | 56 | 458 | | Main + #3778 | 3,005 | 18 | 56 | 459 | The named failures matched across the library and two-pass driver-cache E2E. Both debug-layer E2E checks passed on both trees. The grooming test was filtered out on both because it previously stalled on this host. GPU skip notices can repeat in captured output, and libtest pass totals include early returns. The new GPU regression skipped during the workspace run and executed successfully in isolation. **Not tested:** the filtered grooming case, retail smoke and performance on this AMD host, zero propagated through a different register, and the equivalent float cases on the direct DXIL backend. **AI use:** OpenAI Codex (GPT-6, exact variant unavailable) prepared the test builds, ran the tests, compared the logs, and drafted this report.
Raul-Paiva commented 2026-12-03 15:24:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-12-03T15:24:38Z.


Thanks for running it on the RX 9060 XT. It settles the AMD side: every lane now gives +0 and NaN, and the workspace run shows the same failures as main and none of its own. It also covers the whole suite on this head, which Foniass asked for.

I've added your results to Tested, and the AMD line under Not tested is now only a retail title and frame times there.

The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.

<!-- greyfinch-sync:ivall/xcl:comment:7383093404 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3778#issuecomment-7383093404). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-12-03T15:24:38Z. --- Thanks for running it on the RX 9060 XT. It settles the AMD side: every lane now gives +0 and NaN, and the workspace run shows the same failures as `main` and none of its own. It also covers the whole suite on this head, which Foniass asked for. I've added your results to **Tested**, and the AMD line under **Not tested** is now only a retail title and frame times there. The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3778:upstream-pr/3778'
git switch 'upstream-pr/3778'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3778'
git switch 'upstream-pr/3778'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3778'
git switch 'upstream-pr/3778'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3778'
git switch 'main'
git merge --squash 'upstream-pr/3778'
git switch 'main'
git merge --ff-only 'upstream-pr/3778'
git switch 'main'
git merge 'upstream-pr/3778'
git push origin 'main'
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!3778
No description provided.