test(agc): leave out v_cvt_f32_f64 sources below 2^-126 without DenormPreserve 32 #26142

Merged
root-over merged 5 commits from upstream-pr/26142 into main 2026-11-27 18:43:35 +00:00
root-over commented 2026-11-23 10:21:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by root-over on 2026-11-23T10:21:22Z.


What

agc_driver_cvt_f32_f64_denormal_result fails on main on RADV Renoir (AMD Radeon Graphics, gfx90c, Mesa 26.0.8):

AGC graphics: v_cvt_f32_f64 denormal result: emulated flush FLOAT_MODE 0x000000e0 IEEE=0 lane 7 v_cvt_f32_f64 v10, v[4:5] of 0x380fffffe0000000 is 0x00000000, expected 0x00800000

The driver reports shaderDenormPreserveFloat32. The device's startup probe still leaves it undeclared: [float-controls] f32 denormal preserve: not requested (20 of 256 probe results on normal values differ from the default mode by more than the Vulkan precision bounds). As a result float32DenormPreserve is false, and the test leaves out values whose expected result is an f32 denormal. Without the mode, the driver also flushes an f64 source below 2^-126 before rounding, so a source that RDNA2 rounds up to 0x00800000 comes back as a zero of its sign.

  • When float32DenormPreserve is false, the test now also leaves out a source below 2^-126 if its expected result is not a zero. Results whose expected value is a flushed zero, which the translation selects from the source bits since d94daee70c, are still checked on such devices.
  • The skip line names both reasons.
  • A shader debt fragment records the gap: on such a device the conversion of a source below 2^-126 depends on the driver.

I instrumented the check locally and it leaves out 424 more values. 300 of them match anyway. The other 124 are all signed zeros where the table expects ±0x00800000, or 0x01000000 / 0x01800000 with mul:2 / mul:4. They come from 0x380fffffe0000000, 0x380fffffe8000000 and their negatives at FLOAT_MODE 0xe0, 0xf0, 0xd1 and 0xd2. Devices that declare DenormPreserve 32 (all three in the #21508 cross-check) skip nothing and check the full table as before.

Tested

Ubuntu 26.04, GCC 15.2.0, Release, main 3492c18f81. GPU: AMD Radeon Graphics (RADV RENOIR, gfx90c), Mesa 26.0.8, Linux. Full ctest -j4 on main: 6669 of 6670 pass, and this is the only failure.

With ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer and validation layer 1.4.341, ctest --test-dir build -R '^agc_driver_cvt_f32_f64_denormal_result$' -V:

main this branch
Result fails (message above) passes 3 of 3 runs
Insert instance layer "VK_LAYER_KHRONOS_validation" 1 1 per run
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- 0 0

python3 tools/check_conventions.py --base origin/main and python3 tools/debt_fold.py --check pass. pr_overlap.py --branch reports no overlap. #21508 changes another row of the same test's tables and merges cleanly with this branch.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon Graphics (RADV RENOIR, gfx90c), Mesa 26.0.8, Ubuntu 26.04 Linux
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5451223472 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26142). Originally posted by [root-over](https://github.com/root-over) on 2026-11-23T10:21:22Z. --- ### What `agc_driver_cvt_f32_f64_denormal_result` fails on `main` on RADV Renoir (AMD Radeon Graphics, gfx90c, Mesa 26.0.8): ``` AGC graphics: v_cvt_f32_f64 denormal result: emulated flush FLOAT_MODE 0x000000e0 IEEE=0 lane 7 v_cvt_f32_f64 v10, v[4:5] of 0x380fffffe0000000 is 0x00000000, expected 0x00800000 ``` The driver reports `shaderDenormPreserveFloat32`. The device's startup probe still leaves it undeclared: `[float-controls] f32 denormal preserve: not requested (20 of 256 probe results on normal values differ from the default mode by more than the Vulkan precision bounds)`. As a result `float32DenormPreserve` is false, and the test leaves out values whose expected result is an f32 denormal. Without the mode, the driver also flushes an f64 source below 2^-126 before rounding, so a source that RDNA2 rounds up to `0x00800000` comes back as a zero of its sign. - When `float32DenormPreserve` is false, the test now also leaves out a source below 2^-126 if its expected result is not a zero. Results whose expected value is a flushed zero, which the translation selects from the source bits since d94daee70c, are still checked on such devices. - The skip line names both reasons. - A shader debt fragment records the gap: on such a device the conversion of a source below 2^-126 depends on the driver. I instrumented the check locally and it leaves out 424 more values. 300 of them match anyway. The other 124 are all signed zeros where the table expects `±0x00800000`, or `0x01000000` / `0x01800000` with `mul:2` / `mul:4`. They come from `0x380fffffe0000000`, `0x380fffffe8000000` and their negatives at `FLOAT_MODE` 0xe0, 0xf0, 0xd1 and 0xd2. Devices that declare `DenormPreserve 32` (all three in the #21508 cross-check) skip nothing and check the full table as before. ### Tested Ubuntu 26.04, GCC 15.2.0, Release, `main` `3492c18f81`. GPU: AMD Radeon Graphics (RADV RENOIR, gfx90c), Mesa 26.0.8, Linux. Full `ctest -j4` on `main`: 6669 of 6670 pass, and this is the only failure. With `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer` and validation layer 1.4.341, `ctest --test-dir build -R '^agc_driver_cvt_f32_f64_denormal_result$' -V`: | | `main` | this branch | |---|---|---| | Result | fails (message above) | passes 3 of 3 runs | | `Insert instance layer "VK_LAYER_KHRONOS_validation"` | 1 | 1 per run | | `was not found but was requested by env var VK_INSTANCE_LAYERS` | 0 | 0 | | `VUID-` | 0 | 0 | `python3 tools/check_conventions.py --base origin/main` and `python3 tools/debt_fold.py --check` pass. `pr_overlap.py --branch` reports no overlap. #21508 changes another row of the same test's tables and merges cleanly with this branch. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon Graphics (RADV RENOIR, gfx90c), Mesa 26.0.8, Ubuntu 26.04 Linux - [x] AI-assisted: yes
MarcZX10 commented 2026-11-23 10:24:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T10:24:36Z.

Review: APPROVED


Reviewed — looks good

The full changed source and debt fragment at head 2f2441e2d277c753dff8dfd28d857acd372e883f support the test’s expanded skip condition; no blocking defect was identified. Nothing blocks this; the points below are optional.

What I ran

  • Read the prepared diff, description, commits, manifest, review folder README, and both changed files at the pinned head.
  • No commands or tests were run; the test and convention results in the description are author-reported.

Results

Check Result Note
Changed-file review passed Both changed files read
Tests and prechecks not run Results are author-reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

Runtime behavior, build, tests, and prechecks were not independently verified. Repository files read: core/libs/prx/libSceAgcDriver/tests/execution/CvtF32F64DenormalResult.cpp and docs/dev/debt/changes/test-agc-cvt-f32-f64-tiny-source-without-denorm-preserve.md. Both files listed as reviewed in the manifest were read; no files were excluded.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6019917834 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26142#pullrequestreview-6019917834). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T10:24:36Z. **Review:** APPROVED --- # Reviewed — looks good The full changed source and debt fragment at head `2f2441e2d277c753dff8dfd28d857acd372e883f` support the test’s expanded skip condition; no blocking defect was identified. Nothing blocks this; the points below are optional. ## What I ran - Read the prepared diff, description, commits, manifest, review folder README, and both changed files at the pinned head. - No commands or tests were run; the test and convention results in the description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Changed-file review | passed | Both changed files read | | Tests and prechecks | not run | Results are author-reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Runtime behavior, build, tests, and prechecks were not independently verified. Repository files read: `core/libs/prx/libSceAgcDriver/tests/execution/CvtF32F64DenormalResult.cpp` and `docs/dev/debt/changes/test-agc-cvt-f32-f64-tiny-source-without-denorm-preserve.md`. Both files listed as reviewed in the manifest were read; no files were excluded. ## To get this to a good state Nothing is required.
mihiii1337 commented 2026-11-23 10:41:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T10:41:25Z.

Review: CHANGES_REQUESTED


The tiny-source exception is broader than the measured native-Float64 driver case. On a Vulkan device without Float64, this shader is supported through state.integerFloat64: ConvertF32F64 is computed by the integer ToF32 helper and its packed u32 is only bitcast to f32. A normal result such as 0x00800000 therefore does not depend on the driver's f64 denormal handling and should remain checked.

I rebuilt and ran an extracted exact-Check predicate at this head. For mode 0xe0, lane 7, plain conversion of 0x380fffffe0000000, replacing the correct 0x00800000 with 0xdeadbeef is rejected by the prior condition but accepted by this head's new skip. The rational oracle counted 424 newly skipped cells, including 168 RNE plain/neg/abs cells; ten signed integer-backend mirrors matched the exact expected bits. Please restrict the tiny-f64-source exception to the native Float64 conversion path (the existing expected-f32-denormal exception can remain device-wide), and add a no-Float64/integer-backend negative control.

Production path checked: SpirvModuleSetup.cpp selects integer Float64 when the device lacks the capability, SpirvAluEmitterFloat64.cpp::ToF32 rounds/packs in integer operations, and EmitConvertF32F64 bitcasts those bits. Vulkan defines OpBitcast as bit-preserving: https://docs.vulkan.org/spec/latest/appendices/spirvenv.html#spirvenv-precision

I did not run a GPU test; the author's Renoir A/B remains the evidence for the native path. A separate pre-existing hardware-FTZ edge seen by the CPU oracle is not part of this change request. Conventions, debt-fold and merge checks were independently clean.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6020178668 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26142#pullrequestreview-6020178668). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T10:41:25Z. **Review:** CHANGES_REQUESTED --- The tiny-source exception is broader than the measured native-Float64 driver case. On a Vulkan device without `Float64`, this shader is supported through `state.integerFloat64`: `ConvertF32F64` is computed by the integer `ToF32` helper and its packed `u32` is only bitcast to `f32`. A normal result such as `0x00800000` therefore does not depend on the driver's f64 denormal handling and should remain checked. I rebuilt and ran an extracted exact-`Check` predicate at this head. For mode `0xe0`, lane 7, plain conversion of `0x380fffffe0000000`, replacing the correct `0x00800000` with `0xdeadbeef` is rejected by the prior condition but accepted by this head's new skip. The rational oracle counted 424 newly skipped cells, including 168 RNE plain/neg/abs cells; ten signed integer-backend mirrors matched the exact expected bits. Please restrict the tiny-f64-source exception to the native Float64 conversion path (the existing expected-f32-denormal exception can remain device-wide), and add a no-Float64/integer-backend negative control. Production path checked: `SpirvModuleSetup.cpp` selects integer Float64 when the device lacks the capability, `SpirvAluEmitterFloat64.cpp::ToF32` rounds/packs in integer operations, and `EmitConvertF32F64` bitcasts those bits. Vulkan defines `OpBitcast` as bit-preserving: https://docs.vulkan.org/spec/latest/appendices/spirvenv.html#spirvenv-precision I did not run a GPU test; the author's Renoir A/B remains the evidence for the native path. A separate pre-existing hardware-FTZ edge seen by the CPU oracle is not part of this change request. Conventions, debt-fold and merge checks were independently clean. AI-assisted: yes.
mihiii1337 commented 2026-11-24 13:20:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T13:20:52Z.

Review: APPROVED


Rechecked exact head 692ad857b47b3a84a6fd3a58425ae897df3c5c40. The integer-Float64 gap from my previous review is fixed.

The tiny-source exception is now passed separately and is enabled only for native Float64 when the device does not preserve f32 denormals. Each flush-mode case also runs through a separately recompiled integer backend with Float64 removed from the target, so tiny sources remain checked there. The capability vector outlives that recompilation, and the regression makes the integer path fail if the old broad skip returns.

Contributor-reported hardware checks cover the exact head: R9700 ran all four passes, confirmed the skip only on the native backend, and made the integer 0xdeadbeef mutation fail; RTX 4070 ran 4/4 with the validation layer and no VUIDs. The hosted Windows selection does not execute this focused test, so I am not treating its green job as hardware evidence. No GPU test was run on my machine for this review.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6039916879 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26142#pullrequestreview-6039916879). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-24T13:20:52Z. **Review:** APPROVED --- Rechecked exact head `692ad857b47b3a84a6fd3a58425ae897df3c5c40`. The integer-Float64 gap from my previous review is fixed. The tiny-source exception is now passed separately and is enabled only for native Float64 when the device does not preserve f32 denormals. Each flush-mode case also runs through a separately recompiled integer backend with `Float64` removed from the target, so tiny sources remain checked there. The capability vector outlives that recompilation, and the regression makes the integer path fail if the old broad skip returns. Contributor-reported hardware checks cover the exact head: R9700 ran all four passes, confirmed the skip only on the native backend, and made the integer `0xdeadbeef` mutation fail; RTX 4070 ran 4/4 with the validation layer and no VUIDs. The hosted Windows selection does not execute this focused test, so I am not treating its green job as hardware evidence. No GPU test was run on my machine for this review. AI-assisted: yes.
MarcZX10 commented 2026-11-24 23:36:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-24T23:36:16Z.

Review: COMMENTED


Reviewed — no blocking findings

The reviewed change is consistent with the stated goal, but project checks were not run in this review, so a formal approval is not justified.

What I ran

Reviewed head 692ad857b47b3a84a6fd3a58425ae897df3c5c40 against base main. No commands or project checks were run; the available interface provides read-only review tools. The author reports the targeted Vulkan test passed three runs and the convention and debt checks passed.

Read every changed line in core/libs/prx/libSceAgcDriver/tests/execution/CvtF32F64DenormalResult.cpp and docs/dev/debt/changes/test-agc-cvt-f32-f64-tiny-source-without-denorm-preserve.md. Also read the test’s Vulkan capability helper and the integer f64-to-f32 conversion helper. No changed files were excluded.

Results

Check Result Note
Source review passed Changed lines and targeted helpers reviewed
Project tests not run Author reports three targeted passes
Conventions and debt checks not run Author reports both passed

Negative control

Not run; no test execution environment was available to alter the code under test and confirm failure.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

The author-reported test and static check results were not independently verified. GPU behavior on the reported RADV Renoir setup and other devices was not tested in this review.

To get this to a good state

Nothing is required. Optional: run the targeted test and the reported checks on this head in CI or a configured development environment.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6049145414 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26142#pullrequestreview-6049145414). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-24T23:36:16Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The reviewed change is consistent with the stated goal, but project checks were not run in this review, so a formal approval is not justified. ## What I ran Reviewed head `692ad857b47b3a84a6fd3a58425ae897df3c5c40` against base `main`. No commands or project checks were run; the available interface provides read-only review tools. The author reports the targeted Vulkan test passed three runs and the convention and debt checks passed. Read every changed line in `core/libs/prx/libSceAgcDriver/tests/execution/CvtF32F64DenormalResult.cpp` and `docs/dev/debt/changes/test-agc-cvt-f32-f64-tiny-source-without-denorm-preserve.md`. Also read the test’s Vulkan capability helper and the integer f64-to-f32 conversion helper. No changed files were excluded. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Changed lines and targeted helpers reviewed | | Project tests | not run | Author reports three targeted passes | | Conventions and debt checks | not run | Author reports both passed | ## Negative control Not run; no test execution environment was available to alter the code under test and confirm failure. ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [Test changes at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/692ad857b47b3a84a6fd3a58425ae897df3c5c40/core/libs/prx/libSceAgcDriver/tests/execution/CvtF32F64DenormalResult.cpp#L509-L589) - [Integer f64-to-f32 conversion helper at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/692ad857b47b3a84a6fd3a58425ae897df3c5c40/core/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterFloat64.cpp#L710-L732) - [Debt fragment at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/692ad857b47b3a84a6fd3a58425ae897df3c5c40/docs/dev/debt/changes/test-agc-cvt-f32-f64-tiny-source-without-denorm-preserve.md#L1-L5) ## Not verified The author-reported test and static check results were not independently verified. GPU behavior on the reported RADV Renoir setup and other devices was not tested in this review. ## To get this to a good state Nothing is required. Optional: run the targeted test and the reported checks on this head in CI or a configured development environment.
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!26142
No description provided.