shader: compile the log2 pixel fixtures with -denorm any #845

Merged
alvaroolt merged 1 commit from upstream-pr/851 into main 2026-11-23 13:22:36 +00:00
alvaroolt commented 2026-11-23 13:05:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by alvaroolt on 2026-11-23T13:05:45Z.


Change

pixel_aot_e64_approx_hardware and pixel_aot_sdwa_unary_hardware fail on an NVIDIA GeForce RTX 5080 because the driver refuses CreateGraphicsPipelineState (E_OUTOFMEMORY) for any pixel shader that uses log2 under -denorm preserve (#828). As agreed in the issue, this switches the denormal mode per fixture, only for the approximate programs that contain log2.

  • tests/pixel_aot_check.py: log2_denorm_mode() returns any when the translated HLSL contains log2( and preserve (F32_DENORM_MODE) otherwise. Before returning any, it asserts that no value the fixture depends on is a binary32 subnormal: the inputs, the intermediate results (the unrounded exp, log and rcp results and their + 0.5, the rounded -A * |B| product and D * D square of the mac channels, the accumulator), the expected values and every wrong reference.
  • This applies to e64_approx and sdwa_unary_exp. sdwa_unary_root and sdwa_unary_exact keep preserve, and an assertion pins that only sdwa_unary_exp switches.
  • Every wrong-reference control is unchanged.
  • docs/experiments.md: the denormal-mode paragraph records the exception next to the existing curve one, with the measured adapters.

The minimal preserve reproduction stays in #828 for a later driver retest.

Fixes #828

This change was AI-assisted (Claude Code); I reviewed the diff and the test results.

Verification

Commit c0f4d9c (rebased on e97090a), dev preset, DXC 1.9.2602.17 (Windows SDK 10.0.26100).

Both modes on the same adapter and driver, one batch per program (10 cases each: 2 right references and 8 wrong references):

Adapter e64_approx, sdwa_unary_exp under preserve the same under any
NVIDIA GeForce RTX 5080 (10de:2c02), driver 32.0.16.2124, hardware every case status=error, Translated pixel pipeline failed (HRESULT 0x8007000e) 2 pass, 8 mismatch for each program
Microsoft Basic Render Driver (WARP), 10.0.26100.9818 2 pass, 8 mismatch for each program 2 pass, 8 mismatch for each program

On the RTX 5080 under the new code, sdwa_unary_root (2 pass, 8 mismatch) and sdwa_unary_exact (2 pass, 10 mismatch) still compile with preserve and pass.

Focused tests:

ctest --preset dev --no-tests=error -R '^pixel_aot_(e64_approx|sdwa_unary)_(hardware|warp)$' -V
  • Before (c3db335, the previous main): pixel_aot_e64_approx_hardware and pixel_aot_sdwa_unary_hardware fail with case=N status=error on every case; both _warp tests pass.
  • After: all four pass.
ctest --preset dev --no-tests=error -R '^pixel_aot_' -j 4

82 of 82 passed on c0f4d9c.

Negative control for the new assertion: log2_denorm_mode() with the least subnormal 0x00000001 among the values, and e64_approx with that value in place of C in a row, both raise AssertionError before any compile. A program without log2 returns preserve regardless of the values.

Other checks:

  • The 24 platform-independent Python checks from .github/workflows/windows.yml: all exit 0 on c0f4d9c.
  • tests/pixel_aot_check.py binary with LLVM 15 llvm-mc (gfx1013): exit 0 on c0f4d9c.
  • Full suite before the rebase (on c3db335): ctest --preset dev --no-tests=error -j 4 and ctest --preset release --no-tests=error -j 4 each give 415 passed, 0 failed of 422.
  • Capability skips, the same 7 in both presets, not counted as passes: bvh_wave64_hardware, bvh_wave64_warp, wave_shuffle_warp, spirv_minlod_hardware, spirv_minlod_levels_hardware, spirv_minlod_warp, spirv_minlod_levels_warp.

Environment: Windows 11 build 26300.9974, VS Build Tools 2026 18.12 (MSVC 14.52.37025), Windows SDK 10.0.26100. The debug layer is unavailable (Graphics Tools not installed).

Evidence and follow-up

No new fixture. The fixtures' inputs and references are unchanged; only the recorded denormal mode of two programs changes.

Assumption: with no binary32 subnormal among the inputs, intermediates and expected values, any and preserve produce the same exported bits for these programs. The assertions check that for every value the fixtures use; they do not measure the shader's internal precision.

Not established: whether older NVIDIA architectures or a later driver accept these pipelines under preserve, and what the console computes. The AMD Radeon integrated GPU that accepts preserve (#828) was not rerun with this change.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6559974825 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/851). Originally posted by [alvaroolt](https://github.com/alvaroolt) on 2026-11-23T13:05:45Z. --- ## Change `pixel_aot_e64_approx_hardware` and `pixel_aot_sdwa_unary_hardware` fail on an NVIDIA GeForce RTX 5080 because the driver refuses `CreateGraphicsPipelineState` (`E_OUTOFMEMORY`) for any pixel shader that uses `log2` under `-denorm preserve` (#828). As agreed in the issue, this switches the denormal mode per fixture, only for the approximate programs that contain `log2`. - `tests/pixel_aot_check.py`: `log2_denorm_mode()` returns `any` when the translated HLSL contains `log2(` and `preserve` (`F32_DENORM_MODE`) otherwise. Before returning `any`, it asserts that no value the fixture depends on is a binary32 subnormal: the inputs, the intermediate results (the unrounded exp, log and rcp results and their `+ 0.5`, the rounded `-A * |B|` product and `D * D` square of the mac channels, the accumulator), the expected values and every wrong reference. - This applies to `e64_approx` and `sdwa_unary_exp`. `sdwa_unary_root` and `sdwa_unary_exact` keep `preserve`, and an assertion pins that only `sdwa_unary_exp` switches. - Every wrong-reference control is unchanged. - `docs/experiments.md`: the denormal-mode paragraph records the exception next to the existing `curve` one, with the measured adapters. The minimal `preserve` reproduction stays in #828 for a later driver retest. Fixes #828 This change was AI-assisted (Claude Code); I reviewed the diff and the test results. ## Verification Commit `c0f4d9c` (rebased on `e97090a`), `dev` preset, DXC 1.9.2602.17 (Windows SDK 10.0.26100). Both modes on the same adapter and driver, one batch per program (10 cases each: 2 right references and 8 wrong references): | Adapter | `e64_approx`, `sdwa_unary_exp` under `preserve` | the same under `any` | |---|---|---| | NVIDIA GeForce RTX 5080 (10de:2c02), driver 32.0.16.2124, hardware | every case `status=error`, `Translated pixel pipeline failed (HRESULT 0x8007000e)` | 2 `pass`, 8 `mismatch` for each program | | Microsoft Basic Render Driver (WARP), 10.0.26100.9818 | 2 `pass`, 8 `mismatch` for each program | 2 `pass`, 8 `mismatch` for each program | On the RTX 5080 under the new code, `sdwa_unary_root` (2 `pass`, 8 `mismatch`) and `sdwa_unary_exact` (2 `pass`, 10 `mismatch`) still compile with `preserve` and pass. Focused tests: ```shell ctest --preset dev --no-tests=error -R '^pixel_aot_(e64_approx|sdwa_unary)_(hardware|warp)$' -V ``` - Before (`c3db335`, the previous `main`): `pixel_aot_e64_approx_hardware` and `pixel_aot_sdwa_unary_hardware` fail with `case=N status=error` on every case; both `_warp` tests pass. - After: all four pass. ```shell ctest --preset dev --no-tests=error -R '^pixel_aot_' -j 4 ``` 82 of 82 passed on `c0f4d9c`. Negative control for the new assertion: `log2_denorm_mode()` with the least subnormal `0x00000001` among the values, and `e64_approx` with that value in place of C in a row, both raise `AssertionError` before any compile. A program without `log2` returns `preserve` regardless of the values. Other checks: - The 24 platform-independent Python checks from `.github/workflows/windows.yml`: all exit 0 on `c0f4d9c`. - `tests/pixel_aot_check.py binary` with LLVM 15 `llvm-mc` (gfx1013): exit 0 on `c0f4d9c`. - Full suite before the rebase (on `c3db335`): `ctest --preset dev --no-tests=error -j 4` and `ctest --preset release --no-tests=error -j 4` each give 415 passed, 0 failed of 422. - Capability skips, the same 7 in both presets, not counted as passes: `bvh_wave64_hardware`, `bvh_wave64_warp`, `wave_shuffle_warp`, `spirv_minlod_hardware`, `spirv_minlod_levels_hardware`, `spirv_minlod_warp`, `spirv_minlod_levels_warp`. Environment: Windows 11 build 26300.9974, VS Build Tools 2026 18.12 (MSVC 14.52.37025), Windows SDK 10.0.26100. The debug layer is unavailable (Graphics Tools not installed). ## Evidence and follow-up No new fixture. The fixtures' inputs and references are unchanged; only the recorded denormal mode of two programs changes. Assumption: with no binary32 subnormal among the inputs, intermediates and expected values, `any` and `preserve` produce the same exported bits for these programs. The assertions check that for every value the fixtures use; they do not measure the shader's internal precision. Not established: whether older NVIDIA architectures or a later driver accept these pipelines under `preserve`, and what the console computes. The AMD Radeon integrated GPU that accepts `preserve` (#828) was not rerun with this change. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets.
upstream-sync closed this pull request 2026-11-24 06:45:05 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!845
No description provided.