pixel_aot: make the denormal mode explicit and treat NaN payloads as vendor-dependent #307

Open
opened 2026-11-21 21:45:43 +00:00 by MoonYueya · 15 comments
MoonYueya commented 2026-11-21 21:45:43 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MoonYueya on 2026-11-21T21:45:43Z.


Summary

pixel_aot compares translated shaders against a CPU reference, but the floating-point environment those references assume is mostly implicit. #288 makes one piece explicit (v_mad_f32/v_mac_f32 always flush). This issue is about the rest: the denormal mode the other f32/f16 instructions run under, and NaN payload handling on the readback side. Both differ in ways that can change test results across GPUs.

I measured this on two desktop GPUs and WARP. The data is below in case it is useful. I am not proposing a specific patch.

1. Denormal mode is pipeline state, not shader bytes

On RDNA, instructions such as v_add_f32 / v_fma_f32 honor MODE.FP_DENORM. Its initial value comes from the pipeline's SPI_SHADER_PGM_RSRC1.FLOAT_MODE, not from the instruction stream. A shader blob alone therefore does not tell you whether binary32 denormals are flushed. v_mad_f32/v_mac_f32 are the exception (always flushed, per #288).

On desktop D3D12, the closest equivalent is the DXIL -denorm attribute (preserve / ftz / any). The same HLSL compiled three ways, differing only in that attribute, gave:

Input Op preserve ftz any
f32 min subnormal 0x00000001 min(x, 1.0f) 0x00000001 0x00000000 0x00000000
f32 min subnormal 0x00000001 max(x, -1.0f) 0x00000001 0x00000000 0x00000000
f32 subnormal x * 1.0f not flushed in any mode (folded to a move)

So the attribute does change results, but only on paths that survive optimization. A fixture that "checks denormals" through x * 1.0f would not detect the mode.

Suggestion: treat the f32 (and f16/f64, which have separate mode bits) denormal mode as an explicit parameter of a pixel_aot case, record which value the reference assumes, and compile with the matching -denorm attribute. Without Scarlett pipeline state the correct value is an assumption; writing it down keeps the assumption visible, as #288 does for the product/sum flush.

2. NaN payloads are vendor-dependent on readback

Same probe, 624 rows per vendor (16 f32 bit patterns × 7 ops, 16 f16 bit patterns × 6 ops, × 3 -denorm modes). 597 rows matched between vendors. All 27 mismatches were NaNs:

Case AMD Radeon (RDNA2, desktop) NVIDIA RTX 3080
f32 NaN x + 1.0f (0x7FC00000, 0x7F800001, 0xFFC00003) sign and payload kept all 0x7FFFFFFF
f16 NaN h + 1.0h (0x7E00, 0x7C01, 0xFE03) kept all 0x7FFF
f16 → f32 widen of a NaN quieted, sign and payload kept (0x7C01 → 0x7F802000) all 0x7FFFFFFF
f16 NaN written to an R16G16_FLOAT target, read back 19/19 bit patterns unchanged 4 NaN payloads rewritten to 0x7FFF

Subnormals, ±0 and rounding-boundary rows were identical on both vendors in this probe.

Implication for pixel_aot: a fixture whose expected output contains a NaN can pass on NVIDIA and WARP and fail on AMD, or the other way round, if the comparison is bitwise. Comparing NaNs as a class (or excluding NaN payload bits) avoids that. Otherwise the vendor dependence should be stated in the fixture.

Environment

  • AMD Radeon(TM) Graphics (Ryzen 7 7700 iGPU, RDNA2 desktop), PCI 1002:164E, driver 32.0.11024.2
  • NVIDIA GeForce RTX 3080, PCI 10DE:2206, driver 32.0.16.1742
  • WARP (Microsoft Basic Render Driver) as a third reference
  • Windows 11, DXC from Windows SDK 10.0.26100.0, SM 6.2 with -enable-16bit-types for f16 cases

Limits

  • These are desktop driver results. Xbox Series behavior is not measured, and I am not claiming either vendor matches the console.
  • The probe is synthetic HLSL and uses no game files or dumps.

AI-assisted: yes; the measurements were run on the hardware listed above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6534789463 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312). Originally posted by [MoonYueya](https://github.com/MoonYueya) on 2026-11-21T21:45:43Z. --- ## Summary `pixel_aot` compares translated shaders against a CPU reference, but the floating-point environment those references assume is mostly implicit. #288 makes one piece explicit (`v_mad_f32`/`v_mac_f32` always flush). This issue is about the rest: the denormal mode the other f32/f16 instructions run under, and NaN payload handling on the readback side. Both differ in ways that can change test results across GPUs. I measured this on two desktop GPUs and WARP. The data is below in case it is useful. I am not proposing a specific patch. ## 1. Denormal mode is pipeline state, not shader bytes On RDNA, instructions such as `v_add_f32` / `v_fma_f32` honor `MODE.FP_DENORM`. Its initial value comes from the pipeline's `SPI_SHADER_PGM_RSRC1.FLOAT_MODE`, not from the instruction stream. A shader blob alone therefore does not tell you whether binary32 denormals are flushed. `v_mad_f32`/`v_mac_f32` are the exception (always flushed, per #288). On desktop D3D12, the closest equivalent is the DXIL `-denorm` attribute (`preserve` / `ftz` / `any`). The same HLSL compiled three ways, differing only in that attribute, gave: | Input | Op | `preserve` | `ftz` | `any` | |---|---|---|---|---| | f32 min subnormal `0x00000001` | `min(x, 1.0f)` | `0x00000001` | `0x00000000` | `0x00000000` | | f32 min subnormal `0x00000001` | `max(x, -1.0f)` | `0x00000001` | `0x00000000` | `0x00000000` | | f32 subnormal | `x * 1.0f` | not flushed in any mode (folded to a move) | | | So the attribute does change results, but only on paths that survive optimization. A fixture that "checks denormals" through `x * 1.0f` would not detect the mode. Suggestion: treat the f32 (and f16/f64, which have separate mode bits) denormal mode as an explicit parameter of a `pixel_aot` case, record which value the reference assumes, and compile with the matching `-denorm` attribute. Without Scarlett pipeline state the correct value is an assumption; writing it down keeps the assumption visible, as #288 does for the product/sum flush. ## 2. NaN payloads are vendor-dependent on readback Same probe, 624 rows per vendor (16 f32 bit patterns × 7 ops, 16 f16 bit patterns × 6 ops, × 3 `-denorm` modes). 597 rows matched between vendors. **All 27 mismatches were NaNs:** | Case | AMD Radeon (RDNA2, desktop) | NVIDIA RTX 3080 | |---|---|---| | f32 NaN `x + 1.0f` (`0x7FC00000`, `0x7F800001`, `0xFFC00003`) | sign and payload kept | all `0x7FFFFFFF` | | f16 NaN `h + 1.0h` (`0x7E00`, `0x7C01`, `0xFE03`) | kept | all `0x7FFF` | | f16 → f32 widen of a NaN | quieted, sign and payload kept (`0x7C01` → `0x7F802000`) | all `0x7FFFFFFF` | | f16 NaN written to an `R16G16_FLOAT` target, read back | 19/19 bit patterns unchanged | 4 NaN payloads rewritten to `0x7FFF` | Subnormals, ±0 and rounding-boundary rows were identical on both vendors in this probe. Implication for `pixel_aot`: a fixture whose expected output contains a NaN can pass on NVIDIA and WARP and fail on AMD, or the other way round, if the comparison is bitwise. Comparing NaNs as a class (or excluding NaN payload bits) avoids that. Otherwise the vendor dependence should be stated in the fixture. ## Environment - AMD Radeon(TM) Graphics (Ryzen 7 7700 iGPU, RDNA2 desktop), PCI `1002:164E`, driver 32.0.11024.2 - NVIDIA GeForce RTX 3080, PCI `10DE:2206`, driver 32.0.16.1742 - WARP (Microsoft Basic Render Driver) as a third reference - Windows 11, DXC from Windows SDK 10.0.26100.0, SM 6.2 with `-enable-16bit-types` for f16 cases ## Limits - These are **desktop** driver results. Xbox Series behavior is not measured, and I am not claiming either vendor matches the console. - The probe is synthetic HLSL and uses no game files or dumps. AI-assisted: yes; the measurements were run on the hardware listed above.
R0Y00 commented 2026-11-24 06:48:04 +00:00 (Migrated from github.com)
Author
Contributor

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


Approved for an explicit fixture-level floating-point mode, starting with f32. Match the reference, compilation flags and emitted operations, and include a non-folding control that distinguishes preserve from FTZ. Record unknown/any as such; establish f16 and f64 separately and retain existing instruction-specific rules.

Accept a NaN by class only for a row expecting NaN when the operation or conversion permits sign/payload variation. Record the raw bits and check all other defined bits. Keep comparison predicate results strict. Check integer bit operations, bitcasts and moves bit-for-bit through a lossless integer readback; normalization on a floating-point render-target write is specific to that path.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069832059 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7069832059). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T21:56:57Z. --- Approved for an explicit fixture-level floating-point mode, starting with f32. Match the reference, compilation flags and emitted operations, and include a non-folding control that distinguishes preserve from FTZ. Record unknown/any as such; establish f16 and f64 separately and retain existing instruction-specific rules. Accept a NaN by class only for a row expecting NaN when the operation or conversion permits sign/payload variation. Record the raw bits and check all other defined bits. Keep comparison predicate results strict. Check integer bit operations, bitcasts and moves bit-for-bit through a lossless integer readback; normalization on a floating-point render-target write is specific to that path.
abilliontokens commented 2026-11-24 06:48:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-21T22:50:03Z.


Claiming the approved f32 slice. First step: add an explicit per-case f32 denormal mode to the pixel_aot fixture harness — record the mode the CPU reference assumes, compile the emitted HLSL with the matching DXC -denorm attribute, and add a non-folding preserve-vs-FTZ control (min/max on the least subnormal; x * 1.0f folds to a move and cannot detect the mode). Readback: accept NaN by class only on rows that expect NaN where the operation or conversion permits sign/payload variation, record the raw bits, and keep comparison predicate results and integer/bitcast/move rows bit-for-bit through lossless readback. f16/f64 modes stay unestablished in this patch; existing instruction-specific rules are retained.

Environment: Windows 11 Pro 26200, RTX 5060 Ti (32.0.16.2124) + RX 9060 XT (32.0.32029.2010), CMake 4.4.3 / Ninja 1.13.2, Python 3.12.10, MSVC via vswhere latest. Coordination: fixture-mode plumbing only, no overlap with #288's instruction lowering. Will link the PR here.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7070458701 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7070458701). Originally posted by [abilliontokens](https://github.com/abilliontokens) on 2026-11-21T22:50:03Z. --- Claiming the approved f32 slice. First step: add an explicit per-case f32 denormal mode to the pixel_aot fixture harness — record the mode the CPU reference assumes, compile the emitted HLSL with the matching DXC `-denorm` attribute, and add a non-folding preserve-vs-FTZ control (min/max on the least subnormal; `x * 1.0f` folds to a move and cannot detect the mode). Readback: accept NaN by class only on rows that expect NaN where the operation or conversion permits sign/payload variation, record the raw bits, and keep comparison predicate results and integer/bitcast/move rows bit-for-bit through lossless readback. f16/f64 modes stay unestablished in this patch; existing instruction-specific rules are retained. Environment: Windows 11 Pro 26200, RTX 5060 Ti (32.0.16.2124) + RX 9060 XT (32.0.32029.2010), CMake 4.4.3 / Ninja 1.13.2, Python 3.12.10, MSVC via vswhere latest. Coordination: fixture-mode plumbing only, no overlap with #288's instruction lowering. Will link the PR here. _AI-assisted._
abilliontokens commented 2026-11-24 06:48:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-21T23:22:07Z.


PR up: #363 — explicit f32 denormal mode with matching -denorm flags at ps_6_2, non-folding preserve-vs-FTZ control, NaN-class readback with raw-word logging, and lossless integer readback. f16/f64 left unestablished as approved. One measured vendor exception recorded: the RTX 5060 Ti driver 32.0.16.2124 refuses PSO creation for the curve program under -denorm preserve (E_OUTOFMEMORY); that fixture records mode any (its rows are subnormal-free). Verified on WARP 10.0.26100.9711, RX 9060 XT and RTX 5060 Ti; commands and results in the PR body.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7070826910 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7070826910). Originally posted by [abilliontokens](https://github.com/abilliontokens) on 2026-11-21T23:22:07Z. --- PR up: #363 — explicit f32 denormal mode with matching `-denorm` flags at `ps_6_2`, non-folding preserve-vs-FTZ control, NaN-class readback with raw-word logging, and lossless integer readback. f16/f64 left unestablished as approved. One measured vendor exception recorded: the RTX 5060 Ti driver 32.0.16.2124 refuses PSO creation for the curve program under `-denorm preserve` (E_OUTOFMEMORY); that fixture records mode `any` (its rows are subnormal-free). Verified on WARP 10.0.26100.9711, RX 9060 XT and RTX 5060 Ti; commands and results in the PR body.
roansystemlabs commented 2026-11-24 06:48:28 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-22T08:05:31Z.


Measurement for the f16 part of this issue ("establish f16 and f64 separately"). No project code changed; this only uses the renderer from #363.

Environment

  • Windows 11 (build 26200), NVIDIA GeForce RTX 3070 (Ampere), driver 32.0.16.2101; WARP 10.0.26100.9818
  • DXC from Windows SDK 10.0.26100.0 (dxcompiler 1.9.2602.17), Python 3.12.10
  • Renderer: offscreen_check built from #363 at e045e19, its head before the latest push (lossless R32G32B32A32_UINT readback via the case-trailer flag)

Probe
A minimal standalone ps_6_2 shader compiled with -enable-16bit-types. Every operand comes from the constant buffer, so nothing folds; results are written as raw words to the integer target. f16 rows:

  • min(0x0001, 0x03ff) and max(0x0001, -0) (least / largest binary16 subnormal)
  • 0x0400 * 0.5 (least normal × 0.5, so the result is the subnormal 0x0200)
  • a plain move of 0x0001 (a control that does not depend on the mode)
  • f16 0x0001 -> f32 (expect 0x33800000) and f32 2^-24 -> f16 (expect 0x0001)

A binary32 control shader runs through the same path and readback (min/max on the least f32 subnormal, least normal × 0.5, a move). This shows the harness does see FTZ when it happens.

Each shader is compiled as dxc [-enable-16bit-types] [-denorm <mode>] -T <target> -E main -Fo … -Fc … and drawn with offscreen_check <hardware|warp> --check-pixel-case <cso> <case>. The case expects the preserve result; on a mismatch the renderer's own actual_bits are recorded.

DXIL

  • The only denormal attribute DXC emits is the function attribute "fp32-denorm-mode"="any|ftz|preserve". Without -denorm there is no attribute.
  • No f16 denormal attribute or field is emitted. Between the ftz and preserve builds of the f16 shader, the listings differ only in the shader hash and that fp32 attribute.
  • In the DXIL the f16 operations are native: dx.op.binary.f16 FMin/FMax, fmul fast half, fpext half→float, fptrunc float→half, and the container has the "Use native low precision" flag. So with native 16-bit types, -denorm gives no way to ask for an f16 mode.

Results: PSO creation succeeded for every variant on both adapters.

Variant f16 on RTX 3070 f16 on WARP f32 control on RTX 3070 f32 control on WARP
ps_6_2 (no -denorm) preserved preserved flushed flushed
ps_6_2 -denorm any preserved preserved flushed flushed
ps_6_2 -denorm ftz preserved preserved flushed flushed
ps_6_2 -denorm preserve preserved preserved preserved preserved
ps_6_6 -denorm ftz preserved preserved flushed flushed
  • "preserved" for f16 means all rows matched bit for bit: 00010001 00010200 33800000 00000001. This includes the subnormal produced by the multiply and both conversions.
  • "flushed" for f32 means min, max and least normal × 0.5 returned zero. One detail: in flushed builds, WARP returns max(least subnormal, -0) as 0x80000000 (both operands flushed, then the -0 is selected), while the RTX 3070 returns 0x00000000. That may matter for the sign rules of the f32 FTZ reference.

Conclusion (cautious)

  • On these two adapters, binary16 subnormals are preserved whatever the -denorm flag says, and DXIL records no f16 mode. The -denorm flag is not a lever for f16.
  • So an f16 fixture whose CPU reference assumes FTZ cannot be requested through compile flags. The emitted HLSL would need an explicit flush, or the f16 mode is recorded as preserve, with the evidence above.
  • Two devices are not enough to call f16 "established". AMD and Intel results with the same probe would be needed first, and the probe is small enough to share.

If useful, I'd be glad to take the f16 slice after #363 lands, on top of its fixture-mode plumbing, if that split suits you. It would add an explicit f16 mode per fixture, a non-folding f16 preserve-vs-FTZ control like the one above, and an explicit flush in the emitted HLSL only where a fixture asks for f16 FTZ. f64 stays out of scope.

AI-assisted: run and prepared with the support of Roan System; reviewed before posting.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7076303368 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7076303368). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-22T08:05:31Z. --- Measurement for the **f16** part of this issue ("establish f16 and f64 separately"). No project code changed; this only uses the renderer from #363. **Environment** - Windows 11 (build 26200), NVIDIA GeForce RTX 3070 (Ampere), driver 32.0.16.2101; WARP 10.0.26100.9818 - DXC from Windows SDK 10.0.26100.0 (`dxcompiler 1.9.2602.17`), Python 3.12.10 - Renderer: `offscreen_check` built from #363 at `e045e19`, its head before the latest push (lossless `R32G32B32A32_UINT` readback via the case-trailer flag) **Probe** A minimal standalone `ps_6_2` shader compiled with `-enable-16bit-types`. Every operand comes from the constant buffer, so nothing folds; results are written as raw words to the integer target. f16 rows: - `min(0x0001, 0x03ff)` and `max(0x0001, -0)` (least / largest binary16 subnormal) - `0x0400 * 0.5` (least normal × 0.5, so the result is the subnormal `0x0200`) - a plain move of `0x0001` (a control that does not depend on the mode) - `f16 0x0001 -> f32` (expect `0x33800000`) and `f32 2^-24 -> f16` (expect `0x0001`) A binary32 control shader runs through the same path and readback (`min`/`max` on the least f32 subnormal, least normal × 0.5, a move). This shows the harness does see FTZ when it happens. Each shader is compiled as `dxc [-enable-16bit-types] [-denorm <mode>] -T <target> -E main -Fo … -Fc …` and drawn with `offscreen_check <hardware|warp> --check-pixel-case <cso> <case>`. The case expects the preserve result; on a mismatch the renderer's own `actual_bits` are recorded. **DXIL** - The only denormal attribute DXC emits is the function attribute `"fp32-denorm-mode"="any|ftz|preserve"`. Without `-denorm` there is no attribute. - No f16 denormal attribute or field is emitted. Between the `ftz` and `preserve` builds of the f16 shader, the listings differ only in the shader hash and that fp32 attribute. - In the DXIL the f16 operations are native: `dx.op.binary.f16` FMin/FMax, `fmul fast half`, `fpext half→float`, `fptrunc float→half`, and the container has the "Use native low precision" flag. So with native 16-bit types, `-denorm` gives no way to ask for an f16 mode. **Results**: PSO creation succeeded for every variant on both adapters. | Variant | f16 on RTX 3070 | f16 on WARP | f32 control on RTX 3070 | f32 control on WARP | |---|---|---|---|---| | `ps_6_2` (no `-denorm`) | preserved | preserved | flushed | flushed | | `ps_6_2 -denorm any` | preserved | preserved | flushed | flushed | | `ps_6_2 -denorm ftz` | preserved | preserved | flushed | flushed | | `ps_6_2 -denorm preserve` | preserved | preserved | preserved | preserved | | `ps_6_6 -denorm ftz` | preserved | preserved | flushed | flushed | - "preserved" for f16 means all rows matched bit for bit: `00010001 00010200 33800000 00000001`. This includes the subnormal produced by the multiply and both conversions. - "flushed" for f32 means `min`, `max` and `least normal × 0.5` returned zero. One detail: in flushed builds, WARP returns `max(least subnormal, -0)` as `0x80000000` (both operands flushed, then the `-0` is selected), while the RTX 3070 returns `0x00000000`. That may matter for the sign rules of the f32 FTZ reference. **Conclusion (cautious)** - On these two adapters, binary16 subnormals are preserved whatever the `-denorm` flag says, and DXIL records no f16 mode. The `-denorm` flag is not a lever for f16. - So an f16 fixture whose CPU reference assumes FTZ cannot be requested through compile flags. The emitted HLSL would need an explicit flush, or the f16 mode is recorded as `preserve`, with the evidence above. - Two devices are not enough to call f16 "established". AMD and Intel results with the same probe would be needed first, and the probe is small enough to share. If useful, I'd be glad to take the f16 slice after #363 lands, on top of its fixture-mode plumbing, if that split suits you. It would add an explicit f16 mode per fixture, a non-folding f16 preserve-vs-FTZ control like the one above, and an explicit flush in the emitted HLSL only where a fixture asks for f16 FTZ. f64 stays out of scope. AI-assisted: run and prepared with the support of Roan System; reviewed before posting.
MoonYueya commented 2026-11-24 06:48:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MoonYueya on 2026-11-22T10:25:00Z.


@roansystemlabs Thanks — this matches what we see, and part of it is spec-level rather than measurement:

  • DXIL.rst allows only two string function attributes, and the only float-mode one is fp32-denorm-mode. So DXIL gives no f16 denormal attribute to request; that half of the conclusion is settled by the spec and does not depend on how many devices were tested. (The pipeline-side f16 mode bits on RDNA are a separate matter, as the f32 ones are.) Whether f16 subnormals are preserved is still a measurement, since I could not find it stated in DXIL.rst.
  • Partial AMD data from an earlier probe of ours (desktop RDNA2 iGPU, cs_6_6 -enable-16bit-types, built three times with -denorm preserve|ftz|any, raw words written to a RWStructuredBuffer<uint>): min(h, 1.0h) on the least (0x0001), largest (0x03ff) and a middle (0x0200) binary16 subnormal, and f16→f32 widening of the same values, returned the subnormal unchanged in all three builds. It had no least normal × 0.5 row and no f32 2^-24 → f16 row, so it does not replace an AMD run of your probe. If you share the probe, I can run it on that AMD adapter so the comparison includes AMD hardware.
  • A correction to my own suggestion earlier in this issue. DXIL.rst's FMax text says "Denorms are flushed (sign preserved) before comparison, however the result written to dest may or may not be denorm flushed." A min/max-on-subnormal control is therefore not guaranteed by the spec to separate preserve from FTZ; it happens to on the f32 rows of the adapters in your table and in ours. A row that produces a subnormal through arithmetic is the discriminator I would trust. DXIL's FTZ text for fadd and fdiv requires a resulting denorm to be flushed, so an add row whose inputs are both normal and whose sum is subnormal (for example asfloat(0x00800001) + asfloat(0x80800000), which is 0x00000001 under preserve, both operands from the constant buffer) separates preserve from FTZ by the spec alone. Your least normal × 0.5 row measures the same thing, but DXIL.rst has no fmul section, so it is a measurement rather than a spec guarantee. I'd suggest making an add row the required control and keeping min/max and multiply as supplementary.
  • The WARP -0 versus RTX +0 result for max(least subnormal, -0) fits the same text. Comparing a flushed zero by class (zero, either sign) seems safer than bit-for-bit, unless the operand order in the emitted DXIL is pinned and checked.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7077778245 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7077778245). Originally posted by [MoonYueya](https://github.com/MoonYueya) on 2026-11-22T10:25:00Z. --- @roansystemlabs Thanks — this matches what we see, and part of it is spec-level rather than measurement: - DXIL.rst allows only two string function attributes, and the only float-mode one is `fp32-denorm-mode`. So DXIL gives no f16 denormal attribute to request; that half of the conclusion is settled by the spec and does not depend on how many devices were tested. (The pipeline-side f16 mode bits on RDNA are a separate matter, as the f32 ones are.) Whether f16 subnormals are *preserved* is still a measurement, since I could not find it stated in DXIL.rst. - Partial AMD data from an earlier probe of ours (desktop RDNA2 iGPU, `cs_6_6 -enable-16bit-types`, built three times with `-denorm preserve|ftz|any`, raw words written to a `RWStructuredBuffer<uint>`): `min(h, 1.0h)` on the least (`0x0001`), largest (`0x03ff`) and a middle (`0x0200`) binary16 subnormal, and f16→f32 widening of the same values, returned the subnormal unchanged in all three builds. It had no `least normal × 0.5` row and no `f32 2^-24 → f16` row, so it does not replace an AMD run of your probe. If you share the probe, I can run it on that AMD adapter so the comparison includes AMD hardware. - **A correction to my own suggestion earlier in this issue.** DXIL.rst's FMax text says "Denorms are flushed (sign preserved) before comparison, however the result written to dest may or may not be denorm flushed." A min/max-on-subnormal control is therefore not guaranteed by the spec to separate preserve from FTZ; it happens to on the f32 rows of the adapters in your table and in ours. A row that *produces* a subnormal through arithmetic is the discriminator I would trust. DXIL's FTZ text for `fadd` and `fdiv` requires a resulting denorm to be flushed, so an add row whose inputs are both normal and whose sum is subnormal (for example `asfloat(0x00800001) + asfloat(0x80800000)`, which is `0x00000001` under preserve, both operands from the constant buffer) separates preserve from FTZ by the spec alone. Your `least normal × 0.5` row measures the same thing, but DXIL.rst has no `fmul` section, so it is a measurement rather than a spec guarantee. I'd suggest making an add row the required control and keeping min/max and multiply as supplementary. - The WARP `-0` versus RTX `+0` result for `max(least subnormal, -0)` fits the same text. Comparing a flushed zero by class (zero, either sign) seems safer than bit-for-bit, unless the operand order in the emitted DXIL is pinned and checked. _AI-assisted._
roansystemlabs commented 2026-11-24 06:48:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-22T10:47:50Z.


@MoonYueya Thanks, and agreed on all three points. The probe is below, updated to your suggestion: the required row is now an add of two normal operands whose sum is subnormal, min/max/multiply are supplementary, and zeros are compared by class.

It is three small files (synthetic HLSL, no game data) and uses only dxc and the repository's offscreen_check with the lossless R32G32B32A32_UINT readback from #363:

python -I run_denorm_probe.py <dxc.exe> <offscreen_check.exe> hardware <out_dir>

Each shader is built at ps_6_2 with no flag and with -denorm any|ftz|preserve, and each row is reported as preserved, flushed (+0/-0) or other. Built-in negative control: the f32 -denorm ftz build must flush the required add row and the renderer must report the mismatch, otherwise the script exits 2.

Results on Windows 11 (26200), RTX 3070 driver 32.0.16.2101, and WARP 10.0.26100.9818, renderer built at 075413d:

Row f32: no flag / any / ftz f32: preserve f16: all four builds
add, normal + normal → subnormal (required) flushed (+0) 0x00000001 0x0001 preserved
min(least, largest subnormal) flushed (+0) preserved preserved
max(least subnormal, -0) flushed: +0 on RTX 3070, -0 on WARP preserved preserved
least normal × 0.5 flushed (+0) 0x00400000 0x0200 preserved
f16 0x0001 → f32, f32 2^-24 → f16, move — — preserved

DXIL records only fp32-denorm-mode in every build (none without a flag). The negative control passed on both adapters. An AMD run would be very welcome.

denorm_probe_f32.hlsl
// binary32 denormal probe for Xbox2Windows #312. Synthetic HLSL, no game data.
// Compile: dxc -T ps_6_2 -E main [-denorm any|ftz|preserve]
// Every operand comes from the constant buffer, so nothing can fold at compile time.
// Results are raw words on an R32G32B32A32_UINT target (lossless readback from #363).
cbuffer Constants : register(b0) { uint4 params[16]; };

uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {
    const float least = asfloat(params[0].x);      // 0x00000001: least subnormal
    const float largest = asfloat(params[0].y);    // 0x007fffff: largest subnormal
    const float neg_zero = asfloat(params[0].z);   // 0x80000000
    const float min_normal = asfloat(params[0].w); // 0x00800000: least normal
    const float one_half = asfloat(params[1].x);   // 0x3f000000
    const float add_a = asfloat(params[1].y);      // 0x00800001: normal
    const float add_b = asfloat(params[1].z);      // 0x80800000: normal
    return uint4(asuint(add_a + add_b),             // REQUIRED: normal + normal -> 0x00000001 under preserve
                 asuint(min(least, largest)),       // supplementary: 0x00000001
                 asuint(max(least, neg_zero)),      // supplementary: 0x00000001
                 asuint(min_normal * one_half));    // supplementary: 0x00400000
}
denorm_probe_f16.hlsl
// binary16 denormal probe for Xbox2Windows #312. Synthetic HLSL, no game data.
// Compile: dxc -enable-16bit-types -T ps_6_2 -E main [-denorm any|ftz|preserve]
// Every operand comes from the constant buffer, so nothing can fold at compile time.
// Results are raw words on an R32G32B32A32_UINT target (lossless readback from #363).
cbuffer Constants : register(b0) { uint4 params[16]; };

half from_bits(uint word) { return asfloat16((uint16_t)word); }
uint to_bits(half value) { return (uint)asuint16(value); }

uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {
    const half least = from_bits(params[0].x);      // 0x0001: least subnormal
    const half largest = from_bits(params[0].y);    // 0x03ff: largest subnormal
    const half neg_zero = from_bits(params[0].z);   // 0x8000
    const half min_normal = from_bits(params[0].w); // 0x0400: least normal
    const half one_half = from_bits(params[1].x);   // 0x3800
    const float f32_tiny = asfloat(params[1].y);    // 0x33800000 = 2^-24 (normal in f32)
    const half add_a = from_bits(params[1].z);      // 0x0401: normal
    const half add_b = from_bits(params[1].w);      // 0x8400: normal

    const uint added = to_bits(add_a + add_b);            // REQUIRED: normal + normal -> 0x0001 under preserve
    const uint minimum = to_bits(min(least, largest));    // supplementary: 0x0001
    const uint maximum = to_bits(max(least, neg_zero));   // supplementary: 0x0001
    const uint produced = to_bits(min_normal * one_half); // supplementary: 0x0200
    const uint widened = asuint((float)least);            // f16 -> f32: 0x33800000 if kept
    const uint narrowed = to_bits((half)f32_tiny);        // f32 -> f16: 0x0001 if kept
    const uint moved = to_bits(least);                    // move-only control: 0x0001 in every mode

    return uint4(added | minimum << 16, maximum | produced << 16, widened, narrowed | moved << 16);
}
run_denorm_probe.py
"""Denormal probe for Xbox2Windows #312 (f32 and f16). Measures only; changes no project code.

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

Builds denorm_probe_f32.hlsl and denorm_probe_f16.hlsl (next to this script) at ps_6_2 under no
-denorm flag and -denorm any|ftz|preserve, records the denormal attributes in the DXIL listing, and
draws each with the repository renderer (`offscreen_check <backend> --check-pixel-case`, lossless
R32G32B32A32_UINT readback, case-file trailer bit 0 from #363). Each case expects the preserve
words; on a mismatch the renderer prints the raw words, and every row is classified as
`preserved`, `flushed` (a zero of either sign, compared by class) or `other`.

Required row (per DXIL fadd FTZ text): a sum of two normal operands that is subnormal.
Negative control: the f32 `-denorm ftz` build must flush that row and the renderer must report the
mismatch (exit 1); otherwise the run reports NEGATIVE CONTROL FAILED and exits 2.
"""
import re
import struct
import subprocess
import sys
from pathlib import Path

dxc, renderer, backend, out_dir = sys.argv[1:5]
out = Path(out_dir)
out.mkdir(parents=True, exist_ok=True)
here = Path(__file__).resolve().parent
VARIANTS = [None, "any", "ftz", "preserve"]

# Rows: (name, channel, shift, width_mask, preserve_value, required)
PROBES = {
    "f32": {
        "source": here / "denorm_probe_f32.hlsl", "flags": [],
        "constants": (0x00000001, 0x007FFFFF, 0x80000000, 0x00800000, 0x3F000000, 0x00800001, 0x80800000, 0),
        "rows": [("0x00800001 + 0x80800000", 0, 0, 0xFFFFFFFF, 0x00000001, True),
                 ("min(least, largest)", 1, 0, 0xFFFFFFFF, 0x00000001, False),
                 ("max(least, -0)", 2, 0, 0xFFFFFFFF, 0x00000001, False),
                 ("least normal * 0.5", 3, 0, 0xFFFFFFFF, 0x00400000, False)],
        "sign": 0x80000000,
    },
    "f16": {
        "source": here / "denorm_probe_f16.hlsl", "flags": ["-enable-16bit-types"],
        "constants": (0x0001, 0x03FF, 0x8000, 0x0400, 0x3800, 0x33800000, 0x0401, 0x8400),
        "rows": [("0x0401 + 0x8400", 0, 0, 0xFFFF, 0x0001, True),
                 ("min(0x0001, 0x03ff)", 0, 16, 0xFFFF, 0x0001, False),
                 ("max(0x0001, -0)", 1, 0, 0xFFFF, 0x0001, False),
                 ("0x0400 * 0.5", 1, 16, 0xFFFF, 0x0200, False),
                 ("f32(f16 0x0001)", 2, 0, 0xFFFFFFFF, 0x33800000, False),
                 ("f16(f32 2^-24)", 3, 0, 0xFFFF, 0x0001, False),
                 ("move(0x0001) [mode-independent]", 3, 16, 0xFFFF, 0x0001, False)],
        "sign": 0x8000,
    },
}


def preserve_words(rows):
    words = [0, 0, 0, 0]
    for _, ch, shift, mask, value, _ in rows:
        words[ch] |= (value & mask) << shift
    return words


def classify(value, want, mask, sign):
    if value == want:
        return "preserved"
    if value & (mask & ~sign) == 0:
        return f"flushed ({'-' if value & sign else '+'}0)"
    return "other"


negative_ok = False
for name, probe in PROBES.items():
    words_preserve = preserve_words(probe["rows"])
    case = out / f"{name}.case"
    constants = struct.pack("<8I", *probe["constants"]).ljust(256, b"\0")
    case.write_bytes(constants + struct.pack("<4I", *words_preserve) * 64 + b"\x01")
    for mode in VARIANTS:
        flags = ["-denorm", mode] if mode else []
        label = f"[{name}] ps_6_2 {'-denorm ' + mode if mode else '(no -denorm)'}"
        stem = f"{name}_{mode or 'default'}"
        shader, listing = out / f"{stem}.cso", out / f"{stem}.lst"
        c = subprocess.run([dxc, *probe["flags"], *flags, "-T", "ps_6_2", "-E", "main",
                            "-Fo", shader, "-Fc", listing, probe["source"]], capture_output=True, text=True)
        if c.returncode:
            print(f"{label}: dxc_failed rc={c.returncode} {c.stderr.strip()[:300]}")
            continue
        attrs = sorted(set(re.findall(r'"fp\d+-denorm-mode"="\w+"', listing.read_text(errors="replace"))))
        r = subprocess.run([renderer, backend, "--check-pixel-case", shader, case], capture_output=True, text=True)
        lines = (r.stdout + r.stderr).splitlines()
        adapter = next((line for line in lines if line.startswith("adapter=")), "adapter=?")
        driver = next((line for line in lines if line.startswith("driver=")), "driver=?")
        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}
        if r.returncode == 0:
            words = words_preserve
        elif r.returncode == 1 and len(actual) >= 4:
            words = [actual[i] for i in range(4)]
        else:
            print(f"{label}: renderer rc={r.returncode} {' | '.join(lines)[:400]}")
            continue
        print(f"{label}: rc={r.returncode} dxil_attrs={attrs or ['(none)']} {adapter} {driver}")
        for row, ch, shift, mask, want, required in probe["rows"]:
            value = (words[ch] >> shift) & mask
            state = classify(value, want, mask, 0x80000000 if mask > 0xFFFF else probe["sign"])
            print(f"    {'REQUIRED ' if required else '         '}{row:34s} {value:0{8 if mask > 0xFFFF else 4}x}  {state}")
            if name == "f32" and mode == "ftz" and required and state.startswith("flushed") and r.returncode == 1:
                negative_ok = True

print("NEGATIVE CONTROL " + ("passed: f32 -denorm ftz flushed the required add row and the renderer reported it"
                             if negative_ok else "FAILED: f32 -denorm ftz did not flush the required add row"))
sys.exit(0 if negative_ok else 2)

Taking the f16 slice. In this harness's own lowering, the f16 mode is fixed by construction: v_pk_*_f16 widens each half from its encoding, computes in binary32 and narrows in integer arithmetic, so a binary32 flush never reaches a binary16 subnormal, and DXIL offers no f16 attribute to request. The PR records preserve with that reason, adds a CPU-side check that keeps the lowering free of driver conversions and native halves, and adds a draw whose required row is a v_pk_add_f16 with normal inputs and the subnormal sum 0x8001, with max, multiply and fma as supplementary rows, run under both -denorm preserve and ftz. It is narrower than the per-fixture mode I offered above: no fixture asks for f16 FTZ yet, so an explicit flush in the emitted HLSL would have no user. f64 and the compressed-export path (driver f32tof16) stay out of scope. PR to follow, referencing this issue.

AI-assisted: prepared with an AI coding agent and reviewed by a human before posting.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7078022429 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7078022429). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-22T10:47:50Z. --- @MoonYueya Thanks, and agreed on all three points. The probe is below, updated to your suggestion: the required row is now an add of two normal operands whose sum is subnormal, min/max/multiply are supplementary, and zeros are compared by class. It is three small files (synthetic HLSL, no game data) and uses only `dxc` and the repository's `offscreen_check` with the lossless `R32G32B32A32_UINT` readback from #363: python -I run_denorm_probe.py <dxc.exe> <offscreen_check.exe> hardware <out_dir> Each shader is built at `ps_6_2` with no flag and with `-denorm any|ftz|preserve`, and each row is reported as `preserved`, `flushed (+0/-0)` or `other`. Built-in negative control: the f32 `-denorm ftz` build must flush the required add row and the renderer must report the mismatch, otherwise the script exits 2. Results on Windows 11 (26200), RTX 3070 driver 32.0.16.2101, and WARP 10.0.26100.9818, renderer built at `075413d`: | Row | f32: no flag / any / ftz | f32: preserve | f16: all four builds | |---|---|---|---| | add, normal + normal → subnormal (required) | flushed (+0) | `0x00000001` | `0x0001` preserved | | min(least, largest subnormal) | flushed (+0) | preserved | preserved | | max(least subnormal, -0) | flushed: +0 on RTX 3070, -0 on WARP | preserved | preserved | | least normal × 0.5 | flushed (+0) | `0x00400000` | `0x0200` preserved | | f16 0x0001 → f32, f32 2^-24 → f16, move | — | — | preserved | DXIL records only `fp32-denorm-mode` in every build (none without a flag). The negative control passed on both adapters. An AMD run would be very welcome. <details><summary><code>denorm_probe_f32.hlsl</code></summary> ```hlsl // binary32 denormal probe for Xbox2Windows #312. Synthetic HLSL, no game data. // Compile: dxc -T ps_6_2 -E main [-denorm any|ftz|preserve] // Every operand comes from the constant buffer, so nothing can fold at compile time. // Results are raw words on an R32G32B32A32_UINT target (lossless readback from #363). cbuffer Constants : register(b0) { uint4 params[16]; }; uint4 main(float2 uv : TEXCOORD0) : SV_Target0 { const float least = asfloat(params[0].x); // 0x00000001: least subnormal const float largest = asfloat(params[0].y); // 0x007fffff: largest subnormal const float neg_zero = asfloat(params[0].z); // 0x80000000 const float min_normal = asfloat(params[0].w); // 0x00800000: least normal const float one_half = asfloat(params[1].x); // 0x3f000000 const float add_a = asfloat(params[1].y); // 0x00800001: normal const float add_b = asfloat(params[1].z); // 0x80800000: normal return uint4(asuint(add_a + add_b), // REQUIRED: normal + normal -> 0x00000001 under preserve asuint(min(least, largest)), // supplementary: 0x00000001 asuint(max(least, neg_zero)), // supplementary: 0x00000001 asuint(min_normal * one_half)); // supplementary: 0x00400000 } ``` </details> <details><summary><code>denorm_probe_f16.hlsl</code></summary> ```hlsl // binary16 denormal probe for Xbox2Windows #312. Synthetic HLSL, no game data. // Compile: dxc -enable-16bit-types -T ps_6_2 -E main [-denorm any|ftz|preserve] // Every operand comes from the constant buffer, so nothing can fold at compile time. // Results are raw words on an R32G32B32A32_UINT target (lossless readback from #363). cbuffer Constants : register(b0) { uint4 params[16]; }; half from_bits(uint word) { return asfloat16((uint16_t)word); } uint to_bits(half value) { return (uint)asuint16(value); } uint4 main(float2 uv : TEXCOORD0) : SV_Target0 { const half least = from_bits(params[0].x); // 0x0001: least subnormal const half largest = from_bits(params[0].y); // 0x03ff: largest subnormal const half neg_zero = from_bits(params[0].z); // 0x8000 const half min_normal = from_bits(params[0].w); // 0x0400: least normal const half one_half = from_bits(params[1].x); // 0x3800 const float f32_tiny = asfloat(params[1].y); // 0x33800000 = 2^-24 (normal in f32) const half add_a = from_bits(params[1].z); // 0x0401: normal const half add_b = from_bits(params[1].w); // 0x8400: normal const uint added = to_bits(add_a + add_b); // REQUIRED: normal + normal -> 0x0001 under preserve const uint minimum = to_bits(min(least, largest)); // supplementary: 0x0001 const uint maximum = to_bits(max(least, neg_zero)); // supplementary: 0x0001 const uint produced = to_bits(min_normal * one_half); // supplementary: 0x0200 const uint widened = asuint((float)least); // f16 -> f32: 0x33800000 if kept const uint narrowed = to_bits((half)f32_tiny); // f32 -> f16: 0x0001 if kept const uint moved = to_bits(least); // move-only control: 0x0001 in every mode return uint4(added | minimum << 16, maximum | produced << 16, widened, narrowed | moved << 16); } ``` </details> <details><summary><code>run_denorm_probe.py</code></summary> ```python """Denormal probe for Xbox2Windows #312 (f32 and f16). Measures only; changes no project code. Usage: python -I run_denorm_probe.py <dxc.exe> <offscreen_check.exe> <hardware|warp> <out_dir> Builds denorm_probe_f32.hlsl and denorm_probe_f16.hlsl (next to this script) at ps_6_2 under no -denorm flag and -denorm any|ftz|preserve, records the denormal attributes in the DXIL listing, and draws each with the repository renderer (`offscreen_check <backend> --check-pixel-case`, lossless R32G32B32A32_UINT readback, case-file trailer bit 0 from #363). Each case expects the preserve words; on a mismatch the renderer prints the raw words, and every row is classified as `preserved`, `flushed` (a zero of either sign, compared by class) or `other`. Required row (per DXIL fadd FTZ text): a sum of two normal operands that is subnormal. Negative control: the f32 `-denorm ftz` build must flush that row and the renderer must report the mismatch (exit 1); otherwise the run reports NEGATIVE CONTROL FAILED and exits 2. """ import re import struct import subprocess import sys from pathlib import Path dxc, renderer, backend, out_dir = sys.argv[1:5] out = Path(out_dir) out.mkdir(parents=True, exist_ok=True) here = Path(__file__).resolve().parent VARIANTS = [None, "any", "ftz", "preserve"] # Rows: (name, channel, shift, width_mask, preserve_value, required) PROBES = { "f32": { "source": here / "denorm_probe_f32.hlsl", "flags": [], "constants": (0x00000001, 0x007FFFFF, 0x80000000, 0x00800000, 0x3F000000, 0x00800001, 0x80800000, 0), "rows": [("0x00800001 + 0x80800000", 0, 0, 0xFFFFFFFF, 0x00000001, True), ("min(least, largest)", 1, 0, 0xFFFFFFFF, 0x00000001, False), ("max(least, -0)", 2, 0, 0xFFFFFFFF, 0x00000001, False), ("least normal * 0.5", 3, 0, 0xFFFFFFFF, 0x00400000, False)], "sign": 0x80000000, }, "f16": { "source": here / "denorm_probe_f16.hlsl", "flags": ["-enable-16bit-types"], "constants": (0x0001, 0x03FF, 0x8000, 0x0400, 0x3800, 0x33800000, 0x0401, 0x8400), "rows": [("0x0401 + 0x8400", 0, 0, 0xFFFF, 0x0001, True), ("min(0x0001, 0x03ff)", 0, 16, 0xFFFF, 0x0001, False), ("max(0x0001, -0)", 1, 0, 0xFFFF, 0x0001, False), ("0x0400 * 0.5", 1, 16, 0xFFFF, 0x0200, False), ("f32(f16 0x0001)", 2, 0, 0xFFFFFFFF, 0x33800000, False), ("f16(f32 2^-24)", 3, 0, 0xFFFF, 0x0001, False), ("move(0x0001) [mode-independent]", 3, 16, 0xFFFF, 0x0001, False)], "sign": 0x8000, }, } def preserve_words(rows): words = [0, 0, 0, 0] for _, ch, shift, mask, value, _ in rows: words[ch] |= (value & mask) << shift return words def classify(value, want, mask, sign): if value == want: return "preserved" if value & (mask & ~sign) == 0: return f"flushed ({'-' if value & sign else '+'}0)" return "other" negative_ok = False for name, probe in PROBES.items(): words_preserve = preserve_words(probe["rows"]) case = out / f"{name}.case" constants = struct.pack("<8I", *probe["constants"]).ljust(256, b"\0") case.write_bytes(constants + struct.pack("<4I", *words_preserve) * 64 + b"\x01") for mode in VARIANTS: flags = ["-denorm", mode] if mode else [] label = f"[{name}] ps_6_2 {'-denorm ' + mode if mode else '(no -denorm)'}" stem = f"{name}_{mode or 'default'}" shader, listing = out / f"{stem}.cso", out / f"{stem}.lst" c = subprocess.run([dxc, *probe["flags"], *flags, "-T", "ps_6_2", "-E", "main", "-Fo", shader, "-Fc", listing, probe["source"]], capture_output=True, text=True) if c.returncode: print(f"{label}: dxc_failed rc={c.returncode} {c.stderr.strip()[:300]}") continue attrs = sorted(set(re.findall(r'"fp\d+-denorm-mode"="\w+"', listing.read_text(errors="replace")))) r = subprocess.run([renderer, backend, "--check-pixel-case", shader, case], capture_output=True, text=True) lines = (r.stdout + r.stderr).splitlines() adapter = next((line for line in lines if line.startswith("adapter=")), "adapter=?") driver = next((line for line in lines if line.startswith("driver=")), "driver=?") 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} if r.returncode == 0: words = words_preserve elif r.returncode == 1 and len(actual) >= 4: words = [actual[i] for i in range(4)] else: print(f"{label}: renderer rc={r.returncode} {' | '.join(lines)[:400]}") continue print(f"{label}: rc={r.returncode} dxil_attrs={attrs or ['(none)']} {adapter} {driver}") for row, ch, shift, mask, want, required in probe["rows"]: value = (words[ch] >> shift) & mask state = classify(value, want, mask, 0x80000000 if mask > 0xFFFF else probe["sign"]) print(f" {'REQUIRED ' if required else ' '}{row:34s} {value:0{8 if mask > 0xFFFF else 4}x} {state}") if name == "f32" and mode == "ftz" and required and state.startswith("flushed") and r.returncode == 1: negative_ok = True print("NEGATIVE CONTROL " + ("passed: f32 -denorm ftz flushed the required add row and the renderer reported it" if negative_ok else "FAILED: f32 -denorm ftz did not flush the required add row")) sys.exit(0 if negative_ok else 2) ``` </details> **Taking the f16 slice.** In this harness's own lowering, the f16 mode is fixed by construction: `v_pk_*_f16` widens each half from its encoding, computes in binary32 and narrows in integer arithmetic, so a binary32 flush never reaches a binary16 subnormal, and DXIL offers no f16 attribute to request. The PR records `preserve` with that reason, adds a CPU-side check that keeps the lowering free of driver conversions and native halves, and adds a draw whose required row is a `v_pk_add_f16` with normal inputs and the subnormal sum `0x8001`, with max, multiply and fma as supplementary rows, run under both `-denorm preserve` and `ftz`. It is narrower than the per-fixture mode I offered above: no fixture asks for f16 FTZ yet, so an explicit flush in the emitted HLSL would have no user. f64 and the compressed-export path (driver `f32tof16`) stay out of scope. PR to follow, referencing this issue. AI-assisted: prepared with an AI coding agent and reviewed by a human before posting.
MoonYueya commented 2026-11-24 06:48:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MoonYueya on 2026-11-22T11:19:50Z.


Thanks — here is the AMD column, run with your probe and your renderer unchanged.

Environment: Windows 11, build 10.0.26300.9711; renderer built at 075413d (unchanged source, Ninja/Debug/MSVC 19.51); dxc 1.8.2502.11 from Windows SDK 10.0.26100.0. The three files were taken verbatim from your comment (denorm_probe_f32.hlsl (1295 bytes) sha256 1ac00271558451c7afc6a5ecb54c5186210f58062d8cfa50454514b894691e9a, denorm_probe_f16.hlsl (1899 bytes) 71e580d484e74882a7c1d2dbc9ecb1f46d4aa4f1886f9a186ef8577d109350be, run_denorm_probe.py (5629 bytes) fee2a051f4d93a6c4d08826ae285be3b68a7eba5027e4b71162c18b6cfd589fb). offscreen_check selects the adapter with XBOX2WINDOWS_ADAPTER, so no code or registry change was needed.

Results below use your table layout.

AMD Radeon(TM) Graphics, vendor 1002 device 164e, driver 32.0.11024.2:

Row f32: no flag / any / ftz f32: preserve f16: all four builds
add, normal + normal → subnormal (required) flushed (+0) 0x00000001 0x0001 preserved
min(least, largest subnormal) flushed (+0) preserved preserved
max(least subnormal, -0) flushed (+0) preserved preserved
least normal × 0.5 flushed (+0) 0x00400000 0x0200 preserved
f16 0x0001 → f32, f32 2^-24 → f16, move — — preserved

For reference, the same run on the other two adapters on this machine.

NVIDIA GeForce RTX 3080, vendor 10de device 2206, driver 32.0.16.1742: identical to the AMD column above, including +0 on max(least, -0).

WARP, Microsoft Basic Render Driver, vendor 1414 device 008c, driver 10.0.26100.9711: identical except max(least, -0), which flushes to -0 there, matching what you saw.

As in your run, the DXIL listings record only fp32-denorm-mode in every flagged build, nothing without a flag (same dxc and same flags, so identical in every run). The negative control passed on every run (AMD, the RTX 3080 selected both by default and by name, WARP): the f32 -denorm ftz build flushed the required add row and the renderer reported the mismatch.

Two things I am not claiming. This is desktop AMD driver behaviour on one integrated adapter; I did not run anything on console hardware and the table says nothing about it. And the f16 column is weaker than it looks: these builds returned the binary16 subnormal words on all three adapters, but DXIL carries no f16 denormal attribute, so it does not show that a driver must keep them, nor whether the driver evaluated the half operations at half or wider precision.

AI-assisted: measured with an AI coding agent driving the build and runs, reviewed by a human before posting.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7078370705 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7078370705). Originally posted by [MoonYueya](https://github.com/MoonYueya) on 2026-11-22T11:19:50Z. --- Thanks — here is the AMD column, run with your probe and your renderer unchanged. Environment: Windows 11, build 10.0.26300.9711; renderer built at `075413d` (unchanged source, Ninja/Debug/MSVC 19.51); `dxc` 1.8.2502.11 from Windows SDK 10.0.26100.0. The three files were taken verbatim from your comment (`denorm_probe_f32.hlsl` (1295 bytes) sha256 `1ac00271558451c7afc6a5ecb54c5186210f58062d8cfa50454514b894691e9a`, `denorm_probe_f16.hlsl` (1899 bytes) `71e580d484e74882a7c1d2dbc9ecb1f46d4aa4f1886f9a186ef8577d109350be`, `run_denorm_probe.py` (5629 bytes) `fee2a051f4d93a6c4d08826ae285be3b68a7eba5027e4b71162c18b6cfd589fb`). `offscreen_check` selects the adapter with `XBOX2WINDOWS_ADAPTER`, so no code or registry change was needed. Results below use your table layout. AMD Radeon(TM) Graphics, vendor `1002` device `164e`, driver `32.0.11024.2`: | Row | f32: no flag / any / ftz | f32: preserve | f16: all four builds | |---|---|---|---| | add, normal + normal → subnormal (required) | flushed (+0) | `0x00000001` | `0x0001` preserved | | min(least, largest subnormal) | flushed (+0) | preserved | preserved | | max(least subnormal, -0) | flushed (+0) | preserved | preserved | | least normal × 0.5 | flushed (+0) | `0x00400000` | `0x0200` preserved | | f16 0x0001 → f32, f32 2^-24 → f16, move | — | — | preserved | For reference, the same run on the other two adapters on this machine. NVIDIA GeForce RTX 3080, vendor `10de` device `2206`, driver `32.0.16.1742`: identical to the AMD column above, including `+0` on `max(least, -0)`. WARP, Microsoft Basic Render Driver, vendor `1414` device `008c`, driver `10.0.26100.9711`: identical except `max(least, -0)`, which flushes to `-0` there, matching what you saw. As in your run, the DXIL listings record only `fp32-denorm-mode` in every flagged build, nothing without a flag (same dxc and same flags, so identical in every run). The negative control passed on every run (AMD, the RTX 3080 selected both by default and by name, WARP): the f32 `-denorm ftz` build flushed the required add row and the renderer reported the mismatch. Two things I am not claiming. This is desktop AMD driver behaviour on one integrated adapter; I did not run anything on console hardware and the table says nothing about it. And the f16 column is weaker than it looks: these builds returned the binary16 subnormal words on all three adapters, but DXIL carries no f16 denormal attribute, so it does not show that a driver must keep them, nor whether the driver evaluated the half operations at half or wider precision. AI-assisted: measured with an AI coding agent driving the build and runs, reviewed by a human before posting.
rwZephyr commented 2026-11-24 06:48:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T18:47:13Z.


Discrete RDNA 4 measurement using the published f32/f16 probe. All three files matched the SHA-256 values in the prior AMD iGPU report. This report is AI-assisted. The tests ran locally.

Windows 11 25H2 x64 build 26200.9974. Renderer from unmodified main at f1f95cf62ea873f0b32fbe9ae1a629151b6e382a, dev preset, MSVC 19.44.35230, SDK 10.0.26100, DXC 1.8.2502.8, Python 3.12.10. The renderer identified the RX 9070 XT (1002:7550) on driver 32.0.32029.2010 and WARP (1414:008c) on 10.0.26100.9818. Both reported debug_layer=unavailable.

With the workspace-local toolchain loaded and the debug CRT DLLs staged beside offscreen_check.exe, I configured with cmake --preset dev "-DINTAKE_PYTHON=$python" and built with cmake --build --preset dev --target offscreen_check. Here $python, $dxc, and $renderer point to the virtual environment Python, DXC, and built renderer.

$env:XBOX2WINDOWS_ADAPTER = 'RX 9070 XT'
& $python -I out/issue-312/run_denorm_probe.py $dxc $renderer hardware out/issue-312/hardware
Remove-Item Env:XBOX2WINDOWS_ADAPTER
& $python -I out/issue-312/run_denorm_probe.py $dxc $renderer warp out/issue-312/warp
Probe RX 9070 XT WARP
f32, no flag / any / ftz All four rows flushed to 0x00000000 Same, except max(least, -0) returned 0x80000000
f32, preserve Add/min/max 0x00000001, multiply 0x00400000 Same
f16, all four builds Add/min/max/narrow/move 0x0001, multiply 0x0200, widen 0x33800000 Same

The required f32 FTZ control flushed the normal-plus-normal add to +0 and triggered the renderer mismatch on both backends. Both scripts exited 0. DXIL recorded only fp32-denorm-mode in flagged builds, with no denorm attribute in unflagged builds. The binary16 results measure these specific draws on the listed drivers.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7083868420 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7083868420). Originally posted by [rwZephyr](https://github.com/rwZephyr) on 2026-11-22T18:47:13Z. --- Discrete RDNA 4 measurement using the [published f32/f16 probe](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7078022429). All three files matched the SHA-256 values in the [prior AMD iGPU report](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7078370705). This report is AI-assisted. The tests ran locally. Windows 11 25H2 x64 build `26200.9974`. Renderer from unmodified `main` at `f1f95cf62ea873f0b32fbe9ae1a629151b6e382a`, `dev` preset, MSVC `19.44.35230`, SDK `10.0.26100`, DXC `1.8.2502.8`, Python `3.12.10`. The renderer identified the RX 9070 XT (`1002:7550`) on driver `32.0.32029.2010` and WARP (`1414:008c`) on `10.0.26100.9818`. Both reported `debug_layer=unavailable`. With the workspace-local toolchain loaded and the debug CRT DLLs staged beside `offscreen_check.exe`, I configured with `cmake --preset dev "-DINTAKE_PYTHON=$python"` and built with `cmake --build --preset dev --target offscreen_check`. Here `$python`, `$dxc`, and `$renderer` point to the virtual environment Python, DXC, and built renderer. ```powershell $env:XBOX2WINDOWS_ADAPTER = 'RX 9070 XT' & $python -I out/issue-312/run_denorm_probe.py $dxc $renderer hardware out/issue-312/hardware Remove-Item Env:XBOX2WINDOWS_ADAPTER & $python -I out/issue-312/run_denorm_probe.py $dxc $renderer warp out/issue-312/warp ``` | Probe | RX 9070 XT | WARP | | --- | --- | --- | | f32, no flag / `any` / `ftz` | All four rows flushed to `0x00000000` | Same, except `max(least, -0)` returned `0x80000000` | | f32, `preserve` | Add/min/max `0x00000001`, multiply `0x00400000` | Same | | f16, all four builds | Add/min/max/narrow/move `0x0001`, multiply `0x0200`, widen `0x33800000` | Same | The required f32 FTZ control flushed the normal-plus-normal add to `+0` and triggered the renderer mismatch on both backends. Both scripts exited 0. DXIL recorded only `fp32-denorm-mode` in flagged builds, with no denorm attribute in unflagged builds. The binary16 results measure these specific draws on the listed drivers.
romn4rch commented 2026-11-24 06:48:48 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by romn4rch on 2026-11-22T22:10:51Z.


Intel column, run with the published probe and an unmodified renderer. All three files matched the SHA-256 values in the AMD iGPU report:

  • denorm_probe_f32.hlsl (1295 bytes) 1ac00271558451c7afc6a5ecb54c5186210f58062d8cfa50454514b894691e9a
  • denorm_probe_f16.hlsl (1899 bytes) 71e580d484e74882a7c1d2dbc9ecb1f46d4aa4f1886f9a186ef8577d109350be
  • run_denorm_probe.py (5629 bytes) fee2a051f4d93a6c4d08826ae285be3b68a7eba5027e4b71162c18b6cfd589fb

Environment

  • Windows 11 Pro 26H2, build 26300.10075
  • Intel(R) UHD Graphics, vendor 8086 device 468b, driver 32.0.101.7026 (integrated GPU of a Core i5-12450HX laptop that also has an RTX 3050 6GB Laptop GPU)
  • Renderer: offscreen_check.exe from the gpu-check-windows-x64 CI artifact built from main at b42888dd2e10048348f98d1346db425a32075973. The artifact's SHA-256 matched its .sha256.
  • DXC 1.8.2502.8 (dxcompiler.dll b4711839e, dxil.dll 1.8.2502.8), Python 3.14.7
$env:XBOX2WINDOWS_ADAPTER = 'Intel'
python -I run_denorm_probe.py <dxc.exe> <offscreen_check.exe> hardware <out_dir>

Every build reported adapter=Intel(R) UHD Graphics vendor=8086 device=468b driver=32.0.101.7026, so the selection by name kept all draws on the Intel adapter.

Results, in the same layout as above:

Row f32: no flag / any / ftz f32: preserve f16: all four builds
add, normal + normal → subnormal (required) flushed (+0) 0x00000001 0x0001 preserved
min(least, largest subnormal) flushed (+0) preserved preserved
max(least subnormal, -0) flushed (+0) preserved preserved
least normal × 0.5 flushed (+0) 0x00400000 0x0200 preserved
f16 0x0001 → f32, f32 2^-24 → f16, move — — preserved
  • All eight builds rendered. The f32 no-flag, any and ftz builds returned rc=1 (renderer mismatch against the preserve expectation); the rest returned rc=0.
  • DXIL recorded only fp32-denorm-mode in the flagged builds and no denormal attribute without a flag, for both shaders.
  • Negative control passed: the f32 -denorm ftz build flushed the required add row and the renderer reported the mismatch. The script exited 0.
  • This matches the RTX 3070, RTX 3080, AMD iGPU and RX 9070 XT columns, including +0 for max(least, -0) in flushed builds, where WARP returns -0.

This is the Intel result asked for in the f16 measurement above. The probe now has NVIDIA, AMD and Intel hardware results, plus WARP.

Limits: this is one desktop Intel driver on one integrated adapter, and it says nothing about console hardware. As noted above for the f16 column, these draws returned the binary16 subnormal words; that does not show a driver must keep them, or at which precision it evaluated the half operations. The tests ran locally.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7086616267 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7086616267). Originally posted by [romn4rch](https://github.com/romn4rch) on 2026-11-22T22:10:51Z. --- Intel column, run with the [published probe](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7078022429) and an unmodified renderer. All three files matched the SHA-256 values in the [AMD iGPU report](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7078370705): - `denorm_probe_f32.hlsl` (1295 bytes) `1ac00271558451c7afc6a5ecb54c5186210f58062d8cfa50454514b894691e9a` - `denorm_probe_f16.hlsl` (1899 bytes) `71e580d484e74882a7c1d2dbc9ecb1f46d4aa4f1886f9a186ef8577d109350be` - `run_denorm_probe.py` (5629 bytes) `fee2a051f4d93a6c4d08826ae285be3b68a7eba5027e4b71162c18b6cfd589fb` **Environment** - Windows 11 Pro 26H2, build `26300.10075` - Intel(R) UHD Graphics, vendor `8086` device `468b`, driver `32.0.101.7026` (integrated GPU of a Core i5-12450HX laptop that also has an RTX 3050 6GB Laptop GPU) - Renderer: `offscreen_check.exe` from the `gpu-check-windows-x64` CI artifact built from `main` at `b42888dd2e10048348f98d1346db425a32075973`. The artifact's SHA-256 matched its `.sha256`. - DXC `1.8.2502.8` (`dxcompiler.dll` `b4711839e`, `dxil.dll` 1.8.2502.8), Python `3.14.7` ```powershell $env:XBOX2WINDOWS_ADAPTER = 'Intel' python -I run_denorm_probe.py <dxc.exe> <offscreen_check.exe> hardware <out_dir> ``` Every build reported `adapter=Intel(R) UHD Graphics vendor=8086 device=468b driver=32.0.101.7026`, so the selection by name kept all draws on the Intel adapter. Results, in the same layout as above: | Row | f32: no flag / any / ftz | f32: preserve | f16: all four builds | |---|---|---|---| | add, normal + normal → subnormal (required) | flushed (+0) | `0x00000001` | `0x0001` preserved | | min(least, largest subnormal) | flushed (+0) | preserved | preserved | | max(least subnormal, -0) | flushed (+0) | preserved | preserved | | least normal × 0.5 | flushed (+0) | `0x00400000` | `0x0200` preserved | | f16 0x0001 → f32, f32 2^-24 → f16, move | — | — | preserved | - All eight builds rendered. The f32 no-flag, `any` and `ftz` builds returned rc=1 (renderer mismatch against the preserve expectation); the rest returned rc=0. - DXIL recorded only `fp32-denorm-mode` in the flagged builds and no denormal attribute without a flag, for both shaders. - Negative control passed: the f32 `-denorm ftz` build flushed the required add row and the renderer reported the mismatch. The script exited 0. - This matches the RTX 3070, RTX 3080, AMD iGPU and RX 9070 XT columns, including `+0` for `max(least, -0)` in flushed builds, where WARP returns `-0`. This is the Intel result asked for in the f16 measurement above. The probe now has NVIDIA, AMD and Intel hardware results, plus WARP. Limits: this is one desktop Intel driver on one integrated adapter, and it says nothing about console hardware. As noted above for the f16 column, these draws returned the binary16 subnormal words; that does not show a driver must keep them, or at which precision it evaluated the half operations. The tests ran locally. _AI-assisted._
a747624515-sudo commented 2026-11-24 06:48:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by a747624515-sudo on 2026-11-23T03:25:14Z.


RTX 5070 (driver 32.0.16.2124): probe data, plus two more fixtures that fail PSO creation under -denorm preserve

Everything below is from the published probe in this thread, unmodified. I verified the three files against the SHA-256 values posted above before running:

  • denorm_probe_f32.hlsl (1295 bytes) 1ac00271558451c7afc6a5ecb54c5186210f58062d8cfa50454514b894691e9a
  • denorm_probe_f16.hlsl (1899 bytes) 71e580d484e74882a7c1d2dbc9ecb1f46d4aa4f1886f9a186ef8577d109350be
  • run_denorm_probe.py (5629 bytes) fee2a051f4d93a6c4d08826ae285be3b68a7eba5027e4b71162c18b6cfd589fb

Environment

  • Windows 11 build 26100.9974, MSVC 14.44.35207 (VS Build Tools, Hostx64/x64)
  • NVIDIA GeForce RTX 5070, 10DE:2F04, driver 32.0.16.2124
  • Renderer from unmodified main at bd3020969a5c06816a0dd79830e870ce98c95862, dev preset, Debug
  • DXC 1.9.2602.17 (dxcompiler.dll: 1.9(5184-21d28f72)) from Windows SDK 10.0.26100.0
  • WARP (1414:008c, 10.0.26100.9818) as a second column

1. denormal probe

probe no flag any ftz preserve
f32 required add 0x00800001 + 0x80800000 flushed flushed flushed 0x00000001
f32 min / max / least normal * 0.5 flushed flushed flushed preserved
f16 all seven rows preserved preserved preserved preserved

f16 records only "fp32-denorm-mode" in the DXIL listing in every variant, never an f16 attribute — same as reported for the other adapters. Negative control passed: the f32 ftz build flushed the required add row and the renderer reported the mismatch.

This matches the shape reported on the RTX 5060 Ti: no flag already flushes, only preserve keeps the subnormal.

2. What is new: two more programs that fail PSO creation under preserve

#363 records one NVIDIA driver exception for -denorm preserve — RTX 5060 Ti, driver 32.0.16.2124, on curve. #569 records a second one on a different build: RTX 5080, driver 32.0.16.2101, on dpp. My adapter is on the same driver build as the 5060 Ti entry, and two different programs fail here:

ctest preserve ftz any
pixel_aot_e64_approx_hardware FAIL E_OUTOFMEMORY pass pass
pixel_aot_sdwa_unary_hardware FAIL E_OUTOFMEMORY pass pass

Both fail the same way: all ten batch cases return status=error, with Translated pixel pipeline failed (HRESULT 0x8007000e). Changing only F32_DENORM_MODE in the harness from "preserve" to "ftz" (a copy, no other edit) flips both to exit 0 on the same renderer, shader and adapter.

I also ran all thirteen draw-* fixtures under the unchanged preserve default. Only these two fail; the other eleven pass. draw-e64 still passes under preserve and then fails under ftz at its own dual-mode negative control, which is the expected inversion and a second independent sign that the mode really reaches the pipeline.

So on driver 32.0.16.2124: 5060 Ti loses curve, 5070 loses e64_approx and sdwa_unary. Same driver build, three different programs, two different adapters. That reads as this driver being unreliable for -denorm preserve on some program shapes rather than one bad fixture, which may matter when deciding which fixtures record any.

Limits

  • One adapter, one driver build, one Windows build. I am not claiming this generalizes.
  • I did not modify project code or open a PR; the ftz/any runs used a local copy of pixel_aot_check.py with the single constant changed, kept out of the tree.
  • Desktop driver only. Nothing here measures Scarlett.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7090728141 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7090728141). Originally posted by [a747624515-sudo](https://github.com/a747624515-sudo) on 2026-11-23T03:25:14Z. --- ## RTX 5070 (driver 32.0.16.2124): probe data, plus two more fixtures that fail PSO creation under `-denorm preserve` Everything below is from the published probe in this thread, unmodified. I verified the three files against the SHA-256 values posted above before running: - `denorm_probe_f32.hlsl` (1295 bytes) `1ac00271558451c7afc6a5ecb54c5186210f58062d8cfa50454514b894691e9a` - `denorm_probe_f16.hlsl` (1899 bytes) `71e580d484e74882a7c1d2dbc9ecb1f46d4aa4f1886f9a186ef8577d109350be` - `run_denorm_probe.py` (5629 bytes) `fee2a051f4d93a6c4d08826ae285be3b68a7eba5027e4b71162c18b6cfd589fb` **Environment** - Windows 11 build `26100.9974`, MSVC `14.44.35207` (VS Build Tools, Hostx64/x64) - NVIDIA GeForce RTX 5070, `10DE:2F04`, driver `32.0.16.2124` - Renderer from unmodified `main` at `bd3020969a5c06816a0dd79830e870ce98c95862`, `dev` preset, Debug - DXC `1.9.2602.17` (`dxcompiler.dll: 1.9(5184-21d28f72)`) from Windows SDK `10.0.26100.0` - WARP (`1414:008c`, `10.0.26100.9818`) as a second column **1. denormal probe** | probe | no flag | `any` | `ftz` | `preserve` | |---|---|---|---|---| | f32 required add `0x00800001 + 0x80800000` | flushed | flushed | flushed | **`0x00000001`** | | f32 `min` / `max` / `least normal * 0.5` | flushed | flushed | flushed | preserved | | f16 all seven rows | preserved | preserved | preserved | preserved | f16 records only `"fp32-denorm-mode"` in the DXIL listing in every variant, never an f16 attribute — same as reported for the other adapters. Negative control passed: the f32 `ftz` build flushed the required add row and the renderer reported the mismatch. This matches the shape reported on the RTX 5060 Ti: no flag already flushes, only `preserve` keeps the subnormal. **2. What is new: two more programs that fail PSO creation under `preserve`** #363 records one NVIDIA driver exception for `-denorm preserve` — RTX 5060 Ti, driver `32.0.16.2124`, on `curve`. #569 records a second one on a different build: RTX 5080, driver `32.0.16.2101`, on `dpp`. My adapter is on the **same driver build as the 5060 Ti entry**, and two different programs fail here: | ctest | `preserve` | `ftz` | `any` | |---|---|---|---| | `pixel_aot_e64_approx_hardware` | **FAIL** `E_OUTOFMEMORY` | pass | pass | | `pixel_aot_sdwa_unary_hardware` | **FAIL** `E_OUTOFMEMORY` | pass | pass | Both fail the same way: all ten batch cases return `status=error`, with `Translated pixel pipeline failed (HRESULT 0x8007000e)`. Changing only `F32_DENORM_MODE` in the harness from `"preserve"` to `"ftz"` (a copy, no other edit) flips both to exit 0 on the same renderer, shader and adapter. I also ran all thirteen `draw-*` fixtures under the unchanged `preserve` default. **Only these two fail; the other eleven pass.** `draw-e64` still passes under `preserve` and then fails under `ftz` at its own dual-mode negative control, which is the expected inversion and a second independent sign that the mode really reaches the pipeline. So on driver `32.0.16.2124`: 5060 Ti loses `curve`, 5070 loses `e64_approx` and `sdwa_unary`. Same driver build, three different programs, two different adapters. That reads as this driver being unreliable for `-denorm preserve` on some program shapes rather than one bad fixture, which may matter when deciding which fixtures record `any`. **Limits** - One adapter, one driver build, one Windows build. I am not claiming this generalizes. - I did not modify project code or open a PR; the `ftz`/`any` runs used a local copy of `pixel_aot_check.py` with the single constant changed, kept out of the tree. - Desktop driver only. Nothing here measures Scarlett.
R0Y00 commented 2026-11-24 06:49:00 +00:00 (Migrated from github.com)
Author
Contributor

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


Thanks for the Intel and RTX measurements. On RTX 5070 driver 32.0.16.2124, please record the two new results separately from numeric mismatches. e64_approx and sdwa_unary fail at PSO creation under preserve, while ftz and any create a pipeline. Keep draw-e64 on explicit preserve because its negative control distinguishes that mode. A fixture may use any only if the cases and their mismatch controls show the expected results are mode-independent. Please include the exact HRESULT and keep this scoped to the measured driver and programs.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7091941804 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7091941804). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T04:52:59Z. --- Thanks for the Intel and RTX measurements. On RTX 5070 driver `32.0.16.2124`, please record the two new results separately from numeric mismatches. `e64_approx` and `sdwa_unary` fail at PSO creation under `preserve`, while `ftz` and `any` create a pipeline. Keep `draw-e64` on explicit `preserve` because its negative control distinguishes that mode. A fixture may use `any` only if the cases and their mismatch controls show the expected results are mode-independent. Please include the exact HRESULT and keep this scoped to the measured driver and programs.
denn0x commented 2026-11-24 06:49:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-23T17:09:37Z.


RX 9070 XT: a binary32 equality with a subnormal operand loses the subnormal inside && or ||, even under -denorm preserve. This makes pixel_aot_comparisons_hardware fail on this adapter and driver.

Environment.

  • Windows 11 build 26300.9974.
  • AMD Radeon RX 9070 XT (1002:7550), driver 32.0.32015.7029, debug layer enabled.
  • WARP 10.0.26100.9818.
  • DXC 1.8.2502.11, from SDK 10.0.26100.0.
  • main at f19bcfc, dev preset.

The RX 9070 XT reports above used driver 32.0.32029.2010, and their commits (edc2e54, f1f95cf) predate the f32 compare draws (bdc76df). As far as I can tell, this is the first RDNA 4 result for those draws.

Failure. ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_hardware$' -V fails at check_f32_compare_draws. Only case f32-cmp-1 (F32_COMPARE_SETS[1]: +0.0, -0.0, -1.0, 1.0) mismatches: word 0 is 0x000ccccc where 0x0008cccc is expected. The difference is bit 18, v_cmp_eq_f32_e32 vcc_lo, 1, v16: the inline integer 1 is read as the binary32 bits 0x00000001, and the compare is with -0.0. The expected result is false; the hardware returns true. Its mismatch controls still fire, and WARP passes.

Narrowing. On the hardware, the result stays wrong when I:

  • remove precise;
  • drop -Gis;
  • read the operand straight from the constant buffer.

The trigger is the shape the translator emits, ordered(a) && ordered(b) && (a == b). Synthetic probe, compiled with -Gis -denorm preserve -T ps_6_2, constants 0x00000001, 0x80000000; every bit should be 0:

cbuffer Constants : register(b0) { uint4 params[16]; };
uint4 main(float2 uv : TEXCOORD0) : SV_Target0 {
    float z = asfloat(params[0].y);  // 0x80000000, -0.0
    float d = asfloat(params[0].x);  // 0x00000001
    uint r = 0;
    r |= (asfloat(1u) == z) ? 1u : 0u;
    r |= ((((asuint(asfloat(1u)) & 0x7fffffffu) <= 0x7f800000u) && ((asuint(z) & 0x7fffffffu) <= 0x7f800000u)
           && (asfloat(1u) == z))) ? 2u : 0u;
    r |= ((((asuint(z) & 0x7fffffffu) <= 0x7f800000u)) && (asfloat(1u) == z)) ? 4u : 0u;
    r |= ((((asuint(d) & 0x7fffffffu) <= 0x7f800000u) && ((asuint(z) & 0x7fffffffu) <= 0x7f800000u)
           && (d == z))) ? 8u : 0u;
    r |= (isnan(z) || asfloat(1u) == z) ? 16u : 0u;
    return uint4(r, 0, 0, 0x5a5a5a5a);
}
Bit Shape RX 9070 XT WARP
0 asfloat(1u) == z on its own 0 (correct) 0
1 the translator's guard && equality 1 0
2 one guard && equality 1 0
3 same, with the subnormal read from constants 1 0
4 isnan(z) || equality 1 0

The same equalities on their own, plus d > +0, d != -0, d + d and min(d, 1), keep the subnormal under preserve on this driver. They flush under ftz and any on both backends. So the mode request works, and the deviation is specific to a compare that feeds && or ||.

I also tried other ways of combining the guard and the equality, with -HV 2021. Each is wrong on the hardware except one:

  • bool e = ...; and then guard && e;
  • e ? guard : false;
  • (uint)guard & (uint)e;
  • and(guard, e);
  • the one exception: (e ? 1u : 0u) & (guard ? 8u : 0u), two selects followed by an integer AND, is correct.

That looks like the driver's optimizer folding the boolean logic, so I don't think a translator-side rewrite would be robust.

Not tested: the newer driver 32.0.32029.2010. Updating the driver isn't something I can do on this machine.

Following the earlier guidance to keep comparison predicates strict, I'd record this as a driver-specific mismatch for this adapter, like the RTX 5060 Ti PSO case, rather than relax the reference. I can rerun on request.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7108239560 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7108239560). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-23T17:09:37Z. --- **RX 9070 XT: a binary32 equality with a subnormal operand loses the subnormal inside `&&` or `||`, even under `-denorm preserve`.** This makes `pixel_aot_comparisons_hardware` fail on this adapter and driver. **Environment.** - Windows 11 build 26300.9974. - AMD Radeon RX 9070 XT (`1002:7550`), driver **32.0.32015.7029**, debug layer enabled. - WARP `10.0.26100.9818`. - DXC 1.8.2502.11, from SDK 10.0.26100.0. - `main` at `f19bcfc`, `dev` preset. The RX 9070 XT reports above used driver 32.0.32029.2010, and their commits (`edc2e54`, `f1f95cf`) predate the f32 compare draws (`bdc76df`). As far as I can tell, this is the first RDNA 4 result for those draws. **Failure.** `ctest --preset dev --no-tests=error -R '^pixel_aot_comparisons_hardware$' -V` fails at `check_f32_compare_draws`. Only case `f32-cmp-1` (`F32_COMPARE_SETS[1]`: +0.0, -0.0, -1.0, 1.0) mismatches: word 0 is `0x000ccccc` where `0x0008cccc` is expected. The difference is bit 18, `v_cmp_eq_f32_e32 vcc_lo, 1, v16`: the inline integer `1` is read as the binary32 bits `0x00000001`, and the compare is with -0.0. The expected result is false; the hardware returns true. Its mismatch controls still fire, and WARP passes. **Narrowing.** On the hardware, the result stays wrong when I: - remove `precise`; - drop `-Gis`; - read the operand straight from the constant buffer. The trigger is the shape the translator emits, `ordered(a) && ordered(b) && (a == b)`. Synthetic probe, compiled with `-Gis -denorm preserve -T ps_6_2`, constants `0x00000001`, `0x80000000`; every bit should be 0: ```hlsl cbuffer Constants : register(b0) { uint4 params[16]; }; uint4 main(float2 uv : TEXCOORD0) : SV_Target0 { float z = asfloat(params[0].y); // 0x80000000, -0.0 float d = asfloat(params[0].x); // 0x00000001 uint r = 0; r |= (asfloat(1u) == z) ? 1u : 0u; r |= ((((asuint(asfloat(1u)) & 0x7fffffffu) <= 0x7f800000u) && ((asuint(z) & 0x7fffffffu) <= 0x7f800000u) && (asfloat(1u) == z))) ? 2u : 0u; r |= ((((asuint(z) & 0x7fffffffu) <= 0x7f800000u)) && (asfloat(1u) == z)) ? 4u : 0u; r |= ((((asuint(d) & 0x7fffffffu) <= 0x7f800000u) && ((asuint(z) & 0x7fffffffu) <= 0x7f800000u) && (d == z))) ? 8u : 0u; r |= (isnan(z) || asfloat(1u) == z) ? 16u : 0u; return uint4(r, 0, 0, 0x5a5a5a5a); } ``` | Bit | Shape | RX 9070 XT | WARP | | --- | --- | --- | --- | | 0 | `asfloat(1u) == z` on its own | 0 (correct) | 0 | | 1 | the translator's guard `&&` equality | **1** | 0 | | 2 | one guard `&&` equality | **1** | 0 | | 3 | same, with the subnormal read from constants | **1** | 0 | | 4 | `isnan(z) \|\| equality` | **1** | 0 | The same equalities on their own, plus `d > +0`, `d != -0`, `d + d` and `min(d, 1)`, keep the subnormal under `preserve` on this driver. They flush under `ftz` and `any` on both backends. So the mode request works, and the deviation is specific to a compare that feeds `&&` or `||`. I also tried other ways of combining the guard and the equality, with `-HV 2021`. Each is wrong on the hardware except one: - `bool e = ...;` and then `guard && e`; - `e ? guard : false`; - `(uint)guard & (uint)e`; - `and(guard, e)`; - the one exception: `(e ? 1u : 0u) & (guard ? 8u : 0u)`, two selects followed by an integer AND, is correct. That looks like the driver's optimizer folding the boolean logic, so I don't think a translator-side rewrite would be robust. **Not tested:** the newer driver 32.0.32029.2010. Updating the driver isn't something I can do on this machine. Following the earlier guidance to keep comparison predicates strict, I'd record this as a driver-specific mismatch for this adapter, like the RTX 5060 Ti PSO case, rather than relax the reference. I can rerun on request. _AI-assisted (Claude Code)._
R0Y00 commented 2026-11-24 06:49:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T17:23:03Z.


Keep bit 18 strict and the hardware result as a mismatch. The direct comparison and arithmetic controls separate this from a general inability to preserve binary32 subnormals. @stan495, if available, could you run the same five-bit source-built probe and pixel_aot_comparisons_hardware on the RX 7900 XTX and identify the driver/DXC used? A second RX 9070 XT on 32.0.32029.2010 would also help distinguish driver version from hardware family. Please keep the unusual integer-AND workaround as a probe result until it survives both driver versions and independently preserves NaN predicates and signed zeros.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7108577394 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7108577394). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T17:23:03Z. --- Keep bit 18 strict and the hardware result as a mismatch. The direct comparison and arithmetic controls separate this from a general inability to preserve binary32 subnormals. @stan495, if available, could you run the same five-bit source-built probe and pixel_aot_comparisons_hardware on the RX 7900 XTX and identify the driver/DXC used? A second RX 9070 XT on 32.0.32029.2010 would also help distinguish driver version from hardware family. Please keep the unusual integer-AND workaround as a probe result until it survives both driver versions and independently preserves NaN predicates and signed zeros.
MoonYueya commented 2026-11-24 06:49:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MoonYueya on 2026-11-23T17:25:44Z.


Understood, and we will keep the two kinds of result apart. On our side that means being explicit about what we measured, because the RTX 5070 rows are not ours.

  1. The two PSO-creation failures above come from a747624515-sudo's RTX 5070 run (driver 32.0.16.2124), and that report already carries the exact code: all ten batch cases returned status=error with Translated pixel pipeline failed (HRESULT 0x8007000E). 0x8007000E is E_OUTOFMEMORY, i.e. a creation failure, not a value mismatch — in this harness a wrong value surfaces as pixel_mismatch at compare time, which is the reason the two belong in separate rows rather than one.
  2. In our own columns — AMD RDNA2 iGPU 1002:164e driver 32.0.11024.2, RTX 3080 10de:2206 driver 32.0.16.1742, and WARP 10.0.26100.9711 — every probe build created a pipeline in all four modes and the negative control behaved as expected. We did not run e64_approx or sdwa_unary, so we cannot add or contradict a row for them; treat the RTX 5070 result as the only measurement of those two fixtures.
  3. Keeping draw-e64 on explicit preserve is right for the reason you give: its negative control inverts between modes, so it is the fixture that shows the mode actually reaches the pipeline.
  4. On any: in our f32 columns any sits with ftz, not with preserve — no flag, any and ftz all flush the required add row, and only preserve keeps 0x00000001. A fixture whose expected values assume preservation therefore cannot record any; it is only usable where the cases and their mismatch controls are mode-independent.

Scope: all of the above is the measured adapter, driver and program set, and none of it is console evidence.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7108643034 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7108643034). Originally posted by [MoonYueya](https://github.com/MoonYueya) on 2026-11-23T17:25:44Z. --- Understood, and we will keep the two kinds of result apart. On our side that means being explicit about what we measured, because the RTX 5070 rows are not ours. 1. The two PSO-creation failures above come from a747624515-sudo's RTX 5070 run (driver `32.0.16.2124`), and that report already carries the exact code: all ten batch cases returned `status=error` with `Translated pixel pipeline failed (HRESULT 0x8007000E)`. `0x8007000E` is `E_OUTOFMEMORY`, i.e. a creation failure, not a value mismatch — in this harness a wrong value surfaces as `pixel_mismatch` at compare time, which is the reason the two belong in separate rows rather than one. 2. In our own columns — AMD RDNA2 iGPU `1002:164e` driver `32.0.11024.2`, RTX 3080 `10de:2206` driver `32.0.16.1742`, and WARP `10.0.26100.9711` — every probe build created a pipeline in all four modes and the negative control behaved as expected. We did not run `e64_approx` or `sdwa_unary`, so we cannot add or contradict a row for them; treat the RTX 5070 result as the only measurement of those two fixtures. 3. Keeping `draw-e64` on explicit `preserve` is right for the reason you give: its negative control inverts between modes, so it is the fixture that shows the mode actually reaches the pipeline. 4. On `any`: in our f32 columns `any` sits with `ftz`, not with `preserve` — no flag, `any` and `ftz` all flush the required add row, and only `preserve` keeps `0x00000001`. A fixture whose expected values assume preservation therefore cannot record `any`; it is only usable where the cases and their mismatch controls are mode-independent. Scope: all of the above is the measured adapter, driver and program set, and none of it is console evidence. _AI-assisted._
triggered02 commented 2026-11-26 04:04:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-26T03:32:31Z.


Naming the exact blocker so this thread does not sit on "waiting": @R0Y00's ask on this issue has two specific measurements outstanding, and both are host-specific:

  1. RX 7900 XTX, same five-bit source-built probe + pixel_aot_comparisons_hardware, with the driver and DXC version named (@stan495's offer).
  2. A second RX 9070 XT on driver 32.0.32029.2010, to separate driver version from hardware family.

Until one of those exists, the open question stays open by construction: the current data has the RTX 5070 rows (E_OUTOFMEMORY at PSO creation � a creation failure, not a value mismatch) and @MoonYueya's RDNA2 iGPU rows, which cannot distinguish a driver-level denormal/NaN-payload difference from an instruction-level one. MoonYueya's point that PSO-creation failures and value mismatches belong in separate rows is accepted and is already how the thread reads.

The integer-AND workaround stays a probe result per the maintainer note � it needs to survive both driver versions and preserve NaN predicates and signed zeros before anything treats it as a fix.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181809376 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/312#issuecomment-7181809376). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-26T03:32:31Z. --- Naming the exact blocker so this thread does not sit on "waiting": @R0Y00's ask on this issue has two specific measurements outstanding, and both are host-specific: 1. **RX 7900 XTX, same five-bit source-built probe + pixel_aot_comparisons_hardware**, with the driver and DXC version named (@stan495's offer). 2. **A second RX 9070 XT on driver 32.0.32029.2010**, to separate driver version from hardware family. Until one of those exists, the open question stays open by construction: the current data has the RTX 5070 rows (E_OUTOFMEMORY at PSO creation � a creation failure, not a value mismatch) and @MoonYueya's RDNA2 iGPU rows, which cannot distinguish a driver-level denormal/NaN-payload difference from an instruction-level one. MoonYueya's point that PSO-creation failures and value mismatches belong in separate rows is accepted and is already how the thread reads. The integer-AND workaround stays a probe result per the maintainer note � it needs to survive both driver versions and preserve NaN predicates and signed zeros before anything treats it as a fix.
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#307
No description provided.