v_med3_f32 with NaN returns wrong side on NVIDIA (NVIDIA-specific test failure) #726

Open
opened 2026-11-26 04:13:53 +00:00 by github-bot · 17 comments
Owner

@⁠Tanju42 on GitHub · 2026-11-24 08:27 UTC · original

Title: v_med3_f32(1.0, 2.0, NaN) returns 2.0 on NVIDIA; the RDNA2 result is 1.0

Running the test suite on an NVIDIA RTX 5060 Laptop (driver 591.74, Windows 11
26300) with the default hardware device, the whole suite is green except:

emit::valu_tests::v_med3_f32_matches_rdna2_with_nan
assertion `left == right` failed: hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1

The lowering models the RDNA2 v_med3_f32 NaN rule (with a NaN among the
three, the result is the smaller of the two numbers). The DXIL path evidently
maps it to an intrinsic/host expression whose NaN propagation picks the other
side on NVIDIA hardware; AMD (RX 6700 XT, where the suite is reported green)
matches the console behavior. All other NaN VALU tests in the same module
(v_med3_f16... passes on NVIDIA already) are fine, so only the f32 lowering
needs the NaN-safe form.

Repro: cargo test -p victory-shader --lib -- --test-threads=1
Environment: any NVIDIA D3D12 adapter with SM 6.6; the failure is stable in
serial and parallel runs. The same run under VICTORY_WARP=1 is fully green,
which fits a hardware-intrinsic difference rather than a code bug.

No game files involved — synthetic tests only.

**@⁠Tanju42** on GitHub · 2026-11-24 08:27 UTC · [original](https://github.com/Marvisak/VIctory/issues/726) Title: `v_med3_f32(1.0, 2.0, NaN) returns 2.0 on NVIDIA; the RDNA2 result is 1.0` Running the test suite on an NVIDIA RTX 5060 Laptop (driver 591.74, Windows 11 26300) with the default hardware device, the whole suite is green except: ``` emit::valu_tests::v_med3_f32_matches_rdna2_with_nan assertion `left == right` failed: hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1 ``` The lowering models the RDNA2 `v_med3_f32` NaN rule (with a NaN among the three, the result is the smaller of the two numbers). The DXIL path evidently maps it to an intrinsic/host expression whose NaN propagation picks the other side on NVIDIA hardware; AMD (RX 6700 XT, where the suite is reported green) matches the console behavior. All other NaN VALU tests in the same module (`v_med3_f16...` passes on NVIDIA already) are fine, so only the f32 lowering needs the NaN-safe form. Repro: `cargo test -p victory-shader --lib -- --test-threads=1` Environment: any NVIDIA D3D12 adapter with SM 6.6; the failure is stable in serial and parallel runs. The same run under `VICTORY_WARP=1` is fully green, which fits a hardware-intrinsic difference rather than a code bug. No game files involved — synthetic tests only.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:53 +00:00
Author
Owner

@⁠NuraadGit on GitHub · 2026-11-24 08:35 UTC · original

Data point: on an RTX 2080 (Turing), driver 616.56, Windows 11 26200, both tests pass on main 58fed37. I applied #719's one-line test fix locally so the crate's tests compile.

cargo test -p victory-shader v_med3 -- --test-threads=1
test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok
test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok

Your failing run was on driver 591.74, which is much older, on Blackwell. This one may depend on the driver (or the architecture) rather than on NVIDIA as a whole. A rerun on a current driver on the same laptop would tell which.

AI-assisted (Claude Code); run on the user's machine.

**@⁠NuraadGit** on GitHub · 2026-11-24 08:35 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7126312143) Data point: on an **RTX 2080 (Turing), driver 616.56**, Windows 11 26200, both tests pass on `main` `58fed37`. I applied #719's one-line test fix locally so the crate's tests compile. ``` cargo test -p victory-shader v_med3 -- --test-threads=1 test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok ``` Your failing run was on driver 591.74, which is much older, on Blackwell. This one may depend on the driver (or the architecture) rather than on NVIDIA as a whole. A rerun on a current driver on the same laptop would tell which. *AI-assisted (Claude Code); run on the user's machine.*
Author
Owner

@⁠Nii-SanHP on GitHub · 2026-11-24 08:38 UTC · original

Data point: RTX 5070 Ti (Blackwell, desktop), driver 621.24, Windows 11 26200, main 58fed37 with #719's one-line fix applied locally.

test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok
test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok

Full workspace: 307 passed, 0 failed. Blackwell itself passes on a current driver, which supports the failure being the older driver (591.74) rather than the architecture.

AI-assisted (Claude Code); run on the user's machine. No game data used.

**@⁠Nii-SanHP** on GitHub · 2026-11-24 08:38 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7126381353) Data point: **RTX 5070 Ti (Blackwell, desktop), driver 621.24**, Windows 11 26200, `main` `58fed37` with #719's one-line fix applied locally. ``` test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok ``` Full workspace: 307 passed, 0 failed. Blackwell itself passes on a current driver, which supports the failure being the older driver (591.74) rather than the architecture. *AI-assisted (Claude Code); run on the user's machine. No game data used.*
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-24 08:39 UTC · original

Another data point, from Ampere: RTX 3060 12 GB (desktop), driver 610.88, Windows 11 Pro 26300, Rust 1.98.1 x86_64-pc-windows-msvc, main 58fed37 with #719's one-line fix applied locally (lowers(&words, 0)) so the tests compile.

  • cargo test --locked -p victory-shader v_med3 -- --test-threads=1, 10 runs: both v_med3_f16_matches_rdna2_with_nan and v_med3_f32_matches_rdna2_with_nan passed every time, on the hardware adapter and WARP
  • the same two tests in parallel: pass
  • cargo test --locked --workspace with the fix: 307 passed, 0 failed, 5 ignored

So it now passes on Turing (616.56) and Ampere (610.88) and fails on the Blackwell laptop (591.74). That fits the driver (or Blackwell) rather than NVIDIA in general, as @⁠NuraadGit suggests.

No game data used. AI-assisted (Claude Code).

**@⁠fromthemoonx** on GitHub · 2026-11-24 08:39 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7126399761) Another data point, from Ampere: **RTX 3060 12 GB (desktop), driver 610.88**, Windows 11 Pro 26300, Rust 1.98.1 `x86_64-pc-windows-msvc`, `main` `58fed37` with #719's one-line fix applied locally (`lowers(&words, 0)`) so the tests compile. - `cargo test --locked -p victory-shader v_med3 -- --test-threads=1`, 10 runs: both `v_med3_f16_matches_rdna2_with_nan` and `v_med3_f32_matches_rdna2_with_nan` passed every time, on the hardware adapter and WARP - the same two tests in parallel: pass - `cargo test --locked --workspace` with the fix: 307 passed, 0 failed, 5 ignored So it now passes on Turing (616.56) and Ampere (610.88) and fails on the Blackwell laptop (591.74). That fits the driver (or Blackwell) rather than NVIDIA in general, as @⁠NuraadGit suggests. No game data used. AI-assisted (Claude Code).
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-24 09:01 UTC · original

Ada data point: RTX 4070 Ti (desktop), NVIDIA driver 621.01, Windows 11 build 26300.9974, Rust 1.98.1 (x86_64-pc-windows-msvc). Tested fa001a6 (58fed37 plus the one-line test compilation fix from #719).

cargo test --locked -p victory-shader --lib v_med3 -- --test-threads=1 --nocapture
test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok
test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok

Both tests passed on the hardware adapter and WARP in one run, with no adapter skips. I verified that the default D3D12 adapter was the RTX 4070 Ti.

No game data used. AI-assisted test setup and reporting.

**@⁠DrDarkDK** on GitHub · 2026-11-24 09:01 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7126859216) Ada data point: **RTX 4070 Ti (desktop), NVIDIA driver 621.01**, Windows 11 build 26300.9974, Rust 1.98.1 (`x86_64-pc-windows-msvc`). Tested `fa001a6` (`58fed37` plus the one-line test compilation fix from #719). ```text cargo test --locked -p victory-shader --lib v_med3 -- --test-threads=1 --nocapture test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok ``` Both tests passed on the hardware adapter and WARP in one run, with no adapter skips. I verified that the default D3D12 adapter was the RTX 4070 Ti. No game data used. AI-assisted test setup and reporting.
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 09:15 UTC · original

AMD RDNA4 data point on main (8e79c80, where #719 is already fixed):

  • Hardware: AMD Radeon RX 9060 XT (RDNA4 / PCI\VEN_1002&DEV_7590), AMD Windows driver 32.0.32029.2010 (Adrenalin 26.11.2)
  • Environment: Windows 11 Pro build 26100, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • Command: cargo test -p victory-shader --locked -- v_med3_f --nocapture
running 2 tests
test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok
test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 88 filtered out; finished in 0.42s

Full cargo test --workspace --locked on the same machine also passed (311 passed; 0 failed; 6 ignored).

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 09:15 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7127159009) AMD RDNA4 data point on `main` (`8e79c80`, where `#719` is already fixed): - **Hardware**: AMD Radeon RX 9060 XT (RDNA4 / `PCI\VEN_1002&DEV_7590`), AMD Windows driver `32.0.32029.2010` (Adrenalin `26.11.2`) - **Environment**: Windows 11 Pro build `26100`, Rust `1.98.1` (`x86_64-pc-windows-msvc`) - **Command**: `cargo test -p victory-shader --locked -- v_med3_f --nocapture` ```text running 2 tests test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 88 filtered out; finished in 0.42s ``` Full `cargo test --workspace --locked` on the same machine also passed (`311 passed; 0 failed; 6 ignored`). AI-assisted; synthetic tests only, no game files.
Author
Owner

@⁠terxx465 on GitHub · 2026-11-24 09:44 UTC · original

Data point: RTX 5060 Ti 16 GB (Blackwell, desktop), driver 621.24, Windows 11 Pro 26300, i5-14400F (no iGPU, so the hardware adapter is the RTX), Rust 1.98.1 (x86_64-pc-windows-msvc), DXC from Windows SDK 10.0.26100. Tested main at 8e79c80, no local changes.

cargo test --workspace --locked --no-fail-fast -- --test-threads=4

Full workspace: 311 passed, 0 failed, 6 ignored.

cargo test -p victory-shader -p victory-gpu --locked -- --nocapture --test-threads=1
test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok
test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok

All 13 valu_tests pass on the hardware adapter and WARP. The 4 diff_tests skip here (no console compiler / no console or PC compiler), so they are not covered by this run.

This matches the RTX 5070 Ti result on the same driver: on a current driver, Blackwell passes v_med3_f32.

AI-assisted test run and reporting; synthetic tests only, no game files.

**@⁠terxx465** on GitHub · 2026-11-24 09:44 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7127834631) Data point: **RTX 5060 Ti 16 GB (Blackwell, desktop), driver 621.24**, Windows 11 Pro 26300, i5-14400F (no iGPU, so the hardware adapter is the RTX), Rust 1.98.1 (`x86_64-pc-windows-msvc`), DXC from Windows SDK 10.0.26100. Tested `main` at `8e79c80`, no local changes. ``` cargo test --workspace --locked --no-fail-fast -- --test-threads=4 ``` Full workspace: **311 passed, 0 failed, 6 ignored**. ``` cargo test -p victory-shader -p victory-gpu --locked -- --nocapture --test-threads=1 test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok ``` All 13 `valu_tests` pass on the hardware adapter and WARP. The 4 `diff_tests` skip here (`no console compiler` / `no console or PC compiler`), so they are not covered by this run. This matches the RTX 5070 Ti result on the same driver: on a current driver, Blackwell passes `v_med3_f32`. AI-assisted test run and reporting; synthetic tests only, no game files.
Author
Owner

@⁠EduBertozzi on GitHub · 2026-11-24 10:07 UTC · original

Pascal data point: GTX 1060 6 GB, driver 582.66, Windows 10 Education 22H2 (19045), i7-10700K, Rust 1.98.1. SM 6.6 comes from the Agility SDK 1.620.2 runtime, via #486 on my branch.

cargo test -p victory-shader v_med3 -- --test-threads=1
test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok
test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok

Both tests ran on the hardware adapter, and on WARP 1.0.22 (Microsoft.Direct3D.WARP) with its d3d10warp.dll placed beside the test binary. That adds Pascal to the passing reports here (Turing, Ampere, Ada, desktop Blackwell, RDNA4). So far only the RTX 5060 Laptop on driver 591.74 fails.

AI-assisted (Claude Code); runs on my machine.

**@⁠EduBertozzi** on GitHub · 2026-11-24 10:07 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7128339759) Pascal data point: **GTX 1060 6 GB, driver 582.66**, Windows 10 Education 22H2 (19045), i7-10700K, Rust 1.98.1. SM 6.6 comes from the Agility SDK 1.620.2 runtime, via #486 on my branch. ``` cargo test -p victory-shader v_med3 -- --test-threads=1 test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok ``` Both tests ran on the hardware adapter, and on WARP 1.0.22 (Microsoft.Direct3D.WARP) with its `d3d10warp.dll` placed beside the test binary. That adds Pascal to the passing reports here (Turing, Ampere, Ada, desktop Blackwell, RDNA4). So far only the RTX 5060 Laptop on driver 591.74 fails. AI-assisted (Claude Code); runs on my machine.
Author
Owner

@⁠ayanbarosan on GitHub · 2026-11-24 13:09 UTC · original

On an Optimus laptop, the failure follows the Intel iGPU, not the NVIDIA GPU. Same machine (i5-11400H, RTX 3050 Laptop, Windows 11 build 26300), main at ffe310e with no changes, v_med3 tests run 10 times on each adapter:

Adapter that ran the test v_med3_f32_matches_rdna2_with_nan
Intel UHD Graphics (Tiger Lake, driver 31.0.101.5333), the default adapter fails 10/10: hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1
NVIDIA GeForce RTX 3050 Laptop GPU (driver 610.91) passes 10/10

v_med3_f16 passes on both, as in the original report. To run on the RTX, I changed Host::new in crates/victory-shader/src/emit/host.rs locally to take the adapter from IDXGIFactory6::EnumAdapterByGpuPreference(0, HIGH_PERFORMANCE). I also printed the device's adapter (from GetAdapterLuid) in both modes, so each row names the GPU that actually ran.

Host::new calls D3D12CreateDevice(NULL), which takes DXGI adapter 0, and on Optimus laptops that is usually the integrated GPU. So the two laptop failures reported as NVIDIA (the RTX 5060 Laptop here and the RTX 3050 Ti Laptop in #745) may have run on the iGPU. Every desktop NVIDIA result so far passes. The old-driver explanation doesn't fit #745 either: that failure was on 32.0.16.2114 (621.14), newer than most of the passing desktop drivers. Printing the adapter name in the test output would show this in every report.

The fix from #745 (c796377 on raphael-riesner:shader/med3-nan-bits) passes 10/10 on both adapters here. Anyone with this failure can try that branch.

No game data used. AI-assisted (Claude Code).

**@⁠ayanbarosan** on GitHub · 2026-11-24 13:09 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7132440816) **On an Optimus laptop, the failure follows the Intel iGPU, not the NVIDIA GPU.** Same machine (i5-11400H, RTX 3050 Laptop, Windows 11 build 26300), `main` at ffe310e with no changes, `v_med3` tests run 10 times on each adapter: | Adapter that ran the test | `v_med3_f32_matches_rdna2_with_nan` | |---|---| | Intel UHD Graphics (Tiger Lake, driver 31.0.101.5333), the default adapter | fails 10/10: `hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1` | | NVIDIA GeForce RTX 3050 Laptop GPU (driver 610.91) | passes 10/10 | `v_med3_f16` passes on both, as in the original report. To run on the RTX, I changed `Host::new` in `crates/victory-shader/src/emit/host.rs` locally to take the adapter from `IDXGIFactory6::EnumAdapterByGpuPreference(0, HIGH_PERFORMANCE)`. I also printed the device's adapter (from `GetAdapterLuid`) in both modes, so each row names the GPU that actually ran. `Host::new` calls `D3D12CreateDevice(NULL)`, which takes DXGI adapter 0, and on Optimus laptops that is usually the integrated GPU. So the two laptop failures reported as NVIDIA (the RTX 5060 Laptop here and the RTX 3050 Ti Laptop in #745) may have run on the iGPU. Every desktop NVIDIA result so far passes. The old-driver explanation doesn't fit #745 either: that failure was on 32.0.16.2114 (621.14), newer than most of the passing desktop drivers. Printing the adapter name in the test output would show this in every report. **The fix from #745** (c796377 on [`raphael-riesner:shader/med3-nan-bits`](https://github.com/raphael-riesner/VIctory/tree/shader/med3-nan-bits)) passes 10/10 on both adapters here. Anyone with this failure can try that branch. No game data used. AI-assisted (Claude Code).
Author
Owner

@⁠Sunkiller-qc on GitHub · 2026-11-24 13:21 UTC · original

There's an open PR for this from before this issue: #110 (lordon1a, opened 00:36 UTC). It replaces fcmp uno in Lower::med3() with DXIL's IsNaN (dx.op.isSpecialFloat.f32, opcode 8), because the driver compiler folds fcmp uno x, x to false under fast-math. The symptom is the same: v_med3_f32(1.0, 2.0, NaN) returns 2.0 instead of 1.0. It was found on Intel Iris Xe, which matches ayanbarosan's Intel UHD result on #745. #154 extends the same fix to the other unordered and ordered compares.

So there are two fixes now, #110 and the bit-compare branch on #745. If someone with a failing card (the 5060 Laptop here, or the 3050 Ti Laptop on #745) could run v_med3_f32_matches_rdna2_with_nan on #110, that would settle which one to take.

**@⁠Sunkiller-qc** on GitHub · 2026-11-24 13:21 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7132709909) There's an open PR for this from before this issue: #110 (lordon1a, opened 00:36 UTC). It replaces `fcmp uno` in `Lower::med3()` with DXIL's `IsNaN` (`dx.op.isSpecialFloat.f32`, opcode 8), because the driver compiler folds `fcmp uno x, x` to false under fast-math. The symptom is the same: `v_med3_f32(1.0, 2.0, NaN)` returns 2.0 instead of 1.0. It was found on Intel Iris Xe, which matches ayanbarosan's Intel UHD result on #745. #154 extends the same fix to the other unordered and ordered compares. So there are two fixes now, #110 and the bit-compare branch on #745. If someone with a failing card (the 5060 Laptop here, or the 3050 Ti Laptop on #745) could run `v_med3_f32_matches_rdna2_with_nan` on #110, that would settle which one to take.
Author
Owner

@⁠ayanbarosan on GitHub · 2026-11-24 18:22 UTC · original

I ran v_med3_f32_matches_rdna2_with_nan on #110, on a GPU where it fails. That is the Intel UHD Graphics of the Optimus laptop from my comment above (Tiger Lake, driver 31.0.101.5333, Windows 11 build 26300). For the RTX column, a local change made the test host take the high-performance adapter. A local print of the device's adapter confirmed which GPU each column ran on.

v_med3_f32_matches_rdna2_with_nan Intel UHD (default adapter) RTX 3050 Laptop (driver 610.91)
#110's base, fc0c4dd fails 3/3: hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1 passes
#110 as submitted, d53fa58 passes 10/10 passes 10/10
c796377 from #745, on main at ffe310e (my comment above) passes 10/10 passes 10/10

v_med3_f16 passes in every row. cargo test -p victory-shader --locked --lib on d53fa58: 69 passed, 0 failed, including the new med3_f32_emits_dxil_isnan_instead_of_fcmp_uno.

Both fixes work on this GPU. They rely on different things: #110 on the driver keeping dx.op.isSpecialFloat (IsNaN), and c796377 on integer compares of the bits, which a driver's no-NaN assumption can't fold.

Heads-up for #110: it no longer merges cleanly with main at ffe310e. lower.rs conflicts in two test-only spots: the fields of Lowered, where main added nonuniform_handles and wave_ops, and the helper lowers, which main changed to take rsrc2.

The adapter name in the test output, suggested above, is now #1138.

No game data used. AI-assisted (Claude Code).

**@⁠ayanbarosan** on GitHub · 2026-11-24 18:22 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7140559071) I ran `v_med3_f32_matches_rdna2_with_nan` on #110, on a GPU where it fails. That is the Intel UHD Graphics of the Optimus laptop from my comment above (Tiger Lake, driver 31.0.101.5333, Windows 11 build 26300). For the RTX column, a local change made the test host take the high-performance adapter. A local print of the device's adapter confirmed which GPU each column ran on. | `v_med3_f32_matches_rdna2_with_nan` | Intel UHD (default adapter) | RTX 3050 Laptop (driver 610.91) | |---|---|---| | #110's base, `fc0c4dd` | fails 3/3: `hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1` | passes | | #110 as submitted, `d53fa58` | passes 10/10 | passes 10/10 | | c796377 from #745, on `main` at `ffe310e` (my comment above) | passes 10/10 | passes 10/10 | `v_med3_f16` passes in every row. `cargo test -p victory-shader --locked --lib` on `d53fa58`: 69 passed, 0 failed, including the new `med3_f32_emits_dxil_isnan_instead_of_fcmp_uno`. Both fixes work on this GPU. They rely on different things: #110 on the driver keeping `dx.op.isSpecialFloat` (IsNaN), and c796377 on integer compares of the bits, which a driver's no-NaN assumption can't fold. Heads-up for #110: it no longer merges cleanly with `main` at `ffe310e`. `lower.rs` conflicts in two test-only spots: the fields of `Lowered`, where `main` added `nonuniform_handles` and `wave_ops`, and the helper `lowers`, which `main` changed to take `rsrc2`. The adapter name in the test output, suggested above, is now #1138. No game data used. AI-assisted (Claude Code).
Author
Owner

@⁠DeerSilver on GitHub · 2026-11-24 18:52 UTC · original

Data point from the same GPU as the report: NVIDIA GeForce RTX 5060 Laptop GPU (10de:2d59), driver 621.24, Windows 11 26300, main ffe310e. Both v_med3_f32_matches_rdna2_with_nan and v_med3_f16_matches_rdna2_with_nan pass 5 of 5. To be sure the RTX ran them, I added a local, uncommitted switch to emit::host::Host::new that creates the device on a given DXGI adapter and prints its name.

The same laptop's Intel UHD (8086:a788, driver 32.0.101.7088) fails exactly as reported here, 5 of 5: hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1. On this laptop DXGI lists the RTX first, but on a hybrid laptop where the iGPU is adapter 0, the test's default device is the iGPU (as N7z notes on #971). So this failure may be the iGPU's, or the 591.74 driver's. Either way, #745's c796377 fixes it on the Intel UHD and keeps it passing on the RTX (results on #745).

No game files: the test suite only. AI-assisted (Claude Code).

**@⁠DeerSilver** on GitHub · 2026-11-24 18:52 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7141271142) Data point from the same GPU as the report: **NVIDIA GeForce RTX 5060 Laptop GPU (`10de:2d59`), driver 621.24**, Windows 11 26300, `main` `ffe310e`. Both `v_med3_f32_matches_rdna2_with_nan` and `v_med3_f16_matches_rdna2_with_nan` pass 5 of 5. To be sure the RTX ran them, I added a local, uncommitted switch to `emit::host::Host::new` that creates the device on a given DXGI adapter and prints its name. The same laptop's **Intel UHD (`8086:a788`, driver 32.0.101.7088) fails exactly as reported here**, 5 of 5: `hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1`. On this laptop DXGI lists the RTX first, but on a hybrid laptop where the iGPU is adapter 0, the test's default device is the iGPU (as N7z notes on #971). So this failure may be the iGPU's, or the 591.74 driver's. Either way, #745's `c796377` fixes it on the Intel UHD and keeps it passing on the RTX (results on #745). No game files: the test suite only. AI-assisted (Claude Code).
Author
Owner

@⁠nicolasveilleux on GitHub · 2026-11-24 23:54 UTC · original

I could not reproduce the v_med3_f32 NaN failure on a desktop RTX 2070 SUPER (8 GB, NVIDIA driver 610.60), Windows 11 Pro build 26300, Rust 1.98.1 MSVC, on unmodified upstream main at 70564ae.

cargo test --locked --offline -p victory-shader --lib emit::valu_tests::v_med3_f32_matches_rdna2_with_nan -- --exact --nocapture passed with the default D3D12 adapter and again with VICTORY_WARP=1. The workspace build passed. The full suite reported 471 passed, 5 failed, and 7 ignored, matching the five failures listed in #1744. No game files or local code changes were used. This is a hardware data point for #726, not a test of the patch in #1610.

AI-assisted; the results above come from runs on the stated hardware.

**@⁠nicolasveilleux** on GitHub · 2026-11-24 23:54 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7147926676) I could not reproduce the `v_med3_f32` NaN failure on a desktop RTX 2070 SUPER (8 GB, NVIDIA driver 610.60), Windows 11 Pro build 26300, Rust 1.98.1 MSVC, on unmodified upstream `main` at `70564ae`. `cargo test --locked --offline -p victory-shader --lib emit::valu_tests::v_med3_f32_matches_rdna2_with_nan -- --exact --nocapture` passed with the default D3D12 adapter and again with `VICTORY_WARP=1`. The workspace build passed. The full suite reported 471 passed, 5 failed, and 7 ignored, matching the five failures listed in #1744. No game files or local code changes were used. This is a hardware data point for #726, not a test of the patch in #1610. AI-assisted; the results above come from runs on the stated hardware.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:47 UTC · original · edited 2026-11-26 00:50 UTC

Automated triage for the maintainers.

Confirmed on current main (63bcca4). Lower::med3 in crates/victory-shader/src/emit/lower.rs still picks the NaN case with two fcmp uno compares (pred::UNO on a, b and on third, third). Some driver compilers fold these to false, and then the plain median comes back.

The thread narrows the failing devices down. An Intel UHD iGPU fails 10/10 and 5/5 on two hybrid laptops, while the RTX on the same machines passes. Every desktop NVIDIA, AMD and WARP result passes, including the newest ones (RTX 3070 Ti on 13f91ca, RTX 4070 on 842b0cb). So the "NVIDIA" in the title most likely comes from the test host using an iGPU adapter on a laptop. Those passing results don't fix the bug: the compare still folds on the iGPUs, so this stays open.

Where the fixes stand:

  • The bit-compare fix from #745 (c796377) and #110 (DXIL IsNaN) were both closed without merging. Neither is in main.
  • Open PR #1483 makes v_med3_f32/f16 test for NaN on the bits, and makes the test host pick the high-performance adapter. It needs a rebase.
  • Open PR #2010 (labelled as needing work) keeps fcmp uno and adds more of it. So it would not help if the folding is the cause.
  • Open PRs #1138 and #1889 name or pick the adapter in shader test output. Both need a rebase.

The cause is tracked here and in #745 (fix branch). #971 (Intel Arc) is likely the same compare folding.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:47 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7149957210) · edited 2026-11-26 00:50 UTC <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T23:51:29Z at=2026-11-26T00:51:00Z --> Automated triage for the maintainers. Confirmed on current `main` (`63bcca4`). `Lower::med3` in `crates/victory-shader/src/emit/lower.rs` still picks the NaN case with two `fcmp uno` compares (`pred::UNO` on `a, b` and on `third, third`). Some driver compilers fold these to false, and then the plain median comes back. The thread narrows the failing devices down. An Intel UHD iGPU fails 10/10 and 5/5 on two hybrid laptops, while the RTX on the same machines passes. Every desktop NVIDIA, AMD and WARP result passes, including the newest ones (RTX 3070 Ti on `13f91ca`, RTX 4070 on `842b0cb`). So the "NVIDIA" in the title most likely comes from the test host using an iGPU adapter on a laptop. Those passing results don't fix the bug: the compare still folds on the iGPUs, so this stays open. Where the fixes stand: - The bit-compare fix from #745 (`c796377`) and #110 (DXIL `IsNaN`) were both closed without merging. Neither is in `main`. - Open PR #1483 makes `v_med3_f32/f16` test for NaN on the bits, and makes the test host pick the high-performance adapter. It needs a rebase. - Open PR #2010 (labelled as needing work) keeps `fcmp uno` and adds more of it. So it would not help if the folding is the cause. - Open PRs #1138 and #1889 name or pick the adapter in shader test output. Both need a rebase. The cause is tracked here and in #745 (fix branch). #971 (Intel Arc) is likely the same compare folding. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠artor410 on GitHub · 2026-11-25 21:53 UTC · original

Comparison on RTX 3070 Ti, driver 610.88, Windows 11 26300, rustc 1.98.1. main 13f91ca. Synthetic tests only.

v_med3_f32_matches_rdna2_with_nan passes on main on this card, so #726 (RTX 5060 Laptop, driver 591.74) does not reproduce here. It may depend on the driver.

PR state merges victory-shader NaN test
#2010 open yes 266 pass / 3 fail (same 3 as main), no new test fcmp uno, more of it
#110 closed no head 69 / 0 dx.op.isSpecialFloat (IsNaN)

Main fails the same 3 tests: two stride tests and gathers_at_a_level_match_the_hardware. On this card heap_direct_texture_reads_mark_their_heap_index crashes the process on main and was skipped.

No verdict from this hardware: neither PR changes a result here.

On the cause, #110 reports a driver folding fcmp uno x, x under fast-math. #2010 keeps that compare and adds more of it, so it would not help if that is the cause.

Forks:

  • VItoriaBr (uiliannn/VItoriaBr@578d459c34), whose README reports the world rendering on an RTX 5060 Ti, and DexNom (570a941) detect NaN on the integer bits: abs(bits) > 0x7F800000 via is_nan_f32. That depends on neither fcmp uno nor IsNaN folding.
  • Belobug carries #110 (a5837b8).

A form already used in an NVIDIA fork that reaches the world looks like the safer choice. Neither open PR uses it.

(Claude Code, Claude Opus 5.5.)

**@⁠artor410** on GitHub · 2026-11-25 21:53 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7175673547) Comparison on RTX 3070 Ti, driver 610.88, Windows 11 26300, rustc 1.98.1. main 13f91ca. Synthetic tests only. `v_med3_f32_matches_rdna2_with_nan` **passes on main** on this card, so #726 (RTX 5060 Laptop, driver 591.74) does not reproduce here. It may depend on the driver. | PR | state | merges | victory-shader | NaN test | |---|---|---|---|---| | #2010 | open | yes | 266 pass / 3 fail (same 3 as main), no new test | `fcmp uno`, more of it | | #110 | closed | no | head 69 / 0 | `dx.op.isSpecialFloat` (IsNaN) | Main fails the same 3 tests: two stride tests and `gathers_at_a_level_match_the_hardware`. On this card `heap_direct_texture_reads_mark_their_heap_index` crashes the process on main and was skipped. **No verdict from this hardware:** neither PR changes a result here. On the cause, #110 reports a driver folding `fcmp uno x, x` under fast-math. #2010 keeps that compare and adds more of it, so it would not help if that is the cause. **Forks:** - VItoriaBr (uiliannn/VItoriaBr@578d459c344aa44753e9a61ea6ba10a8c68f6ea6), whose README reports the world rendering on an RTX 5060 Ti, and DexNom (570a941) detect NaN on the integer bits: `abs(bits) > 0x7F800000` via `is_nan_f32`. That depends on neither `fcmp uno` nor IsNaN folding. - Belobug carries #110 (a5837b8). A form already used in an NVIDIA fork that reaches the world looks like the safer choice. Neither open PR uses it. (Claude Code, Claude Opus 5.5.)
Author
Owner

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

Does not reproduce on an NVIDIA GeForce RTX 4070, Windows 11, main 842b0cb. emit::valu_tests::v_med3_f32_matches_rdna2_with_nan passes in the full suite and 2 of 2 runs alone, and also passes on this machine's AMD iGPU. This agrees with FIND-24 in #1633 (RTX 4060), so this issue and TEST-MED3-NAN can probably be closed.

AI-assisted (Claude Code).

**@⁠pawrenity** on GitHub · 2026-11-25 23:51 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7178138849) Does not reproduce on an NVIDIA GeForce RTX 4070, Windows 11, `main` 842b0cb. `emit::valu_tests::v_med3_f32_matches_rdna2_with_nan` passes in the full suite and 2 of 2 runs alone, and also passes on this machine's AMD iGPU. This agrees with FIND-24 in #1633 (RTX 4060), so this issue and TEST-MED3-NAN can probably be closed. AI-assisted (Claude Code).
Author
Owner

@⁠zzm1234560621-prog on GitHub · 2026-11-26 11:13 UTC · original

Independent Xe-LPG data point on the cause, and on #1483's lowering.

Machine: Windows 11 Pro for Workstations (26200), Core Ultra 9 185H, Intel(R) Arc(TM) Graphics (Xe-LPG integrated), driver 32.0.101.6127, Rust 1.98.1 MSVC, MSVC 14.51.

On main ffe310e — the failure reproduces on hardware, and only there:

cargo test -p victory-shader --lib v_med3_f32_matches_rdna2_with_nan
hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1
  • VICTORY_WARP=1 on the same test: passes. WARP agrees with RDNA2, so the emitted DXIL is right and it is the driver.
  • v_med3_f16_matches_rdna2_with_nan on hardware: passes.
  • The value that comes back, 2.0, is exactly the plain-median arm under NaN-skipping min/max — consistent with the triage's "the fcmp uno compares fold to false, and the plain median comes back".

On #1483's head 0daabcc (same tree as ffe310e except crates/victory-shader/src/emit/{lower,valu_tests,bitcode,mod,sampler,host}.rs replaced with that branch's files, nothing else):

cargo test -p victory-shader --lib v_med3
test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok
test emit::valu_tests::v_med3_f32_orders_negative_zero_below_positive_zero ... ok
test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok

hardware adapter: Intel(R) Arc(TM) Graphics is printed for every case, so these ran on the iGPU, not on WARP.

So the bit-compare form (magnitude > infinity, integer compare) fixes Xe-LPG as well as the UHD iGPUs already in this thread. That is one more iGPU family where the fcmp uno form fails and the integer form does not, and it is the first Arc result on this issue as far as I can see.

What this does and does not say

  • It says the direction is right: detect NaN on the bits, and stop depending on fcmp uno.
  • It does not say #1483 is mergeable — its base is ffe310e and the triage on it already says it needs a rebase, and its victory-gpu/src/host.rs hunk overlaps #967.
  • It also does not distinguish why the compare folds here. #110's fast-math explanation fits, but I have not looked at this driver's DXIL pass.

Repro detail, in case someone wants to redo it: take a pristine ffe310e tree, overwrite only those six files with the branch's versions at 0daabcc, then cargo test -p victory-shader --lib v_med3 -- --nocapture. No game files, no console, ~2 minutes on this machine.

Tested with AI assistance (Claude).

**@⁠zzm1234560621-prog** on GitHub · 2026-11-26 11:13 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7190445591) Independent Xe-LPG data point on the cause, and on #1483's lowering. **Machine:** Windows 11 Pro for Workstations (26200), Core Ultra 9 185H, Intel(R) Arc(TM) Graphics (Xe-LPG integrated), driver **32.0.101.6127**, Rust 1.98.1 MSVC, MSVC 14.51. **On `main` `ffe310e`** — the failure reproduces on hardware, and only there: ``` cargo test -p victory-shader --lib v_med3_f32_matches_rdna2_with_nan hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1 ``` - `VICTORY_WARP=1` on the same test: **passes**. WARP agrees with RDNA2, so the emitted DXIL is right and it is the driver. - `v_med3_f16_matches_rdna2_with_nan` on hardware: **passes**. - The value that comes back, `2.0`, is exactly the plain-median arm under NaN-skipping min/max — consistent with the triage's "the `fcmp uno` compares fold to false, and the plain median comes back". **On #1483's head `0daabcc`** (same tree as `ffe310e` except `crates/victory-shader/src/emit/{lower,valu_tests,bitcode,mod,sampler,host}.rs` replaced with that branch's files, nothing else): ``` cargo test -p victory-shader --lib v_med3 test emit::valu_tests::v_med3_f16_matches_rdna2_with_nan ... ok test emit::valu_tests::v_med3_f32_orders_negative_zero_below_positive_zero ... ok test emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok ``` `hardware adapter: Intel(R) Arc(TM) Graphics` is printed for every case, so these ran on the iGPU, not on WARP. So the bit-compare form (`magnitude > infinity`, integer compare) fixes Xe-LPG as well as the UHD iGPUs already in this thread. That is one more iGPU family where the `fcmp uno` form fails and the integer form does not, and it is the first Arc result on this issue as far as I can see. **What this does and does not say** - It says the direction is right: detect NaN on the bits, and stop depending on `fcmp uno`. - It does not say #1483 is mergeable — its base is `ffe310e` and the triage on it already says it needs a rebase, and its `victory-gpu/src/host.rs` hunk overlaps #967. - It also does not distinguish *why* the compare folds here. `#110`'s fast-math explanation fits, but I have not looked at this driver's DXIL pass. **Repro detail**, in case someone wants to redo it: take a pristine `ffe310e` tree, overwrite only those six files with the branch's versions at `0daabcc`, then `cargo test -p victory-shader --lib v_med3 -- --nocapture`. No game files, no console, ~2 minutes on this machine. _Tested with AI assistance (Claude)._
Author
Owner

@⁠zzm1234560621-prog on GitHub · 2026-11-26 12:05 UTC · original

Update, and it narrows this rather than confirming it: on current main (63bcca4) this machine passes v_med3_f32_matches_rdna2_with_nan.

  • main ffe310e, same machine, same driver: hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1 (the run in my comment above).
  • main 63bcca4, unmodified tree: emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok, also run alone, 2 of 2.

med3 still picks the NaN case with fcmp uno (lower.rs:2442-2444) — the bit-compare form was not what changed. What changed between those heads inside med3 is ftz plus max_min_flushed (lower.rs:2436-2441), i.e. the min/max the median is built from. So on this Xe-LPG driver the uno compares do not fold; the failure belongs to the UHD iGPUs in this thread, and "confirmed on current main" is true for those machines, not for Xe-LPG in general.

I have not bisected ffe310e..63bcca4 for the commit that flips it — offer stands if it would help, it is one test over a day of merges.

Separately, the same run gives an Intel baseline this issue list did not have: 7 of 295 victory-shader tests fail on this adapter, and three of them are one ULP in the BVH hit distance. Reported in #3196 so it does not clutter this thread.

No game files. AI-assisted (Claude).

**@⁠zzm1234560621-prog** on GitHub · 2026-11-26 12:05 UTC · [original](https://github.com/Marvisak/VIctory/issues/726#issuecomment-7191561483) Update, and it narrows this rather than confirming it: on current `main` (`63bcca4`) **this machine passes** `v_med3_f32_matches_rdna2_with_nan`. - `main` `ffe310e`, same machine, same driver: `hardware: v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1` (the run in my comment above). - `main` `63bcca4`, unmodified tree: `emit::valu_tests::v_med3_f32_matches_rdna2_with_nan ... ok`, also run alone, 2 of 2. `med3` still picks the NaN case with `fcmp uno` (`lower.rs:2442-2444`) — the bit-compare form was not what changed. What changed between those heads inside `med3` is `ftz` plus `max_min_flushed` (`lower.rs:2436-2441`), i.e. the min/max the median is built from. So on this Xe-LPG driver the `uno` compares do not fold; the failure belongs to the UHD iGPUs in this thread, and "confirmed on current main" is true for those machines, not for Xe-LPG in general. I have not bisected `ffe310e..63bcca4` for the commit that flips it — offer stands if it would help, it is one test over a day of merges. Separately, the same run gives an Intel baseline this issue list did not have: 7 of 295 `victory-shader` tests fail on this adapter, and three of them are one ULP in the BVH hit distance. Reported in #3196 so it does not clutter this thread. _No game files. AI-assisted (Claude)._
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#726
No description provided.