fix(shader): honor f64 comparison input denormal mode #6850

Merged
Ondra97 merged 2 commits from upstream-pr/6850 into main 2026-10-19 12:05:46 +00:00
Ondra97 commented 2026-10-16 14:15:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-16T14:15:58Z.


What

v_cmp*_f64 compared subnormal operands unchanged even when the shader's FLOAT_MODE requires input denormals to be flushed. For example, comparing the f64 bit patterns 0x0000000000000001 < 0x0000000000000002 in mode 0 returned true instead of false, producing the wrong predicate.

The shared f64 comparison path now converts zero-exponent inputs to signed zero when bit 0 of the f16/f64 denormal field is clear (modes 0 and 2). Modes 1 and 3 and the legacy unknown mode retain their behavior. Class comparisons continue to inspect the original bits.

Semantic references: AMD RDNA2 ISA, section 6.4, LLVM's AMDGPU denormal modes, and the prior gfx1036 audit of mode-sensitive VopcCompareF64 results. I did not perform a new AMD or PS5 hardware measurement; the debt entry records that limit.

The existing GPU fixture covers all four denormal modes with IEEE off/on, plus the unknown mode. It checks 236,160 predicate results over edge pairs and deterministic random inputs, including VCC/EXEC, class and existing source-modifier forms. Opposing f32 denormal settings check that the f16/f64 field controls this path. Each of the nine shader variants is compiled once.

Related #6007 changes f32 comparisons and #6760 changes f64 min/max; neither implements this f64 comparison fix.

Tested

Base 82ddae75b6761757f3d3ba9c0723647469270f76, final head 23c9bd7e860146860de99f2f6856073e2a48a47b. The base is still upstream main at publication. No dependency, build-script, workflow or binary changes are included. The complete upstream delta 332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5..82ddae75b6761757f3d3ba9c0723647469270f76 and this patch were statically reviewed before execution, including new files and build/test execution paths.

Windows (native host): AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER, driver 617.42 / 32.0.16.1742; Windows 11 Pro 10.0.26300. WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF.

Vulkan was required with ANYPS5_REQUIRE_VULKAN=1; ANYPS5_GPU=NVIDIA GeForce RTX 4070 Ti SUPER selected the device and its actual selection was verified in the verbose logs. ANYPS5_NO_SHADER_CACHE=1 and request.useCache=false disabled the AnyPS5 shader cache. Driver caches were not controlled. Guest wave32.

Before / after — Windows (native host)

Same final agc_driver_vopc_compare_f64 fixture, hardware, inputs, Release configuration and cache settings; one invocation per variant. The negative control restored the base's unmodified comparison source, then the fixed bytes were restored and checked.

Metric Before (base) After (fix)
Failing regression runs 1/1 0/1
Mode 0, IEEE off, round 0, lane 9, predicate 37 (expected 0) 1 0

This demonstrates the predicate correction; it is not a performance or title benchmark.

  • Full Windows application/library build passed with #6452's exact test-only alignment correction (4fe92c9c23c7bd861d63664d4efde3033b6226f6) temporarily applied. It was removed and is not in these commits.
  • Final related suite: 22/22 passed, 0 failures, 0 skips. Sixteen GPU processes selected the physical NVIDIA device; the remaining groups are CPU/compiler/library checks.
  • Conventions, whitespace and test-registration checks passed (903 test executables registered).

Reproduction from the configured full build, with the environment above:

cmake --build build-runtime --target all libs --parallel 4
ctest --test-dir build-runtime -V --parallel 2 -R '^(agc_driver_(vopc_compare.*|vop3_compare.*|vcmp.*|f64.*|f32_compare.*|f32_denormal_flush)|agc_(shader_mode_register|structurizer|shader_control_flow|constant_phi)|patched_libraries)$'

Linux (VirtualBox): Ubuntu 24.04.5 LTS, kernel 7.0.0-31-generic, GCC 13.3.0; VirtualBox 7.2.20 on the Windows host above, 8 vCPU / 8 GiB assigned. Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF. Graphics: not exercised.

  • Final head and all three changed source files verified against Git blobs in the separate Linux checkout.
  • Full build, including the graphics components and f64 comparison fixture executable, passed.
  • agc_structurizer, agc_shader_mode_register, agc_shader_control_flow and agc_constant_phi: 4/4 passed, 0 failures, 0 skips.
  • Conventions and test registration passed (913 test executables registered).

The existing Linux build retained its CMake cache paths through its compatibility directory:

cmake --build ~/anyps5-rwlock-20261016/build --target all libs agc_driver_vopc_compare_f64_tests --parallel 2
ctest --test-dir ~/anyps5-rwlock-20261016/build --output-on-failure -R '^(agc_structurizer|agc_shader_mode_register|agc_shader_control_flow|agc_constant_phi)$'

Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox validation. Native/bare-metal Linux was not tested. Native Linux GPU validation: not tested.

The full CTest suite was not run. No title was run, and no title fix, FPS improvement or new AMD/PS5 measurement is claimed. Hosted full builds require a collaborator's manual dispatch under the current CI policy.

Checklist

  • Based on current main; open PR implementations/tests and complete file lists of large PRs checked; no other open PR implements this f64 comparison change
  • One topic per PR; follow-ups go in a new PR
  • No comments in code added
  • No new stubs or unimplemented paths
  • No notes, investigation files or images added to the repository
  • New third-party code: n/a
  • Generic shader behavior, not specific to one title
  • Depends on: #6452 for the complete Windows test build
  • Unblocks: none established for a title
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, driver 617.42, Windows 11 Pro 10.0.26300
  • AI-assisted: yes, Codex; code and local test results checked in this task
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4889654029 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6850). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-16T14:15:58Z. --- ### What `v_cmp*_f64` compared subnormal operands unchanged even when the shader's `FLOAT_MODE` requires input denormals to be flushed. For example, comparing the f64 bit patterns `0x0000000000000001 < 0x0000000000000002` in mode 0 returned true instead of false, producing the wrong predicate. The shared f64 comparison path now converts zero-exponent inputs to signed zero when bit 0 of the f16/f64 denormal field is clear (modes 0 and 2). Modes 1 and 3 and the legacy unknown mode retain their behavior. Class comparisons continue to inspect the original bits. Semantic references: [AMD RDNA2 ISA, section 6.4](https://gpuopen.com/download/rdna2-shader-instruction-set-architecture.pdf#page=55), [LLVM's AMDGPU denormal modes](https://llvm.org/docs/AMDGPUUsage.html#floating-point-denorm-mode-enumeration-values), and the prior [gfx1036 audit of mode-sensitive VopcCompareF64 results](https://github.com/boykopovar/AnyPS5/issues/981#issuecomment-6070046381). I did not perform a new AMD or PS5 hardware measurement; the debt entry records that limit. The existing GPU fixture covers all four denormal modes with IEEE off/on, plus the unknown mode. It checks 236,160 predicate results over edge pairs and deterministic random inputs, including VCC/EXEC, class and existing source-modifier forms. Opposing f32 denormal settings check that the f16/f64 field controls this path. Each of the nine shader variants is compiled once. Related #6007 changes f32 comparisons and #6760 changes f64 min/max; neither implements this f64 comparison fix. ### Tested Base `82ddae75b6761757f3d3ba9c0723647469270f76`, final head `23c9bd7e860146860de99f2f6856073e2a48a47b`. The base is still upstream main at publication. No dependency, build-script, workflow or binary changes are included. The complete upstream delta `332b0b1b79feb39a6e5fc5d4e4a5dfe4491d27b5..82ddae75b6761757f3d3ba9c0723647469270f76` and this patch were statically reviewed before execution, including new files and build/test execution paths. **Windows (native host):** AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER, driver 617.42 / 32.0.16.1742; Windows 11 Pro 10.0.26300. WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`, `ANYPS5_ENABLE_SPIRV_TOOLS=OFF`. Vulkan was required with `ANYPS5_REQUIRE_VULKAN=1`; `ANYPS5_GPU=NVIDIA GeForce RTX 4070 Ti SUPER` selected the device and its actual selection was verified in the verbose logs. `ANYPS5_NO_SHADER_CACHE=1` and `request.useCache=false` disabled the AnyPS5 shader cache. Driver caches were not controlled. Guest wave32. #### Before / after — Windows (native host) Same final `agc_driver_vopc_compare_f64` fixture, hardware, inputs, Release configuration and cache settings; one invocation per variant. The negative control restored the base's unmodified comparison source, then the fixed bytes were restored and checked. | Metric | Before (base) | After (fix) | | --- | --- | --- | | Failing regression runs | 1/1 | 0/1 | | Mode 0, IEEE off, round 0, lane 9, predicate 37 (expected 0) | 1 | 0 | This demonstrates the predicate correction; it is not a performance or title benchmark. - Full Windows application/library build passed with #6452's exact test-only alignment correction (`4fe92c9c23c7bd861d63664d4efde3033b6226f6`) temporarily applied. It was removed and is not in these commits. - Final related suite: 22/22 passed, 0 failures, 0 skips. Sixteen GPU processes selected the physical NVIDIA device; the remaining groups are CPU/compiler/library checks. - Conventions, whitespace and test-registration checks passed (903 test executables registered). Reproduction from the configured full build, with the environment above: ```sh cmake --build build-runtime --target all libs --parallel 4 ctest --test-dir build-runtime -V --parallel 2 -R '^(agc_driver_(vopc_compare.*|vop3_compare.*|vcmp.*|f64.*|f32_compare.*|f32_denormal_flush)|agc_(shader_mode_register|structurizer|shader_control_flow|constant_phi)|patched_libraries)$' ``` **Linux (VirtualBox):** Ubuntu 24.04.5 LTS, kernel 7.0.0-31-generic, GCC 13.3.0; VirtualBox 7.2.20 on the Windows host above, 8 vCPU / 8 GiB assigned. Release, `BUILD_TESTING=ON`, `ANYPS5_ENABLE_SPIRV_TOOLS=OFF`. Graphics: not exercised. - Final head and all three changed source files verified against Git blobs in the separate Linux checkout. - Full build, including the graphics components and f64 comparison fixture executable, passed. - `agc_structurizer`, `agc_shader_mode_register`, `agc_shader_control_flow` and `agc_constant_phi`: 4/4 passed, 0 failures, 0 skips. - Conventions and test registration passed (913 test executables registered). The existing Linux build retained its CMake cache paths through its compatibility directory: ```sh cmake --build ~/anyps5-rwlock-20261016/build --target all libs agc_driver_vopc_compare_f64_tests --parallel 2 ctest --test-dir ~/anyps5-rwlock-20261016/build --output-on-failure -R '^(agc_structurizer|agc_shader_mode_register|agc_shader_control_flow|agc_constant_phi)$' ``` Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox validation. Native/bare-metal Linux was not tested. Native Linux GPU validation: not tested. The full CTest suite was not run. No title was run, and no title fix, FPS improvement or new AMD/PS5 measurement is claimed. Hosted full builds require a collaborator's manual dispatch under the current CI policy. ### Checklist - [x] Based on current `main`; open PR implementations/tests and complete file lists of large PRs checked; no other open PR implements this f64 comparison change - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code added - [x] No new stubs or unimplemented paths - [x] No notes, investigation files or images added to the repository - [x] New third-party code: n/a - [x] Generic shader behavior, not specific to one title - [x] Depends on: #6452 for the complete Windows test build - [x] Unblocks: none established for a title - [x] GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, driver 617.42, Windows 11 Pro 10.0.26300 - [x] AI-assisted: yes, Codex; code and local test results checked in this task
github-actions[bot] commented 2026-10-16 14:40:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T14:40:02Z.


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 6280 docs/dev/debt/shader.md L25
PR 6604 docs/dev/debt/shader.md L25
PR 7085 docs/dev/debt/shader.md L25

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 5021 docs/dev/debt/shader.md
PR 5371 docs/dev/debt/shader.md
PR 5426 docs/dev/debt/shader.md
PR 5500 docs/dev/debt/shader.md
PR 5782 docs/dev/debt/shader.md
PR 5941 docs/dev/debt/shader.md
PR 6009 docs/dev/debt/shader.md
PR 6235 docs/dev/debt/shader.md
PR 6924 docs/dev/debt/shader.md
PR 6977 docs/dev/debt/shader.md
PR 7074 docs/dev/debt/shader.md
PR 7223 docs/dev/debt/shader.md
PR 7332 docs/dev/debt/shader.md
PR 7392 docs/dev/debt/shader.md
PR 7395 docs/dev/debt/shader.md
PR 7426 docs/dev/debt/shader.md
PR 7429 docs/dev/debt/shader.md
PR 7484 docs/dev/debt/shader.md
PR 7803 docs/dev/debt/shader.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6217906220 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6850#issuecomment-6217906220). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T14:40:02Z. --- <!-- pr-overlap --> 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 6280](https://www.github.com/boykopovar/AnyPS5/pull/6280) | `docs/dev/debt/shader.md` [L25](https://github.com/boykopovar/AnyPS5/blob/5c6c65232bf8f70e5ba5f74c6d41af84e73c4970/docs/dev/debt/shader.md#L25) | | | | [PR 6604](https://www.github.com/boykopovar/AnyPS5/pull/6604) | `docs/dev/debt/shader.md` [L25](https://github.com/boykopovar/AnyPS5/blob/5c6c65232bf8f70e5ba5f74c6d41af84e73c4970/docs/dev/debt/shader.md#L25) | | | | [PR 7085](https://www.github.com/boykopovar/AnyPS5/pull/7085) | `docs/dev/debt/shader.md` [L25](https://github.com/boykopovar/AnyPS5/blob/5c6c65232bf8f70e5ba5f74c6d41af84e73c4970/docs/dev/debt/shader.md#L25) | | | 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 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `docs/dev/debt/shader.md` | | [PR 5371](https://www.github.com/boykopovar/AnyPS5/pull/5371) | `docs/dev/debt/shader.md` | | [PR 5426](https://www.github.com/boykopovar/AnyPS5/pull/5426) | `docs/dev/debt/shader.md` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `docs/dev/debt/shader.md` | | [PR 5782](https://www.github.com/boykopovar/AnyPS5/pull/5782) | `docs/dev/debt/shader.md` | | [PR 5941](https://www.github.com/boykopovar/AnyPS5/pull/5941) | `docs/dev/debt/shader.md` | | [PR 6009](https://www.github.com/boykopovar/AnyPS5/pull/6009) | `docs/dev/debt/shader.md` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `docs/dev/debt/shader.md` | | [PR 6924](https://www.github.com/boykopovar/AnyPS5/pull/6924) | `docs/dev/debt/shader.md` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `docs/dev/debt/shader.md` | | [PR 7074](https://www.github.com/boykopovar/AnyPS5/pull/7074) | `docs/dev/debt/shader.md` | | [PR 7223](https://www.github.com/boykopovar/AnyPS5/pull/7223) | `docs/dev/debt/shader.md` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `docs/dev/debt/shader.md` | | [PR 7392](https://www.github.com/boykopovar/AnyPS5/pull/7392) | `docs/dev/debt/shader.md` | | [PR 7395](https://www.github.com/boykopovar/AnyPS5/pull/7395) | `docs/dev/debt/shader.md` | | [PR 7426](https://www.github.com/boykopovar/AnyPS5/pull/7426) | `docs/dev/debt/shader.md` | | [PR 7429](https://www.github.com/boykopovar/AnyPS5/pull/7429) | `docs/dev/debt/shader.md` | | [PR 7484](https://www.github.com/boykopovar/AnyPS5/pull/7484) | `docs/dev/debt/shader.md` | | [PR 7803](https://www.github.com/boykopovar/AnyPS5/pull/7803) | `docs/dev/debt/shader.md` |
jotitadev commented 2026-10-16 16:24:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T16:24:39Z.

Review: COMMENTED


Red/green on native Linux, which the description lists as not tested, on two more Vulkan drivers.

Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, plus lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same machine. Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. Head 23c9bd7e8 merged into main 452494439 (clean merge). Device checked in the Selected GPU log line (RTX 3070 subgroup 32, llvmpipe subgroup 8).

Tree RTX 3070 lavapipe
PR agc_driver_vopc_compare_f64 passes 3/3 passes 3/3
PR test, main's CompareInstructions.cpp fails 3/3: mode 0, IEEE off round 0 thread 9 compare 37 is 1, expected 0 fails 3/3, same message

The related set from the description (^(agc_driver_(vopc_compare.*|vop3_compare.*|vcmp.*|f64.*|f32_compare.*|f32_denormal_flush)|agc_(shader_mode_register|structurizer|shader_control_flow|constant_phi)|patched_libraries)$, -j1): 22/22 pass on the RTX 3070 and 22/22 on lavapipe, no skips.

Not run: Windows, AMD, the full suite.

GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04

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

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5550647773 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6850#pullrequestreview-5550647773). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-16T16:24:39Z. **Review:** COMMENTED --- Red/green on native Linux, which the description lists as not tested, on two more Vulkan drivers. **Machine:** NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, plus lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same machine. Ubuntu 26.04, i7-8700, GCC 15.2, Release, `BUILD_TESTING=ON`. Head `23c9bd7e8` merged into `main` `452494439` (clean merge). Device checked in the `Selected GPU` log line (RTX 3070 subgroup 32, llvmpipe subgroup 8). | Tree | RTX 3070 | lavapipe | |---|---|---| | PR | `agc_driver_vopc_compare_f64` passes 3/3 | passes 3/3 | | PR test, `main`'s `CompareInstructions.cpp` | fails 3/3: `mode 0, IEEE off round 0 thread 9 compare 37 is 1, expected 0` | fails 3/3, same message | The related set from the description (`^(agc_driver_(vopc_compare.*|vop3_compare.*|vcmp.*|f64.*|f32_compare.*|f32_denormal_flush)|agc_(shader_mode_register|structurizer|shader_control_flow|constant_phi)|patched_libraries)$`, `-j1`): 22/22 pass on the RTX 3070 and 22/22 on lavapipe, no skips. Not run: Windows, AMD, the full suite. GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04 Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
keravyn-ops commented 2026-10-17 08:55:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-17T08:55:49Z.


AMD / Windows run of this PR at 23c9bd7e8: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release.

  • agc_driver_vopc_compare_f64: pass (vopc f64 compare tests passed, 5.12 s)

AI-assisted: yes (run made on the device above).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232000667 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6850#issuecomment-6232000667). Originally posted by [keravyn-ops](https://github.com/keravyn-ops) on 2026-10-17T08:55:49Z. --- AMD / Windows run of this PR at 23c9bd7e8: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release. - `agc_driver_vopc_compare_f64`: pass (`vopc f64 compare tests passed`, 5.12 s) AI-assisted: yes (run made on the device above).
thuanquang commented 2026-10-19 07:43:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-19T07:43:07Z.


Native data for the matrix the debt entry says hasn't been measured: RX 6700 XT (gfx1031, RDNA 2), the instructions run directly through HIP, all four f16/f64 denormal modes, IEEE 0 and 1 (f32 denormals kept). Inputs are the 196 pairs of 14 f64 values: ±0, the smallest and largest denormals, a mid denormal, ±the smallest normal, ±1 and ±infinity. 132 pairs contain a denormal. For each mode I compared every result with the mode-3 (kept) result for the same pair after flushing each denormal input to its signed zero:

instruction modes 0 and 2 modes 1 and 3
v_cmp_eq_f64, v_cmp_neq_f64, v_cmp_lt_f64, v_cmp_le_f64, v_cmp_gt_f64 132 of 132 match the flushed inputs 132 of 132 match the kept inputs
v_cmp_class_f64 with the denormal mask (0x90) 132 of 132 match the kept inputs the same

The same in IEEE 0 and 1. So the compares flush their inputs to signed zero exactly when bit 0 of the field is clear, including the split modes, and the class compare sees the original bits in every mode, which is what this PR implements. Desktop RDNA 2, not gfx1013.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6262248272 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6850#issuecomment-6262248272). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-19T07:43:07Z. --- Native data for the matrix the debt entry says hasn't been measured: RX 6700 XT (gfx1031, RDNA 2), the instructions run directly through HIP, all four f16/f64 denormal modes, IEEE 0 and 1 (f32 denormals kept). Inputs are the 196 pairs of 14 f64 values: ±0, the smallest and largest denormals, a mid denormal, ±the smallest normal, ±1 and ±infinity. 132 pairs contain a denormal. For each mode I compared every result with the mode-3 (kept) result for the same pair after flushing each denormal input to its signed zero: | instruction | modes 0 and 2 | modes 1 and 3 | |---|---|---| | `v_cmp_eq_f64`, `v_cmp_neq_f64`, `v_cmp_lt_f64`, `v_cmp_le_f64`, `v_cmp_gt_f64` | 132 of 132 match the flushed inputs | 132 of 132 match the kept inputs | | `v_cmp_class_f64` with the denormal mask (`0x90`) | 132 of 132 match the kept inputs | the same | The same in IEEE 0 and 1. So the compares flush their inputs to signed zero exactly when bit 0 of the field is clear, including the split modes, and the class compare sees the original bits in every mode, which is what this PR implements. Desktop RDNA 2, not gfx1013.
adriadam10 commented 2026-10-19 12:08:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T12:08:54Z.


Checked the zero-exponent flush against the f16/f64 denormal field (bit 0 clear = modes 0 and 2), the class compare keeping the original bits, and the nine-mode test (the f32 field is set opposite to the f64 one, so it pins the right field). The test fails on main (mode 0 compare 37) and passes with the change, matching the RTX 3070/lavapipe, Radeon 780M and RX 6700 XT runs in this thread; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6266848466 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6850#issuecomment-6266848466). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T12:08:54Z. --- Checked the zero-exponent flush against the f16/f64 denormal field (bit 0 clear = modes 0 and 2), the class compare keeping the original bits, and the nine-mode test (the f32 field is set opposite to the f64 one, so it pins the right field). The test fails on `main` (mode 0 compare 37) and passes with the change, matching the RTX 3070/lavapipe, Radeon 780M and RX 6700 XT runs in this thread; merged.
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!6850
No description provided.