Skip to content

feat(shader): request DenormPreserve 32 where the device preserves f32 denormals - #8697

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
oneandonlydean:feat/f32-denorm-preserve
Oct 21, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
oneandonlydean:feat/f32-denorm-preserve

Conversation

@oneandonlydean

Copy link
Copy Markdown
Collaborator

What

The recompiler asked the device for DenormPreserve only on 16-bit and 64-bit floats (float16DenormPreserve, float64DenormPreserve). On a device that flushes 32-bit denormals by default and can preserve them (RADV, for one) a 32-bit shader flushed them whatever the guest's float mode said, so the f32 denormal series (#5941, #6009, #6010, #6011), which flushes in the IR and relies on the hardware preserving what it does not flush, could not pass on those devices; the f32 rows pass only on CI's lavapipe 25.2.8, which is why a green CI hid it.

This adds target.float32DenormPreserve:

  • VulkanDevice sets it from shaderDenormPreserveFloat32 when denormBehaviorIndependence is not NONE (a 32-bit mode can differ from the other widths), and adds the DenormPreserve capability. APS5_NO_HW_F32_PRESERVE=1 turns it off, like APS5_NO_HW_F32_FLUSH.
  • The module declares DenormPreserve 32 when the flag is set and the hardware 32-bit flush (float32FlushToZero) is not in use; when the flush is in hardware, that mode wins.
  • The flag is part of the cache key and of the request serialization, which gains a field and a version bump. The branch carries 41; the request version takes the next free number when this lands (main + 1). feat(agc): draw point lists on the vertex path with their point size #6639 and feat(agc): merge partial writes into 4_4_4_4 UNORM color targets #8564 touch the same lines, so whichever lands later renumbers and gates its own fields at its final number.
  • The new cache-key byte invalidates every device's shader cache once.

Behaviour change on devices that advertise shaderDenormPreserveFloat32: every f32 shader now carries DenormPreserve 32 unless the hardware flush is used. Devices that do not advertise it (the RTX 4090 tested here; lavapipe 25.2.8 reports the same properties) get the same SPIR-V as before.

Target() now carries the preserve flag into ProbeFloat32FlushToZero, so on devices that preserve f32 denormals (RADV, for one) the probe can choose the emulated flush instead of the hardware flush. That is a possible performance change, not a correctness one.

Tested

Linux (CachyOS), GCC 16, Release, branch on main 2185dbf:

  • request_serializer, agc_shader_memory, agc_shader_disk_cache, agc_float16_conversion and the new agc_f32_denorm_preserve pass; the new test checks that the flag emits DenormPreserve 32 with its capability, that an unset flag emits no 32-bit denormal mode, and that the hardware flush wins when both are set. Serialization: round trip with the flag on and off, a version 40 stream reads as unset, version 42 is rejected, the cache key changes.
  • On the NVIDIA GeForce RTX 4090 (driver 610.57.04): all 30 agc_driver (submit, f16, f32, f64) tests pass. That GPU reports shaderDenormPreserveFloat32 = false, so it did not run the new path. lavapipe 25.2.8 reports the same properties (queried with vulkaninfo; the tests were not run on it).
  • Wanted from a contributor with RADV or Intel: the [float-controls] probe line, main versus this PR, plus agc_driver f32/f16/f64 and one title.
  • Not tested: any device with shaderDenormPreserveFloat32 = true (RADV, Intel, MoltenVK), so the emitted DenormPreserve 32 module has not run on hardware; Windows; a game.
  • The touched C++ files pass a g++ 13.5 -fsyntax-only check with the project flags.

Checklist

@oneandonlydean oneandonlydean self-assigned this Oct 20, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6639 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L4851, L4969, L5219, L5273-5275
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L830, L860, L869, L913
core/shader/recompiler/tests/RequestSerializerTests.cpp L217, L222, L257, L262, L283, L287, L413, L416, L432, L439, L454, L456
PR 6801 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L4851, L4969, L5219, L5273-5275
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L830, L860, L869, L913
core/shader/recompiler/tests/RequestSerializerTests.cpp L217, L222, L257, L262, L283, L287, L413, L416, L432, L439, L454, L456
PR 7410 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L4851, L4969
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L830, L860, L869, L913
core/shader/recompiler/tests/RequestSerializerTests.cpp L217, L257, L283, L413, L432, L454, L456
PR 8004 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L4851, L4969, L5061, L5071, L5122, L5129-5130, L5140, L5142-5143, L5153, L5161, L5169, L5219, L5274-5276, L7652
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L830, L860, L869, L913
core/shader/recompiler/tests/RequestSerializerTests.cpp L217, L222, L257, L262, L283, L287, L413, L416, L432, L439, L454, L456
PR 8134 core/shader/recompiler/CacheKey.hpp L291
core/shader/recompiler/Recompiler.hpp L292
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp L279
PR 8489 core/shader/recompiler/CacheKey.hpp L291
core/shader/recompiler/Recompiler.hpp L292
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp L279
PR 8564 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L4851, L4969, L5129, L5142
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L830, L869
core/shader/recompiler/tests/RequestSerializerTests.cpp L217, L257, L283, L413, L432, L454, L456
PR 8612 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L3644
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L4851, L4969, L5061, L5071, L5122, L5129-5130, L5140, L5142-5143, L5153, L5161, L5169, L5219, L5274-5276
core/shader/recompiler/CacheKey.hpp L291
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L830, L860, L869, L913
core/shader/recompiler/Recompiler.cpp L605
core/shader/recompiler/Recompiler.hpp L292
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitter.hpp L31
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp L114
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp L279
core/shader/recompiler/tests/RequestSerializerTests.cpp L217, L222, L257, L262, L283, L287, L413, L416, L432, L439, L454, L456

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4072 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/shader/recompiler/Recompiler.cpp
PR 4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 5431 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 5441 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5499 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5609 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/shader/recompiler/Recompiler.hpp
PR 6044 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6146 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6185 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/shader/recompiler/Recompiler.hpp
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6202 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6235 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
PR 6290 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6292 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp
PR 6501 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6539 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
PR 6615 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6636 docs/dev/ENVIRONMENT.md
PR 6645 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6682 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6683 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
PR 6718 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6747 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6788 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6804 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6820 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6868 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6879 core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
docs/dev/ENVIRONMENT.md
PR 6905 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6924 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Recompiler.cpp
docs/dev/ENVIRONMENT.md
PR 6946 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/Recompiler.hpp
docs/dev/ENVIRONMENT.md
PR 6947 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitter.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp
docs/dev/ENVIRONMENT.md
PR 6960 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6970 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Recompiler.hpp
PR 6977 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 7048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7085 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 7395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Recompiler.cpp
PR 7446 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7449 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7484 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitter.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp
docs/dev/ENVIRONMENT.md
PR 7505 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7514 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7550 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitter.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp
docs/dev/ENVIRONMENT.md
PR 7644 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7677 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7684 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 7689 core/shader/recompiler/Recompiler.hpp
PR 7800 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7816 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.cpp
PR 7888 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitter.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
PR 8077 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
docs/dev/ENVIRONMENT.md
PR 8206 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 8278 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 8295 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8658 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/Recompiler.hpp

@MarcZX10

Copy link
Copy Markdown
Contributor

The conventions failure is a missing environment-variable entry: APS5_NO_HW_F32_PRESERVE is read in this PR but has no row in docs/dev/ENVIRONMENT.md. Add the documented row (including its default and effect) and the failed conventions check should be addressed. Your Tested section already states that the new preserve path has not run on hardware advertising shaderDenormPreserveFloat32.

…2 denormals

The recompiler asked for DenormPreserve only for 16-bit and 64-bit floats,
so a device that flushes 32-bit denormals by default (RADV, MoltenVK) flushed
them whatever the guest's float mode said. target.float32DenormPreserve is set
from shaderDenormPreserveFloat32 when denormBehaviorIndependence allows a 32-bit
mode, is part of the cache key and of the request serialization (version 41),
and makes the module declare DenormPreserve 32 unless the 32-bit flush is
already taken in hardware. APS5_NO_HW_F32_PRESERVE=1 turns it off.
@MarcZX10

Copy link
Copy Markdown
Contributor

I prepared the missing documentation row and verified the one-line diff with git diff --check. The fork denied my push (HTTP 403), so please apply this row to docs/dev/ENVIRONMENT.md adjacent to APS5_NO_HW_F32_FLUSH:

| `APS5_NO_HW_F32_PRESERVE` | presence | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` |  | disables requesting the host f32 DenormPreserve mode |

I did not open a standalone docs PR because the variable is not present on current main until this change lands.

@github-actions github-actions Bot added build shader core/shader agc libSceAgc* labels Oct 20, 2026
@janzezno

Copy link
Copy Markdown
Contributor

Run on a device that advertises f32 denorm preserve, which the RTX 4090 run does not.

Host: Arch Linux, kernel 7.2.11, AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, GCC 16.2.1, Release, BUILD_TESTING=ON. shaderDenormPreserveFloat32 = true, shaderDenormFlushToZeroFloat32 = true, denormBehaviorIndependence = 32_BIT_ONLY; the [float-controls] probe reports hardware f32 flush.
main e25333e39; PR head d8dd4e0bd5 merged on top.

The merge conflicts with main in VulkanDevice.cpp (the Float32FlushControlFor change from #8578). I resolved it locally by keeping main's three flush lines and adding the PR's float32DenormPreserve line and the combined float16DenormPreserve || float32DenormPreserve capability line; the PR needs a rebase.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R 'agc|shader|recompiler|request_serializer' -V

@oneandonlydean
oneandonlydean force-pushed the feat/f32-denorm-preserve branch from d8dd4e0 to 3117837 Compare October 20, 2026 23:26
@oneandonlydean

Copy link
Copy Markdown
Collaborator Author

@janzezno Thanks for the RADV run. It's the device class this change is for. The branch is now rebased onto main as 3117837b35, with the VulkanDevice.cpp resolution you used (main's three flush lines, plus the float32DenormPreserve line and the combined capability line).

If you have time, one more run would help: any title you can boot on that RX 7900 GRE, on 3117837b35 against the same main, with ANYPS5_NO_SHADER_CACHE=1. The startup [float-controls] line and whether it gets as far as on main are what matter. Full CI is running on this head.

@github-actions github-actions Bot added docs and removed needs rebase Conflicts with main, rebase needed labels Oct 20, 2026
@janzezno

Copy link
Copy Markdown
Contributor

Ran the rebased head 3117837b35 against its merge base 42427a6a45, on the same machine as before.

Host: Arch Linux, kernel 7.2.11, AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, GCC 16.2.1, Release, BUILD_TESTING=ON.

Title: ccleste 1.00 (PPSA59322), from darkxex/PS5_Celeste. The zip's sha256 is 96861b81…2fb43, the same as the catalog's. I unwrapped eboot.bin and sce_module/libc.prx with tools/unwrap_self.py, relinked them with the default options, and ran them with ANYPS5_NO_SHADER_CACHE=1 SDL_AUDIODRIVER=dummy APS5_NO_PAD_INPUT=1. Each run lasted 45 s, with present counts from APS5_VIDEOOUT_TELEMETRY_DIR.

main 42427a6a45 PR 3117837b35
[float-controls] f32 denormal flush: hardware (0 of 5472 probe results differ from the emulated flush, 25 ms) f32 denormal flush: hardware (0 of 5472 probe results differ from the emulated flush, 35 ms)
At the 45 s cutoff still rendering, 5250 presents, 119.87 fps still rendering, 5250 presents, 119.88 fps
Errors in the log none none

The title gets as far on the PR as on main, and the rest of the two logs match.

Tests: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R 'agc|shader|recompiler|request_serializer' -V

@Queuse

Queuse commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Supplemental Windows/Intel validation: 3117837b35 applied to main 926ed2eda1, GCC 15.2.0-r7 Release.

  • RTX 3050 Laptop/617.42: baseline 11/11; candidate 12/12 focused numeric/cache cases.
  • Iris Xe/101.4502 (shaderDenormPreserveFloat32=true): baseline 9 pass/1 skip/1 failure; candidate 10 pass/1 skip/the same unsupported-Float64 failure.
  • Four f32 execution cases also pass on both with APS5_NO_HW_F32_FLUSH=1.

Required Vulkan, disabled shader cache, Khronos validation: no missing layer or VUID errors. No title or performance claim. AI-assisted: yes.

oneandonlydean pushed a commit that referenced this pull request Nov 4, 2026
Since #8697 every device with shaderDenormPreserveFloat32 and an independent
f32 denormal behaviour gets DenormPreserve 32. RADV on Vega (GCN 5, Mesa
26.0.8) miscompiles the preserving forms of the transcendental ops: its
v_log_f32 lowering picks the denormal scale with a v_cndmask_b32 that reads
two SGPRs, which GFX9 cannot do, so log2(2.0) is 25.0 in some lanes and
agc_driver_log_near_one, vop1_float_unary, fp16_overflow and
float16_result_modifiers fail.

ProbeFloat32DenormPreserve runs v_log_f32, v_sqrt_f32, v_rsq_f32, v_rcp_f32
and v_exp_f32 on normal values with and without the mode, after the flush
probe. The mode only changes denormal handling, but Vulkan does not require
these ops to be correctly rounded, so Float32ResultsAgree accepts each of
the 256 result pairs when they are no further apart than the width of the
interval the Vulkan precision bound allows around the exact result (sqrt's
bound inherited from 1.0 / inversesqrt(), an absolute 2^-21 for log2 inputs
in [0.5, 2.0]). When one falls outside, float32DenormPreserve
stays off and the device keeps its default f32 denormal handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants