fix(shader): translate f32 min and max in f32 denormal modes 1 and 2 #6009

Merged
zmeizy merged 2 commits from upstream-pr/6009 into main 2026-10-24 20:13:04 +00:00
zmeizy commented 2026-10-14 19:12:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zmeizy on 2026-10-14T19:12:51Z.


What

v_min_f32, v_max_f32, v_min3_f32, v_max3_f32 and v_med3_f32 threw f32 denormal mode N ... is not implemented in shaders whose FLOAT_MODE f32 denormal field (bits 5:4) is 1 or 2.

On RDNA2 they follow only bit 0 of the field (input denormals):

  • Mode 2 flushes denormal inputs to zeros of their sign, exactly as mode 0 does.
  • Mode 1 keeps denormal inputs and returns a selected denormal unflushed, exactly as mode 3 does. The result flush of mode 1 does not apply to these instructions. For example, v_min_f32 0x807fffff, 0x3f800000 gives 0x807fffff.

f32DenormalFlushFor now returns the mode-3 flush (none) for them when bit 0 is set, and the mode-0 flush (inputs and result) otherwise. Modes 0 and 3 are unchanged.

Source of semantics: measured with the hardware oracle's kernel template on gfx1030 (AMD Radeon RX 6800, AMD Windows driver 32.0.21045.5002 through its HIP runtime amdhip64_6.dll):

  • Rows: all 2,744 operand triples of 14 values: ±0, ±2^-149, ±0x007fffff, ±2^-126, ±1, ±infinity, the quiet NaN 0x7fc00000 and the signaling NaN 0x7f800001.
  • Instructions: v_min_f32 and v_max_f32 on the first two operands; v_min3_f32, v_max3_f32 and v_med3_f32 on all three.
  • Float modes: ieee 0 and 1, each with denorm32 0 to 3; dx10_clamp 1, denorm16 3, round32 0, round16 0, fp16_overflow 0.
  • Result: at each IEEE setting, mode 1 gives exactly the mode 3 result for every row and instruction, and mode 2 exactly the mode 0 result. Mode 1 differs from mode 0 in 748 to 1,096 rows per instruction, and so does mode 2 from mode 3.

A new entry in docs/dev/debt/shader.md records it. As with mode 3, mode 1 relies on the driver keeping denormals. The general "f32 denormals" entry is left unchanged because #5782 edits that line.

Tested

Ubuntu 24.04 (WSL2), GCC 13.3, lavapipe, on main 73efd940.

  • agc_driver_f32_min_max_denormal_modes (new) pins 56 measured non-NaN triples where modes 1 and 2 differ, for all five instructions in modes 1 and 2 at IEEE 0 and 1. It compiles one program per mode.
    • On main it fails (mode 1 throws). With the change it passes in 0.1 s.
  • All measured rows (2,744 triples x 5 instructions) match the recompiler output with the change in all 8 modes. Before the change, modes 0 and 3 already matched and modes 1 and 2 threw.
  • agc_driver_f32_min_max_nan, agc_driver_f32_denormal_flush, agc_driver_dx10_clamp, agc_driver_f32_output_modifier and agc_driver_f32_result_clamp pass.
  • Measurement data attached: anyps5-gpu-probes-v2-gfx1030.json.gz (probe minmax_f32_denormal_modes).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #6010
  • Unblocks: none
  • GPUs tested: lavapipe (Mesa 25.2.8, LLVM 20.1.2) on Ubuntu 24.04 under WSL2; semantics measured on AMD Radeon RX 6800 (gfx1030, Windows driver 32.0.21045.5002)
  • AI-assisted: yes

🤖 Generated with Claude Code
anyps5-gpu-probes-v2-gfx1030.json.gz

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4863148405 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6009). Originally posted by [zmeizy](https://github.com/zmeizy) on 2026-10-14T19:12:51Z. --- ### What `v_min_f32`, `v_max_f32`, `v_min3_f32`, `v_max3_f32` and `v_med3_f32` threw `f32 denormal mode N ... is not implemented` in shaders whose `FLOAT_MODE` f32 denormal field (bits 5:4) is 1 or 2. On RDNA2 they follow only bit 0 of the field (input denormals): - **Mode 2** flushes denormal inputs to zeros of their sign, exactly as mode 0 does. - **Mode 1** keeps denormal inputs and returns a selected denormal unflushed, exactly as mode 3 does. The result flush of mode 1 does not apply to these instructions. For example, `v_min_f32 0x807fffff, 0x3f800000` gives `0x807fffff`. `f32DenormalFlushFor` now returns the mode-3 flush (none) for them when bit 0 is set, and the mode-0 flush (inputs and result) otherwise. Modes 0 and 3 are unchanged. Source of semantics: measured with the hardware oracle's kernel template on gfx1030 (AMD Radeon RX 6800, AMD Windows driver 32.0.21045.5002 through its HIP runtime `amdhip64_6.dll`): - Rows: all 2,744 operand triples of 14 values: ±0, ±2^-149, ±0x007fffff, ±2^-126, ±1, ±infinity, the quiet NaN 0x7fc00000 and the signaling NaN 0x7f800001. - Instructions: `v_min_f32` and `v_max_f32` on the first two operands; `v_min3_f32`, `v_max3_f32` and `v_med3_f32` on all three. - Float modes: ieee 0 and 1, each with denorm32 0 to 3; dx10_clamp 1, denorm16 3, round32 0, round16 0, fp16_overflow 0. - Result: at each IEEE setting, mode 1 gives exactly the mode 3 result for every row and instruction, and mode 2 exactly the mode 0 result. Mode 1 differs from mode 0 in 748 to 1,096 rows per instruction, and so does mode 2 from mode 3. A new entry in `docs/dev/debt/shader.md` records it. As with mode 3, mode 1 relies on the driver keeping denormals. The general "f32 denormals" entry is left unchanged because #5782 edits that line. ### Tested Ubuntu 24.04 (WSL2), GCC 13.3, lavapipe, on `main` `73efd940`. - `agc_driver_f32_min_max_denormal_modes` (new) pins 56 measured non-NaN triples where modes 1 and 2 differ, for all five instructions in modes 1 and 2 at IEEE 0 and 1. It compiles one program per mode. - On `main` it fails (mode 1 throws). With the change it passes in 0.1 s. - All measured rows (2,744 triples x 5 instructions) match the recompiler output with the change in all 8 modes. Before the change, modes 0 and 3 already matched and modes 1 and 2 threw. - `agc_driver_f32_min_max_nan`, `agc_driver_f32_denormal_flush`, `agc_driver_dx10_clamp`, `agc_driver_f32_output_modifier` and `agc_driver_f32_result_clamp` pass. - Measurement data attached: `anyps5-gpu-probes-v2-gfx1030.json.gz` (probe `minmax_f32_denormal_modes`). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #6010 - [x] Unblocks: none - [x] GPUs tested: lavapipe (Mesa 25.2.8, LLVM 20.1.2) on Ubuntu 24.04 under WSL2; semantics measured on AMD Radeon RX 6800 (gfx1030, Windows driver 32.0.21045.5002) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code) [anyps5-gpu-probes-v2-gfx1030.json.gz](https://github.com/user-attachments/files/33453252/anyps5-gpu-probes-v2-gfx1030.json.gz)
jotitadev commented 2026-10-14 20:33:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T20:33:22Z.

Review: COMMENTED


Run on an Apple GPU. The new test fails here because the device doesn't keep f32 denormals (shaderDenormPreserveFloat32 = false), and mode 1 keeps them.

GPUs tested: Apple M2 Max, MoltenVK 1.4.2 (Vulkan 1.4.357), macOS 27.2, x86-64 under Rosetta; also MoltenVK main with SPIRV-Cross #2704 (keeps the sign of -0)

Method: macos-port at b7eb6b6b (mugurc/AnyPS5) + ImportWatched + this PR's diff (merge-base..head, without docs/), not main, because main does not run the GPU tests on macOS yet. Release, LunarG Vulkan SDK 1.4.363.0, x86-64 under Rosetta. Suite: ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j1 --timeout 30; without the PR it has 13 known macOS failures with MoltenVK 1.4.2 and 7 with the #2704 build (#1). Head c3d5a43fd; the diff applies cleanly.

  • agc_driver_f32_min_max_denormal_modes fails on both drivers. The first failure is v_min3_f32 f32 denormal mode 1, IEEE=0 of 0x00000000, 0x00000000, 0x00000001 is 0x00000001, expected 0x00000000: the denormal compares as zero and the tie picks it.
  • With the Require turned into a print locally, there are 104 mismatches, the same on both drivers:
    • All of them are in mode 1, 52 at each IEEE setting, across all five instructions.
    • Every one has a denormal operand or result.
    • Mode 2 passes for every row.
  • Only the test file on the unchanged branch: it fails with f32 denormal mode 1 at pc 20 is not implemented, so the test runs here.
  • Suite: the new test is the only added failure. No other test changes, on either driver.

On devices without DenormPreserve for f32 the mode 1 rows can't match. Skipping them there would keep the mode 2 coverage on such devices.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5524289515 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6009#pullrequestreview-5524289515). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-14T20:33:22Z. **Review:** COMMENTED --- Run on an Apple GPU. The new test fails here because the device doesn't keep f32 denormals (`shaderDenormPreserveFloat32 = false`), and mode 1 keeps them. GPUs tested: Apple M2 Max, MoltenVK 1.4.2 (Vulkan 1.4.357), macOS 27.2, x86-64 under Rosetta; also MoltenVK main with SPIRV-Cross #2704 (keeps the sign of -0) Method: `macos-port` at `b7eb6b6b` (mugurc/AnyPS5) + ImportWatched + this PR's diff (merge-base..head, without `docs/`), not `main`, because `main` does not run the GPU tests on macOS yet. Release, LunarG Vulkan SDK 1.4.363.0, x86-64 under Rosetta. Suite: `ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j1 --timeout 30`; without the PR it has 13 known macOS failures with MoltenVK 1.4.2 and 7 with the #2704 build (#1). Head `c3d5a43fd`; the diff applies cleanly. - `agc_driver_f32_min_max_denormal_modes` fails on both drivers. The first failure is `v_min3_f32 f32 denormal mode 1, IEEE=0 of 0x00000000, 0x00000000, 0x00000001 is 0x00000001, expected 0x00000000`: the denormal compares as zero and the tie picks it. - With the `Require` turned into a print locally, there are 104 mismatches, the same on both drivers: - All of them are in mode 1, 52 at each IEEE setting, across all five instructions. - Every one has a denormal operand or result. - Mode 2 passes for every row. - Only the test file on the unchanged branch: it fails with `f32 denormal mode 1 at pc 20 is not implemented`, so the test runs here. - Suite: the new test is the only added failure. No other test changes, on either driver. On devices without DenormPreserve for f32 the mode 1 rows can't match. Skipping them there would keep the mode 2 coverage on such devices. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Dextroid17 commented 2026-10-15 01:02:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-15T01:02:54Z.


Ran this on PR head c3d5a43fd (merge base 73efd9407, 290 commits behind main ab9a47684). This confirms jotitadev's MoltenVK result above on a second driver.

Setup: PR head checked out as-is (not rebased), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), Linux, ANYPS5_NO_SHADER_CACHE=1, GPU test run on lavapipe (Mesa 26.2.4 llvmpipe, LLVM 23.1.1).

  • agc_driver_f32_min_max_denormal_modes_tests on the PR: 3 of 3 failed, each first at:
    "AGC graphics: v_min3_f32 f32 denormal mode 1, IEEE=0 of 0x00000000, 0x00000000, 0x00000001 is 0x00000001, expected 0x00000000"
    The test stops at the first mismatch and mode 1 runs before mode 2, so mode 2 never ran here.
  • Mutation check: kept the PR's test, put back the merge-base Translation/src/VectorInstructions.cpp, rebuilt, ran 3 times: 3 of 3 failed. The recompiler stopped with "ShaderRecompiler::Recompile: f32 denormal mode 1 at pc 20 is not implemented".

lavapipe reports shaderDenormPreserveFloat32 = false and shaderDenormFlushToZeroFloat32 = false. On main I find denormal-preserve handling only for f16 and f64 (VulkanDevice.cpp lines 1212-1213, 1222 and 1410), and no f32 DenormPreserve execution mode emitted, by reading. So the kept-denormal result depends on the device, which fits this failure, though I have not proven that lavapipe flushes this input. The test could skip the kept cases when the device reports no f32 denormal preservation, or the translation could produce the kept result without relying on the device. I have not tried either.

Overlap: #6007, #6010, #5782 and #5941 also edit f32DenormalFlushFor.

Not checked: NVIDIA, AMD, Windows, or any title.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6181961356 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6009#issuecomment-6181961356). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-15T01:02:54Z. --- Ran this on PR head c3d5a43fd (merge base 73efd9407, 290 commits behind main ab9a47684). This confirms jotitadev's MoltenVK result above on a second driver. Setup: PR head checked out as-is (not rebased), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), Linux, ANYPS5_NO_SHADER_CACHE=1, GPU test run on lavapipe (Mesa 26.2.4 llvmpipe, LLVM 23.1.1). - agc_driver_f32_min_max_denormal_modes_tests on the PR: 3 of 3 failed, each first at: "AGC graphics: v_min3_f32 f32 denormal mode 1, IEEE=0 of 0x00000000, 0x00000000, 0x00000001 is 0x00000001, expected 0x00000000" The test stops at the first mismatch and mode 1 runs before mode 2, so mode 2 never ran here. - Mutation check: kept the PR's test, put back the merge-base Translation/src/VectorInstructions.cpp, rebuilt, ran 3 times: 3 of 3 failed. The recompiler stopped with "ShaderRecompiler::Recompile: f32 denormal mode 1 at pc 20 is not implemented". lavapipe reports shaderDenormPreserveFloat32 = false and shaderDenormFlushToZeroFloat32 = false. On main I find denormal-preserve handling only for f16 and f64 (VulkanDevice.cpp lines 1212-1213, 1222 and 1410), and no f32 DenormPreserve execution mode emitted, by reading. So the kept-denormal result depends on the device, which fits this failure, though I have not proven that lavapipe flushes this input. The test could skip the kept cases when the device reports no f32 denormal preservation, or the translation could produce the kept result without relying on the device. I have not tried either. Overlap: #6007, #6010, #5782 and #5941 also edit f32DenormalFlushFor. Not checked: NVIDIA, AMD, Windows, or any title. AI-assisted: yes
adriadam10 commented 2026-10-16 20:58:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T20:58:23Z.

Review: CHANGES_REQUESTED


Thanks for the measurement: I reran it on gfx1035 (all 2,744 triples, five instructions, IEEE 0/1, f32 denormal modes 0 to 3). Mode 1 matches mode 3 and mode 2 matches mode 0 on every row, and the 56 rows in the test match bit for bit. So the semantics are right. The problem is the translation of mode 1:

  • agc_driver_f32_min_max_denormal_modes also fails on RADV (Mesa 26.2.4, Radeon 660M, gfx1035), with the same first mismatch that jotitadev (MoltenVK) and Dextroid17 (lavapipe 26.2.4) reported: v_min3_f32 f32 denormal mode 1, IEEE=0 of 0x00000000, 0x00000000, 0x00000001 is 0x00000001, expected 0x00000000. It passes only on CI's lavapipe 25.2.8. RADV reports shaderDenormPreserveFloat32 = true, but the module never declares DenormPreserve for width 32 (only the f16/f64 paths emit it, SpirvModuleEmitter.cpp:1068). The driver therefore uses its default f32 denormal mode and flushes. Where main threw, mode 1 now returns a wrong result on AMD hardware, which is the case "throw if it can't be exact" exists for.
  • A direction, following what the f16 path already does: add an f32 preserve flag to the target, set from shaderDenormPreserveFloat32 like float16DenormPreserve (cache key and request serializer included). When a shader uses these instructions with the input-keep bit set, emit DenormPreserve 32 if the device has it, and throw otherwise. The other option is to do the selection on the bits so that it doesn't depend on the device. In the test, skip the mode 1 rows on devices without f32 denormal preservation and keep mode 2, as jotitadev suggested.
  • Mode 3 on main has the same gap for these instructions with denormal operands (no row there catches it). If your change covers the mode-3 path too, add a mode 3 row to the test. Otherwise, a sentence in the new docs/dev/debt/shader.md line saying that kept denormals need DenormPreserve 32 would make the dependency on the driver explicit.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5553629071 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6009#pullrequestreview-5553629071). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T20:58:23Z. **Review:** CHANGES_REQUESTED --- Thanks for the measurement: I reran it on gfx1035 (all 2,744 triples, five instructions, IEEE 0/1, f32 denormal modes 0 to 3). Mode 1 matches mode 3 and mode 2 matches mode 0 on every row, and the 56 rows in the test match bit for bit. So the semantics are right. The problem is the translation of mode 1: - `agc_driver_f32_min_max_denormal_modes` also fails on RADV (Mesa 26.2.4, Radeon 660M, gfx1035), with the same first mismatch that jotitadev (MoltenVK) and Dextroid17 (lavapipe 26.2.4) reported: `v_min3_f32 f32 denormal mode 1, IEEE=0 of 0x00000000, 0x00000000, 0x00000001 is 0x00000001, expected 0x00000000`. It passes only on CI's lavapipe 25.2.8. RADV reports `shaderDenormPreserveFloat32 = true`, but the module never declares `DenormPreserve` for width 32 (only the f16/f64 paths emit it, `SpirvModuleEmitter.cpp:1068`). The driver therefore uses its default f32 denormal mode and flushes. Where `main` threw, mode 1 now returns a wrong result on AMD hardware, which is the case "throw if it can't be exact" exists for. - A direction, following what the f16 path already does: add an f32 preserve flag to the target, set from `shaderDenormPreserveFloat32` like `float16DenormPreserve` (cache key and request serializer included). When a shader uses these instructions with the input-keep bit set, emit `DenormPreserve 32` if the device has it, and throw otherwise. The other option is to do the selection on the bits so that it doesn't depend on the device. In the test, skip the mode 1 rows on devices without f32 denormal preservation and keep mode 2, as jotitadev suggested. - Mode 3 on `main` has the same gap for these instructions with denormal operands (no row there catches it). If your change covers the mode-3 path too, add a mode 3 row to the test. Otherwise, a sentence in the new `docs/dev/debt/shader.md` line saying that kept denormals need `DenormPreserve 32` would make the dependency on the driver explicit.
zmeizy commented 2026-10-21 17:23:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zmeizy on 2026-10-21T17:23:17Z.


Thanks for re-measuring. Updated in b3fe41a7d2, rebased onto main cecb540a.

Gating. Mode 1 of v_min/max/min3/max3/med3_f32 now translates only when the module keeps f32 denormals: target.float32DenormPreserve set and the hardware f32 flush not in use. Otherwise it throws f32 denormal mode 1 at pc X needs DenormPreserve 32, which the device does not offer for this shader. Mode 2 flushes the inputs, never depends on the driver, and runs everywhere.
Stacked on #6010. The branch sits on #6010's commit, which adds TranslateOptions::float32DenormPreserve (and the result-only flush fix). So Depends on: #6010, and this PR's own change is the second commit. I'll rebase it to a single commit once #6010 is in.
RADV. On main the hardware f32 flush is declared in every module, so RADV throws in mode 1. claude/f32-hardware-flush-float-mode (a separate PR) limits that flush to shaders that flush f32 denormals. With it, RADV gets DenormPreserve 32 here.
Test. agc_driver_f32_min_max_denormal_modes checks the measured rows in each mode the recompiler translates. Where it throws, it requires that the device doesn't keep f32 denormals, that the mode is 1, and that the error names DenormPreserve 32, so main still fails it. On CI's lavapipe 25.2.8 (no shaderDenormPreserveFloat32) it checks the values in mode 2 at IEEE 0 and 1 and the throw in mode 1.
Mode 3. As you said, mode 3 on main has the same driver dependence. This change doesn't cover it, and the new debt entry says that mode 3 keeps depending on the driver without DenormPreserve 32. The entry is rewritten gap-first and is under 1,000 characters.
Checked on Ubuntu 24.04 (WSL2), GCC 13.3, lavapipe (Mesa 25.2.8):

Values, with preserve forced on lavapipe in the local harness: all 2,744 triples × 5 instructions match in modes 0–3 at IEEE 0/1. Without the flag, only mode 1 throws.
Negative control: the new test fails on main (f32 denormal mode 1 at pc 20 is not implemented) and passes with the change.
Focused tests: agc_driver_f32_min_max_denormal_modes, f32_min_max_nan, f32_add_mul_denormal_modes, f32_denormal_flush, dx10_clamp, f32_output_modifier and f32_result_clamp pass with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1, with no validation messages beyond main's.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6322184524 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6009#issuecomment-6322184524). Originally posted by [zmeizy](https://github.com/zmeizy) on 2026-10-21T17:23:17Z. --- Thanks for re-measuring. Updated in b3fe41a7d2, rebased onto main cecb540a. Gating. Mode 1 of v_min/max/min3/max3/med3_f32 now translates only when the module keeps f32 denormals: target.float32DenormPreserve set and the hardware f32 flush not in use. Otherwise it throws f32 denormal mode 1 at pc X needs DenormPreserve 32, which the device does not offer for this shader. Mode 2 flushes the inputs, never depends on the driver, and runs everywhere. Stacked on #6010. The branch sits on #6010's commit, which adds TranslateOptions::float32DenormPreserve (and the result-only flush fix). So Depends on: #6010, and this PR's own change is the second commit. I'll rebase it to a single commit once #6010 is in. RADV. On main the hardware f32 flush is declared in every module, so RADV throws in mode 1. claude/f32-hardware-flush-float-mode (a separate PR) limits that flush to shaders that flush f32 denormals. With it, RADV gets DenormPreserve 32 here. Test. agc_driver_f32_min_max_denormal_modes checks the measured rows in each mode the recompiler translates. Where it throws, it requires that the device doesn't keep f32 denormals, that the mode is 1, and that the error names DenormPreserve 32, so main still fails it. On CI's lavapipe 25.2.8 (no shaderDenormPreserveFloat32) it checks the values in mode 2 at IEEE 0 and 1 and the throw in mode 1. Mode 3. As you said, mode 3 on main has the same driver dependence. This change doesn't cover it, and the new debt entry says that mode 3 keeps depending on the driver without DenormPreserve 32. The entry is rewritten gap-first and is under 1,000 characters. Checked on Ubuntu 24.04 (WSL2), GCC 13.3, lavapipe (Mesa 25.2.8): Values, with preserve forced on lavapipe in the local harness: all 2,744 triples × 5 instructions match in modes 0–3 at IEEE 0/1. Without the flag, only mode 1 throws. Negative control: the new test fails on main (f32 denormal mode 1 at pc 20 is not implemented) and passes with the change. Focused tests: agc_driver_f32_min_max_denormal_modes, f32_min_max_nan, f32_add_mul_denormal_modes, f32_denormal_flush, dx10_clamp, f32_output_modifier and f32_result_clamp pass with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1, with no validation messages beyond main's.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6009
No description provided.