pixel_aot_comparisons_hardware is red on RDNA over one subnormal compare (CI excludes hardware tests) #951

Open
opened 2026-11-23 18:46:11 +00:00 by thepatrickworld · 43 comments
thepatrickworld commented 2026-11-23 18:46:11 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T18:46:11Z.



pixel_aot_comparisons_hardware fails on main on real hardware and never in CI, since both Windows jobs run ctest -E '_hardware$'. It is one bit in one case. The interesting part is not the bit: it is that the harness records preserve as its binary32 denormal assumption, this adapter does not honour that assumption for fcmp, and there is no established answer for what the fixture should do about it.

Reproduction on main

Latest main at the time of writing is 0f0c3eb. Same clone, same build tree, same machine (RX 9070 XT, RDNA4, native wave64, Windows 11 25H2), one file changed between the two runs:

  • unchanged: pixel_aot_comparisons_hardware Failed 2.43 s, _warp Passed 6.03 s
  • with that one file's compare retired: comparisons_hardware Passed 9.14 s, _warp Passed 5.93 s, and the whole pixel_aot_ set 100/100 in 326 s where the unchanged tree is 99/100

One real case fails, f32-cmp-1 (the signed-zero set), one bit:

expected ['pass','mismatch','pass','mismatch',...]
got      ['pass','mismatch','mismatch','mismatch',...]
channel=0 expected_bits=0008cccc actual_bits=000ccccc

Bit 18 is v_cmp_eq_f32_e32 vcc_lo, 1, v16 (tests/pixel_aot_check.py:14483): the integer immediate 1 is the subnormal 0x00000001 (1.401298e-45), compared against rhs = -0.0. The reference (cmp_pred("eq", word_to_float(1), rhs), :14544) says false. The adapter says true, and x == -0.0 can only be true if the compare saw +0.0 where the shader holds a subnormal.

What is actually measured, and what is not

Same compiled shader, same constant buffer, two adapters: WARP returns false (the subnormal is not treated as zero) and the RDNA adapter returns true. The harness compiles with -Gis, the emitted HLSL keeps the operand as asfloat(1u), and the DXIL carries fp32-denorm-mode = "preserve" with the constant folded to 2^-149. So the module explicitly asks for preservation and this adapter does not deliver it for this fcmp.

What I cannot settle from a single card: whether that is the ISA or the driver. I am not claiming "binary32 compares flush" as an ISA fact — I have one adapter, one instruction, and a DXIL that says the opposite of what the hardware did.

Two measurements that bound it, though:

  • the pipe is selective, not globally flushing: on the same adapter v_mul_f32 preserves subnormals while mad/mad32 flush them, which is the split tools/pixel_aot.py:323-331 already models with ftz32;
  • the fixture already contains a denormal control that passes on this adapter (check_denorm_mode_draw, tests/pixel_aot_check.py:11683, with F32_DENORM_MODE = "preserve" at :73-77). So preservation works elsewhere; it is the compare that disagrees.

Why this is a question for you rather than a patch

The harness's stated position is in docs/experiments.md:3335: everything is compiled with -denorm preserve, and "preserve is the harness's recorded assumption". docs/experiments.md:3215 goes further and describes this very fixture as evaluating the 16 IEEE-754 relations "including subnormals". By the project's own policy, an adapter disagreeing with a recorded assumption is "recorded as a mismatch rather than chosen" — which is exactly what is happening: the entry is doing its job and reporting that this card breaks the harness contract.

So there are three ways out, and they are not equivalent:

  1. Keep the case and record the mismatch. The entry stays red on RDNA by design, and the measurement gets documented (which adapter, which instruction, preserve requested and not honoured). Honest, costs nothing to write, leaves main red for anyone with this card.
  2. Make the lowering flush compares explicitly (ftz32 on the operands, as mad/mac already do). Deterministic on every backend, and it retires the ambiguity — but it decides, unmeasured, that the console flushes compares too. It also touches the compare lowering plus the four text assertions in check_controls (:10467-10471) that pin sample16.x == sample16.y and the isnan forms.
  3. Stop making the fixture depend on preservation for that one bit, which is what I did to get the numbers above. It unblocks main immediately and hides the signal. I would not call that a fix.

There is also a smaller point about the bit itself: with rhs = -0.0 it cannot fail for the reason it exists. 1.4e-45 == -0.0 is false, and so is 1.0 == -0.0 if the emitter had wrongly taken the immediate as a float — so the bit never proved that an integer immediate is read as bits. Its defect and its red are unrelated.

What I am asking

Tell me which of the three you want, and I will send it. If the answer is (1), I will write the documentation patch with the measurement and leave the fixture alone. If it is (2), I will send the lowering change with the text assertions updated. I am not sending the third as a change, since it would remove the only runtime case in the suite where a subnormal reaches an f32 comparison.

AI-assisted; runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6566399976 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-23T18:46:11Z. --- --- `pixel_aot_comparisons_hardware` fails on `main` on real hardware and never in CI, since both Windows jobs run `ctest -E '_hardware$'`. It is one bit in one case. The interesting part is not the bit: it is that the harness records `preserve` as its binary32 denormal assumption, this adapter does not honour that assumption for `fcmp`, and there is no established answer for what the fixture should do about it. ### Reproduction on `main` Latest `main` at the time of writing is `0f0c3eb`. Same clone, same build tree, same machine (RX 9070 XT, RDNA4, native wave64, Windows 11 25H2), one file changed between the two runs: - unchanged: `pixel_aot_comparisons_hardware` **Failed 2.43 s**, `_warp` **Passed 6.03 s** - with that one file's compare retired: `comparisons_hardware` **Passed 9.14 s**, `_warp` **Passed 5.93 s**, and the whole `pixel_aot_` set **100/100 in 326 s** where the unchanged tree is 99/100 One real case fails, `f32-cmp-1` (the signed-zero set), one bit: ``` expected ['pass','mismatch','pass','mismatch',...] got ['pass','mismatch','mismatch','mismatch',...] channel=0 expected_bits=0008cccc actual_bits=000ccccc ``` Bit 18 is `v_cmp_eq_f32_e32 vcc_lo, 1, v16` (`tests/pixel_aot_check.py:14483`): the integer immediate `1` is the subnormal `0x00000001` (`1.401298e-45`), compared against `rhs = -0.0`. The reference (`cmp_pred("eq", word_to_float(1), rhs)`, `:14544`) says false. The adapter says true, and `x == -0.0` can only be true if the compare saw `+0.0` where the shader holds a subnormal. ### What is actually measured, and what is not Same compiled shader, same constant buffer, two adapters: **WARP returns false** (the subnormal is not treated as zero) and **the RDNA adapter returns true**. The harness compiles with `-Gis`, the emitted HLSL keeps the operand as `asfloat(1u)`, and the DXIL carries `fp32-denorm-mode = "preserve"` with the constant folded to `2^-149`. So the module explicitly asks for preservation and this adapter does not deliver it for this `fcmp`. What I cannot settle from a single card: whether that is the ISA or the driver. I am not claiming "binary32 compares flush" as an ISA fact — I have one adapter, one instruction, and a DXIL that says the opposite of what the hardware did. Two measurements that bound it, though: - the pipe is **selective**, not globally flushing: on the same adapter `v_mul_f32` preserves subnormals while `mad`/`mad32` flush them, which is the split `tools/pixel_aot.py:323-331` already models with `ftz32`; - the fixture already contains a **denormal control that passes** on this adapter (`check_denorm_mode_draw`, `tests/pixel_aot_check.py:11683`, with `F32_DENORM_MODE = "preserve"` at `:73-77`). So preservation works elsewhere; it is the compare that disagrees. ### Why this is a question for you rather than a patch The harness's stated position is in `docs/experiments.md:3335`: everything is compiled with `-denorm preserve`, and *"preserve is the harness's recorded assumption"*. `docs/experiments.md:3215` goes further and describes this very fixture as evaluating the 16 IEEE-754 relations "including subnormals". By the project's own policy, an adapter disagreeing with a recorded assumption is *"recorded as a mismatch rather than chosen"* — which is exactly what is happening: the entry is doing its job and reporting that this card breaks the harness contract. So there are three ways out, and they are not equivalent: 1. **Keep the case and record the mismatch.** The entry stays red on RDNA by design, and the measurement gets documented (which adapter, which instruction, preserve requested and not honoured). Honest, costs nothing to write, leaves `main` red for anyone with this card. 2. **Make the lowering flush compares explicitly** (`ftz32` on the operands, as `mad`/`mac` already do). Deterministic on every backend, and it retires the ambiguity — but it decides, unmeasured, that the console flushes compares too. It also touches the compare lowering plus the four text assertions in `check_controls` (`:10467-10471`) that pin `sample16.x == sample16.y` and the `isnan` forms. 3. **Stop making the fixture depend on preservation** for that one bit, which is what I did to get the numbers above. It unblocks `main` immediately and hides the signal. I would not call that a fix. There is also a smaller point about the bit itself: with `rhs = -0.0` it cannot fail for the reason it exists. `1.4e-45 == -0.0` is false, and so is `1.0 == -0.0` if the emitter had wrongly taken the immediate as a float — so the bit never proved that an integer immediate is read as bits. Its defect and its red are unrelated. ### What I am asking Tell me which of the three you want, and I will send it. If the answer is (1), I will write the documentation patch with the measurement and leave the fixture alone. If it is (2), I will send the lowering change with the text assertions updated. I am not sending the third as a change, since it would remove the only runtime case in the suite where a subnormal reaches an f32 comparison. _AI-assisted; runs executed locally on the adapter above._
roansystemlabs commented 2026-11-24 06:49:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-23T19:04:26Z.


I'm on the NVIDIA side of this: running pixel_aot_comparisons_hardware and _warp at current main on an RTX 3070 (Ampere) and WARP with the debug layer, plus a standalone f32 compare probe (2^-149 against ±0, all 16 relations, -denorm any/ftz/preserve). Data only, no fixture change. Results here.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111055422 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7111055422). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-23T19:04:26Z. --- I'm on the NVIDIA side of this: running `pixel_aot_comparisons_hardware` and `_warp` at current `main` on an RTX 3070 (Ampere) and WARP with the debug layer, plus a standalone f32 compare probe (2^-149 against ±0, all 16 relations, `-denorm any/ftz/preserve`). Data only, no fixture change. Results here. _AI-assisted._
lantiumBot commented 2026-11-24 06:49:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lantiumBot on 2026-11-23T19:07:53Z.


Second RDNA 4 adapter, same result. Data only, no fixture change.

  • Commit: 0f0c3eb1f50f227ddc154ab7e081839628ff89b3, clean tree, dev preset (Debug)
  • Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), native lane range 32..64
  • Driver: 32.0.32029.2010
  • Windows build: 26300.10075
  • D3D12 debug layer: unavailable
ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_(hardware|warp)$' --output-on-failure

pixel_aot_comparisons_warp passed. pixel_aot_comparisons_hardware failed, identically in 6 of 6 runs, on the same single case and bit as the report above:

got ['pass', 'mismatch', 'mismatch', 'mismatch', 'pass', 'mismatch', 'pass', 'mismatch', 'pass', 'pass', 'pass']
case=2 f32-cmp-1.case
pixel_mismatch x=0 y=0
channel=0 expected=8.08151e-40 actual=1.17549e-39 expected_bits=0008cccc actual_bits=000ccccc

Channels 1 to 3 of that case match. The four expected-mismatch controls still mismatch and the other six positive cases pass.

This only confirms the observation on a second device ID with one driver. It does not separate ISA from driver behaviour.

AI-assisted; runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111135937 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7111135937). Originally posted by [lantiumBot](https://github.com/lantiumBot) on 2026-11-23T19:07:53Z. --- Second RDNA 4 adapter, same result. Data only, no fixture change. - Commit: `0f0c3eb1f50f227ddc154ab7e081839628ff89b3`, clean tree, `dev` preset (Debug) - Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), native lane range 32..64 - Driver: 32.0.32029.2010 - Windows build: 26300.10075 - D3D12 debug layer: unavailable ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_(hardware|warp)$' --output-on-failure ``` `pixel_aot_comparisons_warp` passed. `pixel_aot_comparisons_hardware` failed, identically in 6 of 6 runs, on the same single case and bit as the report above: ```text got ['pass', 'mismatch', 'mismatch', 'mismatch', 'pass', 'mismatch', 'pass', 'mismatch', 'pass', 'pass', 'pass'] case=2 f32-cmp-1.case pixel_mismatch x=0 y=0 channel=0 expected=8.08151e-40 actual=1.17549e-39 expected_bits=0008cccc actual_bits=000ccccc ``` Channels 1 to 3 of that case match. The four expected-mismatch controls still mismatch and the other six positive cases pass. This only confirms the observation on a second device ID with one driver. It does not separate ISA from driver behaviour. AI-assisted; runs executed locally on the adapter above.
R0Y00 commented 2026-11-24 06:49:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:13:59Z.


Keep the preserve-mode expectation and record the mismatch. The two RDNA 4 reports now reproduce the same bit with WARP passing. That gives us an adapter/driver result under a preserve request. It does not establish native gfx1013 compare behavior.

A small source-built comparison would help isolate it. Please compare ±min-subnormal against ±0 with explicitly separate preserve and FTZ builds, use an integer readback with unaffected normal/NaN controls, and report the DXIL denormal mode and raw predicate bits. Keep the existing failing row and report a capability skip separately. We can consider a lowering change once independent evidence establishes the guest behavior.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111288636 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7111288636). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T19:13:59Z. --- Keep the preserve-mode expectation and record the mismatch. The two RDNA 4 reports now reproduce the same bit with WARP passing. That gives us an adapter/driver result under a preserve request. It does not establish native gfx1013 compare behavior. A small source-built comparison would help isolate it. Please compare ±min-subnormal against ±0 with explicitly separate preserve and FTZ builds, use an integer readback with unaffected normal/NaN controls, and report the DXIL denormal mode and raw predicate bits. Keep the existing failing row and report a capability skip separately. We can consider a lowering change once independent evidence establishes the guest behavior.
roansystemlabs commented 2026-11-24 06:49:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-23T19:30:53Z.


NVIDIA and WARP data, as promised, and the source-built comparison you asked for above. Data only, no fixture change.

Short version: on an RTX 3070 (Ampere, driver 621.01) and on WARP, both with the debug layer, pixel_aot_comparisons_hardware and _warp pass on current main. A source-built probe of ±2^-149 against ±0 keeps the subnormal under -denorm preserve, across all 16 binary32 relations and every shape we tried. That includes the translator's ordered && ordered && (a == b) form and the five-bit probe from #312. It flushes under ftz and any, and the normal and NaN controls are identical in both modes. Built with ftz or any, the fixture fails on both of our adapters with exactly the case list and bit reported here for RDNA 4.

Environment

  • Windows 11 25H2, build 26200.9974
  • NVIDIA GeForce RTX 3070 (10de:2484), driver 621.01 (UMD 32.0.16.2101), D3D12 debug layer enabled
  • WARP 10.0.26100.9818 (1414:008c), debug layer enabled
  • debug_errors=0 debug_warnings=0 on every draw of the fixture-mode and probe runs below
  • DXC 1.9.2602.17 (Windows SDK 10.0.26100.0 path). The probe was repeated with DXC release v1.8.2502 (dxcompiler.dll reports 1.8.2502.8), with identical words.
  • main at 185ffbe (#929 merge), clean tree, dev preset (Debug). tests/pixel_aot_check.py, tools/pixel_aot.py, tests/offscreen_check.cpp and tests/pixel_aot_render.cpp are unchanged from 0f0c3eb.
  • Load: other GPU work was running during the CTest runs (19–52 % utilisation, ~7 GB of 8 GB VRAM in use). Pass/fail does not depend on it; the times below do. The probe runs were on a quiet GPU (0–3 % utilisation).

1. The two CTest entries, three serial runs

ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_(hardware|warp)$' -V
Run pixel_aot_comparisons_hardware (RTX 3070) pixel_aot_comparisons_warp
1 Passed, 20.13 s Passed, 6.24 s
2 Passed, 17.72 s Passed, 6.19 s
3 Passed, 17.76 s Passed, 6.21 s

All 11 batch cases give their expected status on both adapters. f32-cmp-1 returns 0x0008cccc (bit 18 clear), and the four expected-mismatch controls and both mutation checks fire.

2. Negative control: the same fixture under ftz and any

We ran check_f32_compare_draws again with only the -denorm value changed. The mode is swapped in memory and no file is edited. The DXIL listing confirms the attribute each time.

-denorm RTX 3070 WARP
preserve (harness default) pass pass
ftz fail: got ['pass','mismatch','mismatch','mismatch',…], expected_bits=0008cccc actual_bits=000ccccc fail, same case and bit
any fail, same case and bit fail, same case and bit

So on these two adapters the fixture does see a flush when the pipeline really flushes, and the RDNA 4 result is exactly what a flushed operand produces in bit 18. The fixture's DXIL under preserve carries "fp32-denorm-mode"="preserve" and fcmp oeq float %55, 0x36A0000000000000 (2^-149), as in the original report.

3. Source-built comparison: ±2^-149 against ±0

One synthetic pixel shader is compiled with -Gis -T ps_6_2, once each with -denorm preserve, ftz, any and with no flag. It is drawn through offscreen_check <backend> --check-pixel-case into the lossless R32G32B32A32_UINT target, and all operands come from the constant buffer. Each 32-bit word packs 16 relations, f lt eq le gt lg ge o u nge nlg ngt nle neq nlt tru, as rel(a, b) in bits 0–15 and rel(b, a) in bits 16–31. Each relation appears in three shapes: a plain HLSL expression (lg and nlg as a < b || a > b and its negation, so NaN stays unordered), the exact form tools/pixel_aot.py emits for v_cmp_*_f32, and the same form with a as an immediate asfloat(…u) (the operand form of bit 18). The fourth word holds the five #312 bits in bits 0–4 and an arithmetic check in bits 8–9.

Raw predicate words, RTX 3070 and WARP identical, z = +0 and −0 identical:

Build (DXIL fp32-denorm-mode) +2^-149 (0x00000001), three shapes −2^-149 (0x80000001), three shapes five-bit probe from #312
preserve ("preserve") aaaaf0f0 ×3: kept f0f0aaaa ×3: kept 0 0 0 0 0
ftz ("ftz") cccccccc ×3: flushed cccccccc ×3: flushed 1 1 1 1 1
any ("any") cccccccc ×3: flushed cccccccc ×3: flushed 1 1 1 1 1
no flag (no attribute) cccccccc ×3: flushed cccccccc ×3: flushed 1 1 1 1 1

"Kept" and "flushed" are judged on every relation bit that differs between the two IEEE references (subnormal kept, or replaced by zero). Every word in this section is a raw readback, pass or fail: each case is drawn twice, once against the kept reference, which the renderer compares bit for bit (a match under preserve, a mismatch under the other builds), and once against the bitwise complement of that reference, so that the renderer prints all four raw words. The two draws agreed in every case. Every probe listing carries the attribute of its build, the unflagged build carries none, and the immediates stay in the DXIL, e.g. fcmp olt float %6, 0xB6A0000000000000 (−2^-149) under preserve.

Mode-independent controls, same draw and same three shapes: FLT_MIN (0x00800000) against ±0, 1.0 against -1.0, and a quiet NaN (0x7fc00000) against 0 and against 2^-149. Words: aaaaf0f0 ×3 for FLT_MIN against +0 and −0 and for 1.0 against -1.0, ff00ff00 ×3 for NaN against 0 and against 2^-149, and the five #312 bits all clear. Identical under preserve, ftz, any and no flag, and equal to the IEEE reference on both adapters. As an arithmetic check in the same draw (bits 8–9 of the fourth word, the only bits that change between builds), 0x00800001 + 0x80800000 returns 0x00000001 under preserve and 0 under the other three builds.

Three runs per adapter with the SDK DXC and one with DXC 1.8 gave the same words (36 cases per adapter and run, each drawn twice).

What this shows, and what it does not

  • On this NVIDIA adapter and driver, and on WARP, a preserve build keeps ±2^-149 in every binary32 compare we probed. That includes a compare feeding && and ||, the shape that fails on the RX 9070 XT in #312. The bit-18 failure is not reproduced here: on these two adapters the translated shader and the fixture's reference agree.
  • On both adapters, any and an unflagged build behave like ftz for these compares, as they do for arithmetic in #312.
  • It does not settle ISA versus driver on RDNA. We have no AMD hardware, and nothing here says what the console does with a subnormal in a compare. The existing failing row is untouched, and we have no capability skip to report: nothing was skipped on either adapter.
  • Not tested: AMD and Intel adapters, other NVIDIA generations and drivers, compute shaders, binary16/binary64 compares, and Release builds.

The probe below should run unchanged on an RDNA 4 adapter. Usage: python -I f32_compare_probe.py <dxc.exe> <offscreen_check.exe> <hardware|warp> <out_dir>. It needs only the standard library and the repository's offscreen_check. It writes the generated HLSL, the DXIL listings, the raw renderer output and a result.json to <out_dir>, and prints a per-subject summary at the end. SHA-256: cedc06cd5d64c7444b0bdb6c421b06700ad84c84081dbdca4e4c3a98c5be3953.

f32_compare_probe.py
"""Standalone f32 compare probe for Xbox2Windows #958. Measures only; changes no project code.

Usage:
    python -I f32_compare_probe.py <dxc.exe> <offscreen_check.exe> <hardware|warp> <out_dir>

Each subject is a pair (a, b) of binary32 words read from the constant buffer, so nothing folds at
compile time, except channel 2 and the #312 bits, which use `a` as the immediate `asfloat(...u)`
on purpose (the operand form of bit 18 in `f32-cmp-1`). Subjects:
  M0  +2^-149 (0x00000001) against +0 and -0
  M1  -2^-149 (0x80000001) against +0 and -0
  M2  mode-independent controls: FLT_MIN (0x00800000) against +0 and -0, 1.0 against -1.0,
      a quiet NaN (0x7fc00000) against +0 and against +2^-149
Every shader is built with `-Gis -T ps_6_2` like the harness: with no -denorm flag, `any`, `ftz`
and `preserve`. The DXIL `fp32-denorm-mode` attribute is read back from each listing.

Channels of the single R32G32B32A32_UINT texel:
  ch0  bits 0-15: the 16 relations as plain HLSL compares, rel(a, b); bits 16-31: rel(b, a)
  ch1  the same in the exact shape the translator emits for v_cmp_*_f32 (ordered guards `&&` the
       compare, or `|| isnan`)
  ch2  the translator shape with `a` as an immediate asfloat(...u)
  ch3  bits 0-4: the five-bit probe from #312 (comment 7108239560), same shapes, with `a` for 2^-149
       bit 8: asuint(0x00800001 + 0x80800000) == 1u (arithmetic: the subnormal sum is kept)
       bit 9: the same sum == 0u (arithmetic: flushed). Bits 8-9 differ by mode by design.

Every subject is drawn twice through the repository renderer (`offscreen_check <backend>
--check-pixel-case`, debug layer enabled when Graphics Tools are installed, lossless integer target):
  verify    expects the IEEE reference with subnormals kept; rc=0 means a bit-for-bit match
  readback  expects the bitwise complement of that reference, so every channel mismatches and the
            renderer prints the four raw words; these are the words reported, pass or fail
Each word is then compared with two IEEE references: subnormal operands kept, or flushed to zero.
"""
import json
import math
import re
import struct
import subprocess
import sys
from pathlib import Path

PREDICATES = ("f", "lt", "eq", "le", "gt", "lg", "ge", "o", "u", "nge", "nlg", "ngt", "nle", "neq", "nlt", "tru")
SUBJECTS = [  # (group, name, a, b)
    ("M0", "+min_sub vs +0", 0x00000001, 0x00000000), ("M0", "+min_sub vs -0", 0x00000001, 0x80000000),
    ("M1", "-min_sub vs +0", 0x80000001, 0x00000000), ("M1", "-min_sub vs -0", 0x80000001, 0x80000000),
    ("M2", "FLT_MIN vs +0", 0x00800000, 0x00000000), ("M2", "FLT_MIN vs -0", 0x00800000, 0x80000000),
    ("M2", "1.0 vs -1.0", 0x3f800000, 0xbf800000),
    ("M2", "NaN vs +0", 0x7fc00000, 0x00000000), ("M2", "NaN vs +min_sub", 0x7fc00000, 0x00000001),
]
ADD_A, ADD_B = 0x00800001, 0x80800000
MODES = [None, "any", "ftz", "preserve"]
PREDICATE_MASK = (0xffffffff, 0xffffffff, 0xffffffff, 0x1f)  # everything except the arithmetic bits


def ordered(x):
    return f"((asuint({x}) & 0x7fffffffu) <= 0x7f800000u)"


def plain(pred, a, b):
    """One plain HLSL expression per relation, IEEE-correct for NaN under -Gis."""
    return {
        "f": "false", "lt": f"({a} < {b})", "eq": f"({a} == {b})", "le": f"({a} <= {b})",
        "gt": f"({a} > {b})", "lg": f"({a} < {b} || {a} > {b})", "ge": f"({a} >= {b})",
        "o": f"(!isnan({a}) && !isnan({b}))", "u": f"(isnan({a}) || isnan({b}))",
        "nge": f"(!({a} >= {b}))", "nlg": f"(!({a} < {b} || {a} > {b}))", "ngt": f"(!({a} > {b}))",
        "nle": f"(!({a} <= {b}))", "neq": f"(!({a} == {b}))", "nlt": f"(!({a} < {b}))", "tru": "true",
    }[pred]


def translator(pred, a, b):
    """The shapes tools/pixel_aot.py emits for v_cmp_<pred>_f32."""
    guard = f"{ordered(a)} && {ordered(b)}"
    nan = f"isnan({a}) || isnan({b})"
    return {
        "f": "false", "lt": f"({guard} && ({a} < {b}))", "eq": f"({guard} && ({a} == {b}))",
        "le": f"({guard} && ({a} <= {b}))", "gt": f"({guard} && ({a} > {b}))",
        "lg": f"({guard} && (({a} < {b} || {a} > {b})))", "ge": f"({guard} && ({a} >= {b}))",
        "o": f"({a} == {a} && {b} == {b})", "u": f"({a} != {a} || {b} != {b})",
        "nge": f"({a} < {b} || {nan})", "nlg": f"({a} == {b} || {nan})", "ngt": f"({a} <= {b} || {nan})",
        "nle": f"({a} > {b} || {nan})", "neq": f"!({a} == {b})", "nlt": f"({a} >= {b} || {nan})",
        "tru": "true",
    }[pred]


def shader_source(imm_word):
    imm = f"asfloat(0x{imm_word:08x}u)"
    lines = [
        "// f32 compare probe for Xbox2Windows #958 (generated by f32_compare_probe.py).",
        "cbuffer Constants : register(b0) { uint4 params[16]; };",
        "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {",
        "    float a = asfloat(params[0].x);",
        "    float b = asfloat(params[0].y);",
        "    float add_a = asfloat(params[0].z); // 0x00800001",
        "    float add_b = asfloat(params[0].w); // 0x80800000",
        "    uint c0 = 0, c1 = 0, c2 = 0, c3 = 0;",
    ]
    for bit, pred in enumerate(PREDICATES):
        lines.append(f"    c0 |= {plain(pred, 'a', 'b')} ? {1 << bit}u : 0u;")
        lines.append(f"    c0 |= {plain(pred, 'b', 'a')} ? {1 << (bit + 16)}u : 0u;")
        lines.append(f"    c1 |= {translator(pred, 'a', 'b')} ? {1 << bit}u : 0u;")
        lines.append(f"    c1 |= {translator(pred, 'b', 'a')} ? {1 << (bit + 16)}u : 0u;")
        lines.append(f"    c2 |= {translator(pred, imm, 'b')} ? {1 << bit}u : 0u;")
        lines.append(f"    c2 |= {translator(pred, 'b', imm)} ? {1 << (bit + 16)}u : 0u;")
    lines += [
        "    // five-bit probe from #312 (comment 7108239560), same shapes",
        f"    c3 |= ({imm} == b) ? 1u : 0u;",
        f"    c3 |= (({ordered(imm)} && {ordered('b')} && ({imm} == b))) ? 2u : 0u;",
        f"    c3 |= (({ordered('b')}) && ({imm} == b)) ? 4u : 0u;",
        f"    c3 |= (({ordered('a')} && {ordered('b')} && (a == b))) ? 8u : 0u;",
        f"    c3 |= (isnan(b) || {imm} == b) ? 16u : 0u;",
        "    // arithmetic control: a sum of two normals whose exact result is the least subnormal",
        "    uint s = asuint(add_a + add_b);",
        "    c3 |= (s == 1u) ? 256u : 0u;",
        "    c3 |= (s == 0u) ? 512u : 0u;",
        "    return uint4(c0, c1, c2, c3);",
        "}",
    ]
    return "\n".join(lines) + "\n"


def as_float(word, flush):
    if flush and (word & 0x7f800000) == 0:
        word &= 0x80000000  # flushed to a zero of the same sign
    return struct.unpack("<f", struct.pack("<I", word))[0]


def rel(pred, a, b):
    o = not (math.isnan(a) or math.isnan(b))
    lg = o and a != b
    return {"f": False, "lt": a < b, "eq": a == b, "le": a <= b, "gt": a > b, "lg": lg, "ge": a >= b,
            "o": o, "u": not o, "nge": not a >= b, "nlg": not lg, "ngt": not a > b,
            "nle": not a <= b, "neq": not a == b, "nlt": not a < b, "tru": True}[pred]


def reference(a_word, b_word, flush):
    """Expected words under IEEE, with subnormal operands (and the sum) kept or flushed to zero."""
    a, b = as_float(a_word, flush), as_float(b_word, flush)
    c0 = 0
    for bit, pred in enumerate(PREDICATES):
        c0 |= (1 << bit if rel(pred, a, b) else 0) | (1 << (bit + 16) if rel(pred, b, a) else 0)
    o = not (math.isnan(a) or math.isnan(b))
    five = [a == b, o and a == b, (not math.isnan(b)) and a == b, o and a == b, math.isnan(b) or a == b]
    c3 = sum(1 << i for i, v in enumerate(five) if v) | (512 if flush else 256)
    return [c0, c0, c0, c3]


def hexwords(words):
    return " ".join(f"{w:08x}" for w in words)


def draw(renderer, backend, cso, case, constants, expected):
    case.write_bytes(constants + struct.pack("<4I", *expected) * 64 + b"\x01")
    r = subprocess.run([renderer, backend, "--check-pixel-case", cso, case], capture_output=True, text=True)
    lines = (r.stdout + r.stderr).splitlines()
    (case.parent / f"{case.stem}.renderer.txt").write_text(f"rc={r.returncode}\n" + "\n".join(lines) + "\n")
    actual = {int(m[1]): int(m[2], 16) for m in
              (re.search(r"channel=(\d+) .*actual_bits=([0-9a-f]{8})", line) for line in lines) if m}
    return r.returncode, lines, actual


def main():
    dxc, renderer, backend, out_dir = sys.argv[1:5]
    out = Path(out_dir)
    out.mkdir(parents=True, exist_ok=True)
    report = {"backend": backend, "draws": [], "errors": []}
    for imm_word in sorted({s[2] for s in SUBJECTS}):
        source = out / f"probe_{imm_word:08x}.hlsl"
        source.write_text(shader_source(imm_word), encoding="ascii")
        for mode in MODES:
            flags = ["-Gis"] + (["-denorm", mode] if mode else [])
            stem = f"a{imm_word:08x}_{mode or 'noflag'}"
            cso, lst = out / f"{stem}.cso", out / f"{stem}.lst"
            c = subprocess.run([dxc, *flags, "-T", "ps_6_2", "-E", "main", "-Fo", cso, "-Fc", lst, source],
                               capture_output=True, text=True)
            label = f"[{backend}] -Gis {'-denorm ' + mode if mode else '(no -denorm)'}"
            if c.returncode:
                print(f"{label} a={imm_word:08x}: dxc failed rc={c.returncode} {c.stderr.strip()[:300]}")
                report["errors"].append({"mode": mode, "a": f"{imm_word:08x}", "dxc": c.stderr.strip()[:300]})
                continue
            attrs = sorted(set(re.findall(r'"fp32-denorm-mode"="\w+"', lst.read_text(errors="replace"))))
            for group, name, a_word, b_word in (s for s in SUBJECTS if s[2] == imm_word):
                keep, flush = reference(a_word, b_word, False), reference(a_word, b_word, True)
                constants = struct.pack("<4I", a_word, b_word, ADD_A, ADD_B).ljust(256, b"\0")
                tag = f"{stem}_b{b_word:08x}"
                rc_v, lines, _ = draw(renderer, backend, cso, out / f"{tag}_verify.case", constants, keep)
                inverted = [w ^ 0xffffffff for w in keep]
                rc_r, rlines, actual = draw(renderer, backend, cso, out / f"{tag}_readback.case", constants, inverted)
                if rc_v not in (0, 1) or rc_r != 1 or len(actual) != 4:
                    msg = f"{label} {name}: verify rc={rc_v} readback rc={rc_r} {' | '.join(rlines)[:400]}"
                    print(msg)
                    report["errors"].append({"mode": mode, "subject": name, "error": msg})
                    continue
                words = [actual[i] for i in range(4)]
                consistent = (rc_v == 0) == (words == keep)
                pred = [w & m for w, m in zip(words, PREDICATE_MASK)]
                match = [k for k, ref in (("kept", keep), ("flushed", flush))
                         if pred == [w & m for w, m in zip(ref, PREDICATE_MASK)]]
                verdict = {2: "kept = flushed (mode-independent)", 1: match[0] if match else ""}.get(len(match),
                                                                                                    "MATCHES NEITHER")
                arith = "kept (1)" if words[3] & 256 else "flushed (0)" if words[3] & 512 else "other"
                debug = next((l for l in lines + rlines if l.startswith("debug_errors=")), "debug_errors=(not printed)")
                adapter = next((l for l in lines if l.startswith("adapter=")), "adapter=?")
                driver = next((l.split("=", 1)[1] for l in lines if l.startswith("driver=")), "?")
                layer = next((l for l in lines if l.startswith("backend=")), "?")
                print(f"{label} {group} {name}: verify rc={rc_v} readback rc={rc_r} consistent={consistent} "
                      f"{adapter} driver={driver} {layer} {debug} dxil_attrs={attrs or ['(none)']}")
                print(f"    words={hexwords(words)}  keep_ref={hexwords(keep)}  flush_ref={hexwords(flush)}")
                print(f"    predicate bits: {verdict}   #312 bits 0-4: {[(words[3] >> i) & 1 for i in range(5)]}"
                      f"   arithmetic: {arith}")
                report["draws"].append({"group": group, "subject": name, "a": f"{a_word:08x}", "b": f"{b_word:08x}",
                                        "mode": mode or "(none)", "dxil_attrs": attrs, "adapter": adapter,
                                        "driver": driver, "debug": layer, "debug_counts": debug,
                                        "verify_rc": rc_v, "readback_rc": rc_r, "consistent": consistent,
                                        "words": [f"{w:08x}" for w in words], "keep_ref": [f"{w:08x}" for w in keep],
                                        "flush_ref": [f"{w:08x}" for w in flush], "predicate_verdict": verdict,
                                        "arithmetic": arith})
    # Summary: M1 kept only under preserve; M2 predicate words identical across all builds.
    by = {}
    for d in report["draws"]:
        by.setdefault(d["subject"], {})[d["mode"]] = d
    summary = {}
    for group, name, *_ in SUBJECTS:
        modes = by.get(name, {})
        if len(modes) != 4:
            summary[name] = "INCOMPLETE"
            continue
        if group == "M2":
            preds = {m: tuple(int(w, 16) & k for w, k in zip(d["words"], PREDICATE_MASK)) for m, d in modes.items()}
            ok = len(set(preds.values())) == 1 and all(d["predicate_verdict"].startswith("kept = flushed")
                                                     for d in modes.values())
            summary[name] = "identical in all builds, IEEE" if ok else "DIFFERS BETWEEN BUILDS OR FROM IEEE"
        else:
            ok = modes["preserve"]["predicate_verdict"] == "kept" and all(
                modes[m]["predicate_verdict"] == "flushed" for m in ("(none)", "any", "ftz"))
            summary[name] = "kept under preserve, flushed otherwise" if ok else "UNEXPECTED"
        summary[name] += "" if all(d["consistent"] for d in modes.values()) else " (VERIFY/READBACK INCONSISTENT)"
    report["summary"] = summary
    print("summary:")
    for name, text in summary.items():
        print(f"    {name:18s} {text}")
    (out / "result.json").write_text(json.dumps(report, indent=1) + "\n")


if __name__ == "__main__":
    main()

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111713224 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7111713224). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-23T19:30:53Z. --- NVIDIA and WARP data, as promised, and the source-built comparison you asked for above. Data only, no fixture change. **Short version:** on an RTX 3070 (Ampere, driver 621.01) and on WARP, both with the debug layer, `pixel_aot_comparisons_hardware` and `_warp` pass on current `main`. A source-built probe of ±2^-149 against ±0 keeps the subnormal under `-denorm preserve`, across all 16 binary32 relations and every shape we tried. That includes the translator's `ordered && ordered && (a == b)` form and the five-bit probe from [#312](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7108239560). It flushes under `ftz` and `any`, and the normal and NaN controls are identical in both modes. Built with `ftz` or `any`, the fixture fails on both of our adapters with exactly the case list and bit reported here for RDNA 4. ### Environment - Windows 11 25H2, build 26200.9974 - NVIDIA GeForce RTX 3070 (`10de:2484`), driver 621.01 (UMD `32.0.16.2101`), D3D12 debug layer enabled - WARP `10.0.26100.9818` (`1414:008c`), debug layer enabled - `debug_errors=0 debug_warnings=0` on every draw of the fixture-mode and probe runs below - DXC `1.9.2602.17` (Windows SDK 10.0.26100.0 path). The probe was repeated with DXC release `v1.8.2502` (`dxcompiler.dll` reports `1.8.2502.8`), with identical words. - `main` at `185ffbe` (#929 merge), clean tree, `dev` preset (Debug). `tests/pixel_aot_check.py`, `tools/pixel_aot.py`, `tests/offscreen_check.cpp` and `tests/pixel_aot_render.cpp` are unchanged from `0f0c3eb`. - Load: other GPU work was running during the CTest runs (19–52 % utilisation, ~7 GB of 8 GB VRAM in use). Pass/fail does not depend on it; the times below do. The probe runs were on a quiet GPU (0–3 % utilisation). ### 1. The two CTest entries, three serial runs ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_(hardware|warp)$' -V ``` | Run | `pixel_aot_comparisons_hardware` (RTX 3070) | `pixel_aot_comparisons_warp` | |---|---|---| | 1 | Passed, 20.13 s | Passed, 6.24 s | | 2 | Passed, 17.72 s | Passed, 6.19 s | | 3 | Passed, 17.76 s | Passed, 6.21 s | All 11 batch cases give their expected status on both adapters. `f32-cmp-1` returns `0x0008cccc` (bit 18 clear), and the four expected-mismatch controls and both mutation checks fire. ### 2. Negative control: the same fixture under `ftz` and `any` We ran `check_f32_compare_draws` again with only the `-denorm` value changed. The mode is swapped in memory and no file is edited. The DXIL listing confirms the attribute each time. | `-denorm` | RTX 3070 | WARP | |---|---|---| | `preserve` (harness default) | pass | pass | | `ftz` | **fail**: `got ['pass','mismatch','mismatch','mismatch',…]`, `expected_bits=0008cccc actual_bits=000ccccc` | **fail**, same case and bit | | `any` | **fail**, same case and bit | **fail**, same case and bit | So on these two adapters the fixture does see a flush when the pipeline really flushes, and the RDNA 4 result is exactly what a flushed operand produces in bit 18. The fixture's DXIL under `preserve` carries `"fp32-denorm-mode"="preserve"` and `fcmp oeq float %55, 0x36A0000000000000` (2^-149), as in the original report. ### 3. Source-built comparison: ±2^-149 against ±0 One synthetic pixel shader is compiled with `-Gis -T ps_6_2`, once each with `-denorm preserve`, `ftz`, `any` and with no flag. It is drawn through `offscreen_check <backend> --check-pixel-case` into the lossless `R32G32B32A32_UINT` target, and all operands come from the constant buffer. Each 32-bit word packs 16 relations, `f lt eq le gt lg ge o u nge nlg ngt nle neq nlt tru`, as `rel(a, b)` in bits 0–15 and `rel(b, a)` in bits 16–31. Each relation appears in three shapes: a plain HLSL expression (`lg` and `nlg` as `a < b || a > b` and its negation, so NaN stays unordered), the exact form `tools/pixel_aot.py` emits for `v_cmp_*_f32`, and the same form with `a` as an immediate `asfloat(…u)` (the operand form of bit 18). The fourth word holds the five #312 bits in bits 0–4 and an arithmetic check in bits 8–9. **Raw predicate words, RTX 3070 and WARP identical, z = +0 and −0 identical:** | Build (DXIL `fp32-denorm-mode`) | `+2^-149` (`0x00000001`), three shapes | `−2^-149` (`0x80000001`), three shapes | five-bit probe from #312 | |---|---|---|---| | `preserve` (`"preserve"`) | `aaaaf0f0` ×3: **kept** | `f0f0aaaa` ×3: **kept** | `0 0 0 0 0` | | `ftz` (`"ftz"`) | `cccccccc` ×3: flushed | `cccccccc` ×3: flushed | `1 1 1 1 1` | | `any` (`"any"`) | `cccccccc` ×3: flushed | `cccccccc` ×3: flushed | `1 1 1 1 1` | | no flag (no attribute) | `cccccccc` ×3: flushed | `cccccccc` ×3: flushed | `1 1 1 1 1` | "Kept" and "flushed" are judged on every relation bit that differs between the two IEEE references (subnormal kept, or replaced by zero). Every word in this section is a raw readback, pass or fail: each case is drawn twice, once against the kept reference, which the renderer compares bit for bit (a match under `preserve`, a mismatch under the other builds), and once against the bitwise complement of that reference, so that the renderer prints all four raw words. The two draws agreed in every case. Every probe listing carries the attribute of its build, the unflagged build carries none, and the immediates stay in the DXIL, e.g. `fcmp olt float %6, 0xB6A0000000000000` (−2^-149) under `preserve`. **Mode-independent controls**, same draw and same three shapes: FLT_MIN (`0x00800000`) against ±0, `1.0` against `-1.0`, and a quiet NaN (`0x7fc00000`) against 0 and against 2^-149. Words: `aaaaf0f0` ×3 for FLT_MIN against +0 and −0 and for `1.0` against `-1.0`, `ff00ff00` ×3 for NaN against 0 and against 2^-149, and the five #312 bits all clear. **Identical under `preserve`, `ftz`, `any` and no flag**, and equal to the IEEE reference on both adapters. As an arithmetic check in the same draw (bits 8–9 of the fourth word, the only bits that change between builds), `0x00800001 + 0x80800000` returns `0x00000001` under `preserve` and `0` under the other three builds. Three runs per adapter with the SDK DXC and one with DXC 1.8 gave the same words (36 cases per adapter and run, each drawn twice). ### What this shows, and what it does not - On **this NVIDIA adapter and driver**, and on **WARP**, a `preserve` build keeps ±2^-149 in every binary32 compare we probed. That includes a compare feeding `&&` and `||`, the shape that fails on the RX 9070 XT in #312. The bit-18 failure is **not reproduced** here: on these two adapters the translated shader and the fixture's reference agree. - On both adapters, `any` and an unflagged build behave like `ftz` for these compares, as they do for arithmetic in #312. - It does **not** settle ISA versus driver on RDNA. We have no AMD hardware, and nothing here says what the console does with a subnormal in a compare. The existing failing row is untouched, and we have no capability skip to report: nothing was skipped on either adapter. - **Not tested:** AMD and Intel adapters, other NVIDIA generations and drivers, compute shaders, binary16/binary64 compares, and Release builds. The probe below should run unchanged on an RDNA 4 adapter. Usage: `python -I f32_compare_probe.py <dxc.exe> <offscreen_check.exe> <hardware|warp> <out_dir>`. It needs only the standard library and the repository's `offscreen_check`. It writes the generated HLSL, the DXIL listings, the raw renderer output and a `result.json` to `<out_dir>`, and prints a per-subject summary at the end. SHA-256: `cedc06cd5d64c7444b0bdb6c421b06700ad84c84081dbdca4e4c3a98c5be3953`. <details><summary><code>f32_compare_probe.py</code></summary> ```python """Standalone f32 compare probe for Xbox2Windows #958. Measures only; changes no project code. Usage: python -I f32_compare_probe.py <dxc.exe> <offscreen_check.exe> <hardware|warp> <out_dir> Each subject is a pair (a, b) of binary32 words read from the constant buffer, so nothing folds at compile time, except channel 2 and the #312 bits, which use `a` as the immediate `asfloat(...u)` on purpose (the operand form of bit 18 in `f32-cmp-1`). Subjects: M0 +2^-149 (0x00000001) against +0 and -0 M1 -2^-149 (0x80000001) against +0 and -0 M2 mode-independent controls: FLT_MIN (0x00800000) against +0 and -0, 1.0 against -1.0, a quiet NaN (0x7fc00000) against +0 and against +2^-149 Every shader is built with `-Gis -T ps_6_2` like the harness: with no -denorm flag, `any`, `ftz` and `preserve`. The DXIL `fp32-denorm-mode` attribute is read back from each listing. Channels of the single R32G32B32A32_UINT texel: ch0 bits 0-15: the 16 relations as plain HLSL compares, rel(a, b); bits 16-31: rel(b, a) ch1 the same in the exact shape the translator emits for v_cmp_*_f32 (ordered guards `&&` the compare, or `|| isnan`) ch2 the translator shape with `a` as an immediate asfloat(...u) ch3 bits 0-4: the five-bit probe from #312 (comment 7108239560), same shapes, with `a` for 2^-149 bit 8: asuint(0x00800001 + 0x80800000) == 1u (arithmetic: the subnormal sum is kept) bit 9: the same sum == 0u (arithmetic: flushed). Bits 8-9 differ by mode by design. Every subject is drawn twice through the repository renderer (`offscreen_check <backend> --check-pixel-case`, debug layer enabled when Graphics Tools are installed, lossless integer target): verify expects the IEEE reference with subnormals kept; rc=0 means a bit-for-bit match readback expects the bitwise complement of that reference, so every channel mismatches and the renderer prints the four raw words; these are the words reported, pass or fail Each word is then compared with two IEEE references: subnormal operands kept, or flushed to zero. """ import json import math import re import struct import subprocess import sys from pathlib import Path PREDICATES = ("f", "lt", "eq", "le", "gt", "lg", "ge", "o", "u", "nge", "nlg", "ngt", "nle", "neq", "nlt", "tru") SUBJECTS = [ # (group, name, a, b) ("M0", "+min_sub vs +0", 0x00000001, 0x00000000), ("M0", "+min_sub vs -0", 0x00000001, 0x80000000), ("M1", "-min_sub vs +0", 0x80000001, 0x00000000), ("M1", "-min_sub vs -0", 0x80000001, 0x80000000), ("M2", "FLT_MIN vs +0", 0x00800000, 0x00000000), ("M2", "FLT_MIN vs -0", 0x00800000, 0x80000000), ("M2", "1.0 vs -1.0", 0x3f800000, 0xbf800000), ("M2", "NaN vs +0", 0x7fc00000, 0x00000000), ("M2", "NaN vs +min_sub", 0x7fc00000, 0x00000001), ] ADD_A, ADD_B = 0x00800001, 0x80800000 MODES = [None, "any", "ftz", "preserve"] PREDICATE_MASK = (0xffffffff, 0xffffffff, 0xffffffff, 0x1f) # everything except the arithmetic bits def ordered(x): return f"((asuint({x}) & 0x7fffffffu) <= 0x7f800000u)" def plain(pred, a, b): """One plain HLSL expression per relation, IEEE-correct for NaN under -Gis.""" return { "f": "false", "lt": f"({a} < {b})", "eq": f"({a} == {b})", "le": f"({a} <= {b})", "gt": f"({a} > {b})", "lg": f"({a} < {b} || {a} > {b})", "ge": f"({a} >= {b})", "o": f"(!isnan({a}) && !isnan({b}))", "u": f"(isnan({a}) || isnan({b}))", "nge": f"(!({a} >= {b}))", "nlg": f"(!({a} < {b} || {a} > {b}))", "ngt": f"(!({a} > {b}))", "nle": f"(!({a} <= {b}))", "neq": f"(!({a} == {b}))", "nlt": f"(!({a} < {b}))", "tru": "true", }[pred] def translator(pred, a, b): """The shapes tools/pixel_aot.py emits for v_cmp_<pred>_f32.""" guard = f"{ordered(a)} && {ordered(b)}" nan = f"isnan({a}) || isnan({b})" return { "f": "false", "lt": f"({guard} && ({a} < {b}))", "eq": f"({guard} && ({a} == {b}))", "le": f"({guard} && ({a} <= {b}))", "gt": f"({guard} && ({a} > {b}))", "lg": f"({guard} && (({a} < {b} || {a} > {b})))", "ge": f"({guard} && ({a} >= {b}))", "o": f"({a} == {a} && {b} == {b})", "u": f"({a} != {a} || {b} != {b})", "nge": f"({a} < {b} || {nan})", "nlg": f"({a} == {b} || {nan})", "ngt": f"({a} <= {b} || {nan})", "nle": f"({a} > {b} || {nan})", "neq": f"!({a} == {b})", "nlt": f"({a} >= {b} || {nan})", "tru": "true", }[pred] def shader_source(imm_word): imm = f"asfloat(0x{imm_word:08x}u)" lines = [ "// f32 compare probe for Xbox2Windows #958 (generated by f32_compare_probe.py).", "cbuffer Constants : register(b0) { uint4 params[16]; };", "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {", " float a = asfloat(params[0].x);", " float b = asfloat(params[0].y);", " float add_a = asfloat(params[0].z); // 0x00800001", " float add_b = asfloat(params[0].w); // 0x80800000", " uint c0 = 0, c1 = 0, c2 = 0, c3 = 0;", ] for bit, pred in enumerate(PREDICATES): lines.append(f" c0 |= {plain(pred, 'a', 'b')} ? {1 << bit}u : 0u;") lines.append(f" c0 |= {plain(pred, 'b', 'a')} ? {1 << (bit + 16)}u : 0u;") lines.append(f" c1 |= {translator(pred, 'a', 'b')} ? {1 << bit}u : 0u;") lines.append(f" c1 |= {translator(pred, 'b', 'a')} ? {1 << (bit + 16)}u : 0u;") lines.append(f" c2 |= {translator(pred, imm, 'b')} ? {1 << bit}u : 0u;") lines.append(f" c2 |= {translator(pred, 'b', imm)} ? {1 << (bit + 16)}u : 0u;") lines += [ " // five-bit probe from #312 (comment 7108239560), same shapes", f" c3 |= ({imm} == b) ? 1u : 0u;", f" c3 |= (({ordered(imm)} && {ordered('b')} && ({imm} == b))) ? 2u : 0u;", f" c3 |= (({ordered('b')}) && ({imm} == b)) ? 4u : 0u;", f" c3 |= (({ordered('a')} && {ordered('b')} && (a == b))) ? 8u : 0u;", f" c3 |= (isnan(b) || {imm} == b) ? 16u : 0u;", " // arithmetic control: a sum of two normals whose exact result is the least subnormal", " uint s = asuint(add_a + add_b);", " c3 |= (s == 1u) ? 256u : 0u;", " c3 |= (s == 0u) ? 512u : 0u;", " return uint4(c0, c1, c2, c3);", "}", ] return "\n".join(lines) + "\n" def as_float(word, flush): if flush and (word & 0x7f800000) == 0: word &= 0x80000000 # flushed to a zero of the same sign return struct.unpack("<f", struct.pack("<I", word))[0] def rel(pred, a, b): o = not (math.isnan(a) or math.isnan(b)) lg = o and a != b return {"f": False, "lt": a < b, "eq": a == b, "le": a <= b, "gt": a > b, "lg": lg, "ge": a >= b, "o": o, "u": not o, "nge": not a >= b, "nlg": not lg, "ngt": not a > b, "nle": not a <= b, "neq": not a == b, "nlt": not a < b, "tru": True}[pred] def reference(a_word, b_word, flush): """Expected words under IEEE, with subnormal operands (and the sum) kept or flushed to zero.""" a, b = as_float(a_word, flush), as_float(b_word, flush) c0 = 0 for bit, pred in enumerate(PREDICATES): c0 |= (1 << bit if rel(pred, a, b) else 0) | (1 << (bit + 16) if rel(pred, b, a) else 0) o = not (math.isnan(a) or math.isnan(b)) five = [a == b, o and a == b, (not math.isnan(b)) and a == b, o and a == b, math.isnan(b) or a == b] c3 = sum(1 << i for i, v in enumerate(five) if v) | (512 if flush else 256) return [c0, c0, c0, c3] def hexwords(words): return " ".join(f"{w:08x}" for w in words) def draw(renderer, backend, cso, case, constants, expected): case.write_bytes(constants + struct.pack("<4I", *expected) * 64 + b"\x01") r = subprocess.run([renderer, backend, "--check-pixel-case", cso, case], capture_output=True, text=True) lines = (r.stdout + r.stderr).splitlines() (case.parent / f"{case.stem}.renderer.txt").write_text(f"rc={r.returncode}\n" + "\n".join(lines) + "\n") actual = {int(m[1]): int(m[2], 16) for m in (re.search(r"channel=(\d+) .*actual_bits=([0-9a-f]{8})", line) for line in lines) if m} return r.returncode, lines, actual def main(): dxc, renderer, backend, out_dir = sys.argv[1:5] out = Path(out_dir) out.mkdir(parents=True, exist_ok=True) report = {"backend": backend, "draws": [], "errors": []} for imm_word in sorted({s[2] for s in SUBJECTS}): source = out / f"probe_{imm_word:08x}.hlsl" source.write_text(shader_source(imm_word), encoding="ascii") for mode in MODES: flags = ["-Gis"] + (["-denorm", mode] if mode else []) stem = f"a{imm_word:08x}_{mode or 'noflag'}" cso, lst = out / f"{stem}.cso", out / f"{stem}.lst" c = subprocess.run([dxc, *flags, "-T", "ps_6_2", "-E", "main", "-Fo", cso, "-Fc", lst, source], capture_output=True, text=True) label = f"[{backend}] -Gis {'-denorm ' + mode if mode else '(no -denorm)'}" if c.returncode: print(f"{label} a={imm_word:08x}: dxc failed rc={c.returncode} {c.stderr.strip()[:300]}") report["errors"].append({"mode": mode, "a": f"{imm_word:08x}", "dxc": c.stderr.strip()[:300]}) continue attrs = sorted(set(re.findall(r'"fp32-denorm-mode"="\w+"', lst.read_text(errors="replace")))) for group, name, a_word, b_word in (s for s in SUBJECTS if s[2] == imm_word): keep, flush = reference(a_word, b_word, False), reference(a_word, b_word, True) constants = struct.pack("<4I", a_word, b_word, ADD_A, ADD_B).ljust(256, b"\0") tag = f"{stem}_b{b_word:08x}" rc_v, lines, _ = draw(renderer, backend, cso, out / f"{tag}_verify.case", constants, keep) inverted = [w ^ 0xffffffff for w in keep] rc_r, rlines, actual = draw(renderer, backend, cso, out / f"{tag}_readback.case", constants, inverted) if rc_v not in (0, 1) or rc_r != 1 or len(actual) != 4: msg = f"{label} {name}: verify rc={rc_v} readback rc={rc_r} {' | '.join(rlines)[:400]}" print(msg) report["errors"].append({"mode": mode, "subject": name, "error": msg}) continue words = [actual[i] for i in range(4)] consistent = (rc_v == 0) == (words == keep) pred = [w & m for w, m in zip(words, PREDICATE_MASK)] match = [k for k, ref in (("kept", keep), ("flushed", flush)) if pred == [w & m for w, m in zip(ref, PREDICATE_MASK)]] verdict = {2: "kept = flushed (mode-independent)", 1: match[0] if match else ""}.get(len(match), "MATCHES NEITHER") arith = "kept (1)" if words[3] & 256 else "flushed (0)" if words[3] & 512 else "other" debug = next((l for l in lines + rlines if l.startswith("debug_errors=")), "debug_errors=(not printed)") adapter = next((l for l in lines if l.startswith("adapter=")), "adapter=?") driver = next((l.split("=", 1)[1] for l in lines if l.startswith("driver=")), "?") layer = next((l for l in lines if l.startswith("backend=")), "?") print(f"{label} {group} {name}: verify rc={rc_v} readback rc={rc_r} consistent={consistent} " f"{adapter} driver={driver} {layer} {debug} dxil_attrs={attrs or ['(none)']}") print(f" words={hexwords(words)} keep_ref={hexwords(keep)} flush_ref={hexwords(flush)}") print(f" predicate bits: {verdict} #312 bits 0-4: {[(words[3] >> i) & 1 for i in range(5)]}" f" arithmetic: {arith}") report["draws"].append({"group": group, "subject": name, "a": f"{a_word:08x}", "b": f"{b_word:08x}", "mode": mode or "(none)", "dxil_attrs": attrs, "adapter": adapter, "driver": driver, "debug": layer, "debug_counts": debug, "verify_rc": rc_v, "readback_rc": rc_r, "consistent": consistent, "words": [f"{w:08x}" for w in words], "keep_ref": [f"{w:08x}" for w in keep], "flush_ref": [f"{w:08x}" for w in flush], "predicate_verdict": verdict, "arithmetic": arith}) # Summary: M1 kept only under preserve; M2 predicate words identical across all builds. by = {} for d in report["draws"]: by.setdefault(d["subject"], {})[d["mode"]] = d summary = {} for group, name, *_ in SUBJECTS: modes = by.get(name, {}) if len(modes) != 4: summary[name] = "INCOMPLETE" continue if group == "M2": preds = {m: tuple(int(w, 16) & k for w, k in zip(d["words"], PREDICATE_MASK)) for m, d in modes.items()} ok = len(set(preds.values())) == 1 and all(d["predicate_verdict"].startswith("kept = flushed") for d in modes.values()) summary[name] = "identical in all builds, IEEE" if ok else "DIFFERS BETWEEN BUILDS OR FROM IEEE" else: ok = modes["preserve"]["predicate_verdict"] == "kept" and all( modes[m]["predicate_verdict"] == "flushed" for m in ("(none)", "any", "ftz")) summary[name] = "kept under preserve, flushed otherwise" if ok else "UNEXPECTED" summary[name] += "" if all(d["consistent"] for d in modes.values()) else " (VERIFY/READBACK INCONSISTENT)" report["summary"] = summary print("summary:") for name, text in summary.items(): print(f" {name:18s} {text}") (out / "result.json").write_text(json.dumps(report, indent=1) + "\n") if __name__ == "__main__": main() ``` </details> _AI-assisted._
lantiumBot commented 2026-11-24 06:49:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lantiumBot on 2026-11-23T19:34:07Z.


Source-built isolation on the RX 9060 XT, as asked above. Short version: on this adapter the compare itself honours preserve. The fixture row fails only when a subnormal literal is compared in the same expression as the not-NaN guard on the other operand. Data only, no fixture change.

1. Plain compares: preserve is honoured

One pixel shader (ps_6_2, -Gis), built twice with -denorm preserve and -denorm ftz, drawn into the renderer's R32G32B32A32_UINT target. 14 operand pairs, six predicates each (==, !=, <, <=, >, >=), plus asuint(sub * 1.0) in word 3. Pairs: +/-0x00000001 against +/-0 in both orders, sub,sub, +sub,-sub, 0x007fffff,+0; controls 0x00800000,+0, 1.0,2.0, 1.0,1.0, +0,-0, qNaN,1.0. Two operand variants: both read from the constant buffer, or the left one written as an asfloat(<bits>u) literal.

Build DXIL attribute RX 9060 XT words 0..3 WARP words 0..3 Matches
preserve, runtime operands "fp32-denorm-mode"="preserve" 0e38ecb2,32cb2a72,000a9a4e,00000001 same IEEE reference
preserve, literal lhs "fp32-denorm-mode"="preserve" 0e38ecb2,32cb2a72,000a9a4e,00000001 same IEEE reference
ftz, runtime operands "fp32-denorm-mode"="ftz" 29a69a69,32a69a69,000a9a4e,00000000 same flushed reference
ftz, literal lhs "fp32-denorm-mode"="ftz" 29a69a69,32a69a69,000a9a4e,00000000 same flushed reference

References computed on the CPU: IEEE 0e38ecb2,32cb2a72,000a9a4e,00000001; both operands flushed to signed zero first 29a69a69,32a69a69,000a9a4e,00000000. Word 2 holds the normal, signed-zero and NaN controls and is 000a9a4e in every build. A second draw with the observed words as the expectation passed on all 64 pixels in every row. So +sub == -0 is false on the Radeon under preserve here, for a runtime and for a literal subnormal.

2. Reduction of the fixture row

The fixture emits (lhs not NaN) && (rhs not NaN) && (asfloat(1u) == alu24). One compare per shader, r = asfloat(params[1].x) = 0x80000000, fixture set 1 constants, bit 0 of word 0 at pixel (0, 0). RG is ((asuint(r) & 0x7fffffffu) <= 0x7f800000u).

Expression IEEE preserve: Radeon preserve: WARP ftz: Radeon ftz: WARP
asfloat(1u) == r 0 0 0 1 1
fixture form, both guards 0 1 0 1 1
RG && asfloat(1u) == r 0 1 0 1 1
lhs guard (constant) && asfloat(1u) == r 0 0 0 1 1
RG && r == asfloat(1u) 0 1 0 1 1
RG && asfloat(1u) > r 1 0 1 0 0
RG && asfloat(1u) != r 1 0 1 0 0
!isnan(r) && asfloat(1u) == r 0 1 0 1 1
(r == r) && asfloat(1u) == r 0 1 0 1 1
RG & (asfloat(1u) == r) 0 1 0 1 1
RG && asfloat(0x007fffffu) == r 0 1 0 1 1
RG && asfloat(0x80000001u) == r 0 1 0 1 1
RG && asfloat(1u) == p, p = +0 0 1 0 1 1
RG && s == r, s = 0x00000001 from the constant buffer 0 0 0 1 1
RG && asfloat(0x00800000u) == r (control) 0 0 0 0 0
RG && 0.0f == r (control) 1 1 1 1 1
RG alone (control) 1 1 1 1 1

Under preserve the Radeon gives the flushed answer exactly when a subnormal literal is compared against an operand that also has a not-NaN test in the same expression. It gives the IEEE answer when the guard is absent, when the subnormal comes from the constant buffer, and for the smallest normal literal. WARP gives the IEEE answer in every preserve row. Under ftz both adapters agree on every row.

DXIL for the two smallest shaders (DXC 1.9.2602.17, -Gis -denorm preserve -T ps_6_2). Both carry attributes #0 = { "fp32-denorm-mode"="preserve" } and the same compare against 2^-149; they differ only in the integer test and the and:

; asfloat(1u) == r                      -> Radeon 0, WARP 0
  %4 = bitcast i32 %3 to float
  %5 = fcmp oeq float %4, 0x36A0000000000000
  %6 = zext i1 %5 to i32

; RG && asfloat(1u) == r                -> Radeon 1, WARP 0
  %4 = and i32 %3, 2147483647
  %5 = icmp ult i32 %4, 2139095041
  %6 = bitcast i32 %3 to float
  %7 = fcmp oeq float %6, 0x36A0000000000000
  %8 = and i1 %5, %7
  %9 = zext i1 %8 to i32

What this does and does not show

  • Measured: with identical DXIL, the adapter result for fcmp oeq x, 2^-149 depends on whether the result is and-ed with a not-NaN test of x. A runtime subnormal in the same guarded expression compares correctly.
  • Hypothesis, not established: the driver's shader compiler folds the guarded compare into another form and loses the subnormal immediate there. I have no view into the driver's output, so this is an inference from the table.
  • This argues against reading the red row as "binary32 compares flush on this hardware". It says nothing about native gfx1013 behaviour.
  • One adapter (device 7590), one driver, one run per row, debug layer unavailable. Section 2 reads pixel (0, 0) only.

Environment

  • Commit: 0f0c3eb1f50f227ddc154ab7e081839628ff89b3, clean tree; renderer is offscreen_check from the dev preset, --check-pixel-batch
  • Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), driver 32.0.32029.2010
  • WARP: Microsoft Basic Render Driver (1414:008c), in-box, driver 10.0.26100.10068
  • Windows build: 26300.10075, D3D12 debug layer unavailable
  • DXC 1.9.2602.17 (21d28f727) from Windows SDK 10.0.26100.0
Section 1 script (uncommitted)
python -B f32_compare_probe.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware
"""Local, uncommitted probe for issue #958: binary32 compares of +/-min-subnormal against +/-0.

One source-built pixel shader, compiled twice (dxc -denorm preserve and -denorm ftz, ps_6_2, -Gis),
drawn through the repository renderer into its lossless R32G32B32A32_UINT target. Two operand
variants: "runtime" reads both operands from the constant buffer; "literal" writes the left operand
as an asfloat(<bits>u) literal, as the comparison fixture does, and reads the right one from the
constant buffer. Normal, NaN and signed-zero pairs are controls.

Each pair yields six predicate bits, low to high: ==, !=, <, <=, >, >=. Channels 0 to 2 pack the
pairs (five per channel, six bits each); channel 3 is asuint(subnormal * 1.0), with both factors
read from the constant buffer, as a control on whether the value itself survives an operation.

Usage: f32_compare_probe.py <dxc> <offscreen_check> <hardware|warp>
"""
from pathlib import Path
import struct
import subprocess
import sys
import tempfile

SUB, NSUB, ZERO, NZERO = 0x00000001, 0x80000001, 0x00000000, 0x80000000
PAIRS = (  # (label, lhs bits, rhs bits)
    ("+sub,+0", SUB, ZERO), ("+sub,-0", SUB, NZERO), ("-sub,+0", NSUB, ZERO), ("-sub,-0", NSUB, NZERO),
    ("+0,+sub", ZERO, SUB), ("-0,-sub", NZERO, NSUB), ("+sub,+sub", SUB, SUB), ("+sub,-sub", SUB, NSUB),
    ("maxsub,+0", 0x007fffff, ZERO), ("minnormal,+0", 0x00800000, ZERO),
    ("1.0,2.0", 0x3f800000, 0x40000000), ("1.0,1.0", 0x3f800000, 0x3f800000),
    ("+0,-0", ZERO, NZERO), ("qNaN,1.0", 0x7fc00000, 0x3f800000),
)
PREDICATES = ("==", "!=", "<", "<=", ">", ">=")
SENTINEL = 0x5a5a5a5a
FIRST_OPERAND = 4   # flat uint index of the first operand in params[16]
ONE_INDEX = 60


def to_float(bits):
    return struct.unpack("<f", struct.pack("<I", bits))[0]


def flush(bits):
    return bits & 0x80000000 if bits & 0x7f800000 == 0 else bits


def reference(ftz):
    words = [0, 0, 0, 0]
    for index, (_, lhs, rhs) in enumerate(PAIRS):
        a, b = (to_float(flush(v) if ftz else v) for v in (lhs, rhs))
        results = (a == b, a != b, a < b, a <= b, a > b, a >= b)
        for bit, value in enumerate(results):
            words[index // 5] |= int(value) << ((index % 5) * 6 + bit)
    words[3] = flush(SUB) if ftz else SUB
    return words


def param(index):
    return f"params[{index // 4}].{'xyzw'[index % 4]}"


def shader(literal):
    lines = ["cbuffer Constants : register(b0) { uint4 params[16]; };",
             "Texture2D<float4> tex : register(t0);", "SamplerState samp : register(s0);",
             "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {", "    uint w0 = 0u, w1 = 0u, w2 = 0u;"]
    for index, (_, lhs, _) in enumerate(PAIRS):
        left = f"asfloat(0x{lhs:08x}u)" if literal else f"asfloat({param(FIRST_OPERAND + 2 * index)})"
        lines.append(f"    precise float a{index} = {left};")
        lines.append(f"    precise float b{index} = asfloat({param(FIRST_OPERAND + 2 * index + 1)});")
        for bit, predicate in enumerate(PREDICATES):
            lines.append(f"    w{index // 5} |= (a{index} {predicate} b{index} ? 1u : 0u) << {(index % 5) * 6 + bit}u;")
    lines.append(f"    precise float product = asfloat({param(FIRST_OPERAND)}) * asfloat({param(ONE_INDEX)});")
    lines.append("    return uint4(w0, w1, w2, asuint(product));")
    lines.append("}")
    return "\n".join(lines) + "\n"


def case_bytes(expected):
    constants = bytearray(256)
    for index, (_, lhs, rhs) in enumerate(PAIRS):
        struct.pack_into("<2I", constants, 4 * (FIRST_OPERAND + 2 * index), lhs, rhs)
    struct.pack_into("<I", constants, 4 * ONE_INDEX, 0x3f800000)
    return bytes(constants) + struct.pack("<4I", *expected) * 64 + bytes([1])  # flags bit 0: integer target


def describe(observed, expected):
    differing = []
    for index, (label, _, _) in enumerate(PAIRS):
        for bit, predicate in enumerate(PREDICATES):
            shift = (index % 5) * 6 + bit
            got, want = (observed[index // 5] >> shift) & 1, (expected[index // 5] >> shift) & 1
            if got != want:
                differing.append(f"({label}){predicate} got={got} want={want}")
    if observed[3] != expected[3]:
        differing.append(f"product got={observed[3]:08x} want={expected[3]:08x}")
    return differing


def main(dxc, renderer, backend):
    with tempfile.TemporaryDirectory() as tmp:
        path = Path(tmp)
        header_done = False
        for literal in (False, True):
            variant = "literal" if literal else "runtime"
            source = path / f"{variant}.hlsl"
            source.write_text(shader(literal), encoding="ascii")
            for mode in ("preserve", "ftz"):
                cso, listing = path / f"{variant}-{mode}.cso", path / f"{variant}-{mode}.ll"
                subprocess.run([dxc, "-Gis", "-denorm", mode, "-T", "ps_6_2", "-E", "main",
                                "-Fo", cso, "-Fc", listing, source], check=True, capture_output=True)
                text = listing.read_text(encoding="utf-8", errors="replace")
                attribute = next((line.strip() for line in text.splitlines() if "fp32-denorm-mode" in line), "absent")
                fcmps = sum(" fcmp " in line for line in text.splitlines())

                probe = path / "probe.case"
                probe.write_bytes(case_bytes([SENTINEL] * 4))
                result = subprocess.run([renderer, backend, "--check-pixel-batch", cso, probe],
                                        capture_output=True, text=True)
                output = result.stdout + result.stderr
                if not header_done:
                    for line in output.splitlines():
                        if line.startswith(("backend=", "adapter=", "driver=")):
                            print(line)
                    header_done = True
                observed = [int(line.rsplit("actual_bits=", 1)[1], 16) for line in output.splitlines()
                            if line.startswith("channel=")]
                if result.returncode != 1 or len(observed) != 4 or "pixel_mismatch x=0 y=0" not in output:
                    raise RuntimeError(output)

                confirm = path / "confirm.case"
                confirm.write_bytes(case_bytes(observed))
                again = subprocess.run([renderer, backend, "--check-pixel-batch", cso, confirm],
                                       capture_output=True, text=True)
                uniform = again.returncode == 0 and "case=0 status=pass" in again.stdout

                ieee, flushed = reference(False), reference(True)
                match = "ieee" if observed == ieee else "flushed" if observed == flushed else "neither"
                print(f"\nvariant={variant} denorm={mode} dxil_attr={attribute} fcmp_count={fcmps}")
                print("observed=" + ",".join(f"{w:08x}" for w in observed) + f" all_64_pixels_equal={uniform}")
                print("ieee_ref=" + ",".join(f"{w:08x}" for w in ieee))
                print("ftz_ref =" + ",".join(f"{w:08x}" for w in flushed))
                print(f"matches={match}")
                for name, expected in (("ieee", ieee), ("ftz", flushed)):
                    differing = describe(observed, expected)
                    if differing and name != match:
                        print(f"differs_from_{name}: " + "; ".join(differing))
    return 0


if __name__ == "__main__":
    sys.exit(main(*sys.argv[1:]))
Section 2 script (uncommitted)
python -B f32_reduce.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe preserve
"""Local, uncommitted reduction for issue #958. Usage: f32_reduce.py <dxc> <offscreen_check> [mode]

Draws one-compare variants of the fixture's failing row (asfloat(1u) == rhs, rhs = -0.0 read from
the constant buffer) into the renderer's R32G32B32A32_UINT target and prints bit 0 of word 0 of
pixel (0, 0) on hardware and WARP. mode is the dxc -denorm value (preserve or ftz).
"""
from pathlib import Path
import struct
import subprocess
import sys
import tempfile

HEADER = ("cbuffer Constants : register(b0) { uint4 params[16]; };\n"
          "Texture2D<float4> tex : register(t0);\nSamplerState samp : register(s0);\n")
SENTINEL = 0x5a5a5a5a
GUARD = "((asuint(asfloat(1u)) & 0x7fffffffu) <= 0x7f800000u) && ((asuint(r) & 0x7fffffffu) <= 0x7f800000u) && "


def body(text):
    return HEADER + "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {\n" + text + "}\n"


R = "    precise float r = asfloat(params[1].x);\n"
RG = "((asuint(r) & 0x7fffffffu) <= 0x7f800000u)"


def one(expr, pre=""):
    return body(R + pre + f"    bool c = {expr};\n    return uint4(c ? 1u : 0u, 0u, 0u, 0u);\n")


VARIANTS = {
    "A  sub == r": one("(asfloat(1u) == r)"),
    "B  lhsguard && rhsguard && sub == r (fixture form)": one(f"({GUARD}(asfloat(1u) == r))"),
    "B1 rhsguard && sub == r": one(f"({RG} && (asfloat(1u) == r))"),
    "B2 lhsguard(const) && sub == r": one("(((asuint(asfloat(1u)) & 0x7fffffffu) <= 0x7f800000u) && (asfloat(1u) == r))"),
    "B3 rhsguard && r == sub (swapped)": one(f"({RG} && (r == asfloat(1u)))"),
    "B4 rhsguard && sub > r (ieee 1, flushed 0)": one(f"({RG} && (asfloat(1u) > r))"),
    "B5 rhsguard && sub != r (ieee 1, flushed 0)": one(f"({RG} && (asfloat(1u) != r))"),
    "B6 !isnan(r) && sub == r": one("(!isnan(r) && (asfloat(1u) == r))"),
    "B7 rhsguard && maxsub == r": one(f"({RG} && (asfloat(0x007fffffu) == r))"),
    "B8 rhsguard && minnormal == r (control, 0)": one(f"({RG} && (asfloat(0x00800000u) == r))"),
    "B9 rhsguard && runtime_sub == r": one(f"({RG} && (s == r))", "    precise float s = asfloat(params[2].x);\n"),
    "BA rhsguard && sub == p (p = +0)": one("(((asuint(p) & 0x7fffffffu) <= 0x7f800000u) && (asfloat(1u) == p))",
                                              "    precise float p = asfloat(params[0].w);\n"),
    "BB rhsguard & (bitwise) sub == r": one(f"({RG} & (asfloat(1u) == r))"),
    "BC rhsguard && 0.0f == r (control, 1)": one(f"({RG} && (0.0f == r))"),
    "BD rhsguard && -sub == r": one(f"({RG} && (asfloat(0x80000001u) == r))"),
    "BE (r == r) && sub == r": one("((r == r) && (asfloat(1u) == r))"),
    "BF rhsguard only (control, 1)": one(f"{RG}"),
}


def main(dxc, renderer, mode="preserve"):
    constants = bytearray(256)
    struct.pack_into("<4I", constants, 12, 0x00000000, 0x80000000, 0xbf800000, 0x3f800000)  # fixture set 1
    struct.pack_into("<I", constants, 32, 0x00000001)  # params[2].x: runtime min subnormal
    with tempfile.TemporaryDirectory() as tmp:
        path = Path(tmp)
        case = path / "probe.case"
        case.write_bytes(bytes(constants) + struct.pack("<4I", *[SENTINEL] * 4) * 64 + bytes([1]))
        for name, source_text in VARIANTS.items():
            if source_text is None:
                continue
            source, cso = path / "v.hlsl", path / "v.cso"
            source.write_text(source_text, encoding="ascii")
            subprocess.run([dxc, "-Gis", "-denorm", mode, "-T", "ps_6_2", "-E", "main", "-Fo", cso, source],
                           check=True, capture_output=True)
            cells = []
            for backend in ("hardware", "warp"):
                result = subprocess.run([renderer, backend, "--check-pixel-batch", cso, case],
                                        capture_output=True, text=True)
                words = [line.rsplit("actual_bits=", 1)[1] for line in (result.stdout + result.stderr).splitlines()
                         if line.startswith("channel=")]
                cells.append(f"{backend}={words[0][-1]}")
            print(f"{name}: " + " ".join(cells), flush=True)
    return 0


if __name__ == "__main__":
    sys.exit(main(*sys.argv[1:]))

AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111787968 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7111787968). Originally posted by [lantiumBot](https://github.com/lantiumBot) on 2026-11-23T19:34:07Z. --- Source-built isolation on the RX 9060 XT, as asked above. Short version: on this adapter the compare itself honours `preserve`. The fixture row fails only when a subnormal **literal** is compared in the same expression as the not-NaN guard on the other operand. Data only, no fixture change. ### 1. Plain compares: preserve is honoured One pixel shader (ps_6_2, `-Gis`), built twice with `-denorm preserve` and `-denorm ftz`, drawn into the renderer's R32G32B32A32_UINT target. 14 operand pairs, six predicates each (`==`, `!=`, `<`, `<=`, `>`, `>=`), plus `asuint(sub * 1.0)` in word 3. Pairs: `+/-0x00000001` against `+/-0` in both orders, `sub,sub`, `+sub,-sub`, `0x007fffff,+0`; controls `0x00800000,+0`, `1.0,2.0`, `1.0,1.0`, `+0,-0`, `qNaN,1.0`. Two operand variants: both read from the constant buffer, or the left one written as an `asfloat(<bits>u)` literal. | Build | DXIL attribute | RX 9060 XT words 0..3 | WARP words 0..3 | Matches | |---|---|---|---|---| | preserve, runtime operands | `"fp32-denorm-mode"="preserve"` | `0e38ecb2,32cb2a72,000a9a4e,00000001` | same | IEEE reference | | preserve, literal lhs | `"fp32-denorm-mode"="preserve"` | `0e38ecb2,32cb2a72,000a9a4e,00000001` | same | IEEE reference | | ftz, runtime operands | `"fp32-denorm-mode"="ftz"` | `29a69a69,32a69a69,000a9a4e,00000000` | same | flushed reference | | ftz, literal lhs | `"fp32-denorm-mode"="ftz"` | `29a69a69,32a69a69,000a9a4e,00000000` | same | flushed reference | References computed on the CPU: IEEE `0e38ecb2,32cb2a72,000a9a4e,00000001`; both operands flushed to signed zero first `29a69a69,32a69a69,000a9a4e,00000000`. Word 2 holds the normal, signed-zero and NaN controls and is `000a9a4e` in every build. A second draw with the observed words as the expectation passed on all 64 pixels in every row. So `+sub == -0` is false on the Radeon under preserve here, for a runtime and for a literal subnormal. ### 2. Reduction of the fixture row The fixture emits `(lhs not NaN) && (rhs not NaN) && (asfloat(1u) == alu24)`. One compare per shader, `r = asfloat(params[1].x)` = `0x80000000`, fixture set 1 constants, bit 0 of word 0 at pixel (0, 0). `RG` is `((asuint(r) & 0x7fffffffu) <= 0x7f800000u)`. | Expression | IEEE | preserve: Radeon | preserve: WARP | ftz: Radeon | ftz: WARP | |---|---|---|---|---|---| | `asfloat(1u) == r` | 0 | 0 | 0 | 1 | 1 | | fixture form, both guards | 0 | **1** | 0 | 1 | 1 | | `RG && asfloat(1u) == r` | 0 | **1** | 0 | 1 | 1 | | lhs guard (constant) `&& asfloat(1u) == r` | 0 | 0 | 0 | 1 | 1 | | `RG && r == asfloat(1u)` | 0 | **1** | 0 | 1 | 1 | | `RG && asfloat(1u) > r` | 1 | **0** | 1 | 0 | 0 | | `RG && asfloat(1u) != r` | 1 | **0** | 1 | 0 | 0 | | `!isnan(r) && asfloat(1u) == r` | 0 | **1** | 0 | 1 | 1 | | `(r == r) && asfloat(1u) == r` | 0 | **1** | 0 | 1 | 1 | | `RG & (asfloat(1u) == r)` | 0 | **1** | 0 | 1 | 1 | | `RG && asfloat(0x007fffffu) == r` | 0 | **1** | 0 | 1 | 1 | | `RG && asfloat(0x80000001u) == r` | 0 | **1** | 0 | 1 | 1 | | `RG && asfloat(1u) == p`, `p` = `+0` | 0 | **1** | 0 | 1 | 1 | | `RG && s == r`, `s` = `0x00000001` from the constant buffer | 0 | 0 | 0 | 1 | 1 | | `RG && asfloat(0x00800000u) == r` (control) | 0 | 0 | 0 | 0 | 0 | | `RG && 0.0f == r` (control) | 1 | 1 | 1 | 1 | 1 | | `RG` alone (control) | 1 | 1 | 1 | 1 | 1 | Under preserve the Radeon gives the flushed answer exactly when a subnormal literal is compared against an operand that also has a not-NaN test in the same expression. It gives the IEEE answer when the guard is absent, when the subnormal comes from the constant buffer, and for the smallest normal literal. WARP gives the IEEE answer in every preserve row. Under ftz both adapters agree on every row. DXIL for the two smallest shaders (DXC 1.9.2602.17, `-Gis -denorm preserve -T ps_6_2`). Both carry `attributes #0 = { "fp32-denorm-mode"="preserve" }` and the same compare against 2^-149; they differ only in the integer test and the `and`: ```llvm ; asfloat(1u) == r -> Radeon 0, WARP 0 %4 = bitcast i32 %3 to float %5 = fcmp oeq float %4, 0x36A0000000000000 %6 = zext i1 %5 to i32 ; RG && asfloat(1u) == r -> Radeon 1, WARP 0 %4 = and i32 %3, 2147483647 %5 = icmp ult i32 %4, 2139095041 %6 = bitcast i32 %3 to float %7 = fcmp oeq float %6, 0x36A0000000000000 %8 = and i1 %5, %7 %9 = zext i1 %8 to i32 ``` ### What this does and does not show - Measured: with identical DXIL, the adapter result for `fcmp oeq x, 2^-149` depends on whether the result is and-ed with a not-NaN test of `x`. A runtime subnormal in the same guarded expression compares correctly. - Hypothesis, not established: the driver's shader compiler folds the guarded compare into another form and loses the subnormal immediate there. I have no view into the driver's output, so this is an inference from the table. - This argues against reading the red row as "binary32 compares flush on this hardware". It says nothing about native gfx1013 behaviour. - One adapter (device 7590), one driver, one run per row, debug layer unavailable. Section 2 reads pixel (0, 0) only. ### Environment - Commit: `0f0c3eb1f50f227ddc154ab7e081839628ff89b3`, clean tree; renderer is `offscreen_check` from the `dev` preset, `--check-pixel-batch` - Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), driver 32.0.32029.2010 - WARP: Microsoft Basic Render Driver (1414:008c), in-box, driver 10.0.26100.10068 - Windows build: 26300.10075, D3D12 debug layer unavailable - DXC 1.9.2602.17 (21d28f727) from Windows SDK 10.0.26100.0 <details> <summary>Section 1 script (uncommitted)</summary> ```powershell python -B f32_compare_probe.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware ``` ```python """Local, uncommitted probe for issue #958: binary32 compares of +/-min-subnormal against +/-0. One source-built pixel shader, compiled twice (dxc -denorm preserve and -denorm ftz, ps_6_2, -Gis), drawn through the repository renderer into its lossless R32G32B32A32_UINT target. Two operand variants: "runtime" reads both operands from the constant buffer; "literal" writes the left operand as an asfloat(<bits>u) literal, as the comparison fixture does, and reads the right one from the constant buffer. Normal, NaN and signed-zero pairs are controls. Each pair yields six predicate bits, low to high: ==, !=, <, <=, >, >=. Channels 0 to 2 pack the pairs (five per channel, six bits each); channel 3 is asuint(subnormal * 1.0), with both factors read from the constant buffer, as a control on whether the value itself survives an operation. Usage: f32_compare_probe.py <dxc> <offscreen_check> <hardware|warp> """ from pathlib import Path import struct import subprocess import sys import tempfile SUB, NSUB, ZERO, NZERO = 0x00000001, 0x80000001, 0x00000000, 0x80000000 PAIRS = ( # (label, lhs bits, rhs bits) ("+sub,+0", SUB, ZERO), ("+sub,-0", SUB, NZERO), ("-sub,+0", NSUB, ZERO), ("-sub,-0", NSUB, NZERO), ("+0,+sub", ZERO, SUB), ("-0,-sub", NZERO, NSUB), ("+sub,+sub", SUB, SUB), ("+sub,-sub", SUB, NSUB), ("maxsub,+0", 0x007fffff, ZERO), ("minnormal,+0", 0x00800000, ZERO), ("1.0,2.0", 0x3f800000, 0x40000000), ("1.0,1.0", 0x3f800000, 0x3f800000), ("+0,-0", ZERO, NZERO), ("qNaN,1.0", 0x7fc00000, 0x3f800000), ) PREDICATES = ("==", "!=", "<", "<=", ">", ">=") SENTINEL = 0x5a5a5a5a FIRST_OPERAND = 4 # flat uint index of the first operand in params[16] ONE_INDEX = 60 def to_float(bits): return struct.unpack("<f", struct.pack("<I", bits))[0] def flush(bits): return bits & 0x80000000 if bits & 0x7f800000 == 0 else bits def reference(ftz): words = [0, 0, 0, 0] for index, (_, lhs, rhs) in enumerate(PAIRS): a, b = (to_float(flush(v) if ftz else v) for v in (lhs, rhs)) results = (a == b, a != b, a < b, a <= b, a > b, a >= b) for bit, value in enumerate(results): words[index // 5] |= int(value) << ((index % 5) * 6 + bit) words[3] = flush(SUB) if ftz else SUB return words def param(index): return f"params[{index // 4}].{'xyzw'[index % 4]}" def shader(literal): lines = ["cbuffer Constants : register(b0) { uint4 params[16]; };", "Texture2D<float4> tex : register(t0);", "SamplerState samp : register(s0);", "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {", " uint w0 = 0u, w1 = 0u, w2 = 0u;"] for index, (_, lhs, _) in enumerate(PAIRS): left = f"asfloat(0x{lhs:08x}u)" if literal else f"asfloat({param(FIRST_OPERAND + 2 * index)})" lines.append(f" precise float a{index} = {left};") lines.append(f" precise float b{index} = asfloat({param(FIRST_OPERAND + 2 * index + 1)});") for bit, predicate in enumerate(PREDICATES): lines.append(f" w{index // 5} |= (a{index} {predicate} b{index} ? 1u : 0u) << {(index % 5) * 6 + bit}u;") lines.append(f" precise float product = asfloat({param(FIRST_OPERAND)}) * asfloat({param(ONE_INDEX)});") lines.append(" return uint4(w0, w1, w2, asuint(product));") lines.append("}") return "\n".join(lines) + "\n" def case_bytes(expected): constants = bytearray(256) for index, (_, lhs, rhs) in enumerate(PAIRS): struct.pack_into("<2I", constants, 4 * (FIRST_OPERAND + 2 * index), lhs, rhs) struct.pack_into("<I", constants, 4 * ONE_INDEX, 0x3f800000) return bytes(constants) + struct.pack("<4I", *expected) * 64 + bytes([1]) # flags bit 0: integer target def describe(observed, expected): differing = [] for index, (label, _, _) in enumerate(PAIRS): for bit, predicate in enumerate(PREDICATES): shift = (index % 5) * 6 + bit got, want = (observed[index // 5] >> shift) & 1, (expected[index // 5] >> shift) & 1 if got != want: differing.append(f"({label}){predicate} got={got} want={want}") if observed[3] != expected[3]: differing.append(f"product got={observed[3]:08x} want={expected[3]:08x}") return differing def main(dxc, renderer, backend): with tempfile.TemporaryDirectory() as tmp: path = Path(tmp) header_done = False for literal in (False, True): variant = "literal" if literal else "runtime" source = path / f"{variant}.hlsl" source.write_text(shader(literal), encoding="ascii") for mode in ("preserve", "ftz"): cso, listing = path / f"{variant}-{mode}.cso", path / f"{variant}-{mode}.ll" subprocess.run([dxc, "-Gis", "-denorm", mode, "-T", "ps_6_2", "-E", "main", "-Fo", cso, "-Fc", listing, source], check=True, capture_output=True) text = listing.read_text(encoding="utf-8", errors="replace") attribute = next((line.strip() for line in text.splitlines() if "fp32-denorm-mode" in line), "absent") fcmps = sum(" fcmp " in line for line in text.splitlines()) probe = path / "probe.case" probe.write_bytes(case_bytes([SENTINEL] * 4)) result = subprocess.run([renderer, backend, "--check-pixel-batch", cso, probe], capture_output=True, text=True) output = result.stdout + result.stderr if not header_done: for line in output.splitlines(): if line.startswith(("backend=", "adapter=", "driver=")): print(line) header_done = True observed = [int(line.rsplit("actual_bits=", 1)[1], 16) for line in output.splitlines() if line.startswith("channel=")] if result.returncode != 1 or len(observed) != 4 or "pixel_mismatch x=0 y=0" not in output: raise RuntimeError(output) confirm = path / "confirm.case" confirm.write_bytes(case_bytes(observed)) again = subprocess.run([renderer, backend, "--check-pixel-batch", cso, confirm], capture_output=True, text=True) uniform = again.returncode == 0 and "case=0 status=pass" in again.stdout ieee, flushed = reference(False), reference(True) match = "ieee" if observed == ieee else "flushed" if observed == flushed else "neither" print(f"\nvariant={variant} denorm={mode} dxil_attr={attribute} fcmp_count={fcmps}") print("observed=" + ",".join(f"{w:08x}" for w in observed) + f" all_64_pixels_equal={uniform}") print("ieee_ref=" + ",".join(f"{w:08x}" for w in ieee)) print("ftz_ref =" + ",".join(f"{w:08x}" for w in flushed)) print(f"matches={match}") for name, expected in (("ieee", ieee), ("ftz", flushed)): differing = describe(observed, expected) if differing and name != match: print(f"differs_from_{name}: " + "; ".join(differing)) return 0 if __name__ == "__main__": sys.exit(main(*sys.argv[1:])) ``` </details> <details> <summary>Section 2 script (uncommitted)</summary> ```powershell python -B f32_reduce.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe preserve ``` ```python """Local, uncommitted reduction for issue #958. Usage: f32_reduce.py <dxc> <offscreen_check> [mode] Draws one-compare variants of the fixture's failing row (asfloat(1u) == rhs, rhs = -0.0 read from the constant buffer) into the renderer's R32G32B32A32_UINT target and prints bit 0 of word 0 of pixel (0, 0) on hardware and WARP. mode is the dxc -denorm value (preserve or ftz). """ from pathlib import Path import struct import subprocess import sys import tempfile HEADER = ("cbuffer Constants : register(b0) { uint4 params[16]; };\n" "Texture2D<float4> tex : register(t0);\nSamplerState samp : register(s0);\n") SENTINEL = 0x5a5a5a5a GUARD = "((asuint(asfloat(1u)) & 0x7fffffffu) <= 0x7f800000u) && ((asuint(r) & 0x7fffffffu) <= 0x7f800000u) && " def body(text): return HEADER + "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {\n" + text + "}\n" R = " precise float r = asfloat(params[1].x);\n" RG = "((asuint(r) & 0x7fffffffu) <= 0x7f800000u)" def one(expr, pre=""): return body(R + pre + f" bool c = {expr};\n return uint4(c ? 1u : 0u, 0u, 0u, 0u);\n") VARIANTS = { "A sub == r": one("(asfloat(1u) == r)"), "B lhsguard && rhsguard && sub == r (fixture form)": one(f"({GUARD}(asfloat(1u) == r))"), "B1 rhsguard && sub == r": one(f"({RG} && (asfloat(1u) == r))"), "B2 lhsguard(const) && sub == r": one("(((asuint(asfloat(1u)) & 0x7fffffffu) <= 0x7f800000u) && (asfloat(1u) == r))"), "B3 rhsguard && r == sub (swapped)": one(f"({RG} && (r == asfloat(1u)))"), "B4 rhsguard && sub > r (ieee 1, flushed 0)": one(f"({RG} && (asfloat(1u) > r))"), "B5 rhsguard && sub != r (ieee 1, flushed 0)": one(f"({RG} && (asfloat(1u) != r))"), "B6 !isnan(r) && sub == r": one("(!isnan(r) && (asfloat(1u) == r))"), "B7 rhsguard && maxsub == r": one(f"({RG} && (asfloat(0x007fffffu) == r))"), "B8 rhsguard && minnormal == r (control, 0)": one(f"({RG} && (asfloat(0x00800000u) == r))"), "B9 rhsguard && runtime_sub == r": one(f"({RG} && (s == r))", " precise float s = asfloat(params[2].x);\n"), "BA rhsguard && sub == p (p = +0)": one("(((asuint(p) & 0x7fffffffu) <= 0x7f800000u) && (asfloat(1u) == p))", " precise float p = asfloat(params[0].w);\n"), "BB rhsguard & (bitwise) sub == r": one(f"({RG} & (asfloat(1u) == r))"), "BC rhsguard && 0.0f == r (control, 1)": one(f"({RG} && (0.0f == r))"), "BD rhsguard && -sub == r": one(f"({RG} && (asfloat(0x80000001u) == r))"), "BE (r == r) && sub == r": one("((r == r) && (asfloat(1u) == r))"), "BF rhsguard only (control, 1)": one(f"{RG}"), } def main(dxc, renderer, mode="preserve"): constants = bytearray(256) struct.pack_into("<4I", constants, 12, 0x00000000, 0x80000000, 0xbf800000, 0x3f800000) # fixture set 1 struct.pack_into("<I", constants, 32, 0x00000001) # params[2].x: runtime min subnormal with tempfile.TemporaryDirectory() as tmp: path = Path(tmp) case = path / "probe.case" case.write_bytes(bytes(constants) + struct.pack("<4I", *[SENTINEL] * 4) * 64 + bytes([1])) for name, source_text in VARIANTS.items(): if source_text is None: continue source, cso = path / "v.hlsl", path / "v.cso" source.write_text(source_text, encoding="ascii") subprocess.run([dxc, "-Gis", "-denorm", mode, "-T", "ps_6_2", "-E", "main", "-Fo", cso, source], check=True, capture_output=True) cells = [] for backend in ("hardware", "warp"): result = subprocess.run([renderer, backend, "--check-pixel-batch", cso, case], capture_output=True, text=True) words = [line.rsplit("actual_bits=", 1)[1] for line in (result.stdout + result.stderr).splitlines() if line.startswith("channel=")] cells.append(f"{backend}={words[0][-1]}") print(f"{name}: " + " ".join(cells), flush=True) return 0 if __name__ == "__main__": sys.exit(main(*sys.argv[1:])) ``` </details> AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.
R0Y00 commented 2026-11-24 06:49:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:45:22Z.


Thanks for the reductions from both adapters. On the RX 9060 XT the plain literal compare and the guarded constant-buffer compare honor preserve; the guarded subnormal literal alone flips to the FTZ answer. The RTX 3070 and WARP preserve results and the FTZ controls give us a second way to tell those paths apart. Please keep the strict fixture and its failing expectation. For a driver report or an independent RDNA 4 rerun, the smallest useful pair is the two preserve shaders that differ only by the guard, plus the same pair in FTZ and the guarded runtime-value control. Record DXC version and raw bits. The measurements identify the expression that triggers the discrepancy; the driver transformation and native gfx1013 behavior are still open.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7112057676 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7112057676). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T19:45:22Z. --- Thanks for the reductions from both adapters. On the RX 9060 XT the plain literal compare and the guarded constant-buffer compare honor preserve; the guarded subnormal literal alone flips to the FTZ answer. The RTX 3070 and WARP preserve results and the FTZ controls give us a second way to tell those paths apart. Please keep the strict fixture and its failing expectation. For a driver report or an independent RDNA 4 rerun, the smallest useful pair is the two preserve shaders that differ only by the guard, plus the same pair in FTZ and the guarded runtime-value control. Record DXC version and raw bits. The measurements identify the expression that triggers the discrepancy; the driver transformation and native gfx1013 behavior are still open.
lantiumBot commented 2026-11-24 06:49:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lantiumBot on 2026-11-23T19:49:27Z.


The smallest pair, as described above: five pixel shaders, one command. For an independent RDNA 4 rerun or a driver report. Data only, no fixture change.

r = 0x80000000 and s = 0x00000001, both read from the constant buffer. Word 0 of the R32G32B32A32_UINT target is the compare result; IEEE says 0 for every row, operands flushed to zero say 1.

Shader -denorm Expression RX 9060 XT words 0..3 In-box WARP words 0..3
plain preserve asfloat(1u) == r 00000000,00000000,00000000,00000000 00000000,00000000,00000000,00000000
guarded preserve G && asfloat(1u) == r 00000001,00000000,00000000,00000000 00000000,00000000,00000000,00000000
plain ftz asfloat(1u) == r 00000001,00000000,00000000,00000000 00000001,00000000,00000000,00000000
guarded ftz G && asfloat(1u) == r 00000001,00000000,00000000,00000000 00000001,00000000,00000000,00000000
guarded-runtime (control) preserve G && s == r 00000000,00000000,00000000,00000000 00000000,00000000,00000000,00000000

G is ((asuint(r) & 0x7fffffffu) <= 0x7f800000u). Three runs per backend gave the same words every time. For each shader a second draw with the observed words as the expectation passed on all 64 pixels. The DXIL attribute was "fp32-denorm-mode"="preserve" or "ftz" as requested in every build.

The two preserve shaders differ only in this line, and only the second disagrees with WARP:

bool c = (asfloat(1u) == r);
bool c = (((asuint(r) & 0x7fffffffu) <= 0x7f800000u) && (asfloat(1u) == r));

Environment

  • Commit: 0f0c3eb1f50f227ddc154ab7e081839628ff89b3, clean tree; renderer is offscreen_check from the dev preset, --check-pixel-batch
  • DXC: dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727), Windows SDK 10.0.26100.0, flags -Gis -denorm <mode> -T ps_6_2 -E main
  • Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), driver 32.0.32029.2010
  • WARP: Microsoft Basic Render Driver (1414:008c), in-box, driver 10.0.26100.10068
  • Windows build: 26300.10075, D3D12 debug layer unavailable

Same limits as before: one adapter, one driver. The driver transformation and native gfx1013 behaviour are not addressed by this.

f32_guard_pair.py (uncommitted)
python -B f32_guard_pair.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware
python -B f32_guard_pair.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp
"""Smallest pair for issue #958: fcmp against a subnormal literal, with and without a not-NaN guard.

Five pixel shaders (ps_6_2, -Gis), drawn into the repository renderer's R32G32B32A32_UINT target:
  plain/preserve, guarded/preserve, plain/ftz, guarded/ftz, guarded-runtime/preserve (control).
r is 0x80000000 (-0.0) and s is 0x00000001, both read from the constant buffer. Word 0 is the
compare result. Each shader is drawn twice: once against a sentinel to read the raw words of
pixel (0, 0), once with those words as the expectation to check all 64 pixels.

Usage: f32_guard_pair.py <dxc> <offscreen_check> <hardware|warp>
"""
from pathlib import Path
import struct
import subprocess
import sys
import tempfile

HEADER = ("cbuffer Constants : register(b0) { uint4 params[16]; };\n"
          "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {\n"
          "    precise float r = asfloat(params[1].x);\n"
          "    precise float s = asfloat(params[2].x);\n")
FOOTER = "    return uint4(c ? 1u : 0u, 0u, 0u, 0u);\n}\n"
GUARD = "((asuint(r) & 0x7fffffffu) <= 0x7f800000u)"
SHADERS = (  # (name, denorm mode, expression, IEEE result, flushed result)
    ("plain", "preserve", "(asfloat(1u) == r)", 0, 1),
    ("guarded", "preserve", f"({GUARD} && (asfloat(1u) == r))", 0, 1),
    ("plain", "ftz", "(asfloat(1u) == r)", 0, 1),
    ("guarded", "ftz", f"({GUARD} && (asfloat(1u) == r))", 0, 1),
    ("guarded-runtime", "preserve", f"({GUARD} && (s == r))", 0, 1),
)
SENTINEL = 0x5a5a5a5a


def case(expected):
    constants = bytearray(256)
    struct.pack_into("<I", constants, 16, 0x80000000)  # params[1].x = -0.0
    struct.pack_into("<I", constants, 32, 0x00000001)  # params[2].x = min subnormal
    return bytes(constants) + struct.pack("<4I", *expected) * 64 + bytes([1])  # flags bit 0: integer target


def main(dxc, renderer, backend):
    version = subprocess.run([dxc, "--version"], capture_output=True, text=True)
    print("dxc=" + (version.stdout + version.stderr).strip().splitlines()[0])
    with tempfile.TemporaryDirectory() as tmp:
        path = Path(tmp)
        printed = False
        for name, mode, expression, ieee, flushed in SHADERS:
            source, cso, listing, probe = (path / f"s.{ext}" for ext in ("hlsl", "cso", "ll", "case"))
            source.write_text(HEADER + f"    bool c = {expression};\n" + FOOTER, encoding="ascii")
            subprocess.run([dxc, "-Gis", "-denorm", mode, "-T", "ps_6_2", "-E", "main", "-Fo", cso, "-Fc", listing,
                            source], check=True, capture_output=True)
            text = listing.read_text(encoding="utf-8", errors="replace")
            attribute = next((line.split("{", 1)[1].split("}")[0].strip() for line in text.splitlines()
                              if "fp32-denorm-mode" in line), "absent")
            probe.write_bytes(case([SENTINEL] * 4))
            first = subprocess.run([renderer, backend, "--check-pixel-batch", cso, probe], capture_output=True, text=True)
            output = first.stdout + first.stderr
            if not printed:
                print("\n".join(line for line in output.splitlines() if line.startswith(("backend=", "adapter=", "driver="))))
                printed = True
            words = [int(line.rsplit("actual_bits=", 1)[1], 16) for line in output.splitlines() if line.startswith("channel=")]
            if first.returncode != 1 or len(words) != 4:
                raise RuntimeError(output)
            probe.write_bytes(case(words))
            second = subprocess.run([renderer, backend, "--check-pixel-batch", cso, probe], capture_output=True, text=True)
            uniform = second.returncode == 0 and "case=0 status=pass" in second.stdout
            print(f"shader={name} denorm={mode} dxil={attribute} words=" + ",".join(f"{w:08x}" for w in words)
                  + f" all_64_pixels_equal={str(uniform).lower()} ieee={ieee} flushed={flushed}")
    return 0


if __name__ == "__main__":
    sys.exit(main(*sys.argv[1:]))

AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7112154514 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7112154514). Originally posted by [lantiumBot](https://github.com/lantiumBot) on 2026-11-23T19:49:27Z. --- The smallest pair, as described above: five pixel shaders, one command. For an independent RDNA 4 rerun or a driver report. Data only, no fixture change. `r` = `0x80000000` and `s` = `0x00000001`, both read from the constant buffer. Word 0 of the R32G32B32A32_UINT target is the compare result; IEEE says 0 for every row, operands flushed to zero say 1. | Shader | `-denorm` | Expression | RX 9060 XT words 0..3 | In-box WARP words 0..3 | |---|---|---|---|---| | plain | preserve | `asfloat(1u) == r` | `00000000,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | guarded | preserve | `G && asfloat(1u) == r` | **`00000001`**`,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | plain | ftz | `asfloat(1u) == r` | `00000001,00000000,00000000,00000000` | `00000001,00000000,00000000,00000000` | | guarded | ftz | `G && asfloat(1u) == r` | `00000001,00000000,00000000,00000000` | `00000001,00000000,00000000,00000000` | | guarded-runtime (control) | preserve | `G && s == r` | `00000000,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | `G` is `((asuint(r) & 0x7fffffffu) <= 0x7f800000u)`. Three runs per backend gave the same words every time. For each shader a second draw with the observed words as the expectation passed on all 64 pixels. The DXIL attribute was `"fp32-denorm-mode"="preserve"` or `"ftz"` as requested in every build. The two preserve shaders differ only in this line, and only the second disagrees with WARP: ```hlsl bool c = (asfloat(1u) == r); bool c = (((asuint(r) & 0x7fffffffu) <= 0x7f800000u) && (asfloat(1u) == r)); ``` ### Environment - Commit: `0f0c3eb1f50f227ddc154ab7e081839628ff89b3`, clean tree; renderer is `offscreen_check` from the `dev` preset, `--check-pixel-batch` - DXC: `dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727)`, Windows SDK 10.0.26100.0, flags `-Gis -denorm <mode> -T ps_6_2 -E main` - Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), driver 32.0.32029.2010 - WARP: Microsoft Basic Render Driver (1414:008c), in-box, driver 10.0.26100.10068 - Windows build: 26300.10075, D3D12 debug layer unavailable Same limits as before: one adapter, one driver. The driver transformation and native gfx1013 behaviour are not addressed by this. <details> <summary>f32_guard_pair.py (uncommitted)</summary> ```powershell python -B f32_guard_pair.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware python -B f32_guard_pair.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp ``` ```python """Smallest pair for issue #958: fcmp against a subnormal literal, with and without a not-NaN guard. Five pixel shaders (ps_6_2, -Gis), drawn into the repository renderer's R32G32B32A32_UINT target: plain/preserve, guarded/preserve, plain/ftz, guarded/ftz, guarded-runtime/preserve (control). r is 0x80000000 (-0.0) and s is 0x00000001, both read from the constant buffer. Word 0 is the compare result. Each shader is drawn twice: once against a sentinel to read the raw words of pixel (0, 0), once with those words as the expectation to check all 64 pixels. Usage: f32_guard_pair.py <dxc> <offscreen_check> <hardware|warp> """ from pathlib import Path import struct import subprocess import sys import tempfile HEADER = ("cbuffer Constants : register(b0) { uint4 params[16]; };\n" "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {\n" " precise float r = asfloat(params[1].x);\n" " precise float s = asfloat(params[2].x);\n") FOOTER = " return uint4(c ? 1u : 0u, 0u, 0u, 0u);\n}\n" GUARD = "((asuint(r) & 0x7fffffffu) <= 0x7f800000u)" SHADERS = ( # (name, denorm mode, expression, IEEE result, flushed result) ("plain", "preserve", "(asfloat(1u) == r)", 0, 1), ("guarded", "preserve", f"({GUARD} && (asfloat(1u) == r))", 0, 1), ("plain", "ftz", "(asfloat(1u) == r)", 0, 1), ("guarded", "ftz", f"({GUARD} && (asfloat(1u) == r))", 0, 1), ("guarded-runtime", "preserve", f"({GUARD} && (s == r))", 0, 1), ) SENTINEL = 0x5a5a5a5a def case(expected): constants = bytearray(256) struct.pack_into("<I", constants, 16, 0x80000000) # params[1].x = -0.0 struct.pack_into("<I", constants, 32, 0x00000001) # params[2].x = min subnormal return bytes(constants) + struct.pack("<4I", *expected) * 64 + bytes([1]) # flags bit 0: integer target def main(dxc, renderer, backend): version = subprocess.run([dxc, "--version"], capture_output=True, text=True) print("dxc=" + (version.stdout + version.stderr).strip().splitlines()[0]) with tempfile.TemporaryDirectory() as tmp: path = Path(tmp) printed = False for name, mode, expression, ieee, flushed in SHADERS: source, cso, listing, probe = (path / f"s.{ext}" for ext in ("hlsl", "cso", "ll", "case")) source.write_text(HEADER + f" bool c = {expression};\n" + FOOTER, encoding="ascii") subprocess.run([dxc, "-Gis", "-denorm", mode, "-T", "ps_6_2", "-E", "main", "-Fo", cso, "-Fc", listing, source], check=True, capture_output=True) text = listing.read_text(encoding="utf-8", errors="replace") attribute = next((line.split("{", 1)[1].split("}")[0].strip() for line in text.splitlines() if "fp32-denorm-mode" in line), "absent") probe.write_bytes(case([SENTINEL] * 4)) first = subprocess.run([renderer, backend, "--check-pixel-batch", cso, probe], capture_output=True, text=True) output = first.stdout + first.stderr if not printed: print("\n".join(line for line in output.splitlines() if line.startswith(("backend=", "adapter=", "driver=")))) printed = True words = [int(line.rsplit("actual_bits=", 1)[1], 16) for line in output.splitlines() if line.startswith("channel=")] if first.returncode != 1 or len(words) != 4: raise RuntimeError(output) probe.write_bytes(case(words)) second = subprocess.run([renderer, backend, "--check-pixel-batch", cso, probe], capture_output=True, text=True) uniform = second.returncode == 0 and "case=0 status=pass" in second.stdout print(f"shader={name} denorm={mode} dxil={attribute} words=" + ",".join(f"{w:08x}" for w in words) + f" all_64_pixels_equal={str(uniform).lower()} ieee={ieee} flushed={flushed}") return 0 if __name__ == "__main__": sys.exit(main(*sys.argv[1:])) ``` </details> AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.
thepatrickworld commented 2026-11-24 06:49:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T19:56:23Z.


Reproduced your section 2 on a second RDNA4 adapter, and your characterization holds exactly. Adding one thing you did not test — hoisting the literal — which closes the workaround question, and what I changed here as a result.

Your table on RX 9070 XT (preserve)

Same shader shape, same fixture constants (r = asfloat(params[1].x) = 0x80000000), bit 0 of word 0:

expression WARP RX 9070 XT
asfloat(1u) == r 0 0
fixture form (both guards) 0 1
RG && asfloat(1u) == r 0 1
RG && r == asfloat(1u) 0 1
RG && asfloat(1u) > r 1 0
RG && asfloat(1u) != r 1 0
!isnan(r) && asfloat(1u) == r 0 1
RG && asfloat(0x007fffffu) == r 0 1
RG && s == r, s from the constant buffer 0 0
RG && asfloat(0x00800000u) == r (control) 0 0
RG && 0.0f == r (control) 1 1

Under -denorm ftz both adapters agree on every row of your list, here too. So: plain compare preserves, the guard plus a compile-time subnormal does not, a runtime subnormal does, and 2^-126 is unaffected.

Hoisting does not rescue it

I tried to materialize the literal in a way the compiler would not fold, nine variants, all under preserve:

variant hardware WARP
precise float s = asfloat(1u); then RG && s == r 1 0
float s = asfloat(1u); 1 0
uint u = 1u; precise float s = asfloat(u); 1 0
asfloat(1u << 0) 1 0
asfloat(uint(0x00000001)) 1 0
local plus a copy of r, guard on the copy 1 0
guard written as isfinite(r) 1 0
?: instead of && 1 0
guard alone (control) 1 1

So the boundary is compile-time constant versus data, not literal versus register: no HLSL spelling of the value survives, only a load from memory does. That is consistent with your folding hypothesis and narrows it usefully — the translation unit cannot work around it, only the fixture can.

Which also means my earlier note was wrong on both counts, and I withdraw it: it is not the binary16 pack (integer, cannot flush) and it is not "binary32 compares flush" (a plain compare preserves, as you show and as I now reproduce). Your reading of the red row is the correct one.

What I changed in the fixture

Bit 18 compared the integer immediate 1 against a runtime operand, so it took the folded path by construction. The row still has value — a subnormal reaching an f32 comparison — so instead of retiring it, it now gets the subnormal from data:

v_lshrrev_b32_e32 v19, 31, v16      ; 0x00000001 when the set's rhs has its sign bit set
...
(18, "v_cmp_gt_f32_e32 vcc_lo, v19, 0.0")

The reference follows the same rule, cmp_pred("gt", word_to_float((words[1] >> 31) & 1), 0.0). Two sets put a subnormal into the compare (rhs = -0.0 and rhs = -inf), and the bit is now observable: it is set exactly on those sets, where before it was clear on every set and could not fail for the reason it existed — with rhs = -0.0, 1.4e-45 == -0.0 and 1.0 == -0.0 are both false, so the bit never tested the immediate typing it was there for.

Measured at d7c4d6e, RX 9070 XT:

  • pixel_aot_comparisons_hardware Passed 9.94 s (it is Failed 2.43 s on 0f0c3eb without the change)
  • pixel_aot_comparisons_warp Passed 5.84 s
  • mutation gt → ge on that instruction: Failed 2.24 s, bit 18 flipping on every set (0038cccc → 003ccccc, 001af0f0 → 001ef0f0), so the row has teeth

The immediate-as-bits property no longer has a runtime case here, and under preserve on this hardware it cannot have one — it stays pinned on the generated source (asfloat(1u) in the emitted text), where no fold can hide it.

The part that is yours to decide

If a future lowering ever wants to compare against a subnormal immediate under the not-NaN guard, it will hit the same fold, and the translator cannot route a literal through memory. Real shaders rarely do this, but the limitation is worth one line in the docs rather than another red entry. I have no view into the driver's output either, so I am only recording the behaviour, not explaining it.

AI-assisted; runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7112325429 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7112325429). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-23T19:56:23Z. --- Reproduced your section 2 on a second RDNA4 adapter, and your characterization holds exactly. Adding one thing you did not test — hoisting the literal — which closes the workaround question, and what I changed here as a result. ### Your table on RX 9070 XT (preserve) Same shader shape, same fixture constants (`r = asfloat(params[1].x) = 0x80000000`), bit 0 of word 0: | expression | WARP | RX 9070 XT | |---|---|---| | `asfloat(1u) == r` | 0 | **0** | | fixture form (both guards) | 0 | **1** | | `RG && asfloat(1u) == r` | 0 | **1** | | `RG && r == asfloat(1u)` | 0 | **1** | | `RG && asfloat(1u) > r` | 1 | **0** | | `RG && asfloat(1u) != r` | 1 | **0** | | `!isnan(r) && asfloat(1u) == r` | 0 | **1** | | `RG && asfloat(0x007fffffu) == r` | 0 | **1** | | `RG && s == r`, `s` from the constant buffer | 0 | **0** | | `RG && asfloat(0x00800000u) == r` (control) | 0 | 0 | | `RG && 0.0f == r` (control) | 1 | 1 | Under `-denorm ftz` both adapters agree on every row of your list, here too. So: plain compare preserves, the guard plus a compile-time subnormal does not, a runtime subnormal does, and 2^-126 is unaffected. ### Hoisting does not rescue it I tried to materialize the literal in a way the compiler would not fold, nine variants, all under `preserve`: | variant | hardware | WARP | |---|---|---| | `precise float s = asfloat(1u);` then `RG && s == r` | 1 | 0 | | `float s = asfloat(1u);` | 1 | 0 | | `uint u = 1u; precise float s = asfloat(u);` | 1 | 0 | | `asfloat(1u << 0)` | 1 | 0 | | `asfloat(uint(0x00000001))` | 1 | 0 | | local plus a copy of `r`, guard on the copy | 1 | 0 | | guard written as `isfinite(r)` | 1 | 0 | | `?:` instead of `&&` | 1 | 0 | | guard alone (control) | 1 | 1 | So the boundary is **compile-time constant versus data**, not literal versus register: no HLSL spelling of the value survives, only a load from memory does. That is consistent with your folding hypothesis and narrows it usefully — the translation unit cannot work around it, only the fixture can. Which also means my earlier note was wrong on both counts, and I withdraw it: it is not the binary16 pack (integer, cannot flush) and it is not "binary32 compares flush" (a plain compare preserves, as you show and as I now reproduce). Your reading of the red row is the correct one. ### What I changed in the fixture Bit 18 compared the integer immediate `1` against a runtime operand, so it took the folded path by construction. The row still has value — a subnormal reaching an f32 comparison — so instead of retiring it, it now gets the subnormal from data: ``` v_lshrrev_b32_e32 v19, 31, v16 ; 0x00000001 when the set's rhs has its sign bit set ... (18, "v_cmp_gt_f32_e32 vcc_lo, v19, 0.0") ``` The reference follows the same rule, `cmp_pred("gt", word_to_float((words[1] >> 31) & 1), 0.0)`. Two sets put a subnormal into the compare (rhs = -0.0 and rhs = -inf), and the bit is now observable: it is set exactly on those sets, where before it was clear on every set and could not fail for the reason it existed — with `rhs = -0.0`, `1.4e-45 == -0.0` and `1.0 == -0.0` are both false, so the bit never tested the immediate typing it was there for. **Measured at `d7c4d6e`, RX 9070 XT:** - `pixel_aot_comparisons_hardware` **Passed 9.94 s** (it is `Failed 2.43 s` on `0f0c3eb` without the change) - `pixel_aot_comparisons_warp` **Passed 5.84 s** - mutation `gt` → `ge` on that instruction: **Failed 2.24 s**, bit 18 flipping on every set (`0038cccc` → `003ccccc`, `001af0f0` → `001ef0f0`), so the row has teeth The immediate-as-bits property no longer has a runtime case here, and under `preserve` on this hardware it cannot have one — it stays pinned on the generated source (`asfloat(1u)` in the emitted text), where no fold can hide it. ### The part that is yours to decide If a future lowering ever wants to compare against a subnormal *immediate* under the not-NaN guard, it will hit the same fold, and the translator cannot route a literal through memory. Real shaders rarely do this, but the limitation is worth one line in the docs rather than another red entry. I have no view into the driver's output either, so I am only recording the behaviour, not explaining it. _AI-assisted; runs executed locally on the adapter above._
R0Y00 commented 2026-11-24 06:49:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T20:01:40Z.


The second RDNA 4 result and the nine hoisting attempts pin down a useful boundary. Please keep the original guarded-immediate preserve case with its strict expectation as a separately selectable diagnostic. A runtime-source comparison is welcome as additional coverage, with the gt to ge mutation. Include the generated-source immediate typing assertion and the plain-immediate / guarded-runtime / FTZ controls so the reduced case stays reproducible. Keep known-mismatch reporting visible. A change that removes the original case would lose the verified driver signal.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7112449255 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7112449255). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T20:01:40Z. --- The second RDNA 4 result and the nine hoisting attempts pin down a useful boundary. Please keep the original guarded-immediate preserve case with its strict expectation as a separately selectable diagnostic. A runtime-source comparison is welcome as additional coverage, with the `gt` to `ge` mutation. Include the generated-source immediate typing assertion and the plain-immediate / guarded-runtime / FTZ controls so the reduced case stays reproducible. Keep known-mismatch reporting visible. A change that removes the original case would lose the verified driver signal.
MasterDomino commented 2026-11-24 06:49:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T20:48:16Z.


Another RX 9070 XT, on two AMD drivers that are not in this thread yet, with the D3D12 debug layer enabled. Same case, same bit. Data only, no fixture change.

  • Adapter: AMD Radeon RX 9070 XT (1002:7550)
  • Drivers: 32.0.31035.1003 (two runs at d7c52d2) and 32.0.31044.16 (four runs at dae1ca2; Windows Update replaced the driver between the two)
  • Windows 11 Home 25H2, build 26200.8875
  • dev preset, MSVC 19.44.35221 (toolset 14.44.35207), Windows SDK 10.0.26100.0, DXC 1.8.2502.11 (239921522)
  • D3D12 debug layer: enabled, debug_errors=0 debug_warnings=0 on every draw
ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_hardware$' -V

Failed identically in all 6 runs (2 on 32.0.31035.1003, 4 on 32.0.31044.16):

got ['pass', 'mismatch', 'mismatch', 'mismatch', 'pass', 'mismatch', 'pass', 'mismatch', 'pass', 'pass', 'pass']
case=2 f32-cmp-1.case
channel=0 expected=8.08151e-40 actual=1.17549e-39 expected_bits=0008cccc actual_bits=000ccccc

Channels 1 to 3 of that case match, the expected-mismatch controls still mismatch, and the other positive cases pass. pixel_aot_comparisons_warp passed in the same build.

Independent RDNA 4 rerun of the smallest pair

The f32_guard_pair.py script from the comment above, taken verbatim (SHA-256 c3f247f8bc7594514016e67e2f4365d34fa42bb484bbf528a663fbb42d14b68c), with the renderer built at dae1ca2 and the DXC above (-Gis -denorm <mode> -T ps_6_2). Three runs per backend, identical every time, and in every row a second draw with the observed words as the expectation matched all 64 pixels:

Shader -denorm DXIL attribute RX 9070 XT, driver 32.0.31044.16 In-box WARP 10.0.26100.8875
plain asfloat(1u) == r preserve "preserve" 00000000,00000000,00000000,00000000 00000000,00000000,00000000,00000000
guarded G && asfloat(1u) == r preserve "preserve" 00000001,00000000,00000000,00000000 00000000,00000000,00000000,00000000
plain ftz "ftz" 00000001,00000000,00000000,00000000 00000001,00000000,00000000,00000000
guarded ftz "ftz" 00000001,00000000,00000000,00000000 00000001,00000000,00000000,00000000
guarded-runtime G && s == r (control) preserve "preserve" 00000000,00000000,00000000,00000000 00000000,00000000,00000000,00000000

Both backends ran with the debug layer enabled. This is the same pattern as the RX 9060 XT table: only the guarded compare against a subnormal literal under preserve gives the flushed answer, on a second RDNA 4 device ID and a third driver. It does not say where the transformation happens or what native gfx1013 does.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7113578912 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7113578912). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T20:48:16Z. --- Another RX 9070 XT, on two AMD drivers that are not in this thread yet, with the D3D12 debug layer enabled. Same case, same bit. Data only, no fixture change. - Adapter: AMD Radeon RX 9070 XT (`1002:7550`) - Drivers: `32.0.31035.1003` (two runs at `d7c52d2`) and `32.0.31044.16` (four runs at `dae1ca2`; Windows Update replaced the driver between the two) - Windows 11 Home 25H2, build 26200.8875 - `dev` preset, MSVC 19.44.35221 (toolset 14.44.35207), Windows SDK 10.0.26100.0, DXC `1.8.2502.11 (239921522)` - D3D12 debug layer: enabled, `debug_errors=0 debug_warnings=0` on every draw ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_hardware$' -V ``` Failed identically in all 6 runs (2 on `32.0.31035.1003`, 4 on `32.0.31044.16`): ```text got ['pass', 'mismatch', 'mismatch', 'mismatch', 'pass', 'mismatch', 'pass', 'mismatch', 'pass', 'pass', 'pass'] case=2 f32-cmp-1.case channel=0 expected=8.08151e-40 actual=1.17549e-39 expected_bits=0008cccc actual_bits=000ccccc ``` Channels 1 to 3 of that case match, the expected-mismatch controls still mismatch, and the other positive cases pass. `pixel_aot_comparisons_warp` passed in the same build. ### Independent RDNA 4 rerun of the smallest pair The `f32_guard_pair.py` script from the [comment above](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7112154514), taken verbatim (SHA-256 `c3f247f8bc7594514016e67e2f4365d34fa42bb484bbf528a663fbb42d14b68c`), with the renderer built at `dae1ca2` and the DXC above (`-Gis -denorm <mode> -T ps_6_2`). Three runs per backend, identical every time, and in every row a second draw with the observed words as the expectation matched all 64 pixels: | Shader | `-denorm` | DXIL attribute | RX 9070 XT, driver `32.0.31044.16` | In-box WARP `10.0.26100.8875` | |---|---|---|---|---| | plain `asfloat(1u) == r` | preserve | `"preserve"` | `00000000,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | guarded `G && asfloat(1u) == r` | preserve | `"preserve"` | **`00000001`**`,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | plain | ftz | `"ftz"` | `00000001,00000000,00000000,00000000` | `00000001,00000000,00000000,00000000` | | guarded | ftz | `"ftz"` | `00000001,00000000,00000000,00000000` | `00000001,00000000,00000000,00000000` | | guarded-runtime `G && s == r` (control) | preserve | `"preserve"` | `00000000,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | Both backends ran with the debug layer enabled. This is the same pattern as the RX 9060 XT table: only the guarded compare against a subnormal literal under `preserve` gives the flushed answer, on a second RDNA 4 device ID and a third driver. It does not say where the transformation happens or what native gfx1013 does. AI-assisted.
MasterDomino commented 2026-11-24 06:49:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T21:11:21Z.


RDNA 4 ISA for the guard pair. The driver inserts a denormal-mode switch around the guarded compare, and that accounts for the flipped bit. Measurement only, no fixture change.

Setup

  • The three expressions of the guard pair, verbatim (same precise cbuffer operands, r = params[1].x), each built with dxc -Gis -denorm <preserve|ftz> -T ps_6_2 -E main, DXC 1.8.2502.11.
  • Radeon GPU Analyzer 2.15.0.30 (official rga-windows-x64-2.15.zip, SHA-256 matched the release digest), DX12 mode, which compiles through the installed driver: AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31044.16, Windows 11 26H2 build 26300.9974.
  • RGA needs a full graphics pipeline, so each PS is paired with a pass-through vs_6_2, one R32G32B32A32_UINT render target and the root signature RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT), CBV(b0).
rga.exe -s dx12 -c gfx1201 --vs-blob vs.cso --ps-blob guarded-preserve.cso --gpso uint_rt.gpso --rs-hlsl rs.hlsl --rs-macro RS --isa guarded-preserve.isa

ISA, -denorm preserve, scheduling waits removed. 1 as an f32 operand is the inline integer constant, i.e. 0x00000001:

plain            asfloat(1u) == r
	s_buffer_load_b32 s0, s[0:3], 0x10
	s_cmp_eq_f32 s0, 1
	s_cselect_b32 s0, 1, 0

guarded          G && asfloat(1u) == r
	s_buffer_load_b32 s0, s[0:3], 0x10
	s_and_b32 s1, 0x7fffffff, s0
	s_denorm_mode 14
	s_cmp_eq_f32 s0, 1
	s_cselect_b64 s[2:3], exec, 0
	s_cmp_lt_u32 s1, 0x7f800001
	s_cselect_b64 s[0:1], exec, 0
	s_and_b64 s[0:1], s[0:1], s[2:3]
	s_and_b64 s[0:1], s[0:1], exec
	s_cselect_b32 s0, 1, 0
	v_mov_b32_e32 v1, s0
	s_denorm_mode 15

guarded-runtime  G && s == r
	s_and_b32 s5, 0x7fffffff, s4
	s_cmp_ge_u32 s5, 0x7f800001
	s_cbranch_scc0 L3
	...
L3:	s_buffer_load_b32 s0, s[0:3], 0x20
	s_cmp_eq_f32 s4, s0

In s_denorm_mode, bits 1:0 are the fp32 mode and bits 3:2 the fp16/fp64 mode (3 = keep input and output denormals, 2 = flush input denormals, keep output). 15 is the preserve mode the DXIL asks for ("fp32-denorm-mode"="preserve"). Only the guarded shader switches to 14 for the compare, so fp32 input denormals are flushed there: 0x00000001 is read as +0, +0 == -0 is true, and the shader writes 1. That is the 00000001 the guard pair returns on this adapter under preserve (my rerun above) and bit 18 of f32-cmp-1. The plain compare and the guarded compare against a constant-buffer subnormal run with no mode change and keep the subnormal, which matches their measured 0.

The DXIL of the guarded shader is the plain pair icmp ult i32 %4, 2139095041 / fcmp oeq float %6, 0x36A0000000000000 / and i1, so the mode switch comes from the driver's compiler, not from DXC.

Under -denorm ftz the plain and guarded shaders contain no s_denorm_mode, and the plain shader's instruction stream is identical to the preserve build, so the flush there comes from pipeline state. That matches the point in #312 that the mode is not visible in the instruction bytes alone.

Limits: RGA builds its own pipeline around the blob (my VS, render target format and root signature), so this is the driver's code for these shaders rather than a capture of the pipeline offscreen_check creates. One driver and one device. It shows what the RDNA 4 driver emits; it says nothing about native gfx1013 or the console. Why the compiler selects mode 14 for this compare is not established.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114124670 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7114124670). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T21:11:21Z. --- RDNA 4 ISA for the guard pair. The driver inserts a denormal-mode switch around the guarded compare, and that accounts for the flipped bit. Measurement only, no fixture change. **Setup** - The three expressions of the [guard pair](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7112154514), verbatim (same `precise` cbuffer operands, `r = params[1].x`), each built with `dxc -Gis -denorm <preserve|ftz> -T ps_6_2 -E main`, DXC `1.8.2502.11`. - Radeon GPU Analyzer 2.15.0.30 (official `rga-windows-x64-2.15.zip`, SHA-256 matched the release digest), DX12 mode, which compiles through the installed driver: AMD Radeon RX 9070 XT (`1002:7550`), driver `32.0.31044.16`, Windows 11 26H2 build 26300.9974. - RGA needs a full graphics pipeline, so each PS is paired with a pass-through `vs_6_2`, one `R32G32B32A32_UINT` render target and the root signature `RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT), CBV(b0)`. ```powershell rga.exe -s dx12 -c gfx1201 --vs-blob vs.cso --ps-blob guarded-preserve.cso --gpso uint_rt.gpso --rs-hlsl rs.hlsl --rs-macro RS --isa guarded-preserve.isa ``` **ISA, `-denorm preserve`**, scheduling waits removed. `1` as an f32 operand is the inline integer constant, i.e. `0x00000001`: ```text plain asfloat(1u) == r s_buffer_load_b32 s0, s[0:3], 0x10 s_cmp_eq_f32 s0, 1 s_cselect_b32 s0, 1, 0 guarded G && asfloat(1u) == r s_buffer_load_b32 s0, s[0:3], 0x10 s_and_b32 s1, 0x7fffffff, s0 s_denorm_mode 14 s_cmp_eq_f32 s0, 1 s_cselect_b64 s[2:3], exec, 0 s_cmp_lt_u32 s1, 0x7f800001 s_cselect_b64 s[0:1], exec, 0 s_and_b64 s[0:1], s[0:1], s[2:3] s_and_b64 s[0:1], s[0:1], exec s_cselect_b32 s0, 1, 0 v_mov_b32_e32 v1, s0 s_denorm_mode 15 guarded-runtime G && s == r s_and_b32 s5, 0x7fffffff, s4 s_cmp_ge_u32 s5, 0x7f800001 s_cbranch_scc0 L3 ... L3: s_buffer_load_b32 s0, s[0:3], 0x20 s_cmp_eq_f32 s4, s0 ``` In `s_denorm_mode`, bits 1:0 are the fp32 mode and bits 3:2 the fp16/fp64 mode (3 = keep input and output denormals, 2 = flush input denormals, keep output). `15` is the preserve mode the DXIL asks for (`"fp32-denorm-mode"="preserve"`). Only the **guarded** shader switches to `14` for the compare, so fp32 input denormals are flushed there: `0x00000001` is read as `+0`, `+0 == -0` is true, and the shader writes 1. That is the `00000001` the guard pair returns on this adapter under `preserve` (my rerun above) and bit 18 of `f32-cmp-1`. The plain compare and the guarded compare against a constant-buffer subnormal run with no mode change and keep the subnormal, which matches their measured `0`. The DXIL of the guarded shader is the plain pair `icmp ult i32 %4, 2139095041` / `fcmp oeq float %6, 0x36A0000000000000` / `and i1`, so the mode switch comes from the driver's compiler, not from DXC. Under `-denorm ftz` the plain and guarded shaders contain no `s_denorm_mode`, and the plain shader's instruction stream is identical to the preserve build, so the flush there comes from pipeline state. That matches the point in #312 that the mode is not visible in the instruction bytes alone. Limits: RGA builds its own pipeline around the blob (my VS, render target format and root signature), so this is the driver's code for these shaders rather than a capture of the pipeline `offscreen_check` creates. One driver and one device. It shows what the RDNA 4 driver emits; it says nothing about native gfx1013 or the console. Why the compiler selects mode 14 for this compare is not established. AI-assisted.
R0Y00 commented 2026-11-24 06:49:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:18:34Z.


The same-blob comparison is useful here. On the reported RX 9070 XT, the guarded-immediate preserve variant alone changes the scalar denormal mode around its compare, while the guarded runtime-source variant preserves the result. Please retain those as separate cases in a focused experimental note. Include the raw pixel words, RGA/DXC versions and the fact that RGA compiles its own pipeline. Keep the strict guarded-immediate case and both the plain-immediate and FTZ controls in the test suite.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114286182 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7114286182). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T21:18:34Z. --- The same-blob comparison is useful here. On the reported RX 9070 XT, the guarded-immediate preserve variant alone changes the scalar denormal mode around its compare, while the guarded runtime-source variant preserves the result. Please retain those as separate cases in a focused experimental note. Include the raw pixel words, RGA/DXC versions and the fact that RGA compiles its own pipeline. Keep the strict guarded-immediate case and both the plain-immediate and FTZ controls in the test suite.
lantiumBot commented 2026-11-24 06:49:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lantiumBot on 2026-11-23T21:21:51Z.


RDNA 4 ISA on the second device (RX 9060 XT, gfx1200), plus one thing the ISA predicted and a draw then confirmed: the flush follows the shape of the DXIL, not the constant. Data only, no fixture change.

1. Same mode switch on gfx1200

The shaders of the guard pair, same text and flags (dxc -Gis -denorm <mode> -T ps_6_2 -E main), compiled by Radeon GPU Analyzer in DX12 mode. The pipeline is the one draw_verified() creates: tests/pixel_aot_vs.hlsl as vs_6_0, its embedded root signature, no input layout, one R32G32B32A32_UINT target.

rga.exe -s dx12 -c gfx1200 --vs-blob vs.cso --ps-blob guarded-preserve.cso --rs-bin rs.bin --gpso state0.gpso --isa guarded-preserve.isa

-denorm preserve, s_wait_*, s_delay_alu and the buffer descriptor setup removed:

plain            asfloat(1u) == r
	s_buffer_load_b32 s0, s[0:3], 0x10
	s_cmp_eq_f32 s0, 1
	s_cselect_b32 s0, 1, 0

guarded          G && asfloat(1u) == r
	s_buffer_load_b32 s0, s[0:3], 0x10
	s_and_b32 s1, 0x7fffffff, s0
	s_denorm_mode 14
	s_cmp_eq_f32 s0, 1
	s_cselect_b64 s[2:3], exec, 0
	s_cmp_lt_u32 s1, 0x7f800001
	s_cselect_b64 s[0:1], exec, 0
	s_and_b64 s[0:1], s[0:1], s[2:3]
	s_and_b64 s[0:1], s[0:1], exec
	s_cselect_b32 s0, 1, 0
	v_mov_b32_e32 v1, s0
	s_denorm_mode 15

guarded-runtime  G && s == r
	s_buffer_load_b32 s4, s[0:3], 0x10
	s_and_b32 s5, 0x7fffffff, s4
	s_cmp_lt_u32 s5, 0x7f800001
	s_cbranch_scc0 L3
	s_buffer_load_b32 s0, s[0:3], 0x20
	s_cmp_eq_f32 s4, s0
	s_cselect_b32 s0, -1, 0
	s_branch L4
L3:	s_movk_i32 s0, 0x0
L4:	s_and_b32 s0, s0, 1

This matches the gfx1201 listing above: s_denorm_mode 14 / 15 around the compare in the guarded shader only. Under -denorm ftz no shader contains s_denorm_mode; the plain and guarded-runtime ISA files are byte-identical between preserve and ftz, and the guarded one differs only by the two mode instructions, one operand order and the scheduling hints.

2. What the switch follows

The three shaders above differ in their DXIL in one way. DXC flattens the && when the right-hand side is a constant compare and keeps a branch when it has to load s:

guarded          %5 = icmp ult i32 %4, 2139095041 / %7 = fcmp oeq float %6, 0x36A0000000000000 / %8 = and i1 %5, %7
guarded-runtime  %5 = icmp ult i32 %4, 2139095041 / br i1 %5 ... / %11 = fcmp oeq float %9, %10 / phi

So I built five more preserve shaders to separate the constant from the shape:

Shader Expression DXIL s_denorm_mode 14/15 Compare in the ISA
guarded-runtime-and G & (s == r) and i1 yes s_cmp_eq_f32 s4, s0
guarded-one G && (1.0f == r) and i1 yes s_cmp_eq_f32 s0, 1.0
guarded-min-normal G && (asfloat(0x00800000u) == r) and i1 yes s_cmp_eq_f32 s0, 0x800000
guarded-max-subnormal G && (asfloat(0x007fffffu) == r) and i1 yes s_cmp_eq_f32 s0, 0x7fffff
unrelated-guard (params[2].x != 0u) && (asfloat(1u) == r) and i1 yes s_cmp_eq_f32 s4, 1

The switch is there with two runtime operands, with a normal constant, and with a guard that does not involve r. In these eight shaders it appears exactly when the fcmp result feeds an and i1, and never for the bare compare or the branch.

3. Drawn, not only disassembled

That predicts a flushed result for a compare with no literal in it. r = 0x80000000, s = 0x00000001, both from the constant buffer, drawn with offscreen_check --check-pixel-batch by the guard-pair method (word 0 is the compare result; IEEE says 0, flushed operands say 1). Three runs per backend, identical every time, all 64 pixels equal in every row:

Shader -denorm Expression RX 9060 XT words 0..3 In-box WARP words 0..3
plain preserve asfloat(1u) == r 00000000,00000000,00000000,00000000 00000000,00000000,00000000,00000000
guarded preserve G && asfloat(1u) == r 00000001,00000000,00000000,00000000 00000000,00000000,00000000,00000000
guarded-runtime preserve G && s == r 00000000,00000000,00000000,00000000 00000000,00000000,00000000,00000000
guarded-runtime-and preserve G & (s == r) 00000001,00000000,00000000,00000000 00000000,00000000,00000000,00000000
plain-runtime preserve s == r 00000000,00000000,00000000,00000000 00000000,00000000,00000000,00000000
guarded-max-subnormal preserve G && asfloat(0x007fffffu) == r 00000001,00000000,00000000,00000000 00000000,00000000,00000000,00000000
unrelated-guard preserve (params[2].x != 0u) && asfloat(1u) == r 00000001,00000000,00000000,00000000 00000000,00000000,00000000,00000000
guarded-runtime-and ftz G & (s == r) 00000001,00000000,00000000,00000000 00000001,00000000,00000000,00000000

The first three rows repeat the earlier table. The fourth is the new one: both operands are data, and the adapter still returns the flushed answer under preserve. On this adapter the boundary is therefore not constant versus data. Loading the subnormal from memory only helped in the earlier control because DXC kept the short-circuit branch for it.

For the experimental note

The request above keeps guarded-immediate and guarded runtime-source as separate cases. On this adapter the runtime-source case preserves the result because its DXIL is a branch, not because the operand is data: G & (s == r) is runtime-source too and returns the flushed word. If the note records the runtime-source case, it may be worth naming its DXIL shape next to it, or adding the and i1 runtime row as a third case. This is one device and one driver; an RX 9070 XT run of guard_shape_draw.py would say whether it holds there. The strict guarded-immediate case and the plain-immediate and FTZ controls are untouched by this.

Environment

  • Commit: 35a24907d17bc253fa33c0b3be171691debe0468, clean tree; offscreen_check from the dev preset
  • DXC: dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727), Windows SDK 10.0.26100.0
  • RGA 2.15.0.30, official rga-windows-x64-2.15.zip, SHA-256 1dd6fc63baa3ea00f0c4daf208b6139ca924566dd4305a77da0b6c5e52df2377 (equal to the release asset digest)
  • Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), driver 32.0.32029.2010, amdxc64.dll 8.18.10.0514
  • WARP: Microsoft Basic Render Driver (1414:008c), in-box, driver 10.0.26100.10068
  • Windows build: 26300.10075, D3D12 debug layer unavailable

Limits

  • RGA compiles its own pipeline object. It mirrors the renderer's VS, root signature and target format, but blend, rasterizer and sample state are RGA's. The draws in section 3 are the renderer's own pipeline and agree with the ISA.
  • RGA ran in its default mode, which uses the installed driver. The amdxc64.dll bundled with RGA has the same file version (8.18.10.0514) and a different hash; with --offline it emits the same two s_denorm_mode instructions for the guarded shader. I did not otherwise check which DLL the default mode loaded.
  • "Feeds an and i1" describes these eight shaders. I did not try or, select, or other consumers, and why the compiler picks mode 14 there is not established.
  • One device, one driver. Nothing here addresses native gfx1013 or the console.
guard_pair_isa.py and guard_shape_draw.py (uncommitted)
python -B guard_pair_isa.py <dxc.exe> <rga.exe> <repo> gfx1200 <outdir>
python -B guard_shape_draw.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware
python -B guard_shape_draw.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp

guard_shape_draw.py imports f32_guard_pair.py from the comment linked above (SHA-256 c3f247f8bc7594514016e67e2f4365d34fa42bb484bbf528a663fbb42d14b68c) from its parent directory and replaces only the shader list.

"""Driver ISA for the issue #958 guard pair, through Radeon GPU Analyzer in DX12 mode.

The five pixel shaders are the ones of out/f32_guard_pair.py (same text, same DXC flags). The pipeline
mirrors draw_verified() in tests/pixel_aot_render.cpp: tests/pixel_aot_vs.hlsl built as vs_6_0, its
embedded root signature, no input layout, one R32G32B32A32_UINT render target.

Usage: guard_pair_isa.py <dxc> <rga> <repo> <asic> <outdir>
"""
from pathlib import Path
import hashlib
import subprocess
import sys

HEADER = ("cbuffer Constants : register(b0) { uint4 params[16]; };\n"
          "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {\n"
          "    precise float r = asfloat(params[1].x);\n"
          "    precise float s = asfloat(params[2].x);\n")
FOOTER = "    return uint4(c ? 1u : 0u, 0u, 0u, 0u);\n}\n"
GUARD = "((asuint(r) & 0x7fffffffu) <= 0x7f800000u)"
SHADERS = (
    ("plain", "preserve", "(asfloat(1u) == r)"),
    ("guarded", "preserve", f"({GUARD} && (asfloat(1u) == r))"),
    ("plain", "ftz", "(asfloat(1u) == r)"),
    ("guarded", "ftz", f"({GUARD} && (asfloat(1u) == r))"),
    ("guarded-runtime", "preserve", f"({GUARD} && (s == r))"),
    ("guarded-runtime", "ftz", f"({GUARD} && (s == r))"),
    # Extra shapes, to see what the mode switch follows.
    ("guarded-runtime-and", "preserve", f"({GUARD} & (s == r))"),
    ("guarded-one", "preserve", f"({GUARD} && (1.0f == r))"),
    ("guarded-min-normal", "preserve", f"({GUARD} && (asfloat(0x00800000u) == r))"),
    ("guarded-max-subnormal", "preserve", f"({GUARD} && (asfloat(0x007fffffu) == r))"),
    ("unrelated-guard", "preserve", "((params[2].x != 0u) && (asfloat(1u) == r))"),
)
GPSO = """# schemaVersion
1.0

# InputLayoutNumElements
0

# InputLayout
{0}

#PrimitiveTopologyType
D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE

# NumRenderTargets
1

# RTVFormats
{{ DXGI_FORMAT_R32G32B32A32_UINT }}
"""


def run(args):
    done = subprocess.run([str(a) for a in args], capture_output=True, text=True)
    return done.returncode, (done.stdout + done.stderr).strip()


def main(dxc, rga, repo, asic, outdir):
    out = Path(outdir)
    out.mkdir(parents=True, exist_ok=True)
    print("dxc=" + run([dxc, "--version"])[1].splitlines()[0])
    print("rga=" + run([rga, "-s", "dx12", "--version"])[1].strip())
    vs, rs = out / "vs.cso", out / "rs.bin"
    code, text = run([dxc, "-T", "vs_6_0", "-E", "main", "-Fo", vs, Path(repo) / "tests" / "pixel_aot_vs.hlsl"])
    assert code == 0, text
    code, text = run([dxc, "-dumpbin", vs, "-extractrootsignature", "-Fo", rs])
    assert code == 0, text
    for layout in ("", "{ }"):
        (out / f"state{len(layout)}.gpso").write_text(GPSO.format(layout), encoding="ascii")
    for name, mode, expression in SHADERS:
        stem = out / f"{name}-{mode}"
        source, cso, listing = (Path(f"{stem}.{ext}") for ext in ("hlsl", "cso", "ll"))
        source.write_text(HEADER + f"    bool c = {expression};\n" + FOOTER, encoding="ascii")
        code, text = run([dxc, "-Gis", "-denorm", mode, "-T", "ps_6_2", "-E", "main", "-Fo", cso, "-Fc", listing, source])
        assert code == 0, text
        dxil = listing.read_text(encoding="utf-8", errors="replace")
        attribute = next((line.split("{", 1)[1].split("}")[0].strip() for line in dxil.splitlines()
                          if "fp32-denorm-mode" in line), "absent")
        isa = Path(f"{stem}.isa")
        code, text = run([rga, "-s", "dx12", "-c", asic, "--vs-blob", vs, "--ps-blob", cso, "--rs-bin", rs,
                          "--gpso", out / "state0.gpso", "--isa", isa])
        print(f"shader={name} denorm={mode} attribute={attribute} "
              f"cso_sha256={hashlib.sha256(cso.read_bytes()).hexdigest()} rga_exit={code}")
        print(text)


if __name__ == "__main__":
    main(*sys.argv[1:6])
"""Draws the guard shapes of issue #958 with the repository renderer (out/f32_guard_pair.py's method).

Usage: guard_shape_draw.py <dxc> <offscreen_check> <hardware|warp>
"""
from pathlib import Path
import sys

sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import f32_guard_pair as pair  # noqa: E402

G = pair.GUARD
pair.SHADERS = (  # (name, denorm mode, expression, IEEE result, flushed result)
    ("plain", "preserve", "(asfloat(1u) == r)", 0, 1),
    ("guarded", "preserve", f"({G} && (asfloat(1u) == r))", 0, 1),
    ("guarded-runtime", "preserve", f"({G} && (s == r))", 0, 1),
    ("guarded-runtime-and", "preserve", f"({G} & (s == r))", 0, 1),
    ("plain-runtime", "preserve", "(s == r)", 0, 1),
    ("guarded-max-subnormal", "preserve", f"({G} && (asfloat(0x007fffffu) == r))", 0, 1),
    ("unrelated-guard", "preserve", "((params[2].x != 0u) && (asfloat(1u) == r))", 0, 1),
    ("guarded-runtime-and", "ftz", f"({G} & (s == r))", 0, 1),
)
if __name__ == "__main__":
    sys.exit(pair.main(*sys.argv[1:]))

AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114359860 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7114359860). Originally posted by [lantiumBot](https://github.com/lantiumBot) on 2026-11-23T21:21:51Z. --- RDNA 4 ISA on the second device (RX 9060 XT, gfx1200), plus one thing the ISA predicted and a draw then confirmed: the flush follows the shape of the DXIL, not the constant. Data only, no fixture change. ### 1. Same mode switch on gfx1200 The shaders of the [guard pair](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7112154514), same text and flags (`dxc -Gis -denorm <mode> -T ps_6_2 -E main`), compiled by Radeon GPU Analyzer in DX12 mode. The pipeline is the one `draw_verified()` creates: `tests/pixel_aot_vs.hlsl` as `vs_6_0`, its embedded root signature, no input layout, one `R32G32B32A32_UINT` target. ```powershell rga.exe -s dx12 -c gfx1200 --vs-blob vs.cso --ps-blob guarded-preserve.cso --rs-bin rs.bin --gpso state0.gpso --isa guarded-preserve.isa ``` `-denorm preserve`, `s_wait_*`, `s_delay_alu` and the buffer descriptor setup removed: ```text plain asfloat(1u) == r s_buffer_load_b32 s0, s[0:3], 0x10 s_cmp_eq_f32 s0, 1 s_cselect_b32 s0, 1, 0 guarded G && asfloat(1u) == r s_buffer_load_b32 s0, s[0:3], 0x10 s_and_b32 s1, 0x7fffffff, s0 s_denorm_mode 14 s_cmp_eq_f32 s0, 1 s_cselect_b64 s[2:3], exec, 0 s_cmp_lt_u32 s1, 0x7f800001 s_cselect_b64 s[0:1], exec, 0 s_and_b64 s[0:1], s[0:1], s[2:3] s_and_b64 s[0:1], s[0:1], exec s_cselect_b32 s0, 1, 0 v_mov_b32_e32 v1, s0 s_denorm_mode 15 guarded-runtime G && s == r s_buffer_load_b32 s4, s[0:3], 0x10 s_and_b32 s5, 0x7fffffff, s4 s_cmp_lt_u32 s5, 0x7f800001 s_cbranch_scc0 L3 s_buffer_load_b32 s0, s[0:3], 0x20 s_cmp_eq_f32 s4, s0 s_cselect_b32 s0, -1, 0 s_branch L4 L3: s_movk_i32 s0, 0x0 L4: s_and_b32 s0, s0, 1 ``` This matches the gfx1201 listing above: `s_denorm_mode 14` / `15` around the compare in the guarded shader only. Under `-denorm ftz` no shader contains `s_denorm_mode`; the plain and guarded-runtime ISA files are byte-identical between `preserve` and `ftz`, and the guarded one differs only by the two mode instructions, one operand order and the scheduling hints. ### 2. What the switch follows The three shaders above differ in their DXIL in one way. DXC flattens the `&&` when the right-hand side is a constant compare and keeps a branch when it has to load `s`: ```text guarded %5 = icmp ult i32 %4, 2139095041 / %7 = fcmp oeq float %6, 0x36A0000000000000 / %8 = and i1 %5, %7 guarded-runtime %5 = icmp ult i32 %4, 2139095041 / br i1 %5 ... / %11 = fcmp oeq float %9, %10 / phi ``` So I built five more `preserve` shaders to separate the constant from the shape: | Shader | Expression | DXIL | `s_denorm_mode 14`/`15` | Compare in the ISA | |---|---|---|---|---| | guarded-runtime-and | `G & (s == r)` | `and i1` | **yes** | `s_cmp_eq_f32 s4, s0` | | guarded-one | `G && (1.0f == r)` | `and i1` | **yes** | `s_cmp_eq_f32 s0, 1.0` | | guarded-min-normal | `G && (asfloat(0x00800000u) == r)` | `and i1` | **yes** | `s_cmp_eq_f32 s0, 0x800000` | | guarded-max-subnormal | `G && (asfloat(0x007fffffu) == r)` | `and i1` | **yes** | `s_cmp_eq_f32 s0, 0x7fffff` | | unrelated-guard | `(params[2].x != 0u) && (asfloat(1u) == r)` | `and i1` | **yes** | `s_cmp_eq_f32 s4, 1` | The switch is there with two runtime operands, with a normal constant, and with a guard that does not involve `r`. In these eight shaders it appears exactly when the `fcmp` result feeds an `and i1`, and never for the bare compare or the branch. ### 3. Drawn, not only disassembled That predicts a flushed result for a compare with no literal in it. `r` = `0x80000000`, `s` = `0x00000001`, both from the constant buffer, drawn with `offscreen_check --check-pixel-batch` by the guard-pair method (word 0 is the compare result; IEEE says 0, flushed operands say 1). Three runs per backend, identical every time, all 64 pixels equal in every row: | Shader | `-denorm` | Expression | RX 9060 XT words 0..3 | In-box WARP words 0..3 | |---|---|---|---|---| | plain | preserve | `asfloat(1u) == r` | `00000000,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | guarded | preserve | `G && asfloat(1u) == r` | **`00000001`**`,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | guarded-runtime | preserve | `G && s == r` | `00000000,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | guarded-runtime-and | preserve | `G & (s == r)` | **`00000001`**`,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | plain-runtime | preserve | `s == r` | `00000000,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | guarded-max-subnormal | preserve | `G && asfloat(0x007fffffu) == r` | **`00000001`**`,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | unrelated-guard | preserve | `(params[2].x != 0u) && asfloat(1u) == r` | **`00000001`**`,00000000,00000000,00000000` | `00000000,00000000,00000000,00000000` | | guarded-runtime-and | ftz | `G & (s == r)` | `00000001,00000000,00000000,00000000` | `00000001,00000000,00000000,00000000` | The first three rows repeat the earlier table. The fourth is the new one: both operands are data, and the adapter still returns the flushed answer under `preserve`. On this adapter the boundary is therefore not constant versus data. Loading the subnormal from memory only helped in the earlier control because DXC kept the short-circuit branch for it. ### For the experimental note The request above keeps guarded-immediate and guarded runtime-source as separate cases. On this adapter the runtime-source case preserves the result because its DXIL is a branch, not because the operand is data: `G & (s == r)` is runtime-source too and returns the flushed word. If the note records the runtime-source case, it may be worth naming its DXIL shape next to it, or adding the `and i1` runtime row as a third case. This is one device and one driver; an RX 9070 XT run of `guard_shape_draw.py` would say whether it holds there. The strict guarded-immediate case and the plain-immediate and FTZ controls are untouched by this. ### Environment - Commit: `35a24907d17bc253fa33c0b3be171691debe0468`, clean tree; `offscreen_check` from the `dev` preset - DXC: `dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727)`, Windows SDK 10.0.26100.0 - RGA 2.15.0.30, official `rga-windows-x64-2.15.zip`, SHA-256 `1dd6fc63baa3ea00f0c4daf208b6139ca924566dd4305a77da0b6c5e52df2377` (equal to the release asset digest) - Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), driver 32.0.32029.2010, `amdxc64.dll` 8.18.10.0514 - WARP: Microsoft Basic Render Driver (1414:008c), in-box, driver 10.0.26100.10068 - Windows build: 26300.10075, D3D12 debug layer unavailable ### Limits - RGA compiles its own pipeline object. It mirrors the renderer's VS, root signature and target format, but blend, rasterizer and sample state are RGA's. The draws in section 3 are the renderer's own pipeline and agree with the ISA. - RGA ran in its default mode, which uses the installed driver. The `amdxc64.dll` bundled with RGA has the same file version (8.18.10.0514) and a different hash; with `--offline` it emits the same two `s_denorm_mode` instructions for the guarded shader. I did not otherwise check which DLL the default mode loaded. - "Feeds an `and i1`" describes these eight shaders. I did not try `or`, `select`, or other consumers, and why the compiler picks mode 14 there is not established. - One device, one driver. Nothing here addresses native gfx1013 or the console. <details> <summary>guard_pair_isa.py and guard_shape_draw.py (uncommitted)</summary> ```powershell python -B guard_pair_isa.py <dxc.exe> <rga.exe> <repo> gfx1200 <outdir> python -B guard_shape_draw.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware python -B guard_shape_draw.py <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp ``` `guard_shape_draw.py` imports `f32_guard_pair.py` from the comment linked above (SHA-256 `c3f247f8bc7594514016e67e2f4365d34fa42bb484bbf528a663fbb42d14b68c`) from its parent directory and replaces only the shader list. ```python """Driver ISA for the issue #958 guard pair, through Radeon GPU Analyzer in DX12 mode. The five pixel shaders are the ones of out/f32_guard_pair.py (same text, same DXC flags). The pipeline mirrors draw_verified() in tests/pixel_aot_render.cpp: tests/pixel_aot_vs.hlsl built as vs_6_0, its embedded root signature, no input layout, one R32G32B32A32_UINT render target. Usage: guard_pair_isa.py <dxc> <rga> <repo> <asic> <outdir> """ from pathlib import Path import hashlib import subprocess import sys HEADER = ("cbuffer Constants : register(b0) { uint4 params[16]; };\n" "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {\n" " precise float r = asfloat(params[1].x);\n" " precise float s = asfloat(params[2].x);\n") FOOTER = " return uint4(c ? 1u : 0u, 0u, 0u, 0u);\n}\n" GUARD = "((asuint(r) & 0x7fffffffu) <= 0x7f800000u)" SHADERS = ( ("plain", "preserve", "(asfloat(1u) == r)"), ("guarded", "preserve", f"({GUARD} && (asfloat(1u) == r))"), ("plain", "ftz", "(asfloat(1u) == r)"), ("guarded", "ftz", f"({GUARD} && (asfloat(1u) == r))"), ("guarded-runtime", "preserve", f"({GUARD} && (s == r))"), ("guarded-runtime", "ftz", f"({GUARD} && (s == r))"), # Extra shapes, to see what the mode switch follows. ("guarded-runtime-and", "preserve", f"({GUARD} & (s == r))"), ("guarded-one", "preserve", f"({GUARD} && (1.0f == r))"), ("guarded-min-normal", "preserve", f"({GUARD} && (asfloat(0x00800000u) == r))"), ("guarded-max-subnormal", "preserve", f"({GUARD} && (asfloat(0x007fffffu) == r))"), ("unrelated-guard", "preserve", "((params[2].x != 0u) && (asfloat(1u) == r))"), ) GPSO = """# schemaVersion 1.0 # InputLayoutNumElements 0 # InputLayout {0} #PrimitiveTopologyType D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE # NumRenderTargets 1 # RTVFormats {{ DXGI_FORMAT_R32G32B32A32_UINT }} """ def run(args): done = subprocess.run([str(a) for a in args], capture_output=True, text=True) return done.returncode, (done.stdout + done.stderr).strip() def main(dxc, rga, repo, asic, outdir): out = Path(outdir) out.mkdir(parents=True, exist_ok=True) print("dxc=" + run([dxc, "--version"])[1].splitlines()[0]) print("rga=" + run([rga, "-s", "dx12", "--version"])[1].strip()) vs, rs = out / "vs.cso", out / "rs.bin" code, text = run([dxc, "-T", "vs_6_0", "-E", "main", "-Fo", vs, Path(repo) / "tests" / "pixel_aot_vs.hlsl"]) assert code == 0, text code, text = run([dxc, "-dumpbin", vs, "-extractrootsignature", "-Fo", rs]) assert code == 0, text for layout in ("", "{ }"): (out / f"state{len(layout)}.gpso").write_text(GPSO.format(layout), encoding="ascii") for name, mode, expression in SHADERS: stem = out / f"{name}-{mode}" source, cso, listing = (Path(f"{stem}.{ext}") for ext in ("hlsl", "cso", "ll")) source.write_text(HEADER + f" bool c = {expression};\n" + FOOTER, encoding="ascii") code, text = run([dxc, "-Gis", "-denorm", mode, "-T", "ps_6_2", "-E", "main", "-Fo", cso, "-Fc", listing, source]) assert code == 0, text dxil = listing.read_text(encoding="utf-8", errors="replace") attribute = next((line.split("{", 1)[1].split("}")[0].strip() for line in dxil.splitlines() if "fp32-denorm-mode" in line), "absent") isa = Path(f"{stem}.isa") code, text = run([rga, "-s", "dx12", "-c", asic, "--vs-blob", vs, "--ps-blob", cso, "--rs-bin", rs, "--gpso", out / "state0.gpso", "--isa", isa]) print(f"shader={name} denorm={mode} attribute={attribute} " f"cso_sha256={hashlib.sha256(cso.read_bytes()).hexdigest()} rga_exit={code}") print(text) if __name__ == "__main__": main(*sys.argv[1:6]) ``` ```python """Draws the guard shapes of issue #958 with the repository renderer (out/f32_guard_pair.py's method). Usage: guard_shape_draw.py <dxc> <offscreen_check> <hardware|warp> """ from pathlib import Path import sys sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import f32_guard_pair as pair # noqa: E402 G = pair.GUARD pair.SHADERS = ( # (name, denorm mode, expression, IEEE result, flushed result) ("plain", "preserve", "(asfloat(1u) == r)", 0, 1), ("guarded", "preserve", f"({G} && (asfloat(1u) == r))", 0, 1), ("guarded-runtime", "preserve", f"({G} && (s == r))", 0, 1), ("guarded-runtime-and", "preserve", f"({G} & (s == r))", 0, 1), ("plain-runtime", "preserve", "(s == r)", 0, 1), ("guarded-max-subnormal", "preserve", f"({G} && (asfloat(0x007fffffu) == r))", 0, 1), ("unrelated-guard", "preserve", "((params[2].x != 0u) && (asfloat(1u) == r))", 0, 1), ("guarded-runtime-and", "ftz", f"({G} & (s == r))", 0, 1), ) if __name__ == "__main__": sys.exit(pair.main(*sys.argv[1:])) ``` </details> AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.
R0Y00 commented 2026-11-24 06:49:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:56:14Z.


Please put the two-adapter shape table and the DXIL/RGA qualification in a focused docs patch. For the test change, the runtime-subnormal comparison and its gt→ge control are useful. Keep the original preserve case separately runnable with its exact failure status, alongside the observational report and strict FTZ control. The proposed divergences() currently returns an empty dict on an unsupported adapter, loader error, shader failure, or crash without channel lines. It also reads only the first mismatching pixel. Please propagate 77, fail on unexpected return or missing readback, and compare every returned word to the strict reference. The observational report can identify the known bit where the preserve and FTZ references differ. Keep that report separate from whether strict preserve passed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115114735 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7115114735). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T21:56:14Z. --- Please put the two-adapter shape table and the DXIL/RGA qualification in a focused docs patch. For the test change, the runtime-subnormal comparison and its gt→ge control are useful. Keep the original preserve case separately runnable with its exact failure status, alongside the observational report and strict FTZ control. The proposed `divergences()` currently returns an empty dict on an unsupported adapter, loader error, shader failure, or crash without channel lines. It also reads only the first mismatching pixel. Please propagate 77, fail on unexpected return or missing readback, and compare every returned word to the strict reference. The observational report can identify the known bit where the preserve and FTZ references differ. Keep that report separate from whether strict preserve passed.
lantiumBot commented 2026-11-24 06:49:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lantiumBot on 2026-11-23T22:01:49Z.


I can take the focused docs patch: the two-adapter shape table (RX 9060 XT and RX 9070 XT), the DXIL shapes, and the RGA qualification with its pipeline caveat, in docs/experiments.md. Docs only, no test change. @thepatrickworld, tell me if you already have it in progress and I will leave it to you.

AI-assisted (Claude Code - Fable 5.2).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115233151 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7115233151). Originally posted by [lantiumBot](https://github.com/lantiumBot) on 2026-11-23T22:01:49Z. --- I can take the focused docs patch: the two-adapter shape table (RX 9060 XT and RX 9070 XT), the DXIL shapes, and the RGA qualification with its pipeline caveat, in `docs/experiments.md`. Docs only, no test change. @thepatrickworld, tell me if you already have it in progress and I will leave it to you. AI-assisted (Claude Code - Fable 5.2).
thepatrickworld commented 2026-11-24 06:49:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T21:46:31Z.


Two things: the RX 9070 XT run of guard_shape_draw.py that @lantiumBot asked for, and the test-suite arrangement that keeps the strict case while the main entry stops being red. The arrangement below was reworked after an external audit of the first version found three holes in it — the fix list is in the last paragraph.

1. The shape table on a second RDNA 4 device

guard_shape_draw.py and f32_guard_pair.py taken verbatim from the comments above, renderer from 25e9451 (main dae1ca2), DXC 1.9.2602.17, RX 9070 XT (1002:7550) driver 32.0.32029.2010, WARP 10.0.26100.9711:

shader -denorm RX 9070 XT words 0..3 RX 9060 XT WARP
plain preserve 00000000,… 00000000,… 00000000,…
guarded && preserve 00000001,… 00000001,… 00000000,…
guarded-runtime && preserve 00000000,… 00000000,… 00000000,…
guarded-runtime & preserve 00000001,… 00000001,… 00000000,…
plain-runtime preserve 00000000,… 00000000,… 00000000,…
guarded-max-subnormal preserve 00000001,… 00000001,… 00000000,…
unrelated-guard preserve 00000001,… 00000001,… 00000000,…
guarded-runtime-and ftz 00000001,… 00000001,… —

One run per backend, and in every row the script's second draw — with the words just observed as the expectation — matched all 64 pixels. The table matches the 9060 XT row for row, so the shape reading holds on a second device and a different driver build: the flush follows the and i1, not the constant and not where the value came from. guarded-runtime-and is the row that settles it — both operands are data and the answer is still flushed — and it also retires an observation I posted earlier: a subnormal read from the same 16-byte vector as r looked special to me, but that was a proxy for the compiler choosing this shape, not a property of the load.

WARP returns the IEEE word under preserve in all seven rows, which is why the fixture can stay strict there.

2. The test-suite arrangement

Against d7c4d6e, git am-able:

  • The main entry stops being red without losing the signal. Bit 18 no longer compares the integer immediate 1; it derives the subnormal from the operand at run time and compares it against zero, so a subnormal still reaches an f32 compare on every adapter. It is also observable now: it is set exactly on the sets whose rhs has its sign bit, and a gt→ge mutation fails the entry (added to the existing mutation list).
  • The immediate typing is pinned on the generated source, and the assertion had to be narrowed: in the diagnostic, asuint(asfloat(1u)) & 0x7fffffffu must appear exactly once (the not-NaN guard of the bit 18 comparison). A bare "asfloat(1u)" would have been vacuous — the legacy source contains 75 of them, because v_cndmask_b32 emits ? asfloat(1u) : asfloat(0u) — and would have passed even if the subnormal immediate were emitted as 1.0f. The asfloat(1065353216u) check in the main entry pins the same property for the 1.0f immediate of bit 21.
  • The strict case stays, in its own entry. pixel_aot_cmp_guard_diagnostic_<adapter> draws f32_compares(legacy_immediate=True) — the original shader with bit 18 as the literal — against its strict expectation. It prints which of the seven sets reproduce the divergence and which do not. The one tolerated divergence is bit 18 of channel 0: bit 18 also exists on channel 1 (v_cmp_gt_f32_e64 s52, s44, -1.0), and an unscoped bit mask would swallow a regression there and even count it as a reproduction. Each draw's exit status is checked too, so a renderer that fails before printing cannot read as "no divergence". On this card it prints 1 of 7 sets reproduced and passes; on WARP it prints seven times that it did not reproduce and passes.
  • FTZ is a strict control, with a limit worth stating. The same source rebuilt with -denorm ftz is compared against a flushed reference and must match bit for bit on all seven sets. To be exact about what that shows: the hardware word does not change between the two modes — only the expectation moves — so this half verifies the flushed reference and that the divergence stays confined to that one bit. It does not, by itself, demonstrate that the divergence depends on the denormal mode.

The diagnostic deliberately runs the case in the shader it was found in. I first tried a four-channel probe — normal immediate, subnormal immediate, runtime subnormal, swapped — and two shaders that differed only in whether the literal was bound to a local before the compare returned opposite answers on this adapter and this driver. That now has an explanation: the reduction changes the DXIL shape, and the shape is what the compiler acts on. A reduced probe is not a canary; the original shader is.

Measured at d7c4d6e, RX 9070 XT, on the version below: pixel_aot_comparisons_hardware 10.48 s, _warp 6.51 s, cmp_guard_diagnostic_hardware 1.84 s (1 of 7), _warp 1.16 s (0 of 7). Full ctest -R "^pixel_aot_": 102 of 102, exit 0.

Patch (112 insertions, 6 deletions, 2 files)
From 71f2019d231e9bc09474ce41e6617b6593ae910a Mon Sep 17 00:00:00 2001
From: Panam <panam@local>
Date: Mon, 23 Nov 2026 22:07:15 +0100
Subject: [PATCH] tests: report the #958 subnormal-immediate case as its own
 diagnostic entry

The guarded-immediate comparison is kept as a separately selectable diagnostic
instead of being dropped, so the verified driver signal stays visible. The main
entry derives the subnormal from the operand at run time and keeps the gt->ge
mutation; the diagnostic also pins the immediate typing on the emitted source
and checks the ftz reference strictly.

The diagnostic tolerates one divergence only: bit 18 of channel 0 reading the
flushed answer. The channel is part of the tolerance because bit 18 also exists
on channel 1, and each case's exit status is checked so a renderer error cannot
read as 'no divergence'.
---
 CMakeLists.txt           |   6 ++
 tests/pixel_aot_check.py | 132 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 132 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b370666..bebe89e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3374,6 +3374,12 @@ if(EXISTS "${INTAKE_PYTHON}")
             "$<TARGET_FILE:offscreen_check>" ${adapter})
         set_tests_properties(pixel_aot_comparisons_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77
             ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_comparisons_${adapter}.txt")
+        # The #958 divergence is reported here rather than asserted away in the entry above: this
+        # one stays green while the driver folds a subnormal immediate under the guard, and says so.
+        add_test(NAME pixel_aot_cmp_guard_diagnostic_${adapter} COMMAND "${INTAKE_PYTHON}" -B
+            "${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-cmp-guard-diagnostic "${DXC_EXECUTABLE}"
+            "$<TARGET_FILE:offscreen_check>" ${adapter})
+        set_tests_properties(pixel_aot_cmp_guard_diagnostic_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77)
         add_test(NAME pixel_aot_blend_scalar_${adapter} COMMAND "${INTAKE_PYTHON}" -B
             "${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-blend-scalar "${DXC_EXECUTABLE}"
             "$<TARGET_FILE:offscreen_check>" ${adapter})
diff --git a/tests/pixel_aot_check.py b/tests/pixel_aot_check.py
index e254ba4..0825b65 100644
--- a/tests/pixel_aot_check.py
+++ b/tests/pixel_aot_check.py
@@ -14454,8 +14454,13 @@ F32_COMPARE_SETS = (
 )
 
 
-def f32_compares() -> list[str]:
-    """Build a shader testing all 16 binary32 predicates across e32, e64, and SDWA."""
+def f32_compares(legacy_immediate: bool = False) -> list[str]:
+    """Build a shader testing all 16 binary32 predicates across e32, e64, and SDWA.
+
+    With legacy_immediate the subnormal bit compares the integer immediate 1 directly, which is the
+    form that diverges on RDNA 4 (#958); the default derives the same value from the operand instead,
+    so the entry that runs every comparison on every adapter stays portable.
+    """
     body = [
         "v_mov_b32_e32 v12, 0",
         "v_mov_b32_e32 v13, 0",
@@ -14470,7 +14475,7 @@ def f32_compares() -> list[str]:
         # compared as zero, while the same value loaded at runtime is preserved (#958).
         # Shifting the sign out of the runtime operand still yields 0x00000001 when the set's
         # rhs is a negative zero, so bit 18 keeps seeing a subnormal.
-        "v_lshrrev_b32_e32 v19, 31, v16",
+        *( [] if legacy_immediate else ["v_lshrrev_b32_e32 v19, 31, v16"] ),
     ]
 
     def emit_flag(acc: str, bit: int, cond: str, insn: str) -> None:
@@ -14486,7 +14491,8 @@ def f32_compares() -> list[str]:
     for bit, insn in (
         (16, "v_cmp_lt_f32_e32 vcc_lo, v18, v16"),
         (17, "v_cmp_eq_f32_e32 vcc_lo, 1.0, v16"),
-        (18, "v_cmp_gt_f32_e32 vcc_lo, v19, 0.0"),
+        (18, "v_cmp_eq_f32_e32 vcc_lo, 1, v16" if legacy_immediate
+             else "v_cmp_gt_f32_e32 vcc_lo, v19, 0.0"),
         (19, "v_cmp_lt_f32_e32 vcc_lo, -0.5, v16"),
         (20, "v_cmp_lt_f32_e32 vcc_lo, 0.15915494, v16"),
         (21, "v_cmp_lt_f32_e32 vcc_lo, 0x3f800000, v16"),
@@ -14531,7 +14537,9 @@ def f32_compares() -> list[str]:
     return body
 
 
-def f32_compares_reference(words: tuple[int, int, int, int]) -> tuple[int, int, int, int]:
+def f32_compares_reference(words: tuple[int, int, int, int],
+                           legacy_immediate: bool = False,
+                           flushed: bool = False) -> tuple[int, int, int, int]:
     """Compute the exact 4 uint bitmasks expected from f32_compares()."""
     def cmp_pred(pred: str, a: float, b: float) -> bool:
         ordered = (not math.isnan(a)) and (not math.isnan(b))
@@ -14575,7 +14583,9 @@ def f32_compares_reference(words: tuple[int, int, int, int]) -> tuple[int, int,
         # (#958), while the same value loaded at runtime is preserved. Bit 18 therefore compares
         # the shifted-out subnormal against zero, and is set exactly on the sets whose rhs has
         # its sign bit set.
-        (18, cmp_pred("gt", word_to_float((words[1] >> 31) & 1), 0.0)),
+        (18, cmp_pred("eq", 0.0, flush_ftz(rhs)) if flushed
+             else cmp_pred("eq", word_to_float(1), rhs) if legacy_immediate
+             else cmp_pred("gt", word_to_float((words[1] >> 31) & 1), 0.0)),
         (19, cmp_pred("lt", -0.5, rhs)),
         (20, cmp_pred("lt", word_to_float(0x3e22f983), rhs)),
         (21, cmp_pred("lt", 1.0, rhs)),
@@ -14630,6 +14640,10 @@ def check_f32_compare_draws(directory, compiler, renderer, backend):
     shader = directory / "f32-compare.cso"
     program = uncompressed_export(f32_compares())
     source.write_text(translate_int(program), encoding="ascii")
+    # An integer immediate has to reach the comparison as binary32 bits, not as a converted
+    # float; the fixture's bit 21 is the case that keeps this pinned (#958).
+    if "asfloat(1065353216u)" not in source.read_text(encoding="ascii"):
+        raise AssertionError("The comparison fixture stopped typing an integer immediate as bits")
     compile_shader(compiler, source, shader)
     cases = []
     for index, words in enumerate(F32_COMPARE_SETS):
@@ -14654,6 +14668,10 @@ def check_f32_compare_draws(directory, compiler, renderer, backend):
     for label, old, new, case_index in (
         ("f32 e32 predicate", "v_cmp_lt_f32_e32 vcc_lo, s44, v16", "v_cmp_le_f32_e32 vcc_lo, s44, v16", 3),
         ("f32 e64 neg", "v_cmp_lt_f32_e64 s52, -s44, |s45|", "v_cmp_lt_f32_e64 s52, s44, |s45|", 2),
+        # Caught through the equality case, not the subnormal ones: on set 3 both operands are 0, so
+        # gt gives false where ge gives true. On the two sets that carry a real subnormal gt and ge
+        # are both true, so either mutation would be invisible there.
+        ("f32 runtime compare gt->ge", "v_cmp_gt_f32_e32 vcc_lo, v19, 0.0", "v_cmp_ge_f32_e32 vcc_lo, v19, 0.0", 3),
     ):
         mutated = [new if line == old else line for line in program]
         assert mutated != program
@@ -14665,6 +14683,101 @@ def check_f32_compare_draws(directory, compiler, renderer, backend):
             raise AssertionError(f"Mutating {label} escaped detection")
 
 
+def check_cmp_guard_diagnostic(directory, compiler, renderer, backend):
+    """Draw the #958 case in its original shader and report the divergence instead of hiding it.
+
+    Requested on #958: keep the guarded-immediate preserve case with its strict expectation as a
+    separately selectable diagnostic, and keep the known-mismatch reporting visible.
+
+    The case has to stay in the shader it was found in. Reducing it to a four-channel probe does not
+    reproduce on RDNA 4: two shaders that differ only in whether the subnormal literal is bound to a
+    local first read opposite answers on the same adapter and driver, so the fold depends on the
+    compilation unit and not on the shape of the single expression.
+
+    Every case is drawn twice from the same source, once with -denorm preserve and once with
+    -denorm ftz. Under preserve the only tolerated divergence is bit 18 of channel 0 reading the
+    flushed answer, and it is printed either way, so the entry also reports when the hardware stops
+    doing it. Under ftz that same bit must read the flushed answer on every set: the hardware word
+    is unchanged between the two modes, only the expectation moves, so this half checks the
+    flushed reference rather than a dependence on the mode.
+
+    Bit 18 carries a real subnormal on 2 of the 7 sets (the ones whose rhs has its sign bit); on the
+    other 5 the emitted comparison is 0.0 > 0.0, so the bit only catches an operand that should not
+    be there. The gt/ge mutation is caught through the equality case (set 3), which is where the two
+    predicates differ; on the subnormal sets both are true and either mutation would be invisible.
+    """
+    source = directory / "cmp-guard.hlsl"
+    shader = directory / "cmp-guard.cso"
+    source.write_text(translate_int(uncompressed_export(f32_compares(legacy_immediate=True))),
+                      encoding="ascii")
+    # The subnormal immediate must reach the generated source as bits, inside the not-NaN guard of
+    # the bit 18 comparison. A bare "asfloat(1u)" would be vacuous: the legacy source contains 75 of
+    # them because v_cndmask_b32 emits "? asfloat(1u) : asfloat(0u)".
+    if "asuint(asfloat(1u)) & 0x7fffffffu" not in source.read_text(encoding="ascii"):
+        raise AssertionError("The diagnostic stopped typing the subnormal immediate as bits")
+
+    def cases_for(prefix):
+        written = []
+        for index, words in enumerate(F32_COMPARE_SETS):
+            constants = bytearray(256)
+            struct.pack_into("<4I", constants, 12, *words)
+            expected = tuple(as_float(w) for w in f32_compares_reference(words, legacy_immediate=True))
+            written.append(write_case(directory / f"{prefix}-{index}.case", constants, expected,
+                                      integer_rt=True))
+        return written
+
+    def divergences(case):
+        result = subprocess.run([renderer, backend, "--check-pixel-case", shader, case],
+                                capture_output=True, text=True)
+        # The renderer returns non-zero on a mismatch, so 0 and 1 are both expected. Anything else
+        # means the case never ran, and treating it as "no channel lines" would read as no
+        # divergence at all.
+        if result.returncode not in (0, 1):
+            raise AssertionError(f"{case} exited {result.returncode} on {backend}: "
+                                 f"{result.stderr.strip()[-400:]}")
+        found = {}
+        for line in result.stderr.splitlines():
+            match = re.search(r"channel=(\d+).*expected_bits=([0-9a-f]{8}) actual_bits=([0-9a-f]{8})", line)
+            if match:
+                expected_bits, actual_bits = int(match.group(2), 16), int(match.group(3), 16)
+                if expected_bits != actual_bits:
+                    found[int(match.group(1))] = (expected_bits, actual_bits)
+        return found
+
+    def only_the_subnormal_bit(index, found, mode):
+        for channel, (expected_bits, actual_bits) in found.items():
+            # Channel 0 carries the legacy immediate this entry exists for. Bit 18 also exists on
+            # channel 1 (v_cmp_gt_f32_e64 s52, s44, -1.0), so an unscoped bit mask would swallow a
+            # regression there and even count it as a reproduction.
+            if channel != 0 or expected_bits ^ actual_bits != 1 << 18 or not actual_bits & (1 << 18):
+                raise AssertionError(
+                    f"Case {index} channel {channel} differs outside the known subnormal bit under "
+                    f"{mode}: expected {expected_bits:08x} actual {actual_bits:08x} (#958)")
+
+    compile_shader(compiler, source, shader)
+    reproduced = []
+    for index, case in enumerate(cases_for("cmp-guard-preserve")):
+        found = divergences(case)
+        only_the_subnormal_bit(index, found, "-denorm preserve")
+        if found:
+            reproduced.append(index)
+            print(f"known mismatch (#958): case {index} compares the subnormal immediate as zero")
+        else:
+            print(f"known mismatch (#958) did not reproduce: case {index}")
+    print(f"known mismatch (#958): {len(reproduced)} of {len(F32_COMPARE_SETS)} sets reproduced")
+
+    compile_shader(compiler, source, shader, mode="ftz")
+    flushed = []
+    for index, words in enumerate(F32_COMPARE_SETS):
+        constants = bytearray(256)
+        struct.pack_into("<4I", constants, 12, *words)
+        expected = tuple(as_float(w) for w in
+                         f32_compares_reference(words, legacy_immediate=True, flushed=True))
+        flushed.append((write_case(directory / f"cmp-guard-ftz-{index}.case", constants, expected,
+                                   integer_rt=True), "pass"))
+    run_pixel_batch(renderer, backend, shader, flushed)
+
+
 def check_predicate_and_rounding_draws(directory, compiler, renderer, backend):
     source = directory / "fixture.hlsl"
     shader = directory / "fixture.cso"
@@ -15628,6 +15741,13 @@ def main():
                 if error.returncode == 77 and str(error.cmd[0]) == str(args[1]):
                     return 77
                 raise
+        if mode == "draw-cmp-guard-diagnostic":
+            try:
+                return check_cmp_guard_diagnostic(directory, *args)
+            except subprocess.CalledProcessError as error:
+                if error.returncode == 77 and str(error.cmd[0]) == str(args[1]):
+                    return 77
+                raise
         if mode == "draw-comparisons":
             try:
                 return check_comparison_draws(directory, *args)
-- 
2.53.0

What the first version of this arrangement got wrong

An external review of the version I posted earlier found four things, all fixed above:

  1. The tolerance was scoped to the bit but not to the channel, so a bit-18 regression on channel 1 would have been swallowed and counted as a reproduction.
  2. The draw's exit status was never checked, so a renderer that failed before printing would have read as "no divergence".
  3. The immediate-typing assertion was "asfloat(1u)" in source, which is vacuous — 75 occurrences.
  4. The commit message claimed the ftz half "pins that the divergence follows the denormal mode". That is not what it shows: the hardware word is identical in both modes, only the expectation changes.

Two smaller corrections, in the same spirit: bit 18 only carries a real subnormal on 2 of the 7 sets (the ones whose rhs has its sign bit — on the others the emitted comparison is 0.0 > 0.0), and the gt→ge mutation is caught through the equality set, not through the subnormal ones.

I have not written the experimental note with the raw words and the RGA caveat — say the word and I will draft it against these numbers, including the fact that RGA compiles its own pipeline so the ISA listing and the draw are separate evidence.

AI-assisted; runs on the adapter above, ISA shape from the RGA listings posted in this thread.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114901134 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7114901134). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-23T21:46:31Z. --- Two things: the RX 9070 XT run of `guard_shape_draw.py` that @lantiumBot asked for, and the test-suite arrangement that keeps the strict case while the main entry stops being red. The arrangement below was reworked after an external audit of the first version found three holes in it — the fix list is in the last paragraph. ### 1. The shape table on a second RDNA 4 device `guard_shape_draw.py` and `f32_guard_pair.py` taken verbatim from the comments above, renderer from `25e9451` (main `dae1ca2`), DXC `1.9.2602.17`, RX 9070 XT (`1002:7550`) driver `32.0.32029.2010`, WARP `10.0.26100.9711`: | shader | `-denorm` | RX 9070 XT words 0..3 | RX 9060 XT | WARP | |---|---|---|---|---| | `plain` | preserve | `00000000,…` | `00000000,…` | `00000000,…` | | `guarded` `&&` | preserve | **`00000001`**`,…` | **`00000001`**`,…` | `00000000,…` | | `guarded-runtime` `&&` | preserve | `00000000,…` | `00000000,…` | `00000000,…` | | `guarded-runtime` `&` | preserve | **`00000001`**`,…` | **`00000001`**`,…` | `00000000,…` | | `plain-runtime` | preserve | `00000000,…` | `00000000,…` | `00000000,…` | | `guarded-max-subnormal` | preserve | **`00000001`**`,…` | **`00000001`**`,…` | `00000000,…` | | `unrelated-guard` | preserve | **`00000001`**`,…` | **`00000001`**`,…` | `00000000,…` | | `guarded-runtime-and` | ftz | `00000001,…` | `00000001,…` | — | One run per backend, and in every row the script's second draw — with the words just observed as the expectation — matched all 64 pixels. The table matches the 9060 XT row for row, so the shape reading holds on a second device and a different driver build: the flush follows the `and i1`, not the constant and not where the value came from. `guarded-runtime-and` is the row that settles it — both operands are data and the answer is still flushed — and it also retires an observation I posted earlier: a subnormal read from the same 16-byte vector as `r` looked special to me, but that was a proxy for the compiler choosing this shape, not a property of the load. WARP returns the IEEE word under `preserve` in all seven rows, which is why the fixture can stay strict there. ### 2. The test-suite arrangement Against `d7c4d6e`, `git am`-able: - **The main entry stops being red without losing the signal.** Bit 18 no longer compares the integer immediate `1`; it derives the subnormal from the operand at run time and compares it against zero, so a subnormal still reaches an f32 compare on every adapter. It is also observable now: it is set exactly on the sets whose `rhs` has its sign bit, and a `gt`→`ge` mutation fails the entry (added to the existing mutation list). - **The immediate typing is pinned on the generated source**, and the assertion had to be narrowed: in the diagnostic, `asuint(asfloat(1u)) & 0x7fffffffu` must appear exactly once (the not-NaN guard of the bit 18 comparison). A bare `"asfloat(1u)"` would have been vacuous — the legacy source contains 75 of them, because `v_cndmask_b32` emits `? asfloat(1u) : asfloat(0u)` — and would have passed even if the subnormal immediate were emitted as `1.0f`. The `asfloat(1065353216u)` check in the main entry pins the same property for the `1.0f` immediate of bit 21. - **The strict case stays, in its own entry.** `pixel_aot_cmp_guard_diagnostic_<adapter>` draws `f32_compares(legacy_immediate=True)` — the original shader with bit 18 as the literal — against its strict expectation. It prints which of the seven sets reproduce the divergence and which do not. The one tolerated divergence is bit 18 **of channel 0**: bit 18 also exists on channel 1 (`v_cmp_gt_f32_e64 s52, s44, -1.0`), and an unscoped bit mask would swallow a regression there and even count it as a reproduction. Each draw's exit status is checked too, so a renderer that fails before printing cannot read as "no divergence". On this card it prints `1 of 7 sets reproduced` and passes; on WARP it prints seven times that it did not reproduce and passes. - **FTZ is a strict control, with a limit worth stating.** The same source rebuilt with `-denorm ftz` is compared against a flushed reference and must match bit for bit on all seven sets. To be exact about what that shows: the hardware word does not change between the two modes — only the expectation moves — so this half verifies the flushed reference and that the divergence stays confined to that one bit. It does not, by itself, demonstrate that the divergence *depends* on the denormal mode. The diagnostic deliberately runs the case in the shader it was found in. I first tried a four-channel probe — normal immediate, subnormal immediate, runtime subnormal, swapped — and two shaders that differed only in whether the literal was bound to a local before the compare returned opposite answers on this adapter and this driver. That now has an explanation: the reduction changes the DXIL shape, and the shape is what the compiler acts on. A reduced probe is not a canary; the original shader is. Measured at `d7c4d6e`, RX 9070 XT, on the version below: `pixel_aot_comparisons_hardware` **10.48 s**, `_warp` **6.51 s**, `cmp_guard_diagnostic_hardware` **1.84 s** (1 of 7), `_warp` **1.16 s** (0 of 7). Full `ctest -R "^pixel_aot_"`: **102 of 102, exit 0**. <details> <summary>Patch (112 insertions, 6 deletions, 2 files)</summary> ```diff From 71f2019d231e9bc09474ce41e6617b6593ae910a Mon Sep 17 00:00:00 2001 From: Panam <panam@local> Date: Mon, 23 Nov 2026 22:07:15 +0100 Subject: [PATCH] tests: report the #958 subnormal-immediate case as its own diagnostic entry The guarded-immediate comparison is kept as a separately selectable diagnostic instead of being dropped, so the verified driver signal stays visible. The main entry derives the subnormal from the operand at run time and keeps the gt->ge mutation; the diagnostic also pins the immediate typing on the emitted source and checks the ftz reference strictly. The diagnostic tolerates one divergence only: bit 18 of channel 0 reading the flushed answer. The channel is part of the tolerance because bit 18 also exists on channel 1, and each case's exit status is checked so a renderer error cannot read as 'no divergence'. --- CMakeLists.txt | 6 ++ tests/pixel_aot_check.py | 132 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 132 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b370666..bebe89e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3374,6 +3374,12 @@ if(EXISTS "${INTAKE_PYTHON}") "$<TARGET_FILE:offscreen_check>" ${adapter}) set_tests_properties(pixel_aot_comparisons_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77 ENVIRONMENT "FORM_COVERAGE_RECORD=${CMAKE_BINARY_DIR}/form_coverage/pixel_aot_comparisons_${adapter}.txt") + # The #958 divergence is reported here rather than asserted away in the entry above: this + # one stays green while the driver folds a subnormal immediate under the guard, and says so. + add_test(NAME pixel_aot_cmp_guard_diagnostic_${adapter} COMMAND "${INTAKE_PYTHON}" -B + "${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-cmp-guard-diagnostic "${DXC_EXECUTABLE}" + "$<TARGET_FILE:offscreen_check>" ${adapter}) + set_tests_properties(pixel_aot_cmp_guard_diagnostic_${adapter} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77) add_test(NAME pixel_aot_blend_scalar_${adapter} COMMAND "${INTAKE_PYTHON}" -B "${CMAKE_SOURCE_DIR}/tests/pixel_aot_check.py" draw-blend-scalar "${DXC_EXECUTABLE}" "$<TARGET_FILE:offscreen_check>" ${adapter}) diff --git a/tests/pixel_aot_check.py b/tests/pixel_aot_check.py index e254ba4..0825b65 100644 --- a/tests/pixel_aot_check.py +++ b/tests/pixel_aot_check.py @@ -14454,8 +14454,13 @@ F32_COMPARE_SETS = ( ) -def f32_compares() -> list[str]: - """Build a shader testing all 16 binary32 predicates across e32, e64, and SDWA.""" +def f32_compares(legacy_immediate: bool = False) -> list[str]: + """Build a shader testing all 16 binary32 predicates across e32, e64, and SDWA. + + With legacy_immediate the subnormal bit compares the integer immediate 1 directly, which is the + form that diverges on RDNA 4 (#958); the default derives the same value from the operand instead, + so the entry that runs every comparison on every adapter stays portable. + """ body = [ "v_mov_b32_e32 v12, 0", "v_mov_b32_e32 v13, 0", @@ -14470,7 +14475,7 @@ def f32_compares() -> list[str]: # compared as zero, while the same value loaded at runtime is preserved (#958). # Shifting the sign out of the runtime operand still yields 0x00000001 when the set's # rhs is a negative zero, so bit 18 keeps seeing a subnormal. - "v_lshrrev_b32_e32 v19, 31, v16", + *( [] if legacy_immediate else ["v_lshrrev_b32_e32 v19, 31, v16"] ), ] def emit_flag(acc: str, bit: int, cond: str, insn: str) -> None: @@ -14486,7 +14491,8 @@ def f32_compares() -> list[str]: for bit, insn in ( (16, "v_cmp_lt_f32_e32 vcc_lo, v18, v16"), (17, "v_cmp_eq_f32_e32 vcc_lo, 1.0, v16"), - (18, "v_cmp_gt_f32_e32 vcc_lo, v19, 0.0"), + (18, "v_cmp_eq_f32_e32 vcc_lo, 1, v16" if legacy_immediate + else "v_cmp_gt_f32_e32 vcc_lo, v19, 0.0"), (19, "v_cmp_lt_f32_e32 vcc_lo, -0.5, v16"), (20, "v_cmp_lt_f32_e32 vcc_lo, 0.15915494, v16"), (21, "v_cmp_lt_f32_e32 vcc_lo, 0x3f800000, v16"), @@ -14531,7 +14537,9 @@ def f32_compares() -> list[str]: return body -def f32_compares_reference(words: tuple[int, int, int, int]) -> tuple[int, int, int, int]: +def f32_compares_reference(words: tuple[int, int, int, int], + legacy_immediate: bool = False, + flushed: bool = False) -> tuple[int, int, int, int]: """Compute the exact 4 uint bitmasks expected from f32_compares().""" def cmp_pred(pred: str, a: float, b: float) -> bool: ordered = (not math.isnan(a)) and (not math.isnan(b)) @@ -14575,7 +14583,9 @@ def f32_compares_reference(words: tuple[int, int, int, int]) -> tuple[int, int, # (#958), while the same value loaded at runtime is preserved. Bit 18 therefore compares # the shifted-out subnormal against zero, and is set exactly on the sets whose rhs has # its sign bit set. - (18, cmp_pred("gt", word_to_float((words[1] >> 31) & 1), 0.0)), + (18, cmp_pred("eq", 0.0, flush_ftz(rhs)) if flushed + else cmp_pred("eq", word_to_float(1), rhs) if legacy_immediate + else cmp_pred("gt", word_to_float((words[1] >> 31) & 1), 0.0)), (19, cmp_pred("lt", -0.5, rhs)), (20, cmp_pred("lt", word_to_float(0x3e22f983), rhs)), (21, cmp_pred("lt", 1.0, rhs)), @@ -14630,6 +14640,10 @@ def check_f32_compare_draws(directory, compiler, renderer, backend): shader = directory / "f32-compare.cso" program = uncompressed_export(f32_compares()) source.write_text(translate_int(program), encoding="ascii") + # An integer immediate has to reach the comparison as binary32 bits, not as a converted + # float; the fixture's bit 21 is the case that keeps this pinned (#958). + if "asfloat(1065353216u)" not in source.read_text(encoding="ascii"): + raise AssertionError("The comparison fixture stopped typing an integer immediate as bits") compile_shader(compiler, source, shader) cases = [] for index, words in enumerate(F32_COMPARE_SETS): @@ -14654,6 +14668,10 @@ def check_f32_compare_draws(directory, compiler, renderer, backend): for label, old, new, case_index in ( ("f32 e32 predicate", "v_cmp_lt_f32_e32 vcc_lo, s44, v16", "v_cmp_le_f32_e32 vcc_lo, s44, v16", 3), ("f32 e64 neg", "v_cmp_lt_f32_e64 s52, -s44, |s45|", "v_cmp_lt_f32_e64 s52, s44, |s45|", 2), + # Caught through the equality case, not the subnormal ones: on set 3 both operands are 0, so + # gt gives false where ge gives true. On the two sets that carry a real subnormal gt and ge + # are both true, so either mutation would be invisible there. + ("f32 runtime compare gt->ge", "v_cmp_gt_f32_e32 vcc_lo, v19, 0.0", "v_cmp_ge_f32_e32 vcc_lo, v19, 0.0", 3), ): mutated = [new if line == old else line for line in program] assert mutated != program @@ -14665,6 +14683,101 @@ def check_f32_compare_draws(directory, compiler, renderer, backend): raise AssertionError(f"Mutating {label} escaped detection") +def check_cmp_guard_diagnostic(directory, compiler, renderer, backend): + """Draw the #958 case in its original shader and report the divergence instead of hiding it. + + Requested on #958: keep the guarded-immediate preserve case with its strict expectation as a + separately selectable diagnostic, and keep the known-mismatch reporting visible. + + The case has to stay in the shader it was found in. Reducing it to a four-channel probe does not + reproduce on RDNA 4: two shaders that differ only in whether the subnormal literal is bound to a + local first read opposite answers on the same adapter and driver, so the fold depends on the + compilation unit and not on the shape of the single expression. + + Every case is drawn twice from the same source, once with -denorm preserve and once with + -denorm ftz. Under preserve the only tolerated divergence is bit 18 of channel 0 reading the + flushed answer, and it is printed either way, so the entry also reports when the hardware stops + doing it. Under ftz that same bit must read the flushed answer on every set: the hardware word + is unchanged between the two modes, only the expectation moves, so this half checks the + flushed reference rather than a dependence on the mode. + + Bit 18 carries a real subnormal on 2 of the 7 sets (the ones whose rhs has its sign bit); on the + other 5 the emitted comparison is 0.0 > 0.0, so the bit only catches an operand that should not + be there. The gt/ge mutation is caught through the equality case (set 3), which is where the two + predicates differ; on the subnormal sets both are true and either mutation would be invisible. + """ + source = directory / "cmp-guard.hlsl" + shader = directory / "cmp-guard.cso" + source.write_text(translate_int(uncompressed_export(f32_compares(legacy_immediate=True))), + encoding="ascii") + # The subnormal immediate must reach the generated source as bits, inside the not-NaN guard of + # the bit 18 comparison. A bare "asfloat(1u)" would be vacuous: the legacy source contains 75 of + # them because v_cndmask_b32 emits "? asfloat(1u) : asfloat(0u)". + if "asuint(asfloat(1u)) & 0x7fffffffu" not in source.read_text(encoding="ascii"): + raise AssertionError("The diagnostic stopped typing the subnormal immediate as bits") + + def cases_for(prefix): + written = [] + for index, words in enumerate(F32_COMPARE_SETS): + constants = bytearray(256) + struct.pack_into("<4I", constants, 12, *words) + expected = tuple(as_float(w) for w in f32_compares_reference(words, legacy_immediate=True)) + written.append(write_case(directory / f"{prefix}-{index}.case", constants, expected, + integer_rt=True)) + return written + + def divergences(case): + result = subprocess.run([renderer, backend, "--check-pixel-case", shader, case], + capture_output=True, text=True) + # The renderer returns non-zero on a mismatch, so 0 and 1 are both expected. Anything else + # means the case never ran, and treating it as "no channel lines" would read as no + # divergence at all. + if result.returncode not in (0, 1): + raise AssertionError(f"{case} exited {result.returncode} on {backend}: " + f"{result.stderr.strip()[-400:]}") + found = {} + for line in result.stderr.splitlines(): + match = re.search(r"channel=(\d+).*expected_bits=([0-9a-f]{8}) actual_bits=([0-9a-f]{8})", line) + if match: + expected_bits, actual_bits = int(match.group(2), 16), int(match.group(3), 16) + if expected_bits != actual_bits: + found[int(match.group(1))] = (expected_bits, actual_bits) + return found + + def only_the_subnormal_bit(index, found, mode): + for channel, (expected_bits, actual_bits) in found.items(): + # Channel 0 carries the legacy immediate this entry exists for. Bit 18 also exists on + # channel 1 (v_cmp_gt_f32_e64 s52, s44, -1.0), so an unscoped bit mask would swallow a + # regression there and even count it as a reproduction. + if channel != 0 or expected_bits ^ actual_bits != 1 << 18 or not actual_bits & (1 << 18): + raise AssertionError( + f"Case {index} channel {channel} differs outside the known subnormal bit under " + f"{mode}: expected {expected_bits:08x} actual {actual_bits:08x} (#958)") + + compile_shader(compiler, source, shader) + reproduced = [] + for index, case in enumerate(cases_for("cmp-guard-preserve")): + found = divergences(case) + only_the_subnormal_bit(index, found, "-denorm preserve") + if found: + reproduced.append(index) + print(f"known mismatch (#958): case {index} compares the subnormal immediate as zero") + else: + print(f"known mismatch (#958) did not reproduce: case {index}") + print(f"known mismatch (#958): {len(reproduced)} of {len(F32_COMPARE_SETS)} sets reproduced") + + compile_shader(compiler, source, shader, mode="ftz") + flushed = [] + for index, words in enumerate(F32_COMPARE_SETS): + constants = bytearray(256) + struct.pack_into("<4I", constants, 12, *words) + expected = tuple(as_float(w) for w in + f32_compares_reference(words, legacy_immediate=True, flushed=True)) + flushed.append((write_case(directory / f"cmp-guard-ftz-{index}.case", constants, expected, + integer_rt=True), "pass")) + run_pixel_batch(renderer, backend, shader, flushed) + + def check_predicate_and_rounding_draws(directory, compiler, renderer, backend): source = directory / "fixture.hlsl" shader = directory / "fixture.cso" @@ -15628,6 +15741,13 @@ def main(): if error.returncode == 77 and str(error.cmd[0]) == str(args[1]): return 77 raise + if mode == "draw-cmp-guard-diagnostic": + try: + return check_cmp_guard_diagnostic(directory, *args) + except subprocess.CalledProcessError as error: + if error.returncode == 77 and str(error.cmd[0]) == str(args[1]): + return 77 + raise if mode == "draw-comparisons": try: return check_comparison_draws(directory, *args) -- 2.53.0 ``` </details> ### What the first version of this arrangement got wrong An external review of the version I posted earlier found four things, all fixed above: 1. The tolerance was scoped to the bit but not to the channel, so a bit-18 regression on channel 1 would have been swallowed *and* counted as a reproduction. 2. The draw's exit status was never checked, so a renderer that failed before printing would have read as "no divergence". 3. The immediate-typing assertion was `"asfloat(1u)" in source`, which is vacuous — 75 occurrences. 4. The commit message claimed the ftz half "pins that the divergence follows the denormal mode". That is not what it shows: the hardware word is identical in both modes, only the expectation changes. Two smaller corrections, in the same spirit: bit 18 only carries a real subnormal on 2 of the 7 sets (the ones whose `rhs` has its sign bit — on the others the emitted comparison is `0.0 > 0.0`), and the `gt`→`ge` mutation is caught through the equality set, not through the subnormal ones. I have not written the experimental note with the raw words and the RGA caveat — say the word and I will draft it against these numbers, including the fact that RGA compiles its own pipeline so the ISA listing and the draw are separate evidence. _AI-assisted; runs on the adapter above, ISA shape from the RGA listings posted in this thread._
thepatrickworld commented 2026-11-24 06:49:50 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T22:54:17Z.


Go ahead — I don't have it in progress. You have the gfx1200 listing and MasterDomino has the gfx1201 one; I did not run RGA at all, so I have no ISA measurement of my own to contribute.

What my run adds is the RX 9070 XT column, and the eight hardware rows are below complete, with all four channel words and the per-row fields (the log prints them per row; my earlier table elided them).

dxc=dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727)
backend=hardware debug_layer=unavailable
adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
driver=32.0.32029.2010
shader=plain denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000000,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1
shader=guarded denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1
shader=guarded-runtime denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000000,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1
shader=guarded-runtime-and denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1
shader=plain-runtime denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000000,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1
shader=guarded-max-subnormal denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1
shader=unrelated-guard denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1
shader=guarded-runtime-and denorm=ftz dxil="fp32-denorm-mode"="ftz" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1

My WARP capture is a summary, not eight lines: 00000000 on all seven preserve rows, and 00000001 on guarded-runtime-and under ftz.

Four things to carry so the note stays inside its evidence.

1. The divergence is four rows, not one. The preserve rows that differ between backends are guarded, guarded-runtime-and, guarded-max-subnormal and unrelated-guard — 00000001 on hardware, 00000000 on WARP. plain, guarded-runtime and plain-runtime agree at 00000000, and the ftz row agrees at 00000001 on both. So the split is not "hardware reads subnormals, WARP flushes": it is exactly the set of shapes that carry an and i1, and it has to be stated that way or the table is just a list of lines.

2. words= and all_64_pixels_equal mean less than they look. words= is the four channel words of the first pixel the renderer reports; the script's docstring calls that (0, 0) but the code does not assert the coordinate. all_64_pixels_equal=true comes from a second draw that uses those four words as the expectation for all 64 pixels: it establishes that the 64 pixels (256 words) are uniform, not that they are IEEE-correct. And ieee= / flushed= are literal expectations in the shader list, not a computed reference.

3. My renderer is the same code as yours, not a different one. d35a24907 is not a commit — yours is 35a24907d17bc253fa33c0b3be171691debe0468. The renderer sources are byte-identical at that commit and at mine (tests/offscreen_check.cpp, tests/pixel_aot_render.cpp and tests/pixel_aot_vs.hlsl share the same blob hashes), so the eight words being identical to your 9060 XT rows is expected. The independent variable is the device, 1002:7550 on driver 32.0.32029.2010, i.e. gfx1201 against your gfx1200 — not the commit.

4. Provenance. DXC 1.9.2602.17 (21d28f727), flags -Gis -denorm <preserve|ftz> -T ps_6_2 -E main; renderer out/build/dev/offscreen_check.exe, dev preset, built at 2d8a0cc, SHA-256 44bee69a4afcd0d83e2e22f33fa14947a582fa94e7b31ce6131076a02f73f2b1, 2 310 144 bytes; Windows 10.0.26200.9711; debug_layer=unavailable on both backends. Scripts unchanged from your published blocks: f32_guard_pair.py c3f247f8…d14b68c, guard_shape_draw.py 3532e2a3…f0080bd. One run on the 9070 XT, against your three on the 9060 XT — the second draw inside a run is uniformity, not repeatability, so write the asymmetry rather than implying three on both.

On the RGA paragraph I would be a blocker rather than a reviewer of style: it needs gfx1200 attributed to your run and gfx1201 to MasterDomino's, the two drivers kept distinct (32.0.32029.2010 vs 32.0.31044.16), and the caveat stated in its own sentence — RGA compiles its own pipeline, with its own blend, rasterizer and sample state, so the ISA listing and the draw are two separate pieces of evidence, not a capture of the same pipeline.

Ping me when the patch is up and I will check the table and the DXIL lines against these rows.

AI-assisted; one machine, one adapter.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7116318595 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7116318595). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-23T22:54:17Z. --- Go ahead — I don't have it in progress. You have the gfx1200 listing and MasterDomino has the gfx1201 one; I did not run RGA at all, so I have no ISA measurement of my own to contribute. What my run adds is the RX 9070 XT column, and the eight hardware rows are below complete, with all four channel words and the per-row fields (the log prints them per row; my earlier table elided them). ``` dxc=dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727) backend=hardware debug_layer=unavailable adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550 driver=32.0.32029.2010 shader=plain denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000000,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1 shader=guarded denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1 shader=guarded-runtime denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000000,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1 shader=guarded-runtime-and denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1 shader=plain-runtime denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000000,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1 shader=guarded-max-subnormal denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1 shader=unrelated-guard denorm=preserve dxil="fp32-denorm-mode"="preserve" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1 shader=guarded-runtime-and denorm=ftz dxil="fp32-denorm-mode"="ftz" words=00000001,00000000,00000000,00000000 all_64_pixels_equal=true ieee=0 flushed=1 ``` My WARP capture is a summary, not eight lines: `00000000` on all seven preserve rows, and `00000001` on `guarded-runtime-and` under `ftz`. Four things to carry so the note stays inside its evidence. **1. The divergence is four rows, not one.** The preserve rows that differ between backends are `guarded`, `guarded-runtime-and`, `guarded-max-subnormal` and `unrelated-guard` — `00000001` on hardware, `00000000` on WARP. `plain`, `guarded-runtime` and `plain-runtime` agree at `00000000`, and the `ftz` row agrees at `00000001` on both. So the split is not "hardware reads subnormals, WARP flushes": it is exactly the set of shapes that carry an `and i1`, and it has to be stated that way or the table is just a list of lines. **2. `words=` and `all_64_pixels_equal` mean less than they look.** `words=` is the four channel words of the first pixel the renderer reports; the script's docstring calls that `(0, 0)` but the code does not assert the coordinate. `all_64_pixels_equal=true` comes from a second draw that uses those four words as the expectation for all 64 pixels: it establishes that the 64 pixels (256 words) are uniform, not that they are IEEE-correct. And `ieee=` / `flushed=` are literal expectations in the shader list, not a computed reference. **3. My renderer is the same code as yours, not a different one.** `d35a24907` is not a commit — yours is `35a24907d17bc253fa33c0b3be171691debe0468`. The renderer sources are byte-identical at that commit and at mine (`tests/offscreen_check.cpp`, `tests/pixel_aot_render.cpp` and `tests/pixel_aot_vs.hlsl` share the same blob hashes), so the eight words being identical to your 9060 XT rows is expected. The independent variable is the device, `1002:7550` on driver `32.0.32029.2010`, i.e. gfx1201 against your gfx1200 — not the commit. **4. Provenance.** DXC `1.9.2602.17` (`21d28f727`), flags `-Gis -denorm <preserve|ftz> -T ps_6_2 -E main`; renderer `out/build/dev/offscreen_check.exe`, dev preset, built at `2d8a0cc`, SHA-256 `44bee69a4afcd0d83e2e22f33fa14947a582fa94e7b31ce6131076a02f73f2b1`, 2 310 144 bytes; Windows `10.0.26200.9711`; `debug_layer=unavailable` on both backends. Scripts unchanged from your published blocks: `f32_guard_pair.py` `c3f247f8…d14b68c`, `guard_shape_draw.py` `3532e2a3…f0080bd`. **One run on the 9070 XT, against your three on the 9060 XT** — the second draw inside a run is uniformity, not repeatability, so write the asymmetry rather than implying three on both. On the RGA paragraph I would be a blocker rather than a reviewer of style: it needs gfx1200 attributed to your run and gfx1201 to MasterDomino's, the two drivers kept distinct (`32.0.32029.2010` vs `32.0.31044.16`), and the caveat stated in its own sentence — RGA compiles its own pipeline, with its own blend, rasterizer and sample state, so the ISA listing and the draw are two separate pieces of evidence, not a capture of the same pipeline. Ping me when the patch is up and I will check the table and the DXIL lines against these rows. _AI-assisted; one machine, one adapter._
trick-ye commented 2026-11-24 06:49:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by trick-ye on 2026-11-23T23:41:16Z.


pixel_aot_comparisons_hardware passed on an RX 7800 XT (RDNA 3) with driver 32.0.32029.2010, at 45ad903 (main when the checkout was cloned at 23:16 UTC on 2026-11-23; upstream main advanced before the runs) and at dae1ca2. This is a related RDNA 3 result for the registered test only. The request in https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7108577394 asked for the five-bit source-built probe and this test on an RX 7900 XTX; this is a different RDNA 3 card, and I did not run the five-bit probe.

Environment

  • AMD Radeon RX 7800 XT (1002:747e), driver 32.0.32029.2010 (AMD Software 26.11.2). It is the only display adapter in this PC.
  • Windows 11 Pro, build 26200.9974
  • MSVC 19.42.34436, Windows SDK 10.0.26100.0, DXC 1.9.2602.17, Python 3.13.0, dev preset
  • Debug layer: the passing pixel tests did not print a renderer header, so their debug-layer status is not shown in these logs. A separate offscreen_hardware run from the 45ad903 build reported backend=hardware debug_layer=enabled, adapter=AMD Radeon RX 7800 XT vendor=1002 device=747e, driver=32.0.32029.2010 and debug_errors=0 debug_warnings=0.
  • Wave width: not printed by these two tests and not measured in this run.

Command

Run from each checkout's root, three times at each commit:

ctest --preset dev --no-tests=error -j 1 -R '^pixel_aot_comparisons_(hardware|warp)$' -V

Result

Expected: both backends pass the strict fixture. Observed: hardware and WARP each passed all three runs at each commit. Capability skips: none in these six CTest invocations. The earlier RDNA 4 reports in this thread failed at f32-cmp-1.case with expected_bits=0008cccc actual_bits=000ccccc (excerpt).

Commit Run pixel_aot_comparisons_hardware pixel_aot_comparisons_warp
45ad903 (main at clone time, clean tree) 1 Passed 22.93 sec Passed 5.90 sec
2 Passed 19.90 sec Passed 5.92 sec
3 Passed 20.33 sec Passed 5.95 sec
dae1ca2 (clean worktree) 1 Passed 20.85 sec Passed 5.88 sec
2 Passed 20.27 sec Passed 5.89 sec
3 Passed 20.41 sec Passed 5.90 sec

Each run reports 100% tests passed, 0 tests failed out of 2.

The RX 7800 XT pass at dae1ca2 does not require a later source commit. At that same commit, the RX 9070 XT report in https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7113578912 failed in four of four runs on driver 32.0.31044.16 with DXC 1.8.2502.11; this run used DXC 1.9.2602.17. The RX 9060 XT in https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7111135937 failed on the same driver version as this RX 7800 XT (32.0.32029.2010), but at 0f0c3eb. These are comparisons, not controls that isolate the GPU, driver or compiler.

Limits

  • One adapter, one driver.
  • I did not rerun with DXC 1.8.2502, so a DXC-dependent DXIL shape is not ruled out by this run.
  • This report covers the registered comparison fixture only. I did not run the five-bit probe from #312 or the reduced guard-pair or shape-table probes from this thread, so I have no raw predicate bits for this adapter.
  • The 45ad903 build linked offscreen_check.exe. Two CPU fixture targets, cpu_exe_tls and cpu_exe_tls_early, failed to link (LNK2019/LNK2001: unresolved __dyn_tls_on_demand_init, __chkstk, __tls_guard, __dyn_tls_init; LNK1120). Neither executable is invoked by the logged pixel tests.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7117243670 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7117243670). Originally posted by [trick-ye](https://github.com/trick-ye) on 2026-11-23T23:41:16Z. --- `pixel_aot_comparisons_hardware` passed on an RX 7800 XT (RDNA 3) with driver `32.0.32029.2010`, at `45ad903` (`main` when the checkout was cloned at 23:16 UTC on 2026-11-23; upstream `main` advanced before the runs) and at `dae1ca2`. This is a related RDNA 3 result for the registered test only. The request in https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7108577394 asked for the five-bit source-built probe and this test on an RX 7900 XTX; this is a different RDNA 3 card, and I did not run the five-bit probe. ## Environment - AMD Radeon RX 7800 XT (`1002:747e`), driver `32.0.32029.2010` (AMD Software 26.11.2). It is the only display adapter in this PC. - Windows 11 Pro, build 26200.9974 - MSVC 19.42.34436, Windows SDK 10.0.26100.0, DXC `1.9.2602.17`, Python 3.13.0, `dev` preset - Debug layer: the passing pixel tests did not print a renderer header, so their debug-layer status is not shown in these logs. A separate `offscreen_hardware` run from the `45ad903` build reported `backend=hardware debug_layer=enabled`, `adapter=AMD Radeon RX 7800 XT vendor=1002 device=747e`, `driver=32.0.32029.2010` and `debug_errors=0 debug_warnings=0`. - Wave width: not printed by these two tests and not measured in this run. ## Command Run from each checkout's root, three times at each commit: ```powershell ctest --preset dev --no-tests=error -j 1 -R '^pixel_aot_comparisons_(hardware|warp)$' -V ``` ## Result Expected: both backends pass the strict fixture. Observed: hardware and WARP each passed all three runs at each commit. Capability skips: none in these six CTest invocations. The earlier RDNA 4 reports in this thread failed at `f32-cmp-1.case` with `expected_bits=0008cccc actual_bits=000ccccc` (excerpt). | Commit | Run | `pixel_aot_comparisons_hardware` | `pixel_aot_comparisons_warp` | |---|---|---|---| | `45ad903` (`main` at clone time, clean tree) | 1 | Passed 22.93 sec | Passed 5.90 sec | | | 2 | Passed 19.90 sec | Passed 5.92 sec | | | 3 | Passed 20.33 sec | Passed 5.95 sec | | `dae1ca2` (clean worktree) | 1 | Passed 20.85 sec | Passed 5.88 sec | | | 2 | Passed 20.27 sec | Passed 5.89 sec | | | 3 | Passed 20.41 sec | Passed 5.90 sec | Each run reports `100% tests passed, 0 tests failed out of 2`. The RX 7800 XT pass at `dae1ca2` does not require a later source commit. At that same commit, the RX 9070 XT report in https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7113578912 failed in four of four runs on driver `32.0.31044.16` with DXC `1.8.2502.11`; this run used DXC `1.9.2602.17`. The RX 9060 XT in https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7111135937 failed on the same driver version as this RX 7800 XT (`32.0.32029.2010`), but at `0f0c3eb`. These are comparisons, not controls that isolate the GPU, driver or compiler. ## Limits - One adapter, one driver. - I did not rerun with DXC 1.8.2502, so a DXC-dependent DXIL shape is not ruled out by this run. - This report covers the registered comparison fixture only. I did not run the five-bit probe from #312 or the reduced guard-pair or shape-table probes from this thread, so I have no raw predicate bits for this adapter. - The `45ad903` build linked `offscreen_check.exe`. Two CPU fixture targets, `cpu_exe_tls` and `cpu_exe_tls_early`, failed to link (LNK2019/LNK2001: unresolved `__dyn_tls_on_demand_init`, `__chkstk`, `__tls_guard`, `__dyn_tls_init`; LNK1120). Neither executable is invoked by the logged pixel tests. AI-assisted (Claude Code).
thepatrickworld commented 2026-11-24 06:49:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T23:49:58Z.


This bounds the phenomenon usefully: the strict entry passes on your RX 7800 XT (gfx1101, RDNA 3) at both 45ad903 and dae1ca2, while the same entry fails on the two RDNA 4 adapters we have (RX 9060 XT 7590/gfx1200 and RX 9070 XT 7550/gfx1201, both on driver 32.0.32029.2010). So it is not "RDNA flushes subnormals in comparisons"; as far as the evidence goes it is RDNA 4 only, and your run is the first data point that separates the generations.

Two things worth having straight, since your report is otherwise complete:

  • Your run says nothing about the diagnostics half of the issue, and I would not read it as agreement with my patch: the test passing means the fixture never reaches the divergent shape there, not that the shape is harmless on gfx1101.
  • The WARP column in the note came from in-box WARP on two Windows builds (10.0.26100.9711). Your run does not state the WARP build; if you add it, the note can cite a third host.

Nothing needed from you unless you want the gfx1101 row in the note; it is @lantiumBot's patch (#1044) and the table there is deliberately RDNA 4 only.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7117411799 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7117411799). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-23T23:49:58Z. --- This bounds the phenomenon usefully: the strict entry passes on your RX 7800 XT (gfx1101, RDNA 3) at both `45ad903` and `dae1ca2`, while the same entry fails on the two RDNA 4 adapters we have (RX 9060 XT `7590`/gfx1200 and RX 9070 XT `7550`/gfx1201, both on driver `32.0.32029.2010`). So it is not "RDNA flushes subnormals in comparisons"; as far as the evidence goes it is RDNA 4 only, and your run is the first data point that separates the generations. Two things worth having straight, since your report is otherwise complete: - Your run says nothing about the diagnostics half of the issue, and I would not read it as agreement with my patch: the test passing means the fixture never reaches the divergent shape there, not that the shape is harmless on gfx1101. - The WARP column in the note came from in-box WARP on two Windows builds (`10.0.26100.9711`). Your run does not state the WARP build; if you add it, the note can cite a third host. Nothing needed from you unless you want the gfx1101 row in the note; it is @lantiumBot's patch (#1044) and the table there is deliberately RDNA 4 only. _AI-assisted._
lantiumBot commented 2026-11-24 06:49:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lantiumBot on 2026-11-24T00:25:10Z.


One open point from the note merged in #1044, measured on the RX 9060 XT: which consumers of the fcmp result go with the flush. That note lists "whether consumers other than and i1 (or, select) trigger it" as not established. Data only, no fixture change.

Short version, for this adapter and driver: and i1 is not the only consumer that goes with the flushed word. With or i1, xor i1, zext followed by an add, and (with a literal operand) zext feeding the value operand of a select, the word is the flushed one too. With a zext that is stored directly, a select that uses the compare as its condition, or a compare that reaches a phi, it is the IEEE one. In each of the 32 shaders the following three are either all present or all absent: the drawn word is the flushed one, the gfx1200 ISA has s_denorm_mode 14 / 15 around the compare, and the ISA turns the compare result into a lane mask.

Setup

Sixteen pixel shaders, each with one compare against the subnormal (and-two-fcmp has a second, unrelated compare), each built with the subnormal as a literal (L = asfloat(1u)) and as data (L = s = params[2].x = 0x00000001): 32 in all, ps_6_2, -Gis -denorm preserve. r = params[1].x = 0x80000000. G is ((asuint(r) & 0x7fffffffu) <= 0x7f800000u); yes and no are params[3].z != 0u and params[3].w != 0u, true and false at run time; a, b = 0x11, 0x22; one, two = 1.0, 2.0 from the constant buffer. Every non-literal operand is read from the constant buffer, so every compare is wave-uniform; the float ones (r, s, one, two) are declared precise.

"DXIL use" is what DXC 1.9.2602.17 does with the result of the subnormal fcmp, read from the listings; the predicate is oeq unless noted. "Lane-mask selects" counts s_cselect_b64 <reg>, exec, 0 in the ISA. The RX 9060 XT cell names which of the two computed expectations the word equals: IEEE, or flushed (the subnormal read as zero).

Shape L Word 0 DXIL use of the fcmp RX 9060 XT s_denorm_mode Lane-mask selects Branches in ISA In-box WARP
plain literal (L == r) ? 1u : 0u zext, stored 00000000 IEEE none 0 0 00000000
and-guard literal (G && (L == r)) ? 1u : 0u and i1 00000001 flushed 14, 15 2 0 00000000
and-guard-gt literal (G && (L > r)) ? 1u : 0u and i1 (fcmp olt) 00000000 flushed 14, 15 2 0 00000001
and-guard-ne literal (G && (L != r)) ? 1u : 0u and i1 (fcmp une) 00000000 flushed 14, 15 2 0 00000001
and-bitwise literal (G & (L == r)) ? 1u : 0u and i1 00000001 flushed 14, 15 2 0 00000000
and-unrelated literal (yes && (L == r)) ? 1u : 0u and i1 00000001 flushed 14, 15 2 0 00000000
and-two-fcmp literal ((one < two) && (L == r)) ? 1u : 0u and i1 00000001 flushed 14, 15 2 0 00000000
or-guard literal (!G || (L == r)) ? 1u : 0u or i1 00000001 flushed 14, 15 2 0 00000000
or-unrelated literal (no || (L == r)) ? 1u : 0u or i1 00000001 flushed 14, 15 2 0 00000000
or-bitwise literal (no | (L == r)) ? 1u : 0u or i1 00000001 flushed 14, 15 2 0 00000000
xor-unrelated literal (yes != (L == r)) ? 1u : 0u xor i1 00000000 flushed 14, 15 2 0 00000001
select-data literal (L == r) ? a : b select condition 00000022 IEEE none 0 0 00000022
select-as-value literal G ? ((L == r) ? 1u : 0u) : 0u zext, then select value operand 00000001 flushed 14, 15 2 0 00000000
ternary-bool literal (G ? (L == r) : false) ? 1u : 0u and i1 00000001 flushed 14, 15 2 0 00000000
zext-add literal uint(L == r) + a zext, then add 00000012 flushed 14, 15 1 0 00000011
not literal (!(L == r)) ? 1u : 0u zext, stored (fcmp une) 00000001 IEEE none 0 0 00000001
plain data (L == r) ? 1u : 0u zext, stored 00000000 IEEE none 0 0 00000000
and-guard data (G && (L == r)) ? 1u : 0u phi (after br) 00000000 IEEE none 0 2 00000000
and-guard-gt data (G && (L > r)) ? 1u : 0u phi (after br) (fcmp ogt) 00000001 IEEE none 0 2 00000001
and-guard-ne data (G && (L != r)) ? 1u : 0u phi (after br) (fcmp une) 00000001 IEEE none 0 2 00000001
and-bitwise data (G & (L == r)) ? 1u : 0u and i1 00000001 flushed 14, 15 2 0 00000000
and-unrelated data (yes && (L == r)) ? 1u : 0u phi (after br) 00000000 IEEE none 0 2 00000000
and-two-fcmp data ((one < two) && (L == r)) ? 1u : 0u phi (after br) 00000000 IEEE none 0 2 00000000
or-guard data (!G || (L == r)) ? 1u : 0u phi (after br) 00000000 IEEE none 0 2 00000000
or-unrelated data (no || (L == r)) ? 1u : 0u phi (after br) 00000000 IEEE none 0 2 00000000
or-bitwise data (no | (L == r)) ? 1u : 0u or i1 00000001 flushed 14, 15 2 0 00000000
xor-unrelated data (yes != (L == r)) ? 1u : 0u xor i1 00000000 flushed 14, 15 2 0 00000001
select-data data (L == r) ? a : b select condition 00000022 IEEE none 0 0 00000022
select-as-value data G ? ((L == r) ? 1u : 0u) : 0u zext, then phi (after br) 00000000 IEEE none 0 2 00000000
ternary-bool data (G ? (L == r) : false) ? 1u : 0u phi (after br) 00000000 IEEE none 0 2 00000000
zext-add data uint(L == r) + a zext, then add 00000012 flushed 14, 15 1 0 00000011
not data (!(L == r)) ? 1u : 0u zext, stored (fcmp une) 00000001 IEEE none 0 0 00000001

The whole probe was run three times on each backend with the script quoted below. Each run draws every shader three times, and the three log files of each backend are byte-identical, so all nine draws per shader and backend gave the same four words. Words 1 to 3 were zero. A further draw with the observed words as the expectation passed over the whole 64x64 target (a uniformity check, not a repeat). WARP returned the IEEE word in all 32. The 32 pixel ISA files are byte-identical across the three runs.

Control: the same 32 shaders built with -denorm ftz (DXIL attribute "fp32-denorm-mode"="ftz" in all 32) gave the flushed word in all 32 on both backends, and none of the 32 ftz listings contains s_denorm_mode. The ftz listings have the same lane-mask select counts as the preserve ones, shader for shader.

Five literal rows are two DXIL programs: DXC emits byte-identical DXIL for and-guard, and-bitwise and ternary-bool, and for or-unrelated and or-bitwise. No other two of the 32 DXIL listings are identical. With a data operand, and-guard and ternary-bool have different DXIL (the order of the phi operands) and byte-identical ISA.

What the table shows

  • 17 rows are flushed and 15 are IEEE; the 17 flushed rows are 14 distinct DXIL programs. Each flushed row has the mode switch and at least one lane-mask select; no IEEE row has either.
  • Flushed: and i1 (with oeq, olt and une), or i1, xor i1, zext then add, and zext then the value operand of a select. Where a data operand gives the same DXIL shape (and-bitwise, or-bitwise, xor-unrelated, zext-add), the data row is flushed too.
  • IEEE: zext stored directly (plain, not), select on the compare, and every shader where DXC emitted a branch and the compare reaches a phi.
  • In these 32, every literal against data difference coincides with a DXIL shape difference, and where the shape is the same the two agree. In these 16 data shaders DXC turns &&, || and a ?: whose arm contains the compare (select-as-value, ternary-bool) into a branch; those 9 rows are IEEE.
  • plain and zext-add differ only by the + a after the zext, and only zext-add is flushed.
  • With a literal operand, select-data (compare as the condition) is IEEE and select-as-value (compare as a value operand) is flushed. That pair is not minimal: select-as-value also carries the guard G, and the driver compiles it to the same instruction sequence as and-guard, except for the source order of one s_and_b64.

What the ISA shows

Every one of the 32 listings uses a scalar float compare on SGPRs (s_cmp_eq_f32, s_cmp_lt_f32, s_cmp_gt_f32 or s_cmp_neq_f32); no listing has a v_cmp_*_f32. In the 16 literal listings the subnormal is the inline constant 1, in the 16 data listings it is a second SGPR. Within each shape the compare is the same instruction with a literal and with data, except and-guard-gt, where DXC writes fcmp olt r, L for the literal and fcmp ogt s, r for data, giving s_cmp_lt_f32 and s_cmp_gt_f32 for the same relation. What differs between the IEEE and the flushed rows is how the result is consumed. Below, s_wait_* and s_delay_alu lines are removed, the prologue before the first cbuffer load is cut, and each listing ends at its export.

plain, literal: IEEE
	s_buffer_load_b32 s0, s[0:3], 0x10
	s_cmp_eq_f32 s0, 1
	s_cselect_b32 s0, 1, 0
	v_mov_b32_e32 v1, s0
	export mrt0, v1, v0, v0, v0 done

select-data, literal: IEEE
	s_buffer_load_b32 s4, s[0:3], 0x10
	s_buffer_load_b64 s[0:1], s[0:3], 0x30
	s_cmp_eq_f32 s4, 1
	s_cselect_b32 s0, s0, s1
	v_mov_b32_e32 v1, s0
	export mrt0, v1, v0, v0, v0 done

and-guard, literal: flushed
	s_buffer_load_b32 s0, s[0:3], 0x10
	s_and_b32 s1, 0x7fffffff, s0
	s_denorm_mode 14
	s_cmp_eq_f32 s0, 1
	s_cselect_b64 s[2:3], exec, 0
	s_cmp_lt_u32 s1, 0x7f800001
	s_cselect_b64 s[0:1], exec, 0
	s_and_b64 s[0:1], s[0:1], s[2:3]
	s_and_b64 s[0:1], s[0:1], exec
	s_cselect_b32 s0, 1, 0
	v_mov_b32_e32 v1, s0
	s_denorm_mode 15
	export mrt0, v1, v0, v0, v0 done

zext-add, literal: flushed
	s_buffer_load_b32 s4, s[0:3], 0x10
	s_buffer_load_b32 s0, s[0:3], 0x30
	s_denorm_mode 14
	s_cmp_eq_f32 s4, 1
	s_cselect_b64 vcc, exec, 0
	v_add_co_ci_u32_e64 v0, vcc_lo, s0, 0, vcc_lo
	v_mov_b32_e32 v1, 0
	s_denorm_mode 15
	export mrt0, v0, v1, v1, v1 done

In the IEEE rows the flag set by the compare goes straight into a scalar s_cselect_b32. In the flushed rows it is first widened to a 64-bit lane mask with s_cselect_b64 ..., exec, 0, then combined with mask logic or used by a vector instruction, and the mode switch brackets that sequence.

On the operand of s_denorm_mode: the LLVM AMDGPU backend builds it as SPDenormMode | (DPDenormModeDefault << 2) (getSPDenormModeValue in llvm/lib/Target/AMDGPU/SIISelLowering.cpp), with FP_DENORM_FLUSH_IN = 2 and FP_DENORM_FLUSH_NONE = 3 (SIDefines.h), the second field covering binary64 and binary16 (SIModeRegisterDefaults.h). Read that way, 15 is no flush for either field and 14 is flush-input for binary32 only, which is the reading given earlier in this issue. It agrees with the drawn words, which are what the compare that reads the subnormal gives if that operand is read as zero. Each of the 17 brackets holds that one compare; in and-two-fcmp with a literal it also holds the one < two compare, which has no subnormal operand. This is LLVM's encoding of the hardware MODE field (LLVM main, read on 2026-11-24); I did not find it in an AMD RDNA 4 reference.

Hypothesis, not established

On this adapter and driver the switch goes with the driver compiler materializing a scalar float compare as a lane mask, rather than with any particular DXIL opcode. That is a pattern over these 32 preserve listings on one device: under ftz the same lane-mask selects are present with no switch, so the mask path alone does not bring the switch. It does not say why mode 14 is selected there, and it may not be the cause: the mask path and the mode switch could both follow from something else in the compiler.

Environment

  • Renderer: offscreen_check from the dev preset (Debug), rebuilt at commit 7baa8543348bcd4bee1456723799fe02bede32a7 on a clean tree, SHA-256 085e34b79ca50d5030a017444f7c8b895459da150d2c6bc176d6fd557fe099f4. That commit was the local main checkout; upstream main had already advanced, including the docs-only merge of #1044.
  • Script: SHA-256 3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252. Every log records the commit, the clean tree, the renderer hash and the script hash, and all runs reported here carry these values.
  • Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), driver 32.0.32029.2010
  • WARP: Microsoft Basic Render Driver (1414:008c), in-box, driver 10.0.26100.10068
  • Windows build: 26300.10075, D3D12 debug layer unavailable
  • DXC 1.9.2602.17 (21d28f727); RGA 2.15.0.30, DX12 mode, gfx1200, wave64 listings, pipeline inputs taken from draw_verified(): tests/pixel_aot_vs.hlsl as vs_6_0, its root signature, one R32G32B32A32_UINT target; other state is RGA's own

Limits

  • RGA compiles its own pipeline object, with its own blend, rasterizer and sample state: the ISA columns and the draw column are separate evidence. They agree in all 32 rows here.
  • Driver library: the 32 pixel ISA files are byte-identical in three RGA modes: the default mode, --offline --amdxc pointing at the amdxc64.dll of the active driver package (u0206168, version string 8.18.10.0514, binary file version 32.0.32029.2010, SHA-256 67b564e684796142371af3bf5ba04055fd9301fd3501f508113fa9ef0034b779), and --offline --amdxc pointing at the copy bundled with RGA (version string 8.18.10.0514, binary file version 32.0.32015.2008, SHA-256 49fa70e3a73a3c6f9af56f27172532803c665971d7e6a98f9f68004081182841). So two builds of the library give the same listings for these 32 shaders. I did not trace which library the default mode loads.
  • Every float compare here has wave-uniform operands and compiles to a scalar s_cmp_*_f32. Per-lane operands were not tested; I would expect them to compile to v_cmp_*_f32, and did not check.
  • One subnormal value (0x00000001) against one other operand (-0.0), with three relations (==, >, !=).
  • One device, one driver, one DXC. No gfx1201 run and no other vendor, so this narrows the open point for the RX 9060 XT; it does not settle it for the RX 9070 XT or other drivers. No RDNA 3 or earlier adapter was run with these shapes; the RX 7800 XT report above covers the registered fixture only.
  • The three runs were made back to back in one session. The wave width of the draws themselves was not recorded; wave64 is what RGA compiled.
  • Raw words are from the first pixel the renderer reports.
  • Nothing here addresses native gfx1013 or the console.

If useful, I can open a follow-up docs PR that narrows the "not established" clause merged in #1044 to what is measured here for the RX 9060 XT, or leave the note as it stands and keep this in the issue.

guard_consumers.py (uncommitted)
python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware preserve <rga.exe> gfx1200 <outdir>
python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp preserve
python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware ftz <rga.exe> gfx1200 <outdir>
python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp ftz
python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware preserve <rga.exe> gfx1200 <outdir> <amdxc64.dll>
"""Local, uncommitted probe for issue #958: which consumers of the fcmp result go with the flush?

Each pixel shader (ps_6_2, -Gis) compares the least subnormal with r = -0.0 and feeds the compare into
one consumer. L is the subnormal either as a literal, asfloat(1u), or as data, s = params[2].x.
For each shader the script reports:
  - what the DXIL does with the fcmp result (the opcodes that use it);
  - word 0 of the first pixel the repository renderer reports from its R32G32B32A32_UINT target, for
    three draws, then one draw with the observed words as the expectation to check the whole target;
  - with RGA, the s_denorm_mode instructions, lane-mask selects and branches in the driver's ISA.
The IEEE and flushed expectations are computed from the expression, not measured.
Every run prints the checkout, the renderer hash and this script's hash.

Usage: guard_consumers.py <repo> <dxc> <offscreen_check> <hardware|warp> <preserve|ftz>
                          [<rga> <asic> <outdir> [<amdxc64.dll for rga --offline --amdxc>]]
"""
from pathlib import Path
import hashlib
import re
import struct
import subprocess
import sys
import tempfile

HEADER = ("cbuffer Constants : register(b0) { uint4 params[16]; };\n"
          "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {\n"
          "    precise float r = asfloat(params[1].x);\n"      # 0x80000000, -0.0
          "    precise float s = asfloat(params[2].x);\n"      # 0x00000001, least subnormal
          "    uint a = params[3].x;\n    uint b = params[3].y;\n"   # 0x11, 0x22
          "    bool yes = params[3].z != 0u;\n"               # true at run time
          "    bool no = params[3].w != 0u;\n"                # false at run time
          "    precise float one = asfloat(params[4].x);\n    precise float two = asfloat(params[4].y);\n")
GUARD = "((asuint(r) & 0x7fffffffu) <= 0x7f800000u)"
# (name, expression giving word 0 as uint, value under IEEE, value when the subnormal reads as zero)
# IEEE: 0x00000001 == -0.0 is false, > is true, != is true. Flushed: +0 == -0 is true, > is false, != is false.
SHAPES = (
    ("plain", "(L == r) ? 1u : 0u", 0, 1),
    ("and-guard", f"({GUARD} && (L == r)) ? 1u : 0u", 0, 1),
    ("and-guard-gt", f"({GUARD} && (L > r)) ? 1u : 0u", 1, 0),
    ("and-guard-ne", f"({GUARD} && (L != r)) ? 1u : 0u", 1, 0),
    ("and-bitwise", f"({GUARD} & (L == r)) ? 1u : 0u", 0, 1),
    ("and-unrelated", "(yes && (L == r)) ? 1u : 0u", 0, 1),
    ("and-two-fcmp", "((one < two) && (L == r)) ? 1u : 0u", 0, 1),
    ("or-guard", f"(!{GUARD} || (L == r)) ? 1u : 0u", 0, 1),
    ("or-unrelated", "(no || (L == r)) ? 1u : 0u", 0, 1),
    ("or-bitwise", "(no | (L == r)) ? 1u : 0u", 0, 1),
    ("xor-unrelated", "(yes != (L == r)) ? 1u : 0u", 1, 0),
    ("select-data", "(L == r) ? a : b", 0x22, 0x11),
    ("select-as-value", f"{GUARD} ? ((L == r) ? 1u : 0u) : 0u", 0, 1),
    ("ternary-bool", f"({GUARD} ? (L == r) : false) ? 1u : 0u", 0, 1),
    ("zext-add", "uint(L == r) + a", 0x11, 0x12),
    ("not", "(!(L == r)) ? 1u : 0u", 1, 0),
)
OPERANDS = (("literal", "asfloat(1u)"), ("data", "s"))
SENTINEL = 0x5a5a5a5a
GPSO = ("# schemaVersion\n1.0\n\n# InputLayoutNumElements\n0\n\n# InputLayout\n\n\n#PrimitiveTopologyType\n"
        "D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE\n\n# NumRenderTargets\n1\n\n# RTVFormats\n"
        "{ DXGI_FORMAT_R32G32B32A32_UINT }\n")


def run(args, cwd=None):
    done = subprocess.run([str(x) for x in args], capture_output=True, text=True, cwd=cwd)
    return done.returncode, done.stdout + done.stderr


def sha256(path):
    return hashlib.sha256(Path(path).read_bytes()).hexdigest()


def case(expected):
    constants = bytearray(256)
    struct.pack_into("<I", constants, 16, 0x80000000)                     # params[1].x
    struct.pack_into("<I", constants, 32, 0x00000001)                     # params[2].x
    struct.pack_into("<4I", constants, 48, 0x11, 0x22, 1, 0)              # params[3]
    struct.pack_into("<2f", constants, 64, 1.0, 2.0)                      # params[4].xy
    return bytes(constants) + struct.pack("<4I", *expected) * 64 + bytes([1])  # flags bit 0: integer target


def fcmp_users(dxil, two_compares):
    """Opcodes of the instructions that use the result of the subnormal compare."""
    lines = dxil.splitlines()
    compares = [(i, m) for i, m in ((i, re.match(r"\s*(%\d+) = fcmp (\w+) ", l)) for i, l in enumerate(lines)) if m]
    assert len(compares) == (2 if two_compares else 1), len(compares)
    # In and-two-fcmp the other compare is `one < two`, an olt, and the subnormal compare is the oeq.
    # (With one compare any predicate can appear: DXC writes `L > r` as `fcmp olt r, L`.)
    index, match = [c for c in compares if c[1].group(2) != "olt"][-1] if two_compares else compares[0]
    name, predicate = match.group(1), match.group(2)
    users = []
    for line in lines[index + 1:]:
        if re.search(re.escape(name) + r"(?!\d)", line):
            word = re.match(r"\s*(?:%\d+ = )?(\w+)", line).group(1)
            users.append(word + (" i1" if word in ("and", "or", "xor") and " i1 " in line else ""))
    return f"fcmp {predicate} -> " + (", ".join(users) or "nothing"), len(compares)


def main(repo, dxc, renderer, backend, denorm, rga=None, asic=None, outdir=None, amdxc=None):
    assert denorm in ("preserve", "ftz"), denorm
    print("dxc=" + run([dxc, "--version"])[1].strip().splitlines()[0])
    # Provenance, recorded at run time.
    head = run(["git", "-C", repo, "rev-parse", "HEAD"])[1].strip()
    dirty = run(["git", "-C", repo, "status", "--porcelain"])[1].strip()
    print(f"repo_head={head} tree_clean={str(not dirty).lower()}")
    print(f"renderer_sha256={sha256(renderer)}")
    print(f"script_sha256={sha256(__file__)}")
    print(f"denorm={denorm}")
    with tempfile.TemporaryDirectory() as tmp:
        path = Path(outdir) if outdir else Path(tmp)
        path.mkdir(parents=True, exist_ok=True)
        if rga:
            vs, rs, gpso = path / "vs.cso", path / "rs.bin", path / "state.gpso"
            assert run([dxc, "-T", "vs_6_0", "-E", "main", "-Fo", vs, Path(repo) / "tests" / "pixel_aot_vs.hlsl"])[0] == 0
            assert run([dxc, "-dumpbin", vs, "-extractrootsignature", "-Fo", rs])[0] == 0
            gpso.write_text(GPSO, encoding="ascii")
            print("rga=" + run([rga, "-s", "dx12", "--version"], cwd=path)[1].strip().splitlines()[0])
            print("rga_driver=" + (f"offline amdxc={Path(amdxc).name} sha256={sha256(amdxc)}" if amdxc else "default"))
        printed = False
        for operand, left in OPERANDS:
            for name, expression, ieee, flushed in SHAPES:
                stem = path / f"{name}-{operand}"
                source, cso, listing, probe = (Path(f"{stem}.{e}") for e in ("hlsl", "cso", "ll", "case"))
                source.write_text(HEADER + f"    uint w = {expression.replace('L', left)};\n"
                                  "    return uint4(w, 0u, 0u, 0u);\n}\n", encoding="ascii")
                code, text = run([dxc, "-Gis", "-denorm", denorm, "-T", "ps_6_2", "-E", "main",
                                  "-Fo", cso, "-Fc", listing, source])
                assert code == 0, text
                dxil = listing.read_text(encoding="utf-8", errors="replace")
                attribute = next((l.split("{", 1)[1].split("}")[0].strip() for l in dxil.splitlines()
                                  if "fp32-denorm-mode" in l), "absent")
                shape, compares = fcmp_users(dxil, name == "and-two-fcmp")
                observed = []
                for _ in range(3):
                    probe.write_bytes(case([SENTINEL] * 4))
                    code, output = run([renderer, backend, "--check-pixel-case", cso, probe])
                    if not printed:
                        print("\n".join(l for l in output.splitlines() if l.startswith(("backend=", "adapter=", "driver="))))
                        printed = True
                    words = [int(w, 16) for w in re.findall(r"actual_bits=([0-9a-f]{8})", output)]
                    assert code == 1 and len(words) == 4, output
                    observed.append(tuple(words))
                same = len(set(observed)) == 1
                probe.write_bytes(case(observed[0]))
                uniform = run([renderer, backend, "--check-pixel-case", cso, probe])[0] == 0
                word = observed[0][0]
                verdict = "ieee" if word == ieee else "flushed" if word == flushed else "other"
                switches = ""
                if rga:
                    extra = ["--offline", "--amdxc", amdxc] if amdxc else []
                    code, text = run([rga, "-s", "dx12", "-c", asic, *extra, "--vs-blob", vs, "--ps-blob", cso,
                                      "--rs-bin", rs, "--gpso", gpso, "--isa", Path(f"{stem}.isa")], cwd=path)
                    files = sorted(path.glob(f"{asic}_{stem.name}_pixel.isa"))
                    assert code == 0 and files, text
                    body = files[0].read_text(encoding="utf-8", errors="replace")
                    modes = re.findall(r"s_denorm_mode\s+(\d+)", body)
                    compare = sorted(set(re.findall(r"\b([sv]_cmp_\w+_f32)\b", body)))
                    # A lane mask built from the scalar compare flag: s_cselect_b64 <reg>, exec, 0.
                    mask = len(re.findall(r"s_cselect_b64\s+\S+\s+exec,\s*0", body))
                    switches = (f" s_denorm_mode=[{','.join(modes)}] "
                                f"branches={len(re.findall(r's_cbranch|s_branch ', body))} "
                                f"float_compare=[{','.join(compare)}] lane_mask_selects={mask} isa_sha256={sha256(files[0])[:16]}")
                print(f"shape={name} operand={operand} dxil[{shape}; fcmp_count={compares}; {attribute}] word0={word:08x} "
                      f"words123={'zero' if observed[0][1:] == (0, 0, 0) else observed[0][1:]} three_draws_identical={str(same).lower()} "
                      f"whole_target_equal={str(uniform).lower()} ieee={ieee:x} flushed={flushed:x} -> {verdict}{switches}",
                      flush=True)
    return 0


if __name__ == "__main__":
    sys.exit(main(*sys.argv[1:]))

AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118048180 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118048180). Originally posted by [lantiumBot](https://github.com/lantiumBot) on 2026-11-24T00:25:10Z. --- One open point from the note merged in #1044, measured on the RX 9060 XT: which consumers of the `fcmp` result go with the flush. That note lists "whether consumers other than `and i1` (`or`, `select`) trigger it" as not established. Data only, no fixture change. Short version, for this adapter and driver: `and i1` is not the only consumer that goes with the flushed word. With `or i1`, `xor i1`, `zext` followed by an `add`, and (with a literal operand) `zext` feeding the value operand of a `select`, the word is the flushed one too. With a `zext` that is stored directly, a `select` that uses the compare as its condition, or a compare that reaches a `phi`, it is the IEEE one. In each of the 32 shaders the following three are either all present or all absent: the drawn word is the flushed one, the `gfx1200` ISA has `s_denorm_mode 14` / `15` around the compare, and the ISA turns the compare result into a lane mask. ### Setup Sixteen pixel shaders, each with one compare against the subnormal (`and-two-fcmp` has a second, unrelated compare), each built with the subnormal as a literal (`L` = `asfloat(1u)`) and as data (`L` = `s` = `params[2].x` = `0x00000001`): 32 in all, `ps_6_2`, `-Gis -denorm preserve`. `r` = `params[1].x` = `0x80000000`. `G` is `((asuint(r) & 0x7fffffffu) <= 0x7f800000u)`; `yes` and `no` are `params[3].z != 0u` and `params[3].w != 0u`, true and false at run time; `a`, `b` = `0x11`, `0x22`; `one`, `two` = 1.0, 2.0 from the constant buffer. Every non-literal operand is read from the constant buffer, so every compare is wave-uniform; the float ones (`r`, `s`, `one`, `two`) are declared `precise`. "DXIL use" is what DXC 1.9.2602.17 does with the result of the subnormal `fcmp`, read from the listings; the predicate is `oeq` unless noted. "Lane-mask selects" counts `s_cselect_b64 <reg>, exec, 0` in the ISA. The RX 9060 XT cell names which of the two computed expectations the word equals: IEEE, or flushed (the subnormal read as zero). | Shape | `L` | Word 0 | DXIL use of the `fcmp` | RX 9060 XT | `s_denorm_mode` | Lane-mask selects | Branches in ISA | In-box WARP | |---|---|---|---|---|---|---|---|---| | plain | literal | `(L == r) ? 1u : 0u` | `zext`, stored | `00000000` IEEE | none | 0 | 0 | `00000000` | | and-guard | literal | `(G && (L == r)) ? 1u : 0u` | `and i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | and-guard-gt | literal | `(G && (L > r)) ? 1u : 0u` | `and i1` (`fcmp olt`) | **`00000000` flushed** | `14`, `15` | 2 | 0 | `00000001` | | and-guard-ne | literal | `(G && (L != r)) ? 1u : 0u` | `and i1` (`fcmp une`) | **`00000000` flushed** | `14`, `15` | 2 | 0 | `00000001` | | and-bitwise | literal | `(G & (L == r)) ? 1u : 0u` | `and i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | and-unrelated | literal | `(yes && (L == r)) ? 1u : 0u` | `and i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | and-two-fcmp | literal | `((one < two) && (L == r)) ? 1u : 0u` | `and i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | or-guard | literal | `(!G \|\| (L == r)) ? 1u : 0u` | `or i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | or-unrelated | literal | `(no \|\| (L == r)) ? 1u : 0u` | `or i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | or-bitwise | literal | `(no \| (L == r)) ? 1u : 0u` | `or i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | xor-unrelated | literal | `(yes != (L == r)) ? 1u : 0u` | `xor i1` | **`00000000` flushed** | `14`, `15` | 2 | 0 | `00000001` | | select-data | literal | `(L == r) ? a : b` | `select` condition | `00000022` IEEE | none | 0 | 0 | `00000022` | | select-as-value | literal | `G ? ((L == r) ? 1u : 0u) : 0u` | `zext`, then `select` value operand | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | ternary-bool | literal | `(G ? (L == r) : false) ? 1u : 0u` | `and i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | zext-add | literal | `uint(L == r) + a` | `zext`, then `add` | **`00000012` flushed** | `14`, `15` | 1 | 0 | `00000011` | | not | literal | `(!(L == r)) ? 1u : 0u` | `zext`, stored (`fcmp une`) | `00000001` IEEE | none | 0 | 0 | `00000001` | | plain | data | `(L == r) ? 1u : 0u` | `zext`, stored | `00000000` IEEE | none | 0 | 0 | `00000000` | | and-guard | data | `(G && (L == r)) ? 1u : 0u` | `phi` (after `br`) | `00000000` IEEE | none | 0 | 2 | `00000000` | | and-guard-gt | data | `(G && (L > r)) ? 1u : 0u` | `phi` (after `br`) (`fcmp ogt`) | `00000001` IEEE | none | 0 | 2 | `00000001` | | and-guard-ne | data | `(G && (L != r)) ? 1u : 0u` | `phi` (after `br`) (`fcmp une`) | `00000001` IEEE | none | 0 | 2 | `00000001` | | and-bitwise | data | `(G & (L == r)) ? 1u : 0u` | `and i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | and-unrelated | data | `(yes && (L == r)) ? 1u : 0u` | `phi` (after `br`) | `00000000` IEEE | none | 0 | 2 | `00000000` | | and-two-fcmp | data | `((one < two) && (L == r)) ? 1u : 0u` | `phi` (after `br`) | `00000000` IEEE | none | 0 | 2 | `00000000` | | or-guard | data | `(!G \|\| (L == r)) ? 1u : 0u` | `phi` (after `br`) | `00000000` IEEE | none | 0 | 2 | `00000000` | | or-unrelated | data | `(no \|\| (L == r)) ? 1u : 0u` | `phi` (after `br`) | `00000000` IEEE | none | 0 | 2 | `00000000` | | or-bitwise | data | `(no \| (L == r)) ? 1u : 0u` | `or i1` | **`00000001` flushed** | `14`, `15` | 2 | 0 | `00000000` | | xor-unrelated | data | `(yes != (L == r)) ? 1u : 0u` | `xor i1` | **`00000000` flushed** | `14`, `15` | 2 | 0 | `00000001` | | select-data | data | `(L == r) ? a : b` | `select` condition | `00000022` IEEE | none | 0 | 0 | `00000022` | | select-as-value | data | `G ? ((L == r) ? 1u : 0u) : 0u` | `zext`, then `phi` (after `br`) | `00000000` IEEE | none | 0 | 2 | `00000000` | | ternary-bool | data | `(G ? (L == r) : false) ? 1u : 0u` | `phi` (after `br`) | `00000000` IEEE | none | 0 | 2 | `00000000` | | zext-add | data | `uint(L == r) + a` | `zext`, then `add` | **`00000012` flushed** | `14`, `15` | 1 | 0 | `00000011` | | not | data | `(!(L == r)) ? 1u : 0u` | `zext`, stored (`fcmp une`) | `00000001` IEEE | none | 0 | 0 | `00000001` | The whole probe was run three times on each backend with the script quoted below. Each run draws every shader three times, and the three log files of each backend are byte-identical, so all nine draws per shader and backend gave the same four words. Words 1 to 3 were zero. A further draw with the observed words as the expectation passed over the whole 64x64 target (a uniformity check, not a repeat). WARP returned the IEEE word in all 32. The 32 pixel ISA files are byte-identical across the three runs. Control: the same 32 shaders built with `-denorm ftz` (DXIL attribute `"fp32-denorm-mode"="ftz"` in all 32) gave the flushed word in all 32 on both backends, and none of the 32 `ftz` listings contains `s_denorm_mode`. The `ftz` listings have the same lane-mask select counts as the `preserve` ones, shader for shader. Five literal rows are two DXIL programs: DXC emits byte-identical DXIL for `and-guard`, `and-bitwise` and `ternary-bool`, and for `or-unrelated` and `or-bitwise`. No other two of the 32 DXIL listings are identical. With a data operand, `and-guard` and `ternary-bool` have different DXIL (the order of the `phi` operands) and byte-identical ISA. ### What the table shows - 17 rows are flushed and 15 are IEEE; the 17 flushed rows are 14 distinct DXIL programs. Each flushed row has the mode switch and at least one lane-mask select; no IEEE row has either. - Flushed: `and i1` (with `oeq`, `olt` and `une`), `or i1`, `xor i1`, `zext` then `add`, and `zext` then the value operand of a `select`. Where a data operand gives the same DXIL shape (`and-bitwise`, `or-bitwise`, `xor-unrelated`, `zext-add`), the data row is flushed too. - IEEE: `zext` stored directly (`plain`, `not`), `select` on the compare, and every shader where DXC emitted a branch and the compare reaches a `phi`. - In these 32, every literal against data difference coincides with a DXIL shape difference, and where the shape is the same the two agree. In these 16 data shaders DXC turns `&&`, `||` and a `?:` whose arm contains the compare (`select-as-value`, `ternary-bool`) into a branch; those 9 rows are IEEE. - `plain` and `zext-add` differ only by the `+ a` after the `zext`, and only `zext-add` is flushed. - With a literal operand, `select-data` (compare as the condition) is IEEE and `select-as-value` (compare as a value operand) is flushed. That pair is not minimal: `select-as-value` also carries the guard `G`, and the driver compiles it to the same instruction sequence as `and-guard`, except for the source order of one `s_and_b64`. ### What the ISA shows Every one of the 32 listings uses a scalar float compare on SGPRs (`s_cmp_eq_f32`, `s_cmp_lt_f32`, `s_cmp_gt_f32` or `s_cmp_neq_f32`); no listing has a `v_cmp_*_f32`. In the 16 literal listings the subnormal is the inline constant `1`, in the 16 data listings it is a second SGPR. Within each shape the compare is the same instruction with a literal and with data, except `and-guard-gt`, where DXC writes `fcmp olt r, L` for the literal and `fcmp ogt s, r` for data, giving `s_cmp_lt_f32` and `s_cmp_gt_f32` for the same relation. What differs between the IEEE and the flushed rows is how the result is consumed. Below, `s_wait_*` and `s_delay_alu` lines are removed, the prologue before the first cbuffer load is cut, and each listing ends at its `export`. ```text plain, literal: IEEE s_buffer_load_b32 s0, s[0:3], 0x10 s_cmp_eq_f32 s0, 1 s_cselect_b32 s0, 1, 0 v_mov_b32_e32 v1, s0 export mrt0, v1, v0, v0, v0 done select-data, literal: IEEE s_buffer_load_b32 s4, s[0:3], 0x10 s_buffer_load_b64 s[0:1], s[0:3], 0x30 s_cmp_eq_f32 s4, 1 s_cselect_b32 s0, s0, s1 v_mov_b32_e32 v1, s0 export mrt0, v1, v0, v0, v0 done and-guard, literal: flushed s_buffer_load_b32 s0, s[0:3], 0x10 s_and_b32 s1, 0x7fffffff, s0 s_denorm_mode 14 s_cmp_eq_f32 s0, 1 s_cselect_b64 s[2:3], exec, 0 s_cmp_lt_u32 s1, 0x7f800001 s_cselect_b64 s[0:1], exec, 0 s_and_b64 s[0:1], s[0:1], s[2:3] s_and_b64 s[0:1], s[0:1], exec s_cselect_b32 s0, 1, 0 v_mov_b32_e32 v1, s0 s_denorm_mode 15 export mrt0, v1, v0, v0, v0 done zext-add, literal: flushed s_buffer_load_b32 s4, s[0:3], 0x10 s_buffer_load_b32 s0, s[0:3], 0x30 s_denorm_mode 14 s_cmp_eq_f32 s4, 1 s_cselect_b64 vcc, exec, 0 v_add_co_ci_u32_e64 v0, vcc_lo, s0, 0, vcc_lo v_mov_b32_e32 v1, 0 s_denorm_mode 15 export mrt0, v0, v1, v1, v1 done ``` In the IEEE rows the flag set by the compare goes straight into a scalar `s_cselect_b32`. In the flushed rows it is first widened to a 64-bit lane mask with `s_cselect_b64 ..., exec, 0`, then combined with mask logic or used by a vector instruction, and the mode switch brackets that sequence. On the operand of `s_denorm_mode`: the LLVM AMDGPU backend builds it as `SPDenormMode | (DPDenormModeDefault << 2)` (`getSPDenormModeValue` in `llvm/lib/Target/AMDGPU/SIISelLowering.cpp`), with `FP_DENORM_FLUSH_IN` = 2 and `FP_DENORM_FLUSH_NONE` = 3 (`SIDefines.h`), the second field covering binary64 and binary16 (`SIModeRegisterDefaults.h`). Read that way, 15 is no flush for either field and 14 is flush-input for binary32 only, which is the reading given earlier in this issue. It agrees with the drawn words, which are what the compare that reads the subnormal gives if that operand is read as zero. Each of the 17 brackets holds that one compare; in `and-two-fcmp` with a literal it also holds the `one < two` compare, which has no subnormal operand. This is LLVM's encoding of the hardware MODE field (LLVM `main`, read on 2026-11-24); I did not find it in an AMD RDNA 4 reference. ### Hypothesis, not established On this adapter and driver the switch goes with the driver compiler materializing a scalar float compare as a lane mask, rather than with any particular DXIL opcode. That is a pattern over these 32 `preserve` listings on one device: under `ftz` the same lane-mask selects are present with no switch, so the mask path alone does not bring the switch. It does not say why mode 14 is selected there, and it may not be the cause: the mask path and the mode switch could both follow from something else in the compiler. ### Environment - Renderer: `offscreen_check` from the `dev` preset (Debug), rebuilt at commit `7baa8543348bcd4bee1456723799fe02bede32a7` on a clean tree, SHA-256 `085e34b79ca50d5030a017444f7c8b895459da150d2c6bc176d6fd557fe099f4`. That commit was the local `main` checkout; upstream `main` had already advanced, including the docs-only merge of #1044. - Script: SHA-256 `3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252`. Every log records the commit, the clean tree, the renderer hash and the script hash, and all runs reported here carry these values. - Adapter: AMD Radeon RX 9060 XT (vendor=1002 device=7590), driver 32.0.32029.2010 - WARP: Microsoft Basic Render Driver (1414:008c), in-box, driver 10.0.26100.10068 - Windows build: 26300.10075, D3D12 debug layer unavailable - DXC 1.9.2602.17 (21d28f727); RGA 2.15.0.30, DX12 mode, `gfx1200`, wave64 listings, pipeline inputs taken from `draw_verified()`: `tests/pixel_aot_vs.hlsl` as `vs_6_0`, its root signature, one `R32G32B32A32_UINT` target; other state is RGA's own ### Limits - RGA compiles its own pipeline object, with its own blend, rasterizer and sample state: the ISA columns and the draw column are separate evidence. They agree in all 32 rows here. - Driver library: the 32 pixel ISA files are byte-identical in three RGA modes: the default mode, `--offline --amdxc` pointing at the `amdxc64.dll` of the active driver package (`u0206168`, version string 8.18.10.0514, binary file version 32.0.32029.2010, SHA-256 `67b564e684796142371af3bf5ba04055fd9301fd3501f508113fa9ef0034b779`), and `--offline --amdxc` pointing at the copy bundled with RGA (version string 8.18.10.0514, binary file version 32.0.32015.2008, SHA-256 `49fa70e3a73a3c6f9af56f27172532803c665971d7e6a98f9f68004081182841`). So two builds of the library give the same listings for these 32 shaders. I did not trace which library the default mode loads. - Every float compare here has wave-uniform operands and compiles to a scalar `s_cmp_*_f32`. Per-lane operands were not tested; I would expect them to compile to `v_cmp_*_f32`, and did not check. - One subnormal value (`0x00000001`) against one other operand (`-0.0`), with three relations (`==`, `>`, `!=`). - One device, one driver, one DXC. No `gfx1201` run and no other vendor, so this narrows the open point for the RX 9060 XT; it does not settle it for the RX 9070 XT or other drivers. No RDNA 3 or earlier adapter was run with these shapes; the RX 7800 XT report above covers the registered fixture only. - The three runs were made back to back in one session. The wave width of the draws themselves was not recorded; wave64 is what RGA compiled. - Raw words are from the first pixel the renderer reports. - Nothing here addresses native gfx1013 or the console. If useful, I can open a follow-up docs PR that narrows the "not established" clause merged in #1044 to what is measured here for the RX 9060 XT, or leave the note as it stands and keep this in the issue. <details> <summary>guard_consumers.py (uncommitted)</summary> ```powershell python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware preserve <rga.exe> gfx1200 <outdir> python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp preserve python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware ftz <rga.exe> gfx1200 <outdir> python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp ftz python -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware preserve <rga.exe> gfx1200 <outdir> <amdxc64.dll> ``` ```python """Local, uncommitted probe for issue #958: which consumers of the fcmp result go with the flush? Each pixel shader (ps_6_2, -Gis) compares the least subnormal with r = -0.0 and feeds the compare into one consumer. L is the subnormal either as a literal, asfloat(1u), or as data, s = params[2].x. For each shader the script reports: - what the DXIL does with the fcmp result (the opcodes that use it); - word 0 of the first pixel the repository renderer reports from its R32G32B32A32_UINT target, for three draws, then one draw with the observed words as the expectation to check the whole target; - with RGA, the s_denorm_mode instructions, lane-mask selects and branches in the driver's ISA. The IEEE and flushed expectations are computed from the expression, not measured. Every run prints the checkout, the renderer hash and this script's hash. Usage: guard_consumers.py <repo> <dxc> <offscreen_check> <hardware|warp> <preserve|ftz> [<rga> <asic> <outdir> [<amdxc64.dll for rga --offline --amdxc>]] """ from pathlib import Path import hashlib import re import struct import subprocess import sys import tempfile HEADER = ("cbuffer Constants : register(b0) { uint4 params[16]; };\n" "uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {\n" " precise float r = asfloat(params[1].x);\n" # 0x80000000, -0.0 " precise float s = asfloat(params[2].x);\n" # 0x00000001, least subnormal " uint a = params[3].x;\n uint b = params[3].y;\n" # 0x11, 0x22 " bool yes = params[3].z != 0u;\n" # true at run time " bool no = params[3].w != 0u;\n" # false at run time " precise float one = asfloat(params[4].x);\n precise float two = asfloat(params[4].y);\n") GUARD = "((asuint(r) & 0x7fffffffu) <= 0x7f800000u)" # (name, expression giving word 0 as uint, value under IEEE, value when the subnormal reads as zero) # IEEE: 0x00000001 == -0.0 is false, > is true, != is true. Flushed: +0 == -0 is true, > is false, != is false. SHAPES = ( ("plain", "(L == r) ? 1u : 0u", 0, 1), ("and-guard", f"({GUARD} && (L == r)) ? 1u : 0u", 0, 1), ("and-guard-gt", f"({GUARD} && (L > r)) ? 1u : 0u", 1, 0), ("and-guard-ne", f"({GUARD} && (L != r)) ? 1u : 0u", 1, 0), ("and-bitwise", f"({GUARD} & (L == r)) ? 1u : 0u", 0, 1), ("and-unrelated", "(yes && (L == r)) ? 1u : 0u", 0, 1), ("and-two-fcmp", "((one < two) && (L == r)) ? 1u : 0u", 0, 1), ("or-guard", f"(!{GUARD} || (L == r)) ? 1u : 0u", 0, 1), ("or-unrelated", "(no || (L == r)) ? 1u : 0u", 0, 1), ("or-bitwise", "(no | (L == r)) ? 1u : 0u", 0, 1), ("xor-unrelated", "(yes != (L == r)) ? 1u : 0u", 1, 0), ("select-data", "(L == r) ? a : b", 0x22, 0x11), ("select-as-value", f"{GUARD} ? ((L == r) ? 1u : 0u) : 0u", 0, 1), ("ternary-bool", f"({GUARD} ? (L == r) : false) ? 1u : 0u", 0, 1), ("zext-add", "uint(L == r) + a", 0x11, 0x12), ("not", "(!(L == r)) ? 1u : 0u", 1, 0), ) OPERANDS = (("literal", "asfloat(1u)"), ("data", "s")) SENTINEL = 0x5a5a5a5a GPSO = ("# schemaVersion\n1.0\n\n# InputLayoutNumElements\n0\n\n# InputLayout\n\n\n#PrimitiveTopologyType\n" "D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE\n\n# NumRenderTargets\n1\n\n# RTVFormats\n" "{ DXGI_FORMAT_R32G32B32A32_UINT }\n") def run(args, cwd=None): done = subprocess.run([str(x) for x in args], capture_output=True, text=True, cwd=cwd) return done.returncode, done.stdout + done.stderr def sha256(path): return hashlib.sha256(Path(path).read_bytes()).hexdigest() def case(expected): constants = bytearray(256) struct.pack_into("<I", constants, 16, 0x80000000) # params[1].x struct.pack_into("<I", constants, 32, 0x00000001) # params[2].x struct.pack_into("<4I", constants, 48, 0x11, 0x22, 1, 0) # params[3] struct.pack_into("<2f", constants, 64, 1.0, 2.0) # params[4].xy return bytes(constants) + struct.pack("<4I", *expected) * 64 + bytes([1]) # flags bit 0: integer target def fcmp_users(dxil, two_compares): """Opcodes of the instructions that use the result of the subnormal compare.""" lines = dxil.splitlines() compares = [(i, m) for i, m in ((i, re.match(r"\s*(%\d+) = fcmp (\w+) ", l)) for i, l in enumerate(lines)) if m] assert len(compares) == (2 if two_compares else 1), len(compares) # In and-two-fcmp the other compare is `one < two`, an olt, and the subnormal compare is the oeq. # (With one compare any predicate can appear: DXC writes `L > r` as `fcmp olt r, L`.) index, match = [c for c in compares if c[1].group(2) != "olt"][-1] if two_compares else compares[0] name, predicate = match.group(1), match.group(2) users = [] for line in lines[index + 1:]: if re.search(re.escape(name) + r"(?!\d)", line): word = re.match(r"\s*(?:%\d+ = )?(\w+)", line).group(1) users.append(word + (" i1" if word in ("and", "or", "xor") and " i1 " in line else "")) return f"fcmp {predicate} -> " + (", ".join(users) or "nothing"), len(compares) def main(repo, dxc, renderer, backend, denorm, rga=None, asic=None, outdir=None, amdxc=None): assert denorm in ("preserve", "ftz"), denorm print("dxc=" + run([dxc, "--version"])[1].strip().splitlines()[0]) # Provenance, recorded at run time. head = run(["git", "-C", repo, "rev-parse", "HEAD"])[1].strip() dirty = run(["git", "-C", repo, "status", "--porcelain"])[1].strip() print(f"repo_head={head} tree_clean={str(not dirty).lower()}") print(f"renderer_sha256={sha256(renderer)}") print(f"script_sha256={sha256(__file__)}") print(f"denorm={denorm}") with tempfile.TemporaryDirectory() as tmp: path = Path(outdir) if outdir else Path(tmp) path.mkdir(parents=True, exist_ok=True) if rga: vs, rs, gpso = path / "vs.cso", path / "rs.bin", path / "state.gpso" assert run([dxc, "-T", "vs_6_0", "-E", "main", "-Fo", vs, Path(repo) / "tests" / "pixel_aot_vs.hlsl"])[0] == 0 assert run([dxc, "-dumpbin", vs, "-extractrootsignature", "-Fo", rs])[0] == 0 gpso.write_text(GPSO, encoding="ascii") print("rga=" + run([rga, "-s", "dx12", "--version"], cwd=path)[1].strip().splitlines()[0]) print("rga_driver=" + (f"offline amdxc={Path(amdxc).name} sha256={sha256(amdxc)}" if amdxc else "default")) printed = False for operand, left in OPERANDS: for name, expression, ieee, flushed in SHAPES: stem = path / f"{name}-{operand}" source, cso, listing, probe = (Path(f"{stem}.{e}") for e in ("hlsl", "cso", "ll", "case")) source.write_text(HEADER + f" uint w = {expression.replace('L', left)};\n" " return uint4(w, 0u, 0u, 0u);\n}\n", encoding="ascii") code, text = run([dxc, "-Gis", "-denorm", denorm, "-T", "ps_6_2", "-E", "main", "-Fo", cso, "-Fc", listing, source]) assert code == 0, text dxil = listing.read_text(encoding="utf-8", errors="replace") attribute = next((l.split("{", 1)[1].split("}")[0].strip() for l in dxil.splitlines() if "fp32-denorm-mode" in l), "absent") shape, compares = fcmp_users(dxil, name == "and-two-fcmp") observed = [] for _ in range(3): probe.write_bytes(case([SENTINEL] * 4)) code, output = run([renderer, backend, "--check-pixel-case", cso, probe]) if not printed: print("\n".join(l for l in output.splitlines() if l.startswith(("backend=", "adapter=", "driver=")))) printed = True words = [int(w, 16) for w in re.findall(r"actual_bits=([0-9a-f]{8})", output)] assert code == 1 and len(words) == 4, output observed.append(tuple(words)) same = len(set(observed)) == 1 probe.write_bytes(case(observed[0])) uniform = run([renderer, backend, "--check-pixel-case", cso, probe])[0] == 0 word = observed[0][0] verdict = "ieee" if word == ieee else "flushed" if word == flushed else "other" switches = "" if rga: extra = ["--offline", "--amdxc", amdxc] if amdxc else [] code, text = run([rga, "-s", "dx12", "-c", asic, *extra, "--vs-blob", vs, "--ps-blob", cso, "--rs-bin", rs, "--gpso", gpso, "--isa", Path(f"{stem}.isa")], cwd=path) files = sorted(path.glob(f"{asic}_{stem.name}_pixel.isa")) assert code == 0 and files, text body = files[0].read_text(encoding="utf-8", errors="replace") modes = re.findall(r"s_denorm_mode\s+(\d+)", body) compare = sorted(set(re.findall(r"\b([sv]_cmp_\w+_f32)\b", body))) # A lane mask built from the scalar compare flag: s_cselect_b64 <reg>, exec, 0. mask = len(re.findall(r"s_cselect_b64\s+\S+\s+exec,\s*0", body)) switches = (f" s_denorm_mode=[{','.join(modes)}] " f"branches={len(re.findall(r's_cbranch|s_branch ', body))} " f"float_compare=[{','.join(compare)}] lane_mask_selects={mask} isa_sha256={sha256(files[0])[:16]}") print(f"shape={name} operand={operand} dxil[{shape}; fcmp_count={compares}; {attribute}] word0={word:08x} " f"words123={'zero' if observed[0][1:] == (0, 0, 0) else observed[0][1:]} three_draws_identical={str(same).lower()} " f"whole_target_equal={str(uniform).lower()} ieee={ieee:x} flushed={flushed:x} -> {verdict}{switches}", flush=True) return 0 if __name__ == "__main__": sys.exit(main(*sys.argv[1:])) ``` </details> AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.
R0Y00 commented 2026-11-24 06:49:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T00:44:14Z.


Thanks for the 32-shader matrix. On this RX 9060 XT and driver, OR, XOR and arithmetic consumers can reproduce the flushed readback too. Direct storage, use as the condition of a select, and the tested phi kept the IEEE word. That resolves the earlier question about OR for this adapter while keeping the observed ISA correlation separate from cause. #1063 now points to the original strict check. An independent RX 9070 XT run of the same source-built matrix would help test how far the result transfers; keep the strict comparison in place.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118378258 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118378258). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T00:44:14Z. --- Thanks for the 32-shader matrix. On this RX 9060 XT and driver, OR, XOR and arithmetic consumers can reproduce the flushed readback too. Direct storage, use as the condition of a select, and the tested phi kept the IEEE word. That resolves the earlier question about OR for this adapter while keeping the observed ISA correlation separate from cause. #1063 now points to the original strict check. An independent RX 9070 XT run of the same source-built matrix would help test how far the result transfers; keep the strict comparison in place.
thepatrickworld commented 2026-11-24 06:49:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T00:51:12Z.


Ran the same script on an RX 9070 XT. The copy I used is byte-identical to yours — guard_consumers.py SHA-256 3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252, extracted from your comment rather than retyped.

The 32 drawn words match your RX 9060 XT column: same 17 rows flushed, same 15 rows IEEE, same word in every cell, including 00000022 for select-data, 00000012 for zext-add and 00000000 for xor-unrelated.

check RX 9060 XT (yours) RX 9070 XT (this run)
preserve, hardware, flushed rows 17 / 32 17 / 32
preserve, hardware, IEEE rows 15 / 32 15 / 32
preserve, WARP, flushed rows 0 / 32 0 / 32
ftz, hardware 32 / 32 flushed 32 / 32 flushed
ftz, WARP 32 / 32 flushed 32 / 32 flushed

Per shader, the three draws gave the same four words and the whole 64×64 target matched the observed words, in all 32 shaders on both backends. Words 1–3 were zero everywhere, as in yours, and every preserve listing carries "fp32-denorm-mode"="preserve" in the DXIL.

So the consumer rule you derived is not specific to one die: the same rows flush on the second one (device 7550 vs 7590, gfx1201 vs gfx1200 per the datasheet). What this does not widen is the driver — 32.0.32029.2010 on both sides — so another driver version is still untested. And I ran no RGA, so the s_denorm_mode and lane-mask columns are yours only: I am confirming the drawn words, not the ISA correlation.

The four invocations, with no RGA argument:

guard_consumers.py <repo> <dxc> <repo>/out/build/dev/offscreen_check.exe hardware preserve
guard_consumers.py <repo> <dxc> <repo>/out/build/dev/offscreen_check.exe warp preserve
guard_consumers.py <repo> <dxc> <repo>/out/build/dev/offscreen_check.exe hardware ftz
guard_consumers.py <repo> <dxc> <repo>/out/build/dev/offscreen_check.exe warp ftz

Provenance:

dxc=dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727)
repo_head=ed983c1ca79056bd13ac41a2bcf32a1d0a3c9ed2  (main at the time of the run; no tracked modification)
renderer_sha256=df250885fbd1ea7a429dcf1e583adabb8305bb602fb21095adae032e4e628398
script_sha256=3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252
backend=hardware debug_layer=unavailable
adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
driver=32.0.32029.2010
warp=Microsoft Basic Render Driver 1414:008c driver 10.0.26100.9711
Windows=10.0.26200.9711

Two notes on provenance, since both differ from yours. The renderer is built from ed983c1, not 7baa854: a different binary, though the same driver and DXC, so this is a re-run of your script under a different build rather than a different compiler. And tree_clean=false is my own doing: the script runs git status --porcelain at start-up and counts untracked files, while my batch redirects stdout into m_hw_preserve.log and the other three logs in the worktree root, next to the two cmake logs. Those six ?? entries are the whole difference — --untracked-files=no and git diff --stat are both empty, and the renderer was built from ed983c1 with no tracked change.

On the strict check: agreed, and nothing here argues for relaxing it. My patch leaves the existing f32_compares entry and its expectation as they are, and adds a separate entry for the #958 case: it prints which of that fixture's seven comparison sets still fold bit 18 under -denorm preserve, fails on any difference other than that bit, and requires the flush under ftz. It does not cover the 32 consumer shapes — those stay in this issue.

AI-assisted; the script is yours, unmodified, and the four logs are on the machine that ran them.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118502502 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118502502). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T00:51:12Z. --- Ran the same script on an RX 9070 XT. The copy I used is byte-identical to yours — `guard_consumers.py` SHA-256 `3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252`, extracted from your comment rather than retyped. **The 32 drawn words match your RX 9060 XT column**: same 17 rows flushed, same 15 rows IEEE, same word in every cell, including `00000022` for `select-data`, `00000012` for `zext-add` and `00000000` for `xor-unrelated`. | check | RX 9060 XT (yours) | RX 9070 XT (this run) | |---|---|---| | `preserve`, hardware, flushed rows | 17 / 32 | 17 / 32 | | `preserve`, hardware, IEEE rows | 15 / 32 | 15 / 32 | | `preserve`, WARP, flushed rows | 0 / 32 | 0 / 32 | | `ftz`, hardware | 32 / 32 flushed | 32 / 32 flushed | | `ftz`, WARP | 32 / 32 flushed | 32 / 32 flushed | Per shader, the three draws gave the same four words and the whole 64×64 target matched the observed words, in all 32 shaders on both backends. Words 1–3 were zero everywhere, as in yours, and every `preserve` listing carries `"fp32-denorm-mode"="preserve"` in the DXIL. So the consumer rule you derived is not specific to one die: the same rows flush on the second one (device 7550 vs 7590, gfx1201 vs gfx1200 per the datasheet). What this does not widen is the driver — `32.0.32029.2010` on both sides — so another driver version is still untested. And I ran no RGA, so the `s_denorm_mode` and lane-mask columns are yours only: I am confirming the drawn words, not the ISA correlation. The four invocations, with no RGA argument: ``` guard_consumers.py <repo> <dxc> <repo>/out/build/dev/offscreen_check.exe hardware preserve guard_consumers.py <repo> <dxc> <repo>/out/build/dev/offscreen_check.exe warp preserve guard_consumers.py <repo> <dxc> <repo>/out/build/dev/offscreen_check.exe hardware ftz guard_consumers.py <repo> <dxc> <repo>/out/build/dev/offscreen_check.exe warp ftz ``` Provenance: ``` dxc=dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727) repo_head=ed983c1ca79056bd13ac41a2bcf32a1d0a3c9ed2 (main at the time of the run; no tracked modification) renderer_sha256=df250885fbd1ea7a429dcf1e583adabb8305bb602fb21095adae032e4e628398 script_sha256=3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252 backend=hardware debug_layer=unavailable adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550 driver=32.0.32029.2010 warp=Microsoft Basic Render Driver 1414:008c driver 10.0.26100.9711 Windows=10.0.26200.9711 ``` Two notes on provenance, since both differ from yours. The renderer is built from `ed983c1`, not `7baa854`: a different binary, though the same driver and DXC, so this is a re-run of your script under a different build rather than a different compiler. And `tree_clean=false` is my own doing: the script runs `git status --porcelain` at start-up and counts untracked files, while my batch redirects stdout into `m_hw_preserve.log` and the other three logs in the worktree root, next to the two cmake logs. Those six `??` entries are the whole difference — `--untracked-files=no` and `git diff --stat` are both empty, and the renderer was built from `ed983c1` with no tracked change. On the strict check: agreed, and nothing here argues for relaxing it. My patch leaves the existing `f32_compares` entry and its expectation as they are, and adds a separate entry for the #958 case: it prints which of that fixture's seven comparison sets still fold bit 18 under `-denorm preserve`, fails on any difference other than that bit, and requires the flush under `ftz`. It does not cover the 32 consumer shapes — those stay in this issue. _AI-assisted; the script is yours, unmodified, and the four logs are on the machine that ran them._
trick-ye commented 2026-11-24 06:49:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by trick-ye on 2026-11-24T00:55:42Z.


Re https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7117411799: the WARP build on this host is 10.0.26100.9818.

The pixel_aot_comparisons_warp runs themselves print no renderer header, so that value comes from other WARP tests on the same PC and the same 45ad903 build: dxr_opacity_warp prints backend=warp debug_layer=enabled, adapter=Microsoft Basic Render Driver vendor=1414 device=008c and driver=10.0.26100.9818. It is in-box WARP: OFFSCREEN_WARP_DIR is empty in the CMake cache, and the product version of the system d3d10warp.dll is 10.0.26100.9818.

Agreed on the scope in your first point. My run covers the registered strict fixture only; it says nothing about the diagnostics half of this issue or about the reduced shapes on this adapter, and it should not be read as agreement or disagreement with any patch.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118579351 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118579351). Originally posted by [trick-ye](https://github.com/trick-ye) on 2026-11-24T00:55:42Z. --- Re https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7117411799: the WARP build on this host is `10.0.26100.9818`. The `pixel_aot_comparisons_warp` runs themselves print no renderer header, so that value comes from other WARP tests on the same PC and the same `45ad903` build: `dxr_opacity_warp` prints `backend=warp debug_layer=enabled`, `adapter=Microsoft Basic Render Driver vendor=1414 device=008c` and `driver=10.0.26100.9818`. It is in-box WARP: `OFFSCREEN_WARP_DIR` is empty in the CMake cache, and the product version of the system `d3d10warp.dll` is `10.0.26100.9818`. Agreed on the scope in your first point. My run covers the registered strict fixture only; it says nothing about the diagnostics half of this issue or about the reduced shapes on this adapter, and it should not be read as agreement or disagreement with any patch. AI-assisted (Claude Code).
R0Y00 commented 2026-11-24 06:49:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T00:57:21Z.


Thanks for rerunning the identical source-built script on the RX 9070 XT. The two RDNA 4 adapters gave the same 17 flushed and 15 IEEE preserve-mode results on driver 32.0.32029.2010, and preserve-mode WARP stayed IEEE in all 32. This is independent readback on a second adapter. The ISA observations still come from the RX 9060 XT run. Keep the strict result and use a different driver version, if available, to test whether the same pattern persists.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118606945 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118606945). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T00:57:21Z. --- Thanks for rerunning the identical source-built script on the RX 9070 XT. The two RDNA 4 adapters gave the same 17 flushed and 15 IEEE preserve-mode results on driver 32.0.32029.2010, and preserve-mode WARP stayed IEEE in all 32. This is independent readback on a second adapter. The ISA observations still come from the RX 9060 XT run. Keep the strict result and use a different driver version, if available, to test whether the same pattern persists.
thepatrickworld commented 2026-11-24 06:50:02 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T01:31:44Z.


Second run done, on a different driver build, same host and the same renderer binary.

What I changed. Only the display driver package. I installed the driver packaged in Adrenalin 26.9.1 (u0203731.inf, DriverVer=09/02/2026 = 2026-09-02, version 32.0.31041.3013) with pnputil, from the extracted INF; the Adrenalin application itself was not installed. That package carries its own user-mode driver as well (amdxc64.dll 8.18.10.0504, against 8.18.10.0514 in the installed one), so this was a kernel and user-mode driver swap, not a panel-only change. The run whose strict result you asked me to keep used 32.0.32029.2010 (DriverVer=11/18/2026 = 2026-11-18).

What stayed identical. Same repo head ed983c1, same renderer_sha256=df250885fbd1ea7a429dcf1e583adabb8305bb602fb21095adae032e4e628398, same script_sha256=3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252 (the guard script, same hash as the copy @lantiumBot published), same DXC 1.9.2602.17, same adapter 1002:7550, same Windows build 26200 — the machine last booted on 2026-11-23 12:16, before both runs, so no update came in between.

Result. The same divergence persists. The four passes (hardware/warp x preserve/ftz) match the first run line for line — diff over the full logs with the driver= line set aside — and that is the only line that differs in any of the four: 32/32 comparison rows, same word0, same ieee=/flushed= counts (the same 17 flushed and 15 IEEE, same values), three_draws_identical=true and whole_target_equal=true everywhere. The renderer, the guard script, DXC and the repo head are hash-identical, so the only variable between the two runs is the driver package.

Then I put the original back. pnputil /delete-driver oem27.inf /uninstall /force on the 26.9.1 package, then pnputil /add-driver <backup>\u0206168.inf /install from the copy I exported with pnputil /export-driver before touching anything. Device back at 32.0.32029.2010, Get-PnpDevice status OK, problem code CM_PROB_NONE. A re-run of the hardware preserve pass is identical to the first run including the driver= line. That re-run is a reproducibility control, not a sensitivity control: what pins the difference to the driver is the hash-identical renderer, guard script, DXC and repo head listed above.

How far this goes. Both builds are 2026 Adrenalin releases ten weeks apart, within the same 32.0.3x line (sub-branches 31041 / 32029), same vendor, same GPU, same OS. So this rules out that the pattern belongs to that one build and its immediate predecessor. It does not rule out the pattern belonging to this driver family: a distant branch, another driver generation, a second GPU family or a non-Windows driver would still be needed for that. Limits unchanged from the earlier note: one host, one physical GPU (RX 9070 XT, 1002:7550), Windows only, no RGA, no second GPU family, WARP is the software adapter.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119188982 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7119188982). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T01:31:44Z. --- Second run done, on a different driver build, same host and the same renderer binary. **What I changed.** Only the display driver package. I installed the driver packaged in Adrenalin 26.9.1 (`u0203731.inf`, `DriverVer=09/02/2026` = 2026-09-02, version `32.0.31041.3013`) with `pnputil`, from the extracted INF; the Adrenalin application itself was not installed. That package carries its own user-mode driver as well (`amdxc64.dll` 8.18.10.0504, against 8.18.10.0514 in the installed one), so this was a kernel and user-mode driver swap, not a panel-only change. The run whose strict result you asked me to keep used `32.0.32029.2010` (`DriverVer=11/18/2026` = 2026-11-18). **What stayed identical.** Same repo head `ed983c1`, same `renderer_sha256=df250885fbd1ea7a429dcf1e583adabb8305bb602fb21095adae032e4e628398`, same `script_sha256=3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252` (the guard script, same hash as the copy @lantiumBot published), same DXC `1.9.2602.17`, same adapter `1002:7550`, same Windows build 26200 — the machine last booted on 2026-11-23 12:16, before both runs, so no update came in between. **Result.** The same divergence persists. The four passes (`hardware`/`warp` x `preserve`/`ftz`) match the first run line for line — `diff` over the full logs with the `driver=` line set aside — and that is the only line that differs in any of the four: 32/32 comparison rows, same `word0`, same `ieee=`/`flushed=` counts (the same 17 flushed and 15 IEEE, same values), `three_draws_identical=true` and `whole_target_equal=true` everywhere. The renderer, the guard script, DXC and the repo head are hash-identical, so the only variable between the two runs is the driver package. **Then I put the original back.** `pnputil /delete-driver oem27.inf /uninstall /force` on the 26.9.1 package, then `pnputil /add-driver <backup>\u0206168.inf /install` from the copy I exported with `pnputil /export-driver` before touching anything. Device back at `32.0.32029.2010`, `Get-PnpDevice` status `OK`, problem code `CM_PROB_NONE`. A re-run of the `hardware preserve` pass is identical to the first run including the `driver=` line. That re-run is a reproducibility control, not a sensitivity control: what pins the difference to the driver is the hash-identical renderer, guard script, DXC and repo head listed above. **How far this goes.** Both builds are 2026 Adrenalin releases ten weeks apart, within the same `32.0.3x` line (sub-branches 31041 / 32029), same vendor, same GPU, same OS. So this rules out that the pattern belongs to that one build and its immediate predecessor. It does not rule out the pattern belonging to this driver family: a distant branch, another driver generation, a second GPU family or a non-Windows driver would still be needed for that. Limits unchanged from the earlier note: one host, one physical GPU (RX 9070 XT, 1002:7550), Windows only, no RGA, no second GPU family, WARP is the software adapter. _AI-assisted._
R0Y00 commented 2026-11-24 06:50:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T01:45:26Z.


The same RX 9070 XT, renderer, source and DXC gave the same 17 flushed and 15 IEEE preserve-mode rows on both 32.0.31041.3013 and 32.0.32029.2010, with unchanged WARP controls. That rules out a change between those two driver packages on this host and leaves the implementation cause open. Keep the strict preserve-mode failure. A different adapter or an independent native shader/ISA comparison would add evidence.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119416596 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7119416596). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T01:45:26Z. --- The same RX 9070 XT, renderer, source and DXC gave the same 17 flushed and 15 IEEE preserve-mode rows on both 32.0.31041.3013 and 32.0.32029.2010, with unchanged WARP controls. That rules out a change between those two driver packages on this host and leaves the implementation cause open. Keep the strict preserve-mode failure. A different adapter or an independent native shader/ISA comparison would add evidence.
thepatrickworld commented 2026-11-24 06:50:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T02:04:41Z.


The ISA side, now compiled on this host rather than taken from the numbers in @lantiumBot's table.

I unpacked RGA 2.15 (2.15.0.30 (10/02/2026)) from its portable Windows package; no installer was run. I ran the same script with its RGA argument set: the verdicts come from the hardware run (backend=hardware), and the ISA columns were produced on this host by RGA's dx12 mode, which uses the installed driver's compiler offline (rga_driver=default, driver 32.0.32029.2010). RGA compiles offline and does not execute the shader. Same script (script_sha256=3017324…a9252, byte-identical), same renderer (renderer_sha256=df25088…8398), repo head ed983c1, tree_clean=false, target gfx1200, denorm=preserve. The run is 32 rows: 16 shapes x 2 operand forms.

Result: the three properties are present on the same 17 of 32 rows and absent on the other 15. 17 rows have the flushed verdict, 17 carry s_denorm_mode=[14,15], and 17 have lane_mask_selects>0 (2 in 15 rows, 1 in each zext-add row). The three row sets are equal — the symmetric difference is empty in both directions — and the flushed set is the same 17 words as the run without RGA, so that set did not move.

Where the split falls. With the subnormal as a literal, 13 of the 16 literal rows flush (and-guard, and-guard-gt, and-guard-ne, and-bitwise, and-unrelated, and-two-fcmp, or-guard, or-unrelated, or-bitwise, xor-unrelated, select-as-value, ternary-bool, zext-add); the three that do not are plain, select-data and not. With the subnormal in a register, only four flush: and-bitwise, or-bitwise, xor-unrelated and zext-add. Those four also flush with a literal, so no shape flushes with data only. The nine shapes that lose flushing with a data operand are exactly the nine whose data form has branches=2.

What this does not add. This is the same driver compiler, offline, not an independent one. A different backend (LLVM/ACO, or a Mesa path) would be a separate compiler; I have no such path wired into this DX12 harness. And there is no second GPU with Status=OK on this host: besides the RX 9070 XT (Status=OK), Windows lists an RTX 3060 with Status=Unknown and a Meta Virtual Monitor (a virtual display), so the "different adapter" half of your request stays open.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119731640 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7119731640). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T02:04:41Z. --- The ISA side, now compiled on this host rather than taken from the numbers in @lantiumBot's table. I unpacked RGA 2.15 (`2.15.0.30 (10/02/2026)`) from its portable Windows package; no installer was run. I ran the same script with its RGA argument set: the verdicts come from the hardware run (`backend=hardware`), and the ISA columns were produced on this host by RGA's `dx12` mode, which uses the installed driver's compiler offline (`rga_driver=default`, driver `32.0.32029.2010`). RGA compiles offline and does not execute the shader. Same script (`script_sha256=3017324…a9252`, byte-identical), same renderer (`renderer_sha256=df25088…8398`), repo head `ed983c1`, `tree_clean=false`, target `gfx1200`, `denorm=preserve`. The run is 32 rows: 16 shapes x 2 operand forms. **Result: the three properties are present on the same 17 of 32 rows and absent on the other 15.** 17 rows have the flushed verdict, 17 carry `s_denorm_mode=[14,15]`, and 17 have `lane_mask_selects>0` (2 in 15 rows, 1 in each `zext-add` row). The three row sets are equal — the symmetric difference is empty in both directions — and the flushed set is the same 17 words as the run without RGA, so that set did not move. **Where the split falls.** With the subnormal as a literal, 13 of the 16 literal rows flush (`and-guard`, `and-guard-gt`, `and-guard-ne`, `and-bitwise`, `and-unrelated`, `and-two-fcmp`, `or-guard`, `or-unrelated`, `or-bitwise`, `xor-unrelated`, `select-as-value`, `ternary-bool`, `zext-add`); the three that do not are `plain`, `select-data` and `not`. With the subnormal in a register, only four flush: `and-bitwise`, `or-bitwise`, `xor-unrelated` and `zext-add`. Those four also flush with a literal, so no shape flushes with data only. The nine shapes that lose flushing with a data operand are exactly the nine whose data form has `branches=2`. **What this does not add.** This is the same driver compiler, offline, not an independent one. A different backend (LLVM/ACO, or a Mesa path) would be a separate compiler; I have no such path wired into this DX12 harness. And there is no second GPU with `Status=OK` on this host: besides the RX 9070 XT (`Status=OK`), Windows lists an RTX 3060 with `Status=Unknown` and a Meta Virtual Monitor (a virtual display), so the "different adapter" half of your request stays open. _AI-assisted._
trick-ye commented 2026-11-24 06:50:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by trick-ye on 2026-11-24T03:44:54Z.


RX 7800 XT (RDNA 3): raw words from f32_compare_probe.py, the probe published in https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7111713224 (its ch3 carries the five #312 bits). Two results: the subnormal subjects read the kept (IEEE) words under preserve in all three shapes, including the translator's guarded shape, and the plain-HLSL channel reads a500a500 where the IEEE reference is ff00ff00 for both NaN subjects.

Environment

  • Renderer: the dev build log for e5bfa0c records linking offscreen_check.exe before these runs. Upstream main has since advanced.
  • Probe: the code block of the linked comment, unmodified; the file's SHA-256 is cedc06cd5d64c7444b0bdb6c421b06700ad84c84081dbdca4e4c3a98c5be3953, the value given in that comment.
  • AMD Radeon RX 7800 XT (1002:747e), driver 32.0.32029.2010; WARP 10.0.26100.9818 (in-box)
  • Windows 11 Pro, build 26200.9974; DXC 1.9.2602.17; Python 3.13.0
  • Debug layer enabled on both backends (backend=hardware debug_layer=enabled, backend=warp debug_layer=enabled); every draw recorded debug_errors=0 debug_warnings=0
  • Wave width is not measured by this probe.

Command

Run once per backend, hardware first:

python -I f32_compare_probe.py <dxc.exe> <offscreen_check.exe> hardware out-hardware
python -I f32_compare_probe.py <dxc.exe> <offscreen_check.exe> warp out-warp

Each run recorded 36 results (9 subjects × 4 builds, each drawn as a verify and a readback pass) and 0 errors. The DXIL listings carry "fp32-denorm-mode"="any", "ftz" and "preserve" for the three flagged builds and no such attribute for the build without -denorm. No capability skip was reported.

Result

Words are ch0 ch1 ch2 ch3 as the probe prints them (ch0 plain HLSL compares, ch1 the translator shape, ch2 the translator shape with an immediate, ch3 the #312 bits and the arithmetic control). "IEEE kept" and "flushed" are the probe's two computed references.

Subject Build RX 7800 XT WARP Probe's reading for the RX 7800 XT
+min_sub vs +0, and vs -0 preserve aaaaf0f0 aaaaf0f0 aaaaf0f0 00000100 same words predicate bits kept; verify rc=0
+min_sub vs +0, and vs -0 no flag, any, ftz cccccccc cccccccc cccccccc 0000021f same words flushed
-min_sub vs +0, and vs -0 preserve f0f0aaaa f0f0aaaa f0f0aaaa 00000100 same words predicate bits kept; verify rc=0
-min_sub vs +0, and vs -0 no flag, any, ftz cccccccc cccccccc cccccccc 0000021f same words flushed
FLT_MIN vs +0, and vs -0; 1.0 vs -1.0 preserve aaaaf0f0 aaaaf0f0 aaaaf0f0 00000100 same words mode-independent, IEEE
FLT_MIN vs +0, and vs -0; 1.0 vs -1.0 no flag, any, ftz aaaaf0f0 aaaaf0f0 aaaaf0f0 00000200 same words mode-independent, IEEE
NaN vs +0, and vs +min_sub preserve a500a500 ff00ff00 ff00ff00 00000100 ff00ff00 ff00ff00 ff00ff00 00000100 MATCHES NEITHER
NaN vs +0, and vs +min_sub no flag, any, ftz a500a500 ff00ff00 ff00ff00 00000200 ff00ff00 ff00ff00 ff00ff00 00000200 MATCHES NEITHER

The probe's summary for the RX 7800 XT:

summary:
    +min_sub vs +0     kept under preserve, flushed otherwise
    +min_sub vs -0     kept under preserve, flushed otherwise
    -min_sub vs +0     kept under preserve, flushed otherwise
    -min_sub vs -0     kept under preserve, flushed otherwise
    FLT_MIN vs +0      identical in all builds, IEEE
    FLT_MIN vs -0      identical in all builds, IEEE
    1.0 vs -1.0        identical in all builds, IEEE
    NaN vs +0          DIFFERS BETWEEN BUILDS OR FROM IEEE
    NaN vs +min_sub    DIFFERS BETWEEN BUILDS OR FROM IEEE

On WARP the last two lines read identical in all builds, IEEE; the other seven are the same.

What the words say for this adapter and driver:

  • Subnormal subjects: under preserve, ch1 and ch2 (the guarded translator shapes) equal the kept reference, the same as ch0, for all four subnormal subjects. The #312 bits 0-4 read [0, 0, 0, 0, 0] under preserve, which is the kept reference for those subjects. Without preserve all three channels equal the flushed reference.
  • NaN subjects: ch1 and ch2 equal the IEEE reference ff00ff00 in all four builds. ch0 reads a500a500 in all four builds. ff00ff00 ^ a500a500 = 5a005a00, so in each 16-bit half the bits for nge, ngt, nle and nlt are clear where the reference has them set. In the probe those four are the plain expressions !(a >= b), !(a > b), !(a <= b) and !(a < b); the upper half is the same expressions with the operands swapped.
  • The first result that matches neither of the probe's references is ch0 of NaN vs +0 in the build without -denorm (21st of the 36 results in run order): expected ff00ff00, actual a500a500. The earlier verify mismatches (rc=1) are the subnormal subjects and the arithmetic bits 8-9 in the builds without preserve, which equal the flushed reference by design.
  • DXIL for the NaN-subject shader: the preserve listing contains fcmp ult twice and fcmp ule twice (the unordered predicates), next to fcmp une and fcmp uno. The four .cso files for that shader have the same SHA-256 in the hardware and WARP output folders, mode for mode, so the two backends were given the same DXIL and returned different ch0 words. The linked comment reports ff00ff00 ×3 for the NaN subjects on an RTX 3070 and on WARP.

Limits

  • One run per backend, one adapter, one driver, one DXC version.
  • The NaN difference is in the probe's plain-HLSL channel only. The translator shapes (ch1, ch2) match the reference; they write these four relations as the opposite compare || isnan(a) || isnan(b) (for example nge as a < b || isnan(a) || isnan(b)), not as a negated compare. I did not trace individual fcmp instructions to probe bits or capture native ISA, so these results do not identify the cause of the backend difference.
  • I did not run the guard-pair or shape-table scripts from this thread.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121382270 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7121382270). Originally posted by [trick-ye](https://github.com/trick-ye) on 2026-11-24T03:44:54Z. --- RX 7800 XT (RDNA 3): raw words from `f32_compare_probe.py`, the probe published in https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7111713224 (its ch3 carries the five #312 bits). Two results: the subnormal subjects read the kept (IEEE) words under `preserve` in all three shapes, including the translator's guarded shape, and the plain-HLSL channel reads `a500a500` where the IEEE reference is `ff00ff00` for both NaN subjects. ## Environment - Renderer: the `dev` build log for `e5bfa0c` records linking `offscreen_check.exe` before these runs. Upstream `main` has since advanced. - Probe: the code block of the linked comment, unmodified; the file's SHA-256 is `cedc06cd5d64c7444b0bdb6c421b06700ad84c84081dbdca4e4c3a98c5be3953`, the value given in that comment. - AMD Radeon RX 7800 XT (`1002:747e`), driver `32.0.32029.2010`; WARP `10.0.26100.9818` (in-box) - Windows 11 Pro, build 26200.9974; DXC `1.9.2602.17`; Python 3.13.0 - Debug layer enabled on both backends (`backend=hardware debug_layer=enabled`, `backend=warp debug_layer=enabled`); every draw recorded `debug_errors=0 debug_warnings=0` - Wave width is not measured by this probe. ## Command Run once per backend, hardware first: ```powershell python -I f32_compare_probe.py <dxc.exe> <offscreen_check.exe> hardware out-hardware python -I f32_compare_probe.py <dxc.exe> <offscreen_check.exe> warp out-warp ``` Each run recorded 36 results (9 subjects × 4 builds, each drawn as a verify and a readback pass) and 0 errors. The DXIL listings carry `"fp32-denorm-mode"="any"`, `"ftz"` and `"preserve"` for the three flagged builds and no such attribute for the build without `-denorm`. No capability skip was reported. ## Result Words are ch0 ch1 ch2 ch3 as the probe prints them (ch0 plain HLSL compares, ch1 the translator shape, ch2 the translator shape with an immediate, ch3 the #312 bits and the arithmetic control). "IEEE kept" and "flushed" are the probe's two computed references. | Subject | Build | RX 7800 XT | WARP | Probe's reading for the RX 7800 XT | |---|---|---|---|---| | `+min_sub` vs `+0`, and vs `-0` | `preserve` | `aaaaf0f0 aaaaf0f0 aaaaf0f0 00000100` | same words | predicate bits kept; verify rc=0 | | `+min_sub` vs `+0`, and vs `-0` | no flag, `any`, `ftz` | `cccccccc cccccccc cccccccc 0000021f` | same words | flushed | | `-min_sub` vs `+0`, and vs `-0` | `preserve` | `f0f0aaaa f0f0aaaa f0f0aaaa 00000100` | same words | predicate bits kept; verify rc=0 | | `-min_sub` vs `+0`, and vs `-0` | no flag, `any`, `ftz` | `cccccccc cccccccc cccccccc 0000021f` | same words | flushed | | `FLT_MIN` vs `+0`, and vs `-0`; `1.0` vs `-1.0` | `preserve` | `aaaaf0f0 aaaaf0f0 aaaaf0f0 00000100` | same words | mode-independent, IEEE | | `FLT_MIN` vs `+0`, and vs `-0`; `1.0` vs `-1.0` | no flag, `any`, `ftz` | `aaaaf0f0 aaaaf0f0 aaaaf0f0 00000200` | same words | mode-independent, IEEE | | NaN vs `+0`, and vs `+min_sub` | `preserve` | `a500a500 ff00ff00 ff00ff00 00000100` | `ff00ff00 ff00ff00 ff00ff00 00000100` | `MATCHES NEITHER` | | NaN vs `+0`, and vs `+min_sub` | no flag, `any`, `ftz` | `a500a500 ff00ff00 ff00ff00 00000200` | `ff00ff00 ff00ff00 ff00ff00 00000200` | `MATCHES NEITHER` | The probe's summary for the RX 7800 XT: ```text summary: +min_sub vs +0 kept under preserve, flushed otherwise +min_sub vs -0 kept under preserve, flushed otherwise -min_sub vs +0 kept under preserve, flushed otherwise -min_sub vs -0 kept under preserve, flushed otherwise FLT_MIN vs +0 identical in all builds, IEEE FLT_MIN vs -0 identical in all builds, IEEE 1.0 vs -1.0 identical in all builds, IEEE NaN vs +0 DIFFERS BETWEEN BUILDS OR FROM IEEE NaN vs +min_sub DIFFERS BETWEEN BUILDS OR FROM IEEE ``` On WARP the last two lines read `identical in all builds, IEEE`; the other seven are the same. What the words say for this adapter and driver: - Subnormal subjects: under `preserve`, ch1 and ch2 (the guarded translator shapes) equal the kept reference, the same as ch0, for all four subnormal subjects. The #312 bits 0-4 read `[0, 0, 0, 0, 0]` under `preserve`, which is the kept reference for those subjects. Without `preserve` all three channels equal the flushed reference. - NaN subjects: ch1 and ch2 equal the IEEE reference `ff00ff00` in all four builds. ch0 reads `a500a500` in all four builds. `ff00ff00 ^ a500a500 = 5a005a00`, so in each 16-bit half the bits for `nge`, `ngt`, `nle` and `nlt` are clear where the reference has them set. In the probe those four are the plain expressions `!(a >= b)`, `!(a > b)`, `!(a <= b)` and `!(a < b)`; the upper half is the same expressions with the operands swapped. - The first result that matches neither of the probe's references is ch0 of `NaN vs +0` in the build without `-denorm` (21st of the 36 results in run order): expected `ff00ff00`, actual `a500a500`. The earlier verify mismatches (rc=1) are the subnormal subjects and the arithmetic bits 8-9 in the builds without `preserve`, which equal the flushed reference by design. - DXIL for the NaN-subject shader: the `preserve` listing contains `fcmp ult` twice and `fcmp ule` twice (the unordered predicates), next to `fcmp une` and `fcmp uno`. The four `.cso` files for that shader have the same SHA-256 in the hardware and WARP output folders, mode for mode, so the two backends were given the same DXIL and returned different ch0 words. The linked comment reports `ff00ff00` ×3 for the NaN subjects on an RTX 3070 and on WARP. ## Limits - One run per backend, one adapter, one driver, one DXC version. - The NaN difference is in the probe's plain-HLSL channel only. The translator shapes (ch1, ch2) match the reference; they write these four relations as the opposite compare `|| isnan(a) || isnan(b)` (for example `nge` as `a < b || isnan(a) || isnan(b)`), not as a negated compare. I did not trace individual `fcmp` instructions to probe bits or capture native ISA, so these results do not identify the cause of the backend difference. - I did not run the guard-pair or shape-table scripts from this thread. AI-assisted (Claude Code).
trick-ye commented 2026-11-24 06:50:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by trick-ye on 2026-11-24T04:01:09Z.


RX 7800 XT with DXC 1.8.2502: pixel_aot_comparisons_hardware still passes, 3 of 3. This addresses the limit I left in https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7117243670, where my runs used DXC 1.9.2602.17 and the failing RX 9070 XT report used 1.8.2502.11. The build used here is the official v1.8.2502 release (1.8.2502.8), not that exact build.

Environment

  • Commit 59eb78126c2f31dc936c002b8cdb2d5629021383 (main when pulled at about 03:40 UTC on 2026-11-24; upstream main has since advanced), clean tree
  • DXC: dxc_2025_02_20.zip from the v1.8.2502 release of microsoft/DirectXShaderCompiler (26,346,851 bytes, SHA-256 70B1913A1BFCE4A3E1A5311D16246F4ECDF3A3E613ABEC8AA529E57668426F85). dxc.exe --version prints dxcompiler.dll: 1.8 - 1.8.2502.8 (b4711839e); dxil.dll: 1.8(1.8.2502.8). dxc.exe, dxcompiler.dll and dxil.dll carry valid Microsoft Corporation signatures.
  • Separate build directory configured with -DDXC_EXECUTABLE=<that dxc.exe>, so the renderer's embedded vertex shader and the test's pixel shaders are both compiled by 1.8.2502. Only offscreen_check was built there.
  • AMD Radeon RX 7800 XT (1002:747e), driver 32.0.32029.2010; WARP 10.0.26100.9818 (in-box)
  • Windows 11 Pro, build 26200.9974; MSVC 19.42.34436; Windows SDK 10.0.26100.0; Python 3.13.0
  • Debug layer: the passing pixel tests print no renderer header, so their debug-layer status is not shown in these logs.
  • Wave width: not printed by these two tests and not measured.

Command

From the checkout root; configure and build once, then the ctest line three times:

cmake -S . -B out/build/dxc18 -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=cl -DDXC_EXECUTABLE=C:/src/tools/dxc-1.8.2502/bin/x64/dxc.exe
cmake --build out/build/dxc18 --target offscreen_check
ctest --test-dir out/build/dxc18 --no-tests=error -j 1 -R '^pixel_aot_comparisons_(hardware|warp)$' -V

The CTest log echoes the test command with the 1.8.2502 dxc.exe and the out/build/dxc18 renderer as its arguments.

Result

Expected: both backends pass the strict fixture. Observed: both passed in all three runs. Capability skips: none.

Run pixel_aot_comparisons_hardware pixel_aot_comparisons_warp
1 Passed 21.59 sec Passed 6.16 sec
2 Passed 20.69 sec Passed 6.18 sec
3 Passed 21.00 sec Passed 6.26 sec

Each run reports 100% tests passed, 0 tests failed out of 2.

At this commit tests/pixel_aot_check.py still has F32_DENORM_MODE = "preserve" and the row (18, "v_cmp_eq_f32_e32 vcc_lo, 1, v16").

Limits

  • One adapter, one driver. The DXC build here reports 1.8.2502.8 (b4711839e); the RX 9070 XT report states 1.8.2502.11 (239921522), a different build of the 1.8.2502 line, so that exact compiler build is not tested here.
  • This is the registered fixture at 59eb781, not at dae1ca2. I did not rebuild dae1ca2 with DXC 1.8.2502.
  • I did not compare the DXIL produced by the two DXC versions.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121630596 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7121630596). Originally posted by [trick-ye](https://github.com/trick-ye) on 2026-11-24T04:01:09Z. --- RX 7800 XT with DXC 1.8.2502: `pixel_aot_comparisons_hardware` still passes, 3 of 3. This addresses the limit I left in https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7117243670, where my runs used DXC `1.9.2602.17` and the failing RX 9070 XT report used `1.8.2502.11`. The build used here is the official `v1.8.2502` release (`1.8.2502.8`), not that exact build. ## Environment - Commit `59eb78126c2f31dc936c002b8cdb2d5629021383` (`main` when pulled at about 03:40 UTC on 2026-11-24; upstream `main` has since advanced), clean tree - DXC: `dxc_2025_02_20.zip` from the `v1.8.2502` release of `microsoft/DirectXShaderCompiler` (26,346,851 bytes, SHA-256 `70B1913A1BFCE4A3E1A5311D16246F4ECDF3A3E613ABEC8AA529E57668426F85`). `dxc.exe --version` prints `dxcompiler.dll: 1.8 - 1.8.2502.8 (b4711839e); dxil.dll: 1.8(1.8.2502.8)`. `dxc.exe`, `dxcompiler.dll` and `dxil.dll` carry valid Microsoft Corporation signatures. - Separate build directory configured with `-DDXC_EXECUTABLE=<that dxc.exe>`, so the renderer's embedded vertex shader and the test's pixel shaders are both compiled by 1.8.2502. Only `offscreen_check` was built there. - AMD Radeon RX 7800 XT (`1002:747e`), driver `32.0.32029.2010`; WARP `10.0.26100.9818` (in-box) - Windows 11 Pro, build 26200.9974; MSVC 19.42.34436; Windows SDK 10.0.26100.0; Python 3.13.0 - Debug layer: the passing pixel tests print no renderer header, so their debug-layer status is not shown in these logs. - Wave width: not printed by these two tests and not measured. ## Command From the checkout root; configure and build once, then the `ctest` line three times: ```powershell cmake -S . -B out/build/dxc18 -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=cl -DDXC_EXECUTABLE=C:/src/tools/dxc-1.8.2502/bin/x64/dxc.exe cmake --build out/build/dxc18 --target offscreen_check ctest --test-dir out/build/dxc18 --no-tests=error -j 1 -R '^pixel_aot_comparisons_(hardware|warp)$' -V ``` The CTest log echoes the test command with the 1.8.2502 `dxc.exe` and the `out/build/dxc18` renderer as its arguments. ## Result Expected: both backends pass the strict fixture. Observed: both passed in all three runs. Capability skips: none. | Run | `pixel_aot_comparisons_hardware` | `pixel_aot_comparisons_warp` | |---|---|---| | 1 | Passed 21.59 sec | Passed 6.16 sec | | 2 | Passed 20.69 sec | Passed 6.18 sec | | 3 | Passed 21.00 sec | Passed 6.26 sec | Each run reports `100% tests passed, 0 tests failed out of 2`. At this commit `tests/pixel_aot_check.py` still has `F32_DENORM_MODE = "preserve"` and the row `(18, "v_cmp_eq_f32_e32 vcc_lo, 1, v16")`. ## Limits - One adapter, one driver. The DXC build here reports `1.8.2502.8 (b4711839e)`; the RX 9070 XT report states `1.8.2502.11 (239921522)`, a different build of the 1.8.2502 line, so that exact compiler build is not tested here. - This is the registered fixture at `59eb781`, not at `dae1ca2`. I did not rebuild `dae1ca2` with DXC 1.8.2502. - I did not compare the DXIL produced by the two DXC versions. AI-assisted (Claude Code).
trick-ye commented 2026-11-24 06:50:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by trick-ye on 2026-11-24T04:05:48Z.


RX 7800 XT (RDNA 3): the 32-shader consumer matrix from https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118048180 reads the IEEE word in all 32 shaders under preserve, in three of three runs. That comment notes that no RDNA 3 adapter had been run with these shapes, and https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7119416596 says a different adapter would add evidence. For the two RDNA 4 adapters, https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118606945 records 17 flushed and 15 IEEE preserve-mode results.

Environment

  • repo_head=59eb78126c2f31dc936c002b8cdb2d5629021383 tree_clean=true (main when pulled at about 03:40 UTC on 2026-11-24; upstream main has since advanced), dev preset (Debug)
  • renderer_sha256=35e32cb27b15c89673ae22e6b96a59c43864ee55aca03aa18593cca9fc289b17
  • script_sha256=3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252, the value given in the linked comment; the script is that comment's code block, unmodified
  • dxc=dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727)
  • adapter=AMD Radeon RX 7800 XT vendor=1002 device=747e, driver=32.0.32029.2010, backend=hardware debug_layer=enabled
  • WARP: adapter=Microsoft Basic Render Driver vendor=1414 device=008c, driver=10.0.26100.9818, backend=warp debug_layer=enabled (in-box)
  • Windows 11 Pro, build 26200.9974. The interpreter I launched is Python 3.13.0; the script's output does not record it.
  • The script prints the renderer header once per run and does not print the renderer's debug_errors line, so debug-layer message counts are not in these logs.
  • Wave width is not measured by this script.
  • No RGA: I ran the five-argument form only, so there are no ISA columns.

Command

Commands as I launched them (paths abbreviated), one process at a time, hardware first. The logs hold the script's stdout only, so they confirm the backend, mode and run counts but not the launcher flags; -I is my addition to the linked comment's form:

python -I -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware preserve   # three times
python -I -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp preserve       # three times
python -I -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware ftz        # once
python -I -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp ftz            # once

Result

Backend Build Runs Script verdicts
RX 7800 XT preserve 3 -> ieee in 32 of 32 shaders, each run
WARP preserve 3 -> ieee in 32 of 32 shaders, each run
RX 7800 XT ftz 1 -> flushed in 32 of 32 shaders
WARP ftz 1 -> flushed in 32 of 32 shaders
  • The three hardware preserve logs are byte-identical, and so are the three WARP preserve logs.
  • The 32 shape= lines of the hardware preserve log are identical to those of the WARP preserve log, including word0.
  • Every one of the 32 lines in every log has three_draws_identical=true whole_target_equal=true.
  • The ftz hardware log has "fp32-denorm-mode"="ftz" on all 32 lines.
  • Expected under preserve: the ieee= value of each line. Observed: that value in all 32, so there is no mismatch to report for this adapter. No capability skip was reported.
The 32 lines of the hardware preserve log
shape=plain operand=literal dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=and-guard operand=literal dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=and-guard-gt operand=literal dxil[fcmp olt -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee
shape=and-guard-ne operand=literal dxil[fcmp une -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee
shape=and-bitwise operand=literal dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=and-unrelated operand=literal dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=and-two-fcmp operand=literal dxil[fcmp oeq -> and i1; fcmp_count=2; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=or-guard operand=literal dxil[fcmp oeq -> or i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=or-unrelated operand=literal dxil[fcmp oeq -> or i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=or-bitwise operand=literal dxil[fcmp oeq -> or i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=xor-unrelated operand=literal dxil[fcmp oeq -> xor i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee
shape=select-data operand=literal dxil[fcmp oeq -> select; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000022 words123=zero three_draws_identical=true whole_target_equal=true ieee=22 flushed=11 -> ieee
shape=select-as-value operand=literal dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=ternary-bool operand=literal dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=zext-add operand=literal dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000011 words123=zero three_draws_identical=true whole_target_equal=true ieee=11 flushed=12 -> ieee
shape=not operand=literal dxil[fcmp une -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee
shape=plain operand=data dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=and-guard operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=and-guard-gt operand=data dxil[fcmp ogt -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee
shape=and-guard-ne operand=data dxil[fcmp une -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee
shape=and-bitwise operand=data dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=and-unrelated operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=and-two-fcmp operand=data dxil[fcmp oeq -> phi; fcmp_count=2; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=or-guard operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=or-unrelated operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=or-bitwise operand=data dxil[fcmp oeq -> or i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=xor-unrelated operand=data dxil[fcmp oeq -> xor i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee
shape=select-data operand=data dxil[fcmp oeq -> select; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000022 words123=zero three_draws_identical=true whole_target_equal=true ieee=22 flushed=11 -> ieee
shape=select-as-value operand=data dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=ternary-bool operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee
shape=zext-add operand=data dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000011 words123=zero three_draws_identical=true whole_target_equal=true ieee=11 flushed=12 -> ieee
shape=not operand=data dxil[fcmp une -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee

Limits

  • One adapter, one driver, one DXC version, one renderer build.
  • Readback only. Without RGA I have no ISA for these shaders on this adapter, so this says nothing about s_denorm_mode or lane-mask selects on RDNA 3.
  • The RDNA 4 counts above are quoted from the maintainer's comment linked there; I did not rerun anything on RDNA 4.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121702641 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7121702641). Originally posted by [trick-ye](https://github.com/trick-ye) on 2026-11-24T04:05:48Z. --- RX 7800 XT (RDNA 3): the 32-shader consumer matrix from https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118048180 reads the IEEE word in all 32 shaders under `preserve`, in three of three runs. That comment notes that no RDNA 3 adapter had been run with these shapes, and https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7119416596 says a different adapter would add evidence. For the two RDNA 4 adapters, https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118606945 records 17 flushed and 15 IEEE preserve-mode results. ## Environment - `repo_head=59eb78126c2f31dc936c002b8cdb2d5629021383 tree_clean=true` (`main` when pulled at about 03:40 UTC on 2026-11-24; upstream `main` has since advanced), `dev` preset (Debug) - `renderer_sha256=35e32cb27b15c89673ae22e6b96a59c43864ee55aca03aa18593cca9fc289b17` - `script_sha256=3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252`, the value given in the linked comment; the script is that comment's code block, unmodified - `dxc=dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727)` - `adapter=AMD Radeon RX 7800 XT vendor=1002 device=747e`, `driver=32.0.32029.2010`, `backend=hardware debug_layer=enabled` - WARP: `adapter=Microsoft Basic Render Driver vendor=1414 device=008c`, `driver=10.0.26100.9818`, `backend=warp debug_layer=enabled` (in-box) - Windows 11 Pro, build 26200.9974. The interpreter I launched is Python 3.13.0; the script's output does not record it. - The script prints the renderer header once per run and does not print the renderer's `debug_errors` line, so debug-layer message counts are not in these logs. - Wave width is not measured by this script. - No RGA: I ran the five-argument form only, so there are no ISA columns. ## Command Commands as I launched them (paths abbreviated), one process at a time, hardware first. The logs hold the script's stdout only, so they confirm the backend, mode and run counts but not the launcher flags; `-I` is my addition to the linked comment's form: ```powershell python -I -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware preserve # three times python -I -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp preserve # three times python -I -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe hardware ftz # once python -I -B guard_consumers.py <repo> <dxc.exe> <repo>/out/build/dev/offscreen_check.exe warp ftz # once ``` ## Result | Backend | Build | Runs | Script verdicts | |---|---|---|---| | RX 7800 XT | `preserve` | 3 | `-> ieee` in 32 of 32 shaders, each run | | WARP | `preserve` | 3 | `-> ieee` in 32 of 32 shaders, each run | | RX 7800 XT | `ftz` | 1 | `-> flushed` in 32 of 32 shaders | | WARP | `ftz` | 1 | `-> flushed` in 32 of 32 shaders | - The three hardware `preserve` logs are byte-identical, and so are the three WARP `preserve` logs. - The 32 `shape=` lines of the hardware `preserve` log are identical to those of the WARP `preserve` log, including `word0`. - Every one of the 32 lines in every log has `three_draws_identical=true whole_target_equal=true`. - The `ftz` hardware log has `"fp32-denorm-mode"="ftz"` on all 32 lines. - Expected under `preserve`: the `ieee=` value of each line. Observed: that value in all 32, so there is no mismatch to report for this adapter. No capability skip was reported. <details> <summary>The 32 lines of the hardware <code>preserve</code> log</summary> ```text shape=plain operand=literal dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=and-guard operand=literal dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=and-guard-gt operand=literal dxil[fcmp olt -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee shape=and-guard-ne operand=literal dxil[fcmp une -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee shape=and-bitwise operand=literal dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=and-unrelated operand=literal dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=and-two-fcmp operand=literal dxil[fcmp oeq -> and i1; fcmp_count=2; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=or-guard operand=literal dxil[fcmp oeq -> or i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=or-unrelated operand=literal dxil[fcmp oeq -> or i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=or-bitwise operand=literal dxil[fcmp oeq -> or i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=xor-unrelated operand=literal dxil[fcmp oeq -> xor i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee shape=select-data operand=literal dxil[fcmp oeq -> select; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000022 words123=zero three_draws_identical=true whole_target_equal=true ieee=22 flushed=11 -> ieee shape=select-as-value operand=literal dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=ternary-bool operand=literal dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=zext-add operand=literal dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000011 words123=zero three_draws_identical=true whole_target_equal=true ieee=11 flushed=12 -> ieee shape=not operand=literal dxil[fcmp une -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee shape=plain operand=data dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=and-guard operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=and-guard-gt operand=data dxil[fcmp ogt -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee shape=and-guard-ne operand=data dxil[fcmp une -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee shape=and-bitwise operand=data dxil[fcmp oeq -> and i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=and-unrelated operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=and-two-fcmp operand=data dxil[fcmp oeq -> phi; fcmp_count=2; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=or-guard operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=or-unrelated operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=or-bitwise operand=data dxil[fcmp oeq -> or i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=xor-unrelated operand=data dxil[fcmp oeq -> xor i1; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee shape=select-data operand=data dxil[fcmp oeq -> select; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000022 words123=zero three_draws_identical=true whole_target_equal=true ieee=22 flushed=11 -> ieee shape=select-as-value operand=data dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=ternary-bool operand=data dxil[fcmp oeq -> phi; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000000 words123=zero three_draws_identical=true whole_target_equal=true ieee=0 flushed=1 -> ieee shape=zext-add operand=data dxil[fcmp oeq -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000011 words123=zero three_draws_identical=true whole_target_equal=true ieee=11 flushed=12 -> ieee shape=not operand=data dxil[fcmp une -> zext; fcmp_count=1; "fp32-denorm-mode"="preserve"] word0=00000001 words123=zero three_draws_identical=true whole_target_equal=true ieee=1 flushed=0 -> ieee ``` </details> ## Limits - One adapter, one driver, one DXC version, one renderer build. - Readback only. Without RGA I have no ISA for these shaders on this adapter, so this says nothing about `s_denorm_mode` or lane-mask selects on RDNA 3. - The RDNA 4 counts above are quoted from the maintainer's comment linked there; I did not rerun anything on RDNA 4. AI-assisted (Claude Code).
Asimmimx commented 2026-11-24 12:03:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T11:24:33Z.


RDNA 2: pixel_aot_comparisons_hardware passes on an RX 6600 in 3 of 3 runs, with the same DXC build (1.8.2502.11) as the failing RX 9070 XT report. This thread has RDNA 4 failures and RDNA 3 passes (RX 7800 XT, on DXC 1.9.2602.17 and 1.8.2502). I found no RDNA 2 result here before posting. Data only, no fixture change.

Environment

  • Commit 153bb5f6 (main), clean tree, dev preset (Debug)
  • AMD Radeon RX 6600 (1002:73ff, RDNA 2), driver 32.0.21045.29003; WARP 10.0.26100.9818
  • Windows 11 Pro 26H2, build 26300.9974; MSVC 19.51.36260; Windows SDK 10.0.26100.0; DXC 1.8.2502.11
  • D3D12 debug layer enabled, debug_errors=0 debug_warnings=0 on every run

Result

ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_(hardware|warp)$' -V
pixel_aot_comparisons_hardware ...   Passed   13.91 sec
pixel_aot_comparisons_hardware ...   Passed   11.39 sec
pixel_aot_comparisons_hardware ...   Passed   11.45 sec
pixel_aot_comparisons_warp .......   Passed    7.74 sec

This includes the f32-cmp-1 bit 18 case (v_cmp_eq_f32 of 0x00000001 against -0.0). Under the harness's preserve assumption it reads false, as on WARP. I did not run f32_compare_probe.py or guard_consumers.py from this thread, and I did not capture the ISA. So this result shows only that the full test passes, not which consumer shapes keep the subnormal on RDNA 2.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7130058610 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7130058610). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-24T11:24:33Z. --- RDNA 2: `pixel_aot_comparisons_hardware` passes on an RX 6600 in 3 of 3 runs, with the same DXC build (`1.8.2502.11`) as the failing RX 9070 XT report. This thread has RDNA 4 failures and RDNA 3 passes (RX 7800 XT, on DXC 1.9.2602.17 and 1.8.2502). I found no RDNA 2 result here before posting. Data only, no fixture change. ## Environment - Commit `153bb5f6` (`main`), clean tree, `dev` preset (Debug) - AMD Radeon RX 6600 (`1002:73ff`, RDNA 2), driver `32.0.21045.29003`; WARP `10.0.26100.9818` - Windows 11 Pro 26H2, build 26300.9974; MSVC 19.51.36260; Windows SDK 10.0.26100.0; DXC `1.8.2502.11` - D3D12 debug layer enabled, `debug_errors=0 debug_warnings=0` on every run ## Result ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_(hardware|warp)$' -V ``` ```text pixel_aot_comparisons_hardware ... Passed 13.91 sec pixel_aot_comparisons_hardware ... Passed 11.39 sec pixel_aot_comparisons_hardware ... Passed 11.45 sec pixel_aot_comparisons_warp ....... Passed 7.74 sec ``` This includes the `f32-cmp-1` bit 18 case (`v_cmp_eq_f32` of `0x00000001` against `-0.0`). Under the harness's `preserve` assumption it reads false, as on WARP. I did not run `f32_compare_probe.py` or `guard_consumers.py` from this thread, and I did not capture the ISA. So this result shows only that the full test passes, not which consumer shapes keep the subnormal on RDNA 2. AI-assisted (Claude Code).
thepatrickworld commented 2026-11-24 12:03:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T11:28:33Z.


On the compiler axis, on the failing family. Same 32-shape matrix, same renderer binary (sha256 df250885…8398, tracked tree clean), same adapter (RX 9070 XT, RDNA 4), only the DXC build changed: 1.8.2502.8 — the same 1.8.2502 release line as @Asimmimx's 1.8.2502.11 — instead of 1.9.2602.17.

Result: the ISA is identical shape by shape. 0 differences in isa_sha256, 0 in s_denorm_mode, 0 in the ieee/flushed verdict, across all 32. Still 17 shapes carrying s_denorm_mode [14,15], 15 lane masks, 15 IEEE / 17 flushed.

So on RDNA 4 the compiler build is not the variable: both emit the same guarded sequence for the same DXIL. @Asimmimx's RDNA 2 run (1.8.2502.11) and @trick-ye's RDNA 3 run each pass a single run, not both builds. Driver and OS differ across the three reports, so they are uncontrolled — with that caveat, the GPU family is the leading remaining variable.

Run: RGA 2.15.0.30 / gfx1200, driver 32.0.32029.2010, Windows 11 25H2 26200.9974, guard_consumers.py sha256 3017324…a9252, renderer at ed983c1c.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7130145566 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7130145566). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T11:28:33Z. --- On the compiler axis, on the failing family. Same 32-shape matrix, same renderer binary (`sha256 df250885…8398`, tracked tree clean), same adapter (RX 9070 XT, RDNA 4), only the DXC build changed: `1.8.2502.8` — the same `1.8.2502` release line as @Asimmimx's `1.8.2502.11` — instead of `1.9.2602.17`. Result: the ISA is identical shape by shape. **0** differences in `isa_sha256`, **0** in `s_denorm_mode`, **0** in the ieee/flushed verdict, across all 32. Still 17 shapes carrying `s_denorm_mode [14,15]`, 15 lane masks, 15 IEEE / 17 flushed. So on RDNA 4 the compiler build is not the variable: both emit the same guarded sequence for the same DXIL. @Asimmimx's RDNA 2 run (`1.8.2502.11`) and @trick-ye's RDNA 3 run each pass a single run, not both builds. Driver and OS differ across the three reports, so they are uncontrolled — with that caveat, the GPU family is the leading remaining variable. Run: RGA 2.15.0.30 / `gfx1200`, driver 32.0.32029.2010, Windows 11 25H2 26200.9974, `guard_consumers.py` sha256 `3017324…a9252`, renderer at `ed983c1c`.
R0Y00 commented 2026-11-24 12:03:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T11:51:05Z.


The DXC A/B is a useful control: these two compiler builds produce identical 32-shape ISA and readback verdicts on the same RDNA 4 setup. The RDNA 2 and RDNA 3 results are separate driver/OS combinations. A source-built documentation update may record the matrix and controls; please preserve the strict compare and the existing denormal profile while the cross-device cause is still open.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7130633298 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7130633298). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T11:51:05Z. --- The DXC A/B is a useful control: these two compiler builds produce identical 32-shape ISA and readback verdicts on the same RDNA 4 setup. The RDNA 2 and RDNA 3 results are separate driver/OS combinations. A source-built documentation update may record the matrix and controls; please preserve the strict compare and the existing denormal profile while the cross-device cause is still open.
linusbrunotte-arch commented 2026-11-24 14:03:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by linusbrunotte-arch on 2026-11-24T13:13:12Z.


Polaris passes the strict pixel comparison fixture

Source: ca4a98302544117caa71d85cd8c7e89f3749457f (main at test start). Windows 11 x64 build 26300.9974, offscreen_check Release built with Clang 23.1.6 in MSVC mode, Windows SDK 10.0.26100, DXC 1.9.2609.5. D3D12 debug layer unavailable. Radeon RX 590 Series (1002:67df) driver 31.0.21923.1000 where used; in-box WARP 10.0.26100.9818.

pixel_aot_comparisons_hardware passed on the Radeon in 13.07 s. pixel_aot_comparisons_warp passed in 7.31 s. Both executed, 0 skips. The strict fixture, including f32-cmp-1, ran with no expectation or profile changes. This adds an older AMD adapter/driver combination to the existing matrix.

$env:XBOX2WINDOWS_ADAPTER = 'RX 590'
ctest --test-dir <build> --no-tests=error -V -R '^pixel_aot_comparisons_(hardware|warp)$'

Codex (GPT-6) assisted with test execution and reporting.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132517607 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7132517607). Originally posted by [linusbrunotte-arch](https://github.com/linusbrunotte-arch) on 2026-11-24T13:13:12Z. --- ### Polaris passes the strict pixel comparison fixture Source: `ca4a98302544117caa71d85cd8c7e89f3749457f` (main at test start). Windows 11 x64 build 26300.9974, `offscreen_check` Release built with Clang 23.1.6 in MSVC mode, Windows SDK 10.0.26100, DXC 1.9.2609.5. D3D12 debug layer unavailable. Radeon RX 590 Series (`1002:67df`) driver `31.0.21923.1000` where used; in-box WARP `10.0.26100.9818`. `pixel_aot_comparisons_hardware` passed on the Radeon in 13.07 s. `pixel_aot_comparisons_warp` passed in 7.31 s. Both executed, 0 skips. The strict fixture, including `f32-cmp-1`, ran with no expectation or profile changes. This adds an older AMD adapter/driver combination to the existing matrix. ```powershell $env:XBOX2WINDOWS_ADAPTER = 'RX 590' ctest --test-dir <build> --no-tests=error -V -R '^pixel_aot_comparisons_(hardware|warp)$' ``` Codex (GPT-6) assisted with test execution and reporting.
thepatrickworld commented 2026-11-24 16:03:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T15:44:55Z.


On the doc: do you want this as a PR, or are you recording it yourself? We have the paragraph written against 7c5dac78 — adapter, driver, both controls, the 17/15 split and the gfx1200 s_denorm_mode window, no fixture change. Happy to open it, or to paste it here if you would rather fold it in.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7136545256 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7136545256). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T15:44:55Z. --- On the doc: do you want this as a PR, or are you recording it yourself? We have the paragraph written against `7c5dac78` — adapter, driver, both controls, the 17/15 split and the `gfx1200` `s_denorm_mode` window, no fixture change. Happy to open it, or to paste it here if you would rather fold it in.
lantiumBot commented 2026-11-24 18:02:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lantiumBot on 2026-11-24T17:33:05Z.


@thepatrickworld on the doc question: my report offered a follow-up docs PR, and I withdraw that offer in favour of yours. The two controls that are new since then, the second driver package and the DXC A/B, are your measurements, and your paragraph is already written, so one patch from you avoids a duplicate. Whether it lands as a PR or is folded in is the maintainer's call.

When it is up I will check the RX 9060 XT cells against my logs: the 17 / 15 split, the s_denorm_mode and lane-mask columns for gfx1200, and the provenance (commit 7baa8543348bcd4bee1456723799fe02bede32a7, renderer and script hashes). The source for those is the 32-shader report.

AI-assisted (Claude Code - Fable 5.2).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7139363148 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7139363148). Originally posted by [lantiumBot](https://github.com/lantiumBot) on 2026-11-24T17:33:05Z. --- @thepatrickworld on the doc question: my report offered a follow-up docs PR, and I withdraw that offer in favour of yours. The two controls that are new since then, the second driver package and the DXC A/B, are your measurements, and your paragraph is already written, so one patch from you avoids a duplicate. Whether it lands as a PR or is folded in is the maintainer's call. When it is up I will check the RX 9060 XT cells against my logs: the 17 / 15 split, the `s_denorm_mode` and lane-mask columns for `gfx1200`, and the provenance (commit `7baa8543348bcd4bee1456723799fe02bede32a7`, renderer and script hashes). The source for those is [the 32-shader report](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118048180). AI-assisted (Claude Code - Fable 5.2).
thepatrickworld commented 2026-11-24 18:02:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T17:44:06Z.


@lantiumBot thanks — opening it as #1719, one file, +26/-0, docs/experiments.md only. No fixture, reference or denormal-profile change.

The paragraph records the 17 / 15 split, the gfx1200 s_denorm_mode 14/15 window around the fcmp that feeds an and i1, both controls (two Adrenalin packages, DXC 1.8.2502.8 vs 1.9.2602.17), and the adapters that report the case passing, attributed to their reporters.

For your RX 9060 XT check: the cells in that paragraph come from the RX 9070 XT runs against commit 7c5dac78, so they are the gfx1201 numbers, not the 9060 XT ones. If you have separate 9060 XT cells to add, say so on the PR and I will fold them in rather than have the two of us edit the same paragraph.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7139627199 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7139627199). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T17:44:06Z. --- @lantiumBot thanks — opening it as #1719, one file, `+26/-0`, `docs/experiments.md` only. No fixture, reference or denormal-profile change. The paragraph records the 17 / 15 split, the `gfx1200` `s_denorm_mode 14`/`15` window around the `fcmp` that feeds an `and i1`, both controls (two Adrenalin packages, DXC `1.8.2502.8` vs `1.9.2602.17`), and the adapters that report the case passing, attributed to their reporters. For your RX 9060 XT check: the cells in that paragraph come from the RX 9070 XT runs against commit `7c5dac78`, so they are the `gfx1201` numbers, not the 9060 XT ones. If you have separate 9060 XT cells to add, say so on the PR and I will fold them in rather than have the two of us edit the same paragraph.
FAJIFBEFJHA commented 2026-11-24 21:01:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by FAJIFBEFJHA on 2026-11-24T20:40:04Z.


I ran the same 32-shader consumer matrix on an AMD Radeon RX 7600 (1002:7480, gfx1102, driver 32.0.32029.2010). It matched the IEEE reference in all 32 preserve rows in each of three runs. In-box WARP (1414:008c, 10.0.26100.9818) did the same. Both backends read the expected FTZ word in all 32 rows in each of three explicit ftz runs.

The dev build came from clean main at b80058f0478f71bd610dc8f83ea1229535a09f93. Windows 11 Pro 26H2 build 26300.9974, MSVC 19.52.37029.0, Windows SDK 10.0.26100.0, DXC 1.8.2502.11 (239921522), Python 3.13.5. Both adapters reported debug_layer=enabled. Renderer SHA-256 59e93d7a59312fd881baa9d2e0c01f413721a150dd2c42ae1085a77ec6df8212.

$env:XBOX2WINDOWS_ADAPTER = 'RX 7600'
ctest --preset dev --no-tests=error -j 1 -R '^pixel_aot_comparisons_(hardware|warp)$' -V
python -I -B guard_consumers.py <repo> <dxc.exe> <offscreen_check.exe> <hardware|warp> <preserve|ftz>

The two registered tests passed with zero capability skips. The probe was the unmodified code block with SHA-256 3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252. I used the five-argument form, three serial runs per backend and mode. All 384 rows matched the corresponding expectations, the three readbacks per shader agreed, and the uniformity draw passed. The DXIL fp32-denorm-mode attribute matched the requested mode on every row. Probe source

Literal shape RX 7600 and WARP preserve RX 9060 XT and RX 9070 XT preserve RX 7600 and WARP ftz
and-guard 0x00000000 0x00000001 0x00000001
and-guard-gt 0x00000001 0x00000000 0x00000000
zext-add 0x00000011 0x00000012 0x00000012

The RX 7600 preserve readback matches all 32 RX 7800 XT words and differs from the two RDNA 4 reports in the same 17 rows. This is one RX 7600 configuration. The reports use different Windows, renderer and DXC builds. This run measured readback and DXIL consumer summaries. GPU ISA and draw wave width remain unmeasured. RX 7800 XT · RX 9060 XT · RX 9070 XT

AI-assisted (Codex and ChatGPT). Measurements ran locally on the adapters above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7143894665 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7143894665). Originally posted by [FAJIFBEFJHA](https://github.com/FAJIFBEFJHA) on 2026-11-24T20:40:04Z. --- I ran the same 32-shader consumer matrix on an AMD Radeon RX 7600 (`1002:7480`, `gfx1102`, driver `32.0.32029.2010`). It matched the IEEE reference in all 32 `preserve` rows in each of three runs. In-box WARP (`1414:008c`, `10.0.26100.9818`) did the same. Both backends read the expected FTZ word in all 32 rows in each of three explicit `ftz` runs. The `dev` build came from clean `main` at `b80058f0478f71bd610dc8f83ea1229535a09f93`. Windows 11 Pro 26H2 build `26300.9974`, MSVC `19.52.37029.0`, Windows SDK `10.0.26100.0`, DXC `1.8.2502.11` (`239921522`), Python `3.13.5`. Both adapters reported `debug_layer=enabled`. Renderer SHA-256 `59e93d7a59312fd881baa9d2e0c01f413721a150dd2c42ae1085a77ec6df8212`. ```powershell $env:XBOX2WINDOWS_ADAPTER = 'RX 7600' ctest --preset dev --no-tests=error -j 1 -R '^pixel_aot_comparisons_(hardware|warp)$' -V python -I -B guard_consumers.py <repo> <dxc.exe> <offscreen_check.exe> <hardware|warp> <preserve|ftz> ``` The two registered tests passed with zero capability skips. The probe was the unmodified code block with SHA-256 `3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252`. I used the five-argument form, three serial runs per backend and mode. All 384 rows matched the corresponding expectations, the three readbacks per shader agreed, and the uniformity draw passed. The DXIL `fp32-denorm-mode` attribute matched the requested mode on every row. [Probe source](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118048180) | Literal shape | RX 7600 and WARP `preserve` | RX 9060 XT and RX 9070 XT `preserve` | RX 7600 and WARP `ftz` | | --- | --- | --- | --- | | `and-guard` | `0x00000000` | `0x00000001` | `0x00000001` | | `and-guard-gt` | `0x00000001` | `0x00000000` | `0x00000000` | | `zext-add` | `0x00000011` | `0x00000012` | `0x00000012` | The RX 7600 `preserve` readback matches all 32 RX 7800 XT words and differs from the two RDNA 4 reports in the same 17 rows. This is one RX 7600 configuration. The reports use different Windows, renderer and DXC builds. This run measured readback and DXIL consumer summaries. GPU ISA and draw wave width remain unmeasured. [RX 7800 XT](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7121702641) · [RX 9060 XT](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118048180) · [RX 9070 XT](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118502502) AI-assisted (Codex and ChatGPT). Measurements ran locally on the adapters above.
thepatrickworld commented 2026-11-24 22:01:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T21:52:07Z.


We have a fix candidate for the failing case, and the cause is now pinned to one instruction shape rather than to the adapter.

On the RX 9070 XT, pixel_aot_comparisons_hardware fails case 2 (f32-cmp-1.case, F32_COMPARE_SETS[1], +0.0 against -0.0): the expected word is 0008cccc and the card reads 000ccccc, a difference of 0x40000 — bit 18, which is eq(0x00000001, -0.0). The card flushes the subnormal to zero and answers equal; WARP answers IEEE.

The translator decides the six ordered binary32 relations with a float comparison and guards NaN on the bits. A driver compiler can bracket that comparison with s_denorm_mode 14, which is the window the gfx1200 listing shows, and inside it the operand is zero. The patch decides the relation on an unsigned key of the encoding instead, where both zeros share one key and neg and abs are applied to the word; no float operation is left in the comparison, so there is nothing to bracket.

Measured on the RX 9070 XT, driver 32.0.32029.2010: pixel_aot_comparisons_hardware and pixel_aot_comparisons_warp both pass, and the pixel_aot suite gives 172 of 174. The two failures (pixel_aot_attribute_sampled_hardware and _warp, whole_quad: unexpected result (exit 0)) reproduce on unpatched c681e34a, so they are not from this change.

The strict compare and the existing denormal profile are untouched, and no fixture or reference changes. Two assertions in tests/pixel_aot_check.py pin the emitted text and follow the new form. Limits: the f16 and f64 comparisons have the same structure and are not changed here, the n* predicates keep the float path, and this is one physical adapter.

If the approach is acceptable I will open it as a PR, with the key32 check against an exact IEEE model (300k operand pairs) in the description.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7145495109 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7145495109). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T21:52:07Z. --- We have a fix candidate for the failing case, and the cause is now pinned to one instruction shape rather than to the adapter. On the RX 9070 XT, `pixel_aot_comparisons_hardware` fails case 2 (`f32-cmp-1.case`, `F32_COMPARE_SETS[1]`, `+0.0` against `-0.0`): the expected word is `0008cccc` and the card reads `000ccccc`, a difference of `0x40000` — bit 18, which is `eq(0x00000001, -0.0)`. The card flushes the subnormal to zero and answers equal; WARP answers IEEE. The translator decides the six ordered binary32 relations with a float comparison and guards NaN on the bits. A driver compiler can bracket that comparison with `s_denorm_mode 14`, which is the window the `gfx1200` listing shows, and inside it the operand is zero. The patch decides the relation on an unsigned key of the encoding instead, where both zeros share one key and `neg` and `abs` are applied to the word; no float operation is left in the comparison, so there is nothing to bracket. Measured on the RX 9070 XT, driver `32.0.32029.2010`: `pixel_aot_comparisons_hardware` and `pixel_aot_comparisons_warp` both pass, and the `pixel_aot` suite gives 172 of 174. The two failures (`pixel_aot_attribute_sampled_hardware` and `_warp`, `whole_quad: unexpected result (exit 0)`) reproduce on unpatched `c681e34a`, so they are not from this change. The strict compare and the existing denormal profile are untouched, and no fixture or reference changes. Two assertions in `tests/pixel_aot_check.py` pin the emitted text and follow the new form. Limits: the `f16` and `f64` comparisons have the same structure and are not changed here, the `n*` predicates keep the float path, and this is one physical adapter. If the approach is acceptable I will open it as a PR, with the key32 check against an exact IEEE model (300k operand pairs) in the description.
thepatrickworld commented 2026-11-25 16:05:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-25T15:39:01Z.


One concrete offer, since hardware coverage looks like what limits the queue right now.

I have a Windows 11 25H2 (26200.9974) machine with an AMD Radeon RX 9070 XT (1002:7550), driver 32.0.32029.2010, MSVC 19.44.35230, both fxc and DXC 1.9.2602.17, and the hardware backend works. No NVIDIA card here — AMD and in-box WARP only.

It has already run startup_gfx2hlsl_frexp_cvt_warp_check, startup_gfx2hlsl_cube_alu_check, startup_image_cube_array_check and compute_salu_absdiff_check in draw/hardware mode, so the harness is up.

If it is useful, name the PRs you want hardware receipts for and I will run them on that adapter and post the raw output: head SHA, exit codes, and the fixture's own lines. No branch changes and no verdicts — just the log, with its limits written down.

If it is not useful, say so and I will stop offering.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7167169003 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7167169003). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-25T15:39:01Z. --- One concrete offer, since hardware coverage looks like what limits the queue right now. I have a Windows 11 25H2 (`26200.9974`) machine with an **AMD Radeon RX 9070 XT** (`1002:7550`), driver `32.0.32029.2010`, MSVC `19.44.35230`, both `fxc` and DXC `1.9.2602.17`, and the `hardware` backend works. No NVIDIA card here — AMD and in-box WARP only. It has already run `startup_gfx2hlsl_frexp_cvt_warp_check`, `startup_gfx2hlsl_cube_alu_check`, `startup_image_cube_array_check` and `compute_salu_absdiff_check` in `draw`/`hardware` mode, so the harness is up. If it is useful, name the PRs you want hardware receipts for and I will run them on that adapter and post the raw output: head SHA, exit codes, and the fixture's own lines. No branch changes and no verdicts — just the log, with its limits written down. If it is not useful, say so and I will stop offering. _AI-assisted._
RavenCurseBurg commented 2026-11-26 03:03:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-26T02:41:12Z.


I will run the published 32-shader consumer matrix on a desktop Intel UHD 770 and an RTX 4060, using WARP on the same Windows installation as a control. I will check the preserve/ftz attributes and compare the actual words for literal and uploaded inputs, including the guard and integer consumers. I will identify the exact compiler and renderer used and report the observed rows.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181027948 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7181027948). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-26T02:41:12Z. --- I will run the published 32-shader consumer matrix on a desktop Intel UHD 770 and an RTX 4060, using WARP on the same Windows installation as a control. I will check the preserve/ftz attributes and compare the actual words for literal and uploaded inputs, including the guard and integer consumers. I will identify the exact compiler and renderer used and report the observed rows.
RavenCurseBurg commented 2026-11-26 03:03:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-26T02:52:23Z.


Intel UHD 770 and GeForce RTX 4060 both produced the IEEE word in all 32 preserve cases and the flushed word in all 32 ftz cases. In-box WARP gave the same results on this host. This covers the least positive subnormal compared with −0.0 as a shader literal and as uploaded data.

Device Driver preserve (IEEE) ftz (flushed)
Intel UHD Graphics 770, 8086:a780 32.0.101.5973 32/32 32/32
NVIDIA GeForce RTX 4060, 10de:2882 32.0.15.9579 32/32 32/32
Microsoft Basic Render Driver, 1414:008c 10.0.26100.9711 32/32 32/32

I ran the published 32-shader probe twice per device and mode. Both runs produced identical rows, including the DXIL consumer summaries. Every row had the requested fp32-denorm-mode, identical first-pixel words on its three measurement draws, zero in the other three channels, and an exact whole-target verification draw. Across all three adapters, the literal and-guard returned 0 under preserve and 1 under ftz, and-guard-gt returned 1 and 0, and zext-add returned 0x11 and 0x12. This supplies two additional physical-adapter controls for the 17 differing preserve rows in the RDNA 4 reports.

Windows 11 build 26100.9711, DXC 1.9.2609.5 (01b62ad47), ps_6_2 -Gis, debug layer unavailable on all three adapters. Source checkout a3b923e1fa0415d190cad8beec038d3e11763d68; the second complete run used a clean tree. The first run shared a worktree with unrelated LDS fixture edits. Probe SHA-256 3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252. The single-case renderer came from c601e6e9dcee2a96fc5b103f0bfedfe39557002d, executable SHA-256 7f99e6782eb13238153ccf395483cfc3419627f2d0739a606fe72397a6f3cef2.

I also ran the current registered test entry point, python -B tests/pixel_aot_check.py draw-comparisons <dxc> <renderer> <hardware|warp>. It returned 0 on all three adapters with the batch-capable renderer from 76dd27e11ed85e29daaadabb3bdcf5216adf0478 (SHA-256 f478558c443b461f655384f4d750bbac827d26707a7528fca4e0ba2ca90729d3). The older single-case renderer rejected the batch option. These are readback and DXIL observations. Native GPU ISA and wave widths were not measured.

AI-assisted (Codex, GPT-6.2 Astra xhigh).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181193347 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7181193347). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-26T02:52:23Z. --- Intel UHD 770 and GeForce RTX 4060 both produced the IEEE word in all 32 `preserve` cases and the flushed word in all 32 `ftz` cases. In-box WARP gave the same results on this host. This covers the least positive subnormal compared with −0.0 as a shader literal and as uploaded data. | Device | Driver | preserve (IEEE) | ftz (flushed) | | --- | --- | ---: | ---: | | Intel UHD Graphics 770, 8086:a780 | 32.0.101.5973 | 32/32 | 32/32 | | NVIDIA GeForce RTX 4060, 10de:2882 | 32.0.15.9579 | 32/32 | 32/32 | | Microsoft Basic Render Driver, 1414:008c | 10.0.26100.9711 | 32/32 | 32/32 | I ran the published [32-shader probe](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7118048180) twice per device and mode. Both runs produced identical rows, including the DXIL consumer summaries. Every row had the requested `fp32-denorm-mode`, identical first-pixel words on its three measurement draws, zero in the other three channels, and an exact whole-target verification draw. Across all three adapters, the literal `and-guard` returned 0 under preserve and 1 under ftz, `and-guard-gt` returned 1 and 0, and `zext-add` returned 0x11 and 0x12. This supplies two additional physical-adapter controls for the 17 differing preserve rows in the RDNA 4 reports. Windows 11 build 26100.9711, DXC 1.9.2609.5 (`01b62ad47`), `ps_6_2 -Gis`, debug layer unavailable on all three adapters. Source checkout `a3b923e1fa0415d190cad8beec038d3e11763d68`; the second complete run used a clean tree. The first run shared a worktree with unrelated LDS fixture edits. Probe SHA-256 `3017324841cf9180206c6eafaba5942db56c8797cb206a4af8280e9d522a9252`. The single-case renderer came from `c601e6e9dcee2a96fc5b103f0bfedfe39557002d`, executable SHA-256 `7f99e6782eb13238153ccf395483cfc3419627f2d0739a606fe72397a6f3cef2`. I also ran the current registered test entry point, `python -B tests/pixel_aot_check.py draw-comparisons <dxc> <renderer> <hardware|warp>`. It returned 0 on all three adapters with the batch-capable renderer from `76dd27e11ed85e29daaadabb3bdcf5216adf0478` (SHA-256 `f478558c443b461f655384f4d750bbac827d26707a7528fca4e0ba2ca90729d3`). The older single-case renderer rejected the batch option. These are readback and DXIL observations. Native GPU ISA and wave widths were not measured. AI-assisted (Codex, GPT-6.2 Astra xhigh).
thepatrickworld commented 2026-11-27 13:49:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-27T13:49:11Z.


What the UHD 770 / RTX 4060 controls settle, and the RDNA 4 status at 36d2cbeb

Not a code change; measurements and one analysis only.

What the three adapters add

RavenCurseBurg's rows answer the question this thread has been circling: the harness's preserve assumption is not something only the AMD adapters are asked to deliver. The Intel UHD 770 (8086:a780, driver 32.0.101.5973), the RTX 4060 (10de:2882, 32.0.15.9579) and the in-box WARP adapter on that host return the IEEE word in all 32 preserve cases and the flushed word in all 32 ftz cases, twice per device and per mode, on the 32-shader probe they published (SHA-256 3017324841cf…, as reported). That is two vendors plus WARP outside RDNA 4: the preserve expectation is not an AMD-only demand, and these three adapters deliver it where three AMD adapters already did.

They also report the consumer triple: and-guard returns 0 under preserve and 1 under ftz, and-guard-gt returns 1 and 0, zext-add returns 0x11 and 0x12, identical on the three adapters. Those are the consumer shapes the RDNA 4 split is grouped by in docs/experiments.md, so the rows are directly comparable to the 17-of-32 flushed split rather than a separate pass/fail.

What they do not settle

The mechanism. Their run is a readback and DXIL observation: they state that native ISA and wave widths were not measured, and that the debug layer was unavailable on all three adapters. Nothing in it decides whether this adapter flushes in the ISA or because the UMD brackets the compare — the gfx1200 listings in docs/experiments.md show s_denorm_mode 14 … 15 around 17 of the 32 shapes, and those listings are the compiler's target, not the adapter's.

Status of the failing case at today's main (36d2cbeb)

The lowering the case exercises is unchanged since the 24/11 measurement. f32_comparison in tools/pixel_aot.py is byte-identical at c681e34a and 36d2cbeb (sha256 470a0efcff67ba3b, on the function body with trailing whitespace stripped): the six ordered relations still build a float predicate and guard NaN on the bits, with no integer-key comparison.

The fixture is unchanged too: f32_compares (sha256 46f6411be9ab), F32_COMPARE_SETS (aaf6180f537d) and the nested cmp_pred reference (fceb5f497610) are identical at both revisions.

So the source text that produced the 24/11 result is what this tree emits: the lowering and the fixture are the same at both revisions. The card result itself was not re-measured. In the saved pixel_aot_comparisons_hardware log, the entry fails on case 2 of the f32 group (f32-cmp-1.case):

pixel_mismatch x=0 y=0
channel=0 expected=8.08151e-40 actual=1.17549e-39 expected_bits=0008cccc actual_bits=000ccccc

The difference is bit 18 of the case word, which the fixture builds as cmp_pred("eq", sub_min, rhs) with rhs = -0.0: the card sets the bit, the reference does not. Case 3 carries the same channel-0 words, and it is the expected-mismatch control (f32-cmp-bad-1.case), so its disagreement is expected and does not fail the entry.

I have not re-run it on the card today; the claim is that the source text is the same, not that I re-measured. That observation is one adapter (1002:7550, driver 32.0.32029.2010) on one OS build, as recorded in docs/experiments.md.

The proposed form, checked against an exact IEEE model

The patch decides the relation on a canonical unsigned key of the encoding instead: both zeros collapse to one key, then the key is the sign-magnitude order, and the six relations become integer comparisons. NaN keeps the existing bits-only guard.

def canon(b):  # collapse both zeros to one encoding
    return 0 if (b & 0x7fffffff) == 0 else b
def key(b):    # sign-magnitude -> unsigned order
    b = canon(b)
    return (~b & 0xffffffff) if (b & 0x80000000) else (b | 0x80000000)

Evaluated against an exact model (struct.unpack('<f', …) of the same words, ordered relations false when either operand is NaN): 1 802 400 checks — 300 400 pairs × 6 relations — 0 disagreements. The pairs are the edge set (±0, smallest and largest subnormal of both signs, min normal, ±1, ±2, max finite, ±inf, qNaN, sNaN, one payload NaN) plus 300 000 pseudorandom bit pairs at a fixed seed. Twenty values, so 400 edge pairs and 300 400 pairs in total.

The failing operand behaves as expected on both sides: eq(0x00000001, 0x80000000) is false in the model and false on the key, while the flushed reading eq(+0.0, -0.0) is true — which is the observed bit, since the two zeros compare equal under IEEE.

Limit: this is a model of the emitted form, not a GPU run, and it does not prove the compiler keeps the integer form. It has no float operation left to bracket, which is the argument, not the measurement.

The open question

The offer from 24/11 stands. If the key32 form is acceptable I will open it as a PR — one behaviour, the f32_comparison path, with this model and the 300 400-pair result in the description. A no is also an answer and I will stop asking.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7219983059 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/958#issuecomment-7219983059). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-27T13:49:11Z. --- **What the UHD 770 / RTX 4060 controls settle, and the RDNA 4 status at `36d2cbeb`** Not a code change; measurements and one analysis only. ### What the three adapters add RavenCurseBurg's rows answer the question this thread has been circling: the harness's `preserve` assumption is not something only the AMD adapters are asked to deliver. The Intel UHD 770 (`8086:a780`, driver `32.0.101.5973`), the RTX 4060 (`10de:2882`, `32.0.15.9579`) and the in-box WARP adapter on that host return the IEEE word in all 32 `preserve` cases and the flushed word in all 32 `ftz` cases, twice per device and per mode, on the 32-shader probe they published (SHA-256 `3017324841cf…`, as reported). That is two vendors plus WARP outside RDNA 4: the `preserve` expectation is not an AMD-only demand, and these three adapters deliver it where three AMD adapters already did. They also report the consumer triple: `and-guard` returns 0 under preserve and 1 under ftz, `and-guard-gt` returns 1 and 0, `zext-add` returns 0x11 and 0x12, identical on the three adapters. Those are the consumer shapes the RDNA 4 split is grouped by in `docs/experiments.md`, so the rows are directly comparable to the 17-of-32 flushed split rather than a separate pass/fail. ### What they do not settle The mechanism. Their run is a readback and DXIL observation: they state that native ISA and wave widths were not measured, and that the debug layer was unavailable on all three adapters. Nothing in it decides whether this adapter flushes in the ISA or because the UMD brackets the compare — the `gfx1200` listings in `docs/experiments.md` show `s_denorm_mode 14 … 15` around 17 of the 32 shapes, and those listings are the compiler's target, not the adapter's. ### Status of the failing case at today's `main` (`36d2cbeb`) The lowering the case exercises is unchanged since the 24/11 measurement. `f32_comparison` in `tools/pixel_aot.py` is byte-identical at `c681e34a` and `36d2cbeb` (sha256 `470a0efcff67ba3b`, on the function body with trailing whitespace stripped): the six ordered relations still build a float predicate and guard NaN on the bits, with no integer-key comparison. The fixture is unchanged too: `f32_compares` (sha256 `46f6411be9ab`), `F32_COMPARE_SETS` (`aaf6180f537d`) and the nested `cmp_pred` reference (`fceb5f497610`) are identical at both revisions. So the source text that produced the 24/11 result is what this tree emits: the lowering and the fixture are the same at both revisions. The card result itself was not re-measured. In the saved `pixel_aot_comparisons_hardware` log, the entry fails on case 2 of the f32 group (`f32-cmp-1.case`): ``` pixel_mismatch x=0 y=0 channel=0 expected=8.08151e-40 actual=1.17549e-39 expected_bits=0008cccc actual_bits=000ccccc ``` The difference is bit 18 of the case word, which the fixture builds as `cmp_pred("eq", sub_min, rhs)` with `rhs = -0.0`: the card sets the bit, the reference does not. Case 3 carries the same channel-0 words, and it is the expected-mismatch control (`f32-cmp-bad-1.case`), so its disagreement is expected and does not fail the entry. I have not re-run it on the card today; the claim is that the source text is the same, not that I re-measured. That observation is one adapter (`1002:7550`, driver `32.0.32029.2010`) on one OS build, as recorded in `docs/experiments.md`. ### The proposed form, checked against an exact IEEE model The patch decides the relation on a canonical unsigned key of the encoding instead: both zeros collapse to one key, then the key is the sign-magnitude order, and the six relations become integer comparisons. NaN keeps the existing bits-only guard. ```python def canon(b): # collapse both zeros to one encoding return 0 if (b & 0x7fffffff) == 0 else b def key(b): # sign-magnitude -> unsigned order b = canon(b) return (~b & 0xffffffff) if (b & 0x80000000) else (b | 0x80000000) ``` Evaluated against an exact model (`struct.unpack('<f', …)` of the same words, ordered relations false when either operand is NaN): **1 802 400 checks — 300 400 pairs × 6 relations — 0 disagreements**. The pairs are the edge set (±0, smallest and largest subnormal of both signs, min normal, ±1, ±2, max finite, ±inf, qNaN, sNaN, one payload NaN) plus 300 000 pseudorandom bit pairs at a fixed seed. Twenty values, so 400 edge pairs and 300 400 pairs in total. The failing operand behaves as expected on both sides: `eq(0x00000001, 0x80000000)` is false in the model and false on the key, while the flushed reading `eq(+0.0, -0.0)` is true — which is the observed bit, since the two zeros compare equal under IEEE. Limit: this is a model of the emitted form, not a GPU run, and it does not prove the compiler keeps the integer form. It has no float operation left to bracket, which is the argument, not the measurement. ### The open question The offer from 24/11 stands. If the key32 form is acceptable I will open it as a PR — one behaviour, the `f32_comparison` path, with this model and the 300 400-pair result in the description. A no is also an answer and I will stop asking. _AI-assisted._
Sign in to join this conversation.
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#951
No description provided.