Mesa ANV: v_cmp_*_f16 treats f16 subnormals as zero (agc_driver_vopc_compare) #2861

Closed
opened 2026-10-10 16:48:32 +00:00 by ThatsLeo · 2 comments
ThatsLeo commented 2026-10-10 16:48:32 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-10T16:48:32Z.


agc_driver_vopc_compare fails on Intel Arc (Meteor Lake, Mesa 26.2.3 ANV), as reported for other Intel GPUs in #2114:

vopc compares: thread 0 compare 36 is 0, expected 1

Every failing compare has an f16 subnormal operand (0x0001): -0 < 0x0001 and 0 < 0x0001 come out false. EmitF16BitsToF32 widens halves with UnpackHalf2x16, which may flush subnormals, and ANV does.

Fix: ThatsLeo/AnyPS5:fix/shader-f16-subnormal-widen (one commit, e59865e0, on main 57f96fd2). A subnormal half is converted as its fraction times 2^-24 with its sign, which is exact in f32; other halves still go through UnpackHalf2x16. All callers of EmitF16BitsToF32 get the exact conversion.

Tested: Fedora 44, GCC 16.2.1, Release. agc_driver_vopc_compare passes on Intel Arc and lavapipe. Full ctest on main (57f96fd2), on this branch and with all eight fixes listed in #2803-#2807 and here, on Intel Arc and lavapipe: no new failure. With all of them and #1250, all 698 tests pass on Intel Arc and on lavapipe. Dreaming Sarah (PPSA02929) runs with no visual difference.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5793289351 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2861). Originally posted by [ThatsLeo](https://github.com/ThatsLeo) on 2026-10-10T16:48:32Z. --- `agc_driver_vopc_compare` fails on Intel Arc (Meteor Lake, Mesa 26.2.3 ANV), as reported for other Intel GPUs in #2114: ``` vopc compares: thread 0 compare 36 is 0, expected 1 ``` Every failing compare has an f16 subnormal operand (`0x0001`): `-0 < 0x0001` and `0 < 0x0001` come out false. `EmitF16BitsToF32` widens halves with `UnpackHalf2x16`, which may flush subnormals, and ANV does. **Fix:** [`ThatsLeo/AnyPS5:fix/shader-f16-subnormal-widen`](https://github.com/ThatsLeo/AnyPS5/tree/fix/shader-f16-subnormal-widen) (one commit, `e59865e0`, on `main` `57f96fd2`). A subnormal half is converted as its fraction times 2^-24 with its sign, which is exact in f32; other halves still go through `UnpackHalf2x16`. All callers of `EmitF16BitsToF32` get the exact conversion. **Tested:** Fedora 44, GCC 16.2.1, Release. `agc_driver_vopc_compare` passes on Intel Arc and lavapipe. Full `ctest` on `main` (`57f96fd2`), on this branch and with all eight fixes listed in #2803-#2807 and here, on Intel Arc and lavapipe: no new failure. With all of them and #1250, all 698 tests pass on Intel Arc and on lavapipe. Dreaming Sarah (PPSA02929) runs with no visual difference. AI-assisted: yes.
Silverash-i8 commented 2026-10-10 17:29:51 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T17:29:51Z.


Tested this on the Windows Intel driver too, since it's the same failure I reported in #2822 for Arrow Lake.

Windows 11, WinLibs GCC 15.2.0 r7, Release, Intel Graphics in a Core Ultra 9 275HX (Arrow Lake, driver 32.0.101.8991), ANYPS5_GPU=Intel. On main 57f96fd2 I stacked e59865e0 (this) and 7df6c709 (#2860) with the other Intel fixes (#2777's 758eeb9f, #2815's 377829ec, the LDS lock change from #2805, #1250 for vop1_float_unary), plus the fp16_overflow skip from my 7217a416:

  • agc_driver_vopc_compare passes.
  • Full ctest -j6: 2 failures out of 709 (46 skipped on this device). One was agc_driver_gated_dispatch_capture, the timing flake from #2832, which passes on its own. The other was patched_libraries, which passes on a re-run and doesn't touch shaders.

So both fixes work on Arrow Lake. The difference is that #2822 adds DenormPreserve 16 to UnpackHalf2x16 and only applies where the device has Float16, RoundingModeRTE and DenormPreserve, while this one converts subnormals exactly everywhere, at the cost of a few extra instructions per widen. Since this one doesn't depend on device support, I'd be happy for it to be the one that goes in, and I'll close #2822 if the maintainers agree.

AI-assisted (Claude Code); I ran everything above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100264810 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2861#issuecomment-6100264810). Originally posted by [Silverash-i8](https://github.com/Silverash-i8) on 2026-10-10T17:29:51Z. --- Tested this on the Windows Intel driver too, since it's the same failure I reported in #2822 for Arrow Lake. Windows 11, WinLibs GCC 15.2.0 r7, Release, Intel Graphics in a Core Ultra 9 275HX (Arrow Lake, driver 32.0.101.8991), `ANYPS5_GPU=Intel`. On `main` `57f96fd2` I stacked `e59865e0` (this) and `7df6c709` (#2860) with the other Intel fixes (#2777's `758eeb9f`, #2815's `377829ec`, the LDS lock change from #2805, #1250 for `vop1_float_unary`), plus the `fp16_overflow` skip from my `7217a416`: - `agc_driver_vopc_compare` passes. - Full `ctest -j6`: 2 failures out of 709 (46 skipped on this device). One was `agc_driver_gated_dispatch_capture`, the timing flake from #2832, which passes on its own. The other was `patched_libraries`, which passes on a re-run and doesn't touch shaders. So both fixes work on Arrow Lake. The difference is that #2822 adds `DenormPreserve 16` to `UnpackHalf2x16` and only applies where the device has Float16, RoundingModeRTE and DenormPreserve, while this one converts subnormals exactly everywhere, at the cost of a few extra instructions per widen. Since this one doesn't depend on device support, I'd be happy for it to be the one that goes in, and I'll close #2822 if the maintainers agree. AI-assisted (Claude Code); I ran everything above on my machine.
oneandonlydean commented 2026-10-10 18:08:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T18:08:44Z.


Closing as a duplicate of #2822. Your exact widening (e59865e0) and test results would be useful there; #1463 (open) takes the same integer-decode route.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100608129 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2861#issuecomment-6100608129). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T18:08:44Z. --- Closing as a duplicate of #2822. Your exact widening (`e59865e0`) and test results would be useful there; #1463 (open) takes the same integer-decode route.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#2861
No description provided.