Shader float mode (IEEE_MODE, DX10_CLAMP, FLOAT_MODE) is per shader; the recompiler assumes one #981

Open
opened 2026-10-06 21:33:31 +00:00 by adriadam10 · 8 comments
adriadam10 commented 2026-10-06 21:33:31 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-06T21:33:31Z.


The recompiler doesn't read the shader's float mode, and every float semantic we've added so far was measured in one fixed mode. Which mode is right depends on the shader, so some results are wrong for some titles.

What the hardware does with the mode

Each shader carries its mode in RSRC1 (COMPUTE_PGM_RSRC1 0x212, SPI_SHADER_PGM_RSRC1_PS/GS/HS 0x00A/0x08A/0x10A), and the wave starts in that mode:

Field Changes
IEEE_MODE signaling NaN quieting; NaN handling of min/max/med3; omod is ignored when it's 1
DX10_CLAMP clamp of a NaN gives 0 or NaN
FLOAT_MODE f32 and f16/f64 denormals (flush/keep, input and output separately), rounding (RNE/RTP/RTN/RTZ)
FP16_OVFL f16 overflow to inf or max

A shader can also change the mode at run time with s_setreg*, s_denorm_mode or s_round_mode.

What titles use

  • Astro's Playroom, all 2942 shader headers in eboot.bin: IEEE_MODE=0 in all of them. FLOAT_MODE=0xc0 (f32 denormals flushed, f16/f64 kept, RNE) with DX10_CLAMP=1 in 2932; 0x00 with DX10_CLAMP=0 in 10. No run-time mode changes.
  • KytyPS5 throws unless vertex and pixel shaders use float_mode == 0xc0, dx10_clamp and no ieee_mode (src/graphics/shader/shader.cpp), and reads the f32 denormal bit of compute shaders.
  • Other modes are used: Dragon Ball FighterZ uses FLOAT_MODE=0x04 in pixel shaders (f64 round toward +inf, KytyPS5/KytyPS5#884). Gran Turismo 7 (PS4) needs its own f64 denormal mode in its compute shaders (shadps4-emu/shadPS4#5126).

What's wrong on our side

  • The recompiler assumes one mode. Some semantics on main follow IEEE=0 (output modifier), others IEEE=1 (v_mullit_f32). Both are recorded in TechnicalDebt.
  • The HW oracle (#871) defaults to IEEE=1 with f32 denormals kept, the opposite of what Astro's Playroom uses. Anything measured without passing the flags was measured in the wrong mode for it. Example: #533 (ours) matched the hardware in all 512 cells with IEEE=1, but 114 differed with IEEE=0.
  • Denormals are left to the Vulkan driver: only SignedZeroInfNanPreserve is declared, so f32 denormal results differ between host GPUs, except in the ops that handle them on the bits.

What we'd do

  1. Oracle: remove the defaults so every run states the full mode, and add DX10_CLAMP, rounding and FP16_OVFL. Document it in HW_ORACLE.md.
  2. Audit: run every execution test's kernel with HW-captured expected values on the oracle under each mode and list the cells that depend on the mode or were captured in the wrong one.
  3. Carry the mode: decode RSRC1 for compute and every graphics stage into the RecompileRequest, include it in the shader cache key and the request serializer, no behaviour change.
  4. Denormals and rounding through SPIR-V float controls (DenormFlushToZero/DenormPreserve, RoundingModeRTE/RTZ) where the device reports support. Throw where it doesn't, and for RTP/RTN, which Vulkan has no execution mode for.
  5. One PR per family (IEEE NaN rules, DX10_CLAMP, FP16_OVFL), each implementing both values of its bit, measured on the hardware. Until a family is done, a mode it depends on throws, with a TechnicalDebt line.
  6. Run-time mode changes with an immediate operand tracked statically (the mode is uniform per wave); anything else throws.

Questions

  • @boykopovar Step 3 touches RecompileRequest and the cache key, which #639 is reworking. Where should the mode go so it fits #639: a field of the request, or part of what RegisterShader keeps?
  • Steps 4-5 make shaders in modes we don't model yet throw, where today they run with a possibly wrong result (the 10 Astro's Playroom shaders with 0x00/DX10_CLAMP=0 would throw until DX10_CLAMP and f16 denormals are done). Is that the behaviour you want, or should those run and only be listed in TechnicalDebt?

Until this is settled we've stopped our shader work: no new shader PRs from us, and we're pausing our reviews/merges of float-related shader PRs. Integer, memory and decoding PRs don't depend on the mode. Our open #533 is on hold until it can be done for both IEEE values.

cc @oneandonlydean

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5735709883 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/981). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-06T21:33:31Z. --- The recompiler doesn't read the shader's float mode, and every float semantic we've added so far was measured in one fixed mode. Which mode is right depends on the shader, so some results are wrong for some titles. ### What the hardware does with the mode Each shader carries its mode in `RSRC1` (`COMPUTE_PGM_RSRC1` 0x212, `SPI_SHADER_PGM_RSRC1_PS/GS/HS` 0x00A/0x08A/0x10A), and the wave starts in that mode: | Field | Changes | |---|---| | `IEEE_MODE` | signaling NaN quieting; NaN handling of min/max/med3; omod is ignored when it's 1 | | `DX10_CLAMP` | clamp of a NaN gives 0 or NaN | | `FLOAT_MODE` | f32 and f16/f64 denormals (flush/keep, input and output separately), rounding (RNE/RTP/RTN/RTZ) | | `FP16_OVFL` | f16 overflow to inf or max | A shader can also change the mode at run time with `s_setreg*`, `s_denorm_mode` or `s_round_mode`. ### What titles use - Astro's Playroom, all 2942 shader headers in `eboot.bin`: `IEEE_MODE=0` in all of them. `FLOAT_MODE=0xc0` (f32 denormals flushed, f16/f64 kept, RNE) with `DX10_CLAMP=1` in 2932; `0x00` with `DX10_CLAMP=0` in 10. No run-time mode changes. - KytyPS5 throws unless vertex and pixel shaders use `float_mode == 0xc0`, `dx10_clamp` and no `ieee_mode` (`src/graphics/shader/shader.cpp`), and reads the f32 denormal bit of compute shaders. - Other modes are used: Dragon Ball FighterZ uses `FLOAT_MODE=0x04` in pixel shaders (f64 round toward +inf, KytyPS5/KytyPS5#884). Gran Turismo 7 (PS4) needs its own f64 denormal mode in its compute shaders (shadps4-emu/shadPS4#5126). ### What's wrong on our side - The recompiler assumes one mode. Some semantics on `main` follow IEEE=0 (output modifier), others IEEE=1 (`v_mullit_f32`). Both are recorded in TechnicalDebt. - The HW oracle (#871) defaults to `IEEE=1` with f32 denormals kept, the opposite of what Astro's Playroom uses. Anything measured without passing the flags was measured in the wrong mode for it. Example: #533 (ours) matched the hardware in all 512 cells with IEEE=1, but 114 differed with IEEE=0. - Denormals are left to the Vulkan driver: only `SignedZeroInfNanPreserve` is declared, so f32 denormal results differ between host GPUs, except in the ops that handle them on the bits. ### What we'd do 1. Oracle: remove the defaults so every run states the full mode, and add `DX10_CLAMP`, rounding and `FP16_OVFL`. Document it in `HW_ORACLE.md`. 2. Audit: run every execution test's kernel with HW-captured expected values on the oracle under each mode and list the cells that depend on the mode or were captured in the wrong one. 3. Carry the mode: decode `RSRC1` for compute and every graphics stage into the `RecompileRequest`, include it in the shader cache key and the request serializer, no behaviour change. 4. Denormals and rounding through SPIR-V float controls (`DenormFlushToZero`/`DenormPreserve`, `RoundingModeRTE`/`RTZ`) where the device reports support. Throw where it doesn't, and for RTP/RTN, which Vulkan has no execution mode for. 5. One PR per family (IEEE NaN rules, DX10_CLAMP, FP16_OVFL), each implementing both values of its bit, measured on the hardware. Until a family is done, a mode it depends on throws, with a TechnicalDebt line. 6. Run-time mode changes with an immediate operand tracked statically (the mode is uniform per wave); anything else throws. ### Questions - @boykopovar Step 3 touches `RecompileRequest` and the cache key, which #639 is reworking. Where should the mode go so it fits #639: a field of the request, or part of what `RegisterShader` keeps? - Steps 4-5 make shaders in modes we don't model yet throw, where today they run with a possibly wrong result (the 10 Astro's Playroom shaders with `0x00`/`DX10_CLAMP=0` would throw until DX10_CLAMP and f16 denormals are done). Is that the behaviour you want, or should those run and only be listed in TechnicalDebt? Until this is settled we've stopped our shader work: no new shader PRs from us, and we're pausing our reviews/merges of float-related shader PRs. Integer, memory and decoding PRs don't depend on the mode. Our open #533 is on hold until it can be done for both IEEE values. cc @oneandonlydean
adriadam10 commented 2026-10-07 05:50:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T05:50:52Z.


Open shader PRs on hold until this is settled, because their results depend on the float mode:

  • #1017: v_fma_f64 with subnormal operands (f64 denormals)
  • #697: v_interp_*_f16 (f16 denormals/rounding, NaN)
  • #938: ds_{add,min,max}_src2_f32 (float ops in LDS)
  • #533: packed f16 NaN results (ours)

Integer, memory and decoding shader PRs are reviewed and merged as usual.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6031878239 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/981#issuecomment-6031878239). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T05:50:52Z. --- Open shader PRs on hold until this is settled, because their results depend on the float mode: - #1017: `v_fma_f64` with subnormal operands (f64 denormals) - #697: `v_interp_*_f16` (f16 denormals/rounding, NaN) - #938: `ds_{add,min,max}_src2_f32` (float ops in LDS) - #533: packed f16 NaN results (ours) Integer, memory and decoding shader PRs are reviewed and merged as usual.
kr4y4 commented 2026-10-07 19:20:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-07T19:20:31Z.


Data point for the f16/f64 denormal half of FLOAT_MODE, from a host GPU that flushes f16 denormals when no mode is declared.

Intel Raptor Lake-S Mobile Graphics, Windows driver 32.0.101.6790, current main:

  • Two tests fail on this device and pass on an RTX 4070 in the same machine:
    • agc_driver_vopc_compare: 26 mismatches, all with an f16 denormal operand. Example: thread 0, f16 a = 0x8000, b = 0x0001, where compares 36, 37, 40, 43, 46 and 47 are wrong (compare 36 is 0, expected 1).
    • agc_driver_sdwa_float_selectors: 11 mismatches. Example: lane 6 min_f16 BYTE_0/WORD_1 -> WORD_0 is 0xfda00047, expected 0xfda00000.
  • The recompiler unpacks f16 with UnpackHalf2x16 and computes in f32. Vulkan lets the driver flush denormals produced by unpacking unless the entry point declares DenormPreserve for that width (Vulkan spec, "Precision and Operation of SPIR-V Instructions"). Only SignedZeroInfNanPreserve 32 is declared, so this driver's result is allowed.
  • Adding OpCapability DenormPreserve and OpExecutionMode %main DenormPreserve 16 to the emitted modules makes both tests pass on the Intel GPU and on the RTX 4070. DenormPreserve 32 alone changes nothing.

VkPhysicalDeviceFloatControlsProperties on the two devices:

denormBehaviorIndependence shaderDenormPreserveFloat16/32/64
Intel Raptor Lake-S ALL 1 / 1 / 1
RTX 4070 Laptop (32.0.15.9597) ALL 1 / 0 / 0

So for the common FLOAT_MODE = 0xc0 (f16/f64 denormals kept), both devices can honour the f16 part through DenormPreserve 16. The f32 flush part has no portable equivalent on the RTX 4070 (shaderDenormFlushToZeroFloat32 = 0).

No PR, since float-mode PRs are on hold here. The patched modules were tested in a local harness that loads the emitted SPIR-V before dispatch. Found with AI assistance (Claude Code); the numbers above were measured on the hardware listed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6045125985 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/981#issuecomment-6045125985). Originally posted by [kr4y4](https://github.com/kr4y4) on 2026-10-07T19:20:31Z. --- Data point for the f16/f64 denormal half of `FLOAT_MODE`, from a host GPU that flushes f16 denormals when no mode is declared. Intel Raptor Lake-S Mobile Graphics, Windows driver 32.0.101.6790, current main: - Two tests fail on this device and pass on an RTX 4070 in the same machine: - `agc_driver_vopc_compare`: 26 mismatches, all with an f16 denormal operand. Example: thread 0, f16 `a = 0x8000`, `b = 0x0001`, where compares 36, 37, 40, 43, 46 and 47 are wrong (`compare 36 is 0, expected 1`). - `agc_driver_sdwa_float_selectors`: 11 mismatches. Example: `lane 6 min_f16 BYTE_0/WORD_1 -> WORD_0 is 0xfda00047, expected 0xfda00000`. - The recompiler unpacks f16 with `UnpackHalf2x16` and computes in f32. Vulkan lets the driver flush denormals produced by unpacking unless the entry point declares `DenormPreserve` for that width (Vulkan spec, "Precision and Operation of SPIR-V Instructions"). Only `SignedZeroInfNanPreserve 32` is declared, so this driver's result is allowed. - Adding `OpCapability DenormPreserve` and `OpExecutionMode %main DenormPreserve 16` to the emitted modules makes both tests pass on the Intel GPU and on the RTX 4070. `DenormPreserve 32` alone changes nothing. `VkPhysicalDeviceFloatControlsProperties` on the two devices: | | `denormBehaviorIndependence` | `shaderDenormPreserveFloat16/32/64` | |---|---|---| | Intel Raptor Lake-S | ALL | 1 / 1 / 1 | | RTX 4070 Laptop (32.0.15.9597) | ALL | 1 / 0 / 0 | So for the common `FLOAT_MODE = 0xc0` (f16/f64 denormals kept), both devices can honour the f16 part through `DenormPreserve 16`. The f32 flush part has no portable equivalent on the RTX 4070 (`shaderDenormFlushToZeroFloat32 = 0`). No PR, since float-mode PRs are on hold here. The patched modules were tested in a local harness that loads the emitted SPIR-V before dispatch. Found with AI assistance (Claude Code); the numbers above were measured on the hardware listed.
adriadam10 commented 2026-10-08 20:00:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T20:00:22Z.


Picking this up now that #639 is in. Plan, one PR each:

  1. Oracle: no default mode. Every run states IEEE_MODE, DX10_CLAMP, FLOAT_MODE (denormals + rounding) and FP16_OVFL, and HW_ORACLE.md documents them.
  2. Carry the mode, no behaviour change: decode RSRC1 of compute and every graphics stage into GuestContext in the RecompileRequest, and include it in the shader cache key and the request serializer.
  3. IEEE_MODE family first, since every Astro's Playroom shader has IEEE_MODE=0: NaN rules of min/max/med3, signaling NaN quieting and omod, both values measured on hardware.

Modes we don't model yet keep running as today and are listed in TechnicalDebt; only ops whose result we know depends on the mode will throw. That answers the second question in the issue the less disruptive way. @boykopovar, say if you'd rather they throw.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6067991003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/981#issuecomment-6067991003). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T20:00:22Z. --- Picking this up now that #639 is in. Plan, one PR each: 1. **Oracle**: no default mode. Every run states `IEEE_MODE`, `DX10_CLAMP`, `FLOAT_MODE` (denormals + rounding) and `FP16_OVFL`, and `HW_ORACLE.md` documents them. 2. **Carry the mode, no behaviour change**: decode `RSRC1` of compute and every graphics stage into `GuestContext` in the `RecompileRequest`, and include it in the shader cache key and the request serializer. 3. **IEEE_MODE family** first, since every Astro's Playroom shader has `IEEE_MODE=0`: NaN rules of min/max/med3, signaling NaN quieting and omod, both values measured on hardware. Modes we don't model yet keep running as today and are listed in TechnicalDebt; only ops whose result we know depends on the mode will throw. That answers the second question in the issue the less disruptive way. @boykopovar, say if you'd rather they throw.
SleglJan commented 2026-10-08 20:34:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-08T20:34:18Z.


Hardware on offer for this plan: a Ryzen 7950X3D iGPU (Raphael, gfx1036, RDNA2) running tools/hw-oracle under hsa-rocr 7.2.4 on Linux, in the same machine as an RTX 3080 (NVIDIA) and the RADV iGPU as Vulkan hosts. On the NVIDIA host shaderDenormPreserveFloat32, shaderDenormFlushToZeroFloat32 and shaderDenormFlushToZeroFloat16 are false and only shaderDenormPreserveFloat16 is true; the RADV host reports all four true with 32-bit-only independence.

Unless someone has it in hand, I'll take the audit step: replay the execution tests' ALU kernels on the oracle in the titles' mode (IEEE 0, f32 denormals flushed, f16/f64 kept, DX10_CLAMP 1, RNE) and in the old default (IEEE 1, f32 denormals kept), plus the other IEEE × denormal × DX10_CLAMP combinations, and post here the cells that depend on the mode or were pinned in the wrong one, with the script. After that I can take one family, FLOAT_MODE denormals if nobody has started it, since the f32 flush needs SPIR-V emulation on NVIDIA and that can be checked against both hosts here; say if you'd rather I take DX10_CLAMP or FP16_OVFL instead.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6068547601 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/981#issuecomment-6068547601). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-08T20:34:18Z. --- Hardware on offer for this plan: a Ryzen 7950X3D iGPU (Raphael, gfx1036, RDNA2) running `tools/hw-oracle` under hsa-rocr 7.2.4 on Linux, in the same machine as an RTX 3080 (NVIDIA) and the RADV iGPU as Vulkan hosts. On the NVIDIA host `shaderDenormPreserveFloat32`, `shaderDenormFlushToZeroFloat32` and `shaderDenormFlushToZeroFloat16` are false and only `shaderDenormPreserveFloat16` is true; the RADV host reports all four true with 32-bit-only independence. Unless someone has it in hand, I'll take the audit step: replay the execution tests' ALU kernels on the oracle in the titles' mode (IEEE 0, f32 denormals flushed, f16/f64 kept, DX10_CLAMP 1, RNE) and in the old default (IEEE 1, f32 denormals kept), plus the other IEEE × denormal × DX10_CLAMP combinations, and post here the cells that depend on the mode or were pinned in the wrong one, with the script. After that I can take one family, FLOAT_MODE denormals if nobody has started it, since the f32 flush needs SPIR-V emulation on NVIDIA and that can be checked against both hosts here; say if you'd rather I take DX10_CLAMP or FP16_OVFL instead. AI-assisted: yes (Claude Code).
SleglJan commented 2026-10-08 21:23:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-08T21:23:36Z.


Audit of the execution tests' pinned rows against the hardware under the float modes, as offered above. Measured on 2026-10-08 on a Ryzen 7950X3D iGPU (Raphael, gfx1036, RDNA2) with tools/hw-oracle under hsa-rocr 7.2.4 on Linux (CachyOS, kernel 7.2.9), on main 4b6ab6bb's test sources; the PS5's gfx1013 is not measured.

Method. Of the 186 execution tests, 56 kernels (in 48 tests) load their inputs into v4..v7 and store from v10 on, so their ALU words run on the oracle unchanged as .long words; 47 of those (from 41 tests) could be driven automatically, since their rows are tables in the source. Each kernel's rows ran in seven modes: the titles' mode (IEEE_MODE=0, f32 denormals flushed, f16/f64 kept, DX10_CLAMP=1, RNE, FP16_OVFL=0), the oracle's former default (IEEE_MODE=1, f32 denormals kept), and the titles' mode with one field changed at a time (IEEE 1, f32 kept, f16/f64 flushed, DX10_CLAMP 0, FP16_OVFL 1). The same kernels, whole, ran through the recompiler on an RTX 3080 (NVIDIA) and on the RADV iGPU; the 48 tests pass on both hosts. 27,652 result cells. The comparison that matters is bit-exact against the test's own Expected table, honouring its Checked masks, for the 36 kernels that have one (the other 11, the DPP, DsSwizzle, Permlane16 and FmaLegacy kernels, compute their expectation in code and have no mode-dependent cells); a NaN-tolerant comparison hides 68 of the cells below per 32-bit word, or 125 if f16 halves are compared the same way.

Asserted cells whose pinned value differs from the hardware in the titles' mode: 217. On all of them both hosts return the pinned value bit-exact.

Test Cells Instruction Pinned value reproduced by Reading
F64Arithmetic 35 v_min_f64/v_max_f64 (14), f64 add/mul/fma/ldexp quiet bit (21) IEEE_MODE=1 pinned with IEEE 1 (#446 states no mode)
SdwaLdexpF16 36 v_ldexp_f16_sdwa quiet bit, 3 columns IEEE_MODE=1 pinned with IEEE 1 (#666 varied DENORM16, not IEEE)
F64Rounding 28 v_cvt_f32_f64 mul:2 IEEE_MODE=1, or f32 denormals kept output modifier, see below
DivFixupF16 21 v_div_fixup_f16 quiet bit, all 8 forms IEEE_MODE=1 pinned with IEEE 1 (#438 states no mode)
F64Division, F64DivisionModifiers, F64NanConversions, F64Conversions 15, 10, 13, 1 f64 quiet bit IEEE_MODE=1 pinned with IEEE 1 (#474, #446 state no mode)
F64Transcendental 8 f64 rcp/rsq/sqrt quiet bit IEEE_MODE=1 pinned with IEEE 1 (#447 states no mode)
Vop3PackLdexp 50 v_mul_lo_i32 no mode oracle artefact: the opcode reads 0 on gfx1036 in every row; #596 found it absent on gfx1035 and pinned the computed low 32 bits of the product

The quiet-bit cells all have the same shape: with IEEE_MODE=0 the hardware passes a signalling NaN through f32, f64 and f16 results unquieted (0x7f800001, 0x7ff0000000000001 and 0x7c01 stay); with IEEE_MODE=1 it is returned quieted, which is what the tables hold. For min/max with IEEE_MODE=0 a NaN operand, signalling or not, loses to the other operand (v_min_f64(1.0, sNaN) is 1.0); with IEEE_MODE=1 the sNaN is returned quieted. F32MinMaxNan is pinned in the titles' mode and matches; F64Arithmetic's min/max are pinned in IEEE 1, so the recompiler's f32 and f64 min/max follow different modes today.

One output-modifier deviation from the recompiler's own omod rule. v_cvt_f32_f64 mul:2 of 1.0 gives 0x40000000 on the hardware in the titles' mode and 0x3f800000 with IEEE 1 or with f32 denormals kept. Translation/src/Float64Instructions.cpp clears omod on every f64-family result (lines 30 and 37), following #446's "omod is ignored by every f64 op (cvt_f32_f64 too)", measured in a mode where it is. The rule the data supports, with every IEEE × denormal combination run for each result type: the output modifier applies only when IEEE_MODE=0 and the denormal field of the result's own type says flush. An f32 result follows the f32 field, so cvt_f32_f64 applies it in the titles' mode. An f64 or f16 result follows the f16/f64 field, so both ignore it in the titles' mode and apply it with IEEE_MODE=0 and that field at 0: v_mul_f64 div:2 of 2.5 gives 0x3ff4000000000000 there and 0x4004000000000000 in every other combination, v_add_f16 mul:2 of 1.0+1.0 gives 0x4400 there and 0x4000 otherwise. An applied modifier also turns -0 into +0 (v_mul_f32(-0, 1) mul:2 is +0). TechnicalDebt's output-modifier line records the f32 rule and the f16 one; the f64 half and cvt_f32_f64 are not recorded.

Cells the tests do not assert, where both hosts differ from the hardware in the titles' mode: 19, all masked on purpose (#511: results that depend on the denormal mode; #498: underflowing products). In 14 SdwaFloatSelectors cells the hosts return the f32-denormals-kept value, which is also the pinned one (row 4 column 7, v_max_f32_sdwa sext(v4) WORD_1, v5 clamp: hardware 0, hosts and table 0x00001a0e). Row 3 of the same column matches no mode: hardware 0, hosts 0x000005c2, table 0x00470047 (the denormals-kept value). Row 4 column 11 is an f16 sNaN: hardware 0x7cde, RADV 0x7ede, NVIDIA 0x7fff. Vop2ModifierForms rows 17, 18 and 21 column 4 (v_mul_legacy_f32_dpp): hardware +0, since the input is flushed before the legacy zero rule; hosts -0; the table holds -0 in row 21 and the denormals-kept 0x80000001/0x80002000 in rows 17 and 18.

Host differences: 95 cells, all NVIDIA's canonical NaN (0x7fffffff, f16 0x7fff) on f32 and f16 results and through SDWA selectors. RADV returns the titles'-mode hardware value in 94 of them; the exception is SdwaFloatSelectors row 4 column 11 above. Every affected test masks or NaN-compares those cells.

Which field changes which result, over the 1,907 cells whose bits depend on the mode (1,691 ignoring NaN payloads; a cell can depend on several fields)
Field Cells Instructions
IEEE_MODE 826 (219 of them the quiet bit) omod on f32 results (with f32 flush); min/max/min3/max3/med3 NaN rules; sNaN quieting in f32, f64 and f16 results
f16/f64 denormals 592 omod on f64 and f16 results; f16 arithmetic (VOP3 and SDWA), v_ldexp_f16, v_pack_b32_f16, v_div_fixup_f16
f32 denormals 461 omod on f32 results (with IEEE 0); f32 inputs and outputs flushed to signed zero, before v_mul_legacy_f32's zero rule
DX10_CLAMP 333 clamp of a NaN result gives +0 with 1 and the NaN with 0, on f32, f64 and f16
FP16_OVFL 115 ±inf f16 results become ±0x7bff, including v_div_fixup_f16's infinity case

The per-kernel breakdown (mode-sensitivity.txt), the per-cell data for the flagged cells (audit.json, with the seven mode values and both hosts), the pinned-versus-hardware listing and the scripts are at https://gist.github.com/SleglJan/30456e5687240f0b639a78e5477f2f91. The remaining 59 partially replayable kernels (results stored outside v10..v25 or more than 16, prologue address setup or register initialisation, branches outside the ALU words, EXEC changes, user-data SGPRs) are being adapted for a second pass; the memory and image tests are out of the oracle's reach. If wanted, the replay driver can go in under tools/ and the harness, which runs any kernel's words through the recompiler on the host ANYPS5_GPU selects, as an execution-test target, so the audit reruns on any RDNA2 machine.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6069323386 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/981#issuecomment-6069323386). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-08T21:23:36Z. --- Audit of the execution tests' pinned rows against the hardware under the float modes, as offered above. Measured on 2026-10-08 on a Ryzen 7950X3D iGPU (Raphael, gfx1036, RDNA2) with `tools/hw-oracle` under hsa-rocr 7.2.4 on Linux (CachyOS, kernel 7.2.9), on `main` 4b6ab6bb's test sources; the PS5's gfx1013 is not measured. **Method.** Of the 186 execution tests, 56 kernels (in 48 tests) load their inputs into `v4..v7` and store from `v10` on, so their ALU words run on the oracle unchanged as `.long` words; 47 of those (from 41 tests) could be driven automatically, since their rows are tables in the source. Each kernel's rows ran in seven modes: the titles' mode (`IEEE_MODE=0`, f32 denormals flushed, f16/f64 kept, `DX10_CLAMP=1`, RNE, `FP16_OVFL=0`), the oracle's former default (`IEEE_MODE=1`, f32 denormals kept), and the titles' mode with one field changed at a time (IEEE 1, f32 kept, f16/f64 flushed, DX10_CLAMP 0, FP16_OVFL 1). The same kernels, whole, ran through the recompiler on an RTX 3080 (NVIDIA) and on the RADV iGPU; the 48 tests pass on both hosts. 27,652 result cells. The comparison that matters is bit-exact against the test's own `Expected` table, honouring its `Checked` masks, for the 36 kernels that have one (the other 11, the DPP, DsSwizzle, Permlane16 and FmaLegacy kernels, compute their expectation in code and have no mode-dependent cells); a NaN-tolerant comparison hides 68 of the cells below per 32-bit word, or 125 if f16 halves are compared the same way. **Asserted cells whose pinned value differs from the hardware in the titles' mode: 217.** On all of them both hosts return the pinned value bit-exact. | Test | Cells | Instruction | Pinned value reproduced by | Reading | |---|---:|---|---|---| | F64Arithmetic | 35 | `v_min_f64`/`v_max_f64` (14), f64 add/mul/fma/ldexp quiet bit (21) | `IEEE_MODE=1` | pinned with IEEE 1 (#446 states no mode) | | SdwaLdexpF16 | 36 | `v_ldexp_f16_sdwa` quiet bit, 3 columns | `IEEE_MODE=1` | pinned with IEEE 1 (#666 varied DENORM16, not IEEE) | | F64Rounding | 28 | `v_cvt_f32_f64 mul:2` | `IEEE_MODE=1`, or f32 denormals kept | output modifier, see below | | DivFixupF16 | 21 | `v_div_fixup_f16` quiet bit, all 8 forms | `IEEE_MODE=1` | pinned with IEEE 1 (#438 states no mode) | | F64Division, F64DivisionModifiers, F64NanConversions, F64Conversions | 15, 10, 13, 1 | f64 quiet bit | `IEEE_MODE=1` | pinned with IEEE 1 (#474, #446 state no mode) | | F64Transcendental | 8 | f64 rcp/rsq/sqrt quiet bit | `IEEE_MODE=1` | pinned with IEEE 1 (#447 states no mode) | | Vop3PackLdexp | 50 | `v_mul_lo_i32` | no mode | oracle artefact: the opcode reads 0 on gfx1036 in every row; #596 found it absent on gfx1035 and pinned the computed low 32 bits of the product | The quiet-bit cells all have the same shape: with `IEEE_MODE=0` the hardware passes a signalling NaN through f32, f64 and f16 results unquieted (`0x7f800001`, `0x7ff0000000000001` and `0x7c01` stay); with `IEEE_MODE=1` it is returned quieted, which is what the tables hold. For min/max with `IEEE_MODE=0` a NaN operand, signalling or not, loses to the other operand (`v_min_f64(1.0, sNaN)` is 1.0); with `IEEE_MODE=1` the sNaN is returned quieted. F32MinMaxNan is pinned in the titles' mode and matches; F64Arithmetic's min/max are pinned in IEEE 1, so the recompiler's f32 and f64 min/max follow different modes today. **One output-modifier deviation from the recompiler's own omod rule.** `v_cvt_f32_f64 mul:2` of 1.0 gives `0x40000000` on the hardware in the titles' mode and `0x3f800000` with IEEE 1 or with f32 denormals kept. `Translation/src/Float64Instructions.cpp` clears `omod` on every f64-family result (lines 30 and 37), following #446's "omod is ignored by every f64 op (`cvt_f32_f64` too)", measured in a mode where it is. The rule the data supports, with every IEEE × denormal combination run for each result type: the output modifier applies only when `IEEE_MODE=0` and the denormal field of the result's own type says flush. An f32 result follows the f32 field, so `cvt_f32_f64` applies it in the titles' mode. An f64 or f16 result follows the f16/f64 field, so both ignore it in the titles' mode and apply it with `IEEE_MODE=0` and that field at 0: `v_mul_f64 div:2` of 2.5 gives `0x3ff4000000000000` there and `0x4004000000000000` in every other combination, `v_add_f16 mul:2` of 1.0+1.0 gives `0x4400` there and `0x4000` otherwise. An applied modifier also turns -0 into +0 (`v_mul_f32(-0, 1) mul:2` is +0). TechnicalDebt's output-modifier line records the f32 rule and the f16 one; the f64 half and `cvt_f32_f64` are not recorded. **Cells the tests do not assert, where both hosts differ from the hardware in the titles' mode: 19**, all masked on purpose (#511: results that depend on the denormal mode; #498: underflowing products). In 14 SdwaFloatSelectors cells the hosts return the f32-denormals-kept value, which is also the pinned one (row 4 column 7, `v_max_f32_sdwa sext(v4) WORD_1, v5 clamp`: hardware `0`, hosts and table `0x00001a0e`). Row 3 of the same column matches no mode: hardware `0`, hosts `0x000005c2`, table `0x00470047` (the denormals-kept value). Row 4 column 11 is an f16 sNaN: hardware `0x7cde`, RADV `0x7ede`, NVIDIA `0x7fff`. Vop2ModifierForms rows 17, 18 and 21 column 4 (`v_mul_legacy_f32_dpp`): hardware `+0`, since the input is flushed before the legacy zero rule; hosts `-0`; the table holds `-0` in row 21 and the denormals-kept `0x80000001`/`0x80002000` in rows 17 and 18. **Host differences:** 95 cells, all NVIDIA's canonical NaN (`0x7fffffff`, f16 `0x7fff`) on f32 and f16 results and through SDWA selectors. RADV returns the titles'-mode hardware value in 94 of them; the exception is SdwaFloatSelectors row 4 column 11 above. Every affected test masks or NaN-compares those cells. <details><summary>Which field changes which result, over the 1,907 cells whose bits depend on the mode (1,691 ignoring NaN payloads; a cell can depend on several fields)</summary> | Field | Cells | Instructions | |---|---:|---| | `IEEE_MODE` | 826 (219 of them the quiet bit) | omod on f32 results (with f32 flush); min/max/min3/max3/med3 NaN rules; sNaN quieting in f32, f64 and f16 results | | f16/f64 denormals | 592 | omod on f64 and f16 results; f16 arithmetic (VOP3 and SDWA), `v_ldexp_f16`, `v_pack_b32_f16`, `v_div_fixup_f16` | | f32 denormals | 461 | omod on f32 results (with IEEE 0); f32 inputs and outputs flushed to signed zero, before `v_mul_legacy_f32`'s zero rule | | `DX10_CLAMP` | 333 | clamp of a NaN result gives +0 with 1 and the NaN with 0, on f32, f64 and f16 | | `FP16_OVFL` | 115 | ±inf f16 results become ±0x7bff, including `v_div_fixup_f16`'s infinity case | </details> The per-kernel breakdown (`mode-sensitivity.txt`), the per-cell data for the flagged cells (`audit.json`, with the seven mode values and both hosts), the pinned-versus-hardware listing and the scripts are at https://gist.github.com/SleglJan/30456e5687240f0b639a78e5477f2f91. The remaining 59 partially replayable kernels (results stored outside `v10..v25` or more than 16, prologue address setup or register initialisation, branches outside the ALU words, EXEC changes, user-data SGPRs) are being adapted for a second pass; the memory and image tests are out of the oracle's reach. If wanted, the replay driver can go in under `tools/` and the harness, which runs any kernel's words through the recompiler on the host `ANYPS5_GPU` selects, as an execution-test target, so the audit reruns on any RDNA2 machine. AI-assisted: yes (Claude Code).
SleglJan commented 2026-10-08 22:11:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-08T22:11:35Z.


Second pass of the audit above, covering the kernels that needed adapting (results outside v10..v25, more than 16 results, prologue setup, user-data SGPRs, computed inputs), plus the Division kernels and the four whose code arrays hold a named constant. Same GPU, oracle and seven modes; main 4b6ab6bb's test sources and recompiler; upstream has since changed F32MinMaxNan.cpp and added ImagePckN, InterpolationF16, InterpolationModes, LdsSrc2 and PackedAlu, which this pass does not cover. 221 adapters run (43 whole kernels, 168 parts of 16 kernels split by result columns, store-free word ranges or input groups, 4 single test cases, 6 wave64), 11 skipped: five branch cases whose path runs through a store (BranchPastEndpgm, LoopEndingExits), and six kernels that need more than the oracle's 4 KiB of LDS (four), eight inputs per lane, or an opcode with no gfx103x encoding. 62 kernels, 69,504 cells; a second oracle run of every adapter reproduced all 486,528 values except ShaderClock's masked clock columns. 18 kernels with table inputs also ran through the recompiler on both hosts; the 42 with computed inputs and the two that take user-data SGPRs did not.

Asserted cells whose pinned value differs from the hardware in the titles' mode: 163, every one a signalling NaN kept unquieted by the hardware with IEEE_MODE=0 and quieted in the table, reproduced by IEEE_MODE=1 only, as in the first pass.

Test Cells Instructions Test's own check on the hardware value
Vop1FloatUnary 118 f32 ceil, floor, trunc, rndne, fract, frexp_mant, sqrt, rsq, rcp, rcp_iflag, log, exp, sin, cos; the same in f16 except frexp_mant and rcp_iflag rejects
Division 21 v_div_fmas_f32, v_div_fixup_f32 rejects
Float16Misc 12 v_ldexp_f16, v_frexp_mant_f16, v_mul_legacy_f32 accepts (NaN-tolerant)
Float16Rounding 12 v_add_f16, v_mul_f16 accepts (NaN-tolerant)

The other 14 kernels with a pin table (13 tests) match in all 16,960 asserted cells. Both hosts return the pinned value in 147 of the 163 cells; in the other 16, all in the NaN-tolerant tests, NVIDIA returns its canonical NaN, and RADV the hardware value in Float16Misc's four. So Vop1FloatUnary's and Division's sNaN rows assert the IEEE 1 result exactly, and the recompiler at 4b6ab6bb gives it in every mode. Unasserted cells whose pin differs: 82, all captured with f32 denormals kept (72 v_mul_legacy_f32 lanes with an f32 denormal, where the hosts return the hardware's +0 in 35, -0 in 19 and the pin in 13, and differ from each other in 5; and 10 masked Vop1FloatUnary cells).

Host versus hardware on the 18 host-run kernels: 358 of 22,944 cells, none outside what the test's own check accepts; the sources are the quiet bit above, NVIDIA's canonical NaN, f32 denormal inputs the hosts do not flush (unasserted v_mul_legacy_f32 lanes and Vop1FloatUnary row 0), and differences within the tolerance of the transcendental columns. In every cell of an integer, scalar or LDS instruction the oracle and both hosts agree, which is the check that those 18 adapters reproduce their kernels; RelativeIndexing is checked by its table alone, and the other 43 kernels compute their expectation in code and are compared across modes only.

Which field changes which result, over the 1,224 cells whose bits depend on the mode
Field Cells Instructions
f16/f64 denormals 478 f16 norm, pknorm, frexp, ldexp; f16 results with output modifiers; f16 add, cvt, mul; the compare bits of VopcCompare (4) and VopcCompareF64 (50)
IEEE_MODE 351 (163 the quiet bit) sNaN quieting above; v_cvt_f32_f16 mul:4, v_cvt_f32_ubyte0 mul:2, v_cvt_f32_ubyte1 div:2 (188, with f32 denormals: the output-modifier rule)
f32 denormals 324 the same 188; v_mul_legacy_f32 with a denormal lane (72); the LDS float atomics' columns (54); 10 masked Vop1FloatUnary cells
FP16_OVFL 247 v_ldexp_f16, v_cvt_f16_f32 (also with div:2), v_cvt_f16_u16, f16 add and mul, f16 mul, fma and rcp with mul:2, f16 exp, log, rcp, rsq
DX10_CLAMP 21 clamped f16 results, 16 of them v_sqrt_f16 clamp mul:2

Not measurable here: FmaRounding columns 4 to 7 and 9 and Float16Misc column 10, whose instructions exist only on gfx10.1; Float16Misc word 36 decodes as v_mac_legacy_f32 on gfx1013 and as the fused v_fmac_legacy_f32 on gfx1036, so its column is excluded. Over both passes: 330 asserted cells in 13 tests whose pinned value is the IEEE_MODE=1 result or, in F64Rounding, the ignored output modifier, and 50 Vop3PackLdexp cells of an opcode the oracle cannot run. The adapters, the driver, every run's body and raw output, the per-cell data and the listings for both passes are on a data branch of the fork: https://github.com/SleglJan/AnyPS5/tree/audit/oracle-2026-10-08/oracle-audit.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6070046381 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/981#issuecomment-6070046381). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-08T22:11:35Z. --- Second pass of the audit above, covering the kernels that needed adapting (results outside `v10..v25`, more than 16 results, prologue setup, user-data SGPRs, computed inputs), plus the Division kernels and the four whose code arrays hold a named constant. Same GPU, oracle and seven modes; `main` 4b6ab6bb's test sources and recompiler; upstream has since changed F32MinMaxNan.cpp and added ImagePckN, InterpolationF16, InterpolationModes, LdsSrc2 and PackedAlu, which this pass does not cover. 221 adapters run (43 whole kernels, 168 parts of 16 kernels split by result columns, store-free word ranges or input groups, 4 single test cases, 6 wave64), 11 skipped: five branch cases whose path runs through a store (BranchPastEndpgm, LoopEndingExits), and six kernels that need more than the oracle's 4 KiB of LDS (four), eight inputs per lane, or an opcode with no gfx103x encoding. 62 kernels, 69,504 cells; a second oracle run of every adapter reproduced all 486,528 values except ShaderClock's masked clock columns. 18 kernels with table inputs also ran through the recompiler on both hosts; the 42 with computed inputs and the two that take user-data SGPRs did not. **Asserted cells whose pinned value differs from the hardware in the titles' mode: 163**, every one a signalling NaN kept unquieted by the hardware with `IEEE_MODE=0` and quieted in the table, reproduced by `IEEE_MODE=1` only, as in the first pass. | Test | Cells | Instructions | Test's own check on the hardware value | |---|---:|---|---| | Vop1FloatUnary | 118 | f32 ceil, floor, trunc, rndne, fract, frexp_mant, sqrt, rsq, rcp, rcp_iflag, log, exp, sin, cos; the same in f16 except frexp_mant and rcp_iflag | rejects | | Division | 21 | `v_div_fmas_f32`, `v_div_fixup_f32` | rejects | | Float16Misc | 12 | `v_ldexp_f16`, `v_frexp_mant_f16`, `v_mul_legacy_f32` | accepts (NaN-tolerant) | | Float16Rounding | 12 | `v_add_f16`, `v_mul_f16` | accepts (NaN-tolerant) | The other 14 kernels with a pin table (13 tests) match in all 16,960 asserted cells. Both hosts return the pinned value in 147 of the 163 cells; in the other 16, all in the NaN-tolerant tests, NVIDIA returns its canonical NaN, and RADV the hardware value in Float16Misc's four. So Vop1FloatUnary's and Division's sNaN rows assert the IEEE 1 result exactly, and the recompiler at 4b6ab6bb gives it in every mode. Unasserted cells whose pin differs: 82, all captured with f32 denormals kept (72 `v_mul_legacy_f32` lanes with an f32 denormal, where the hosts return the hardware's +0 in 35, -0 in 19 and the pin in 13, and differ from each other in 5; and 10 masked Vop1FloatUnary cells). **Host versus hardware** on the 18 host-run kernels: 358 of 22,944 cells, none outside what the test's own check accepts; the sources are the quiet bit above, NVIDIA's canonical NaN, f32 denormal inputs the hosts do not flush (unasserted `v_mul_legacy_f32` lanes and Vop1FloatUnary row 0), and differences within the tolerance of the transcendental columns. In every cell of an integer, scalar or LDS instruction the oracle and both hosts agree, which is the check that those 18 adapters reproduce their kernels; RelativeIndexing is checked by its table alone, and the other 43 kernels compute their expectation in code and are compared across modes only. <details><summary>Which field changes which result, over the 1,224 cells whose bits depend on the mode</summary> | Field | Cells | Instructions | |---|---:|---| | f16/f64 denormals | 478 | f16 norm, pknorm, frexp, ldexp; f16 results with output modifiers; f16 add, cvt, mul; the compare bits of VopcCompare (4) and VopcCompareF64 (50) | | `IEEE_MODE` | 351 (163 the quiet bit) | sNaN quieting above; `v_cvt_f32_f16 mul:4`, `v_cvt_f32_ubyte0 mul:2`, `v_cvt_f32_ubyte1 div:2` (188, with f32 denormals: the output-modifier rule) | | f32 denormals | 324 | the same 188; `v_mul_legacy_f32` with a denormal lane (72); the LDS float atomics' columns (54); 10 masked Vop1FloatUnary cells | | `FP16_OVFL` | 247 | `v_ldexp_f16`, `v_cvt_f16_f32` (also with `div:2`), `v_cvt_f16_u16`, f16 add and mul, f16 mul, fma and rcp with `mul:2`, f16 exp, log, rcp, rsq | | `DX10_CLAMP` | 21 | clamped f16 results, 16 of them `v_sqrt_f16 clamp mul:2` | </details> Not measurable here: FmaRounding columns 4 to 7 and 9 and Float16Misc column 10, whose instructions exist only on gfx10.1; Float16Misc word 36 decodes as `v_mac_legacy_f32` on gfx1013 and as the fused `v_fmac_legacy_f32` on gfx1036, so its column is excluded. Over both passes: 330 asserted cells in 13 tests whose pinned value is the `IEEE_MODE=1` result or, in F64Rounding, the ignored output modifier, and 50 Vop3PackLdexp cells of an opcode the oracle cannot run. The adapters, the driver, every run's body and raw output, the per-cell data and the listings for both passes are on a data branch of the fork: https://github.com/SleglJan/AnyPS5/tree/audit/oracle-2026-10-08/oracle-audit. AI-assisted: yes (Claude Code).
CouchRiv commented 2026-10-09 07:04:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by CouchRiv on 2026-10-09T07:04:11Z.


Data for "only ops whose result we know depends on the mode will throw": which ALU ops change with the FLOAT_MODE rounding bits. Measured on 2026-10-09 with tools/hw-oracle on a Radeon 610M (gfx1036, RDNA2), every control explicit (IEEE 0, DX10_CLAMP 1, f32 denormals flushed, f16/f64 kept), each case run in round to nearest and in the three other modes, and compared with main f1451396 on NVIDIA (615.71.09) and RADV (Mesa 26.2.4). On every row below both drivers give the round-to-nearest result, so the lowering ignores the mode, not the driver.

Ops Field Rows that change (+inf / -inf / zero) Example (mode: hardware, both drivers)
v_add/sub/mul/fma_f32 and their fmac/fmaak/fmamk forms, v_fma_mix_f32 round32 v_add_f32 92 / 35 / 41 of 576, v_fma_f32 199 / 162 / 135 of 2,744 add(1, FLT_MAX) +inf: 7f800000, 7f7fffff
v_cvt_f32_i32/u32/f64 round32 v_cvt_f32_f64 14 / 14 / 18 of 32 cvt_f32_u32(0x7fffffff) zero: 4effffff, 4f000000
v_cvt_f16_f32/i16/u16 round16 v_cvt_f16_f32 31 / 31 / 32 of 72 cvt_f16_f32(FLT_MAX) zero: 7bff, 7c00
v_add/mul/fma/ldexp_f64 round16 (bits 3:2) v_add_f64 118 / 59 / 61 of 625 add_f64(1, 1/3) +inf: 3ff55555_55555556, ..._55555555
v_add/sub/mul/fma_f16, v_fma_mixlo/hi_f16, v_ldexp_f16, v_div_fixup_f16 round16 v_fma_f16 241 / 110 / 122 of 2,221 fma_f16(1, 1, 2^-24) +inf: 3c01, 3c00
v_fract_f32/f16/f64 round32 / round16 v_fract_f32 5 / 2 / 2 of 72 fract(-0.1) +inf: 3f666667, 3f666666
v_cvt_pk_u8_f32 round32 33 / 11 / 11 of 360 cvt_pk_u8(1/3) +inf: 00000001, 00000000
v_div_fixup/div_fmas/div_scale/mullit/cubema/ldexp_f32 round32 v_div_fmas_f32 503 / 415 / 411 of 5,488 div_fixup(inf, 1, 1) zero: 7f7fffff, 7f800000

Packed f16 (v_pk_add/mul/fma_f16) also follows round16 on hardware, but main already refuses those shaders. v_pk_min/max_f16 do not change with the rounding bits. Both drivers report shaderRoundingModeRTZFloat32 and Float64; NVIDIA lacks RTZFloat16. I can attach the raw rows per op if that helps the throw list.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6076145816 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/981#issuecomment-6076145816). Originally posted by [CouchRiv](https://github.com/CouchRiv) on 2026-10-09T07:04:11Z. --- Data for "only ops whose result we know depends on the mode will throw": which ALU ops change with the `FLOAT_MODE` rounding bits. Measured on 2026-10-09 with `tools/hw-oracle` on a Radeon 610M (gfx1036, RDNA2), every control explicit (IEEE 0, DX10_CLAMP 1, f32 denormals flushed, f16/f64 kept), each case run in round to nearest and in the three other modes, and compared with `main` f1451396 on NVIDIA (615.71.09) and RADV (Mesa 26.2.4). On every row below both drivers give the round-to-nearest result, so the lowering ignores the mode, not the driver. | Ops | Field | Rows that change (+inf / -inf / zero) | Example (mode: hardware, both drivers) | |---|---|---|---| | `v_add/sub/mul/fma_f32` and their fmac/fmaak/fmamk forms, `v_fma_mix_f32` | round32 | `v_add_f32` 92 / 35 / 41 of 576, `v_fma_f32` 199 / 162 / 135 of 2,744 | `add(1, FLT_MAX)` +inf: `7f800000`, `7f7fffff` | | `v_cvt_f32_i32/u32/f64` | round32 | `v_cvt_f32_f64` 14 / 14 / 18 of 32 | `cvt_f32_u32(0x7fffffff)` zero: `4effffff`, `4f000000` | | `v_cvt_f16_f32/i16/u16` | round16 | `v_cvt_f16_f32` 31 / 31 / 32 of 72 | `cvt_f16_f32(FLT_MAX)` zero: `7bff`, `7c00` | | `v_add/mul/fma/ldexp_f64` | round16 (bits 3:2) | `v_add_f64` 118 / 59 / 61 of 625 | `add_f64(1, 1/3)` +inf: `3ff55555_55555556`, `..._55555555` | | `v_add/sub/mul/fma_f16`, `v_fma_mixlo/hi_f16`, `v_ldexp_f16`, `v_div_fixup_f16` | round16 | `v_fma_f16` 241 / 110 / 122 of 2,221 | `fma_f16(1, 1, 2^-24)` +inf: `3c01`, `3c00` | | `v_fract_f32/f16/f64` | round32 / round16 | `v_fract_f32` 5 / 2 / 2 of 72 | `fract(-0.1)` +inf: `3f666667`, `3f666666` | | `v_cvt_pk_u8_f32` | round32 | 33 / 11 / 11 of 360 | `cvt_pk_u8(1/3)` +inf: `00000001`, `00000000` | | `v_div_fixup/div_fmas/div_scale/mullit/cubema/ldexp_f32` | round32 | `v_div_fmas_f32` 503 / 415 / 411 of 5,488 | `div_fixup(inf, 1, 1)` zero: `7f7fffff`, `7f800000` | Packed f16 (`v_pk_add/mul/fma_f16`) also follows round16 on hardware, but `main` already refuses those shaders. `v_pk_min/max_f16` do not change with the rounding bits. Both drivers report `shaderRoundingModeRTZFloat32` and Float64; NVIDIA lacks `RTZFloat16`. I can attach the raw rows per op if that helps the throw list.
iDiesIrae-Req commented 2026-10-13 03:50:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by iDiesIrae-Req on 2026-10-13T03:50:27Z.


A title that changes MODE at run time: vkQuake (PPSA99010, catalog homebrew, with the Quake shareware id1/pak0.pak) on Windows, main c13dc7e6b. In 7 of 9 runs on an RTX 4070 it aborts about 7 s into its first demo:

compute shader 0x20bf82000: shader 0x20bf82000 stage 0: ShaderRecompiler::Recompile: s_round_mode 8 at pc 316 changes the initial MODE rounding fields: runtime MODE changes are not implemented

The shader is produced at run time by the title's own RADV port (radv/ps5, cache in app0/radv-shader-cache), not shipped in eboot.bin. Mesa's ACO emits s_round_mode when a shader needs a rounding mode other than the wave's initial one, so other titles built on that RADV port may reach this too. The other two runs stopped earlier on a GPU stall, so the stop is not deterministic.

Details: https://github.com/boykopovar/AnyPS5/issues/1578.

Measured with Claude Code assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137814037 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/981#issuecomment-6137814037). Originally posted by [iDiesIrae-Req](https://github.com/iDiesIrae-Req) on 2026-10-13T03:50:27Z. --- A title that changes MODE at run time: vkQuake (PPSA99010, catalog homebrew, with the Quake shareware `id1/pak0.pak`) on Windows, `main` c13dc7e6b. In 7 of 9 runs on an RTX 4070 it aborts about 7 s into its first demo: ``` compute shader 0x20bf82000: shader 0x20bf82000 stage 0: ShaderRecompiler::Recompile: s_round_mode 8 at pc 316 changes the initial MODE rounding fields: runtime MODE changes are not implemented ``` The shader is produced at run time by the title's own RADV port (`radv/ps5`, cache in `app0/radv-shader-cache`), not shipped in `eboot.bin`. Mesa's ACO emits `s_round_mode` when a shader needs a rounding mode other than the wave's initial one, so other titles built on that RADV port may reach this too. The other two runs stopped earlier on a GPU stall, so the stop is not deterministic. Details: https://github.com/boykopovar/AnyPS5/issues/1578. Measured with Claude Code assistance.
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
boykopovar/AnyPS5#981
No description provided.