test(shader): execute every non-f64 VOPC compare against values measured on RDNA #539

Merged
adriadam10 merged 1 commit from upstream-pr/539 into main 2026-10-04 21:21:52 +00:00
adriadam10 commented 2026-10-04 16:12:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-04T16:12:54Z.


What

Execution test for the VOPC compares that no test runs today: all 156 non-f64 compare opcodes (f32, f16, i16/u16, i32/u32, i64/u64, class_f32/class_f16, v_cmp_* and v_cmpx_*). Each one runs in its VOPC (_e32) form and its VOP3 (_e64) form, so 312 compares in total. The VOP3 forms swap the operands and write to an SGPR pair instead of VCC. f64 compares are already covered by VopcCompareF64 and are left out.

The shader runs three times: as wave32, as native wave64, and as wave64 split into two halves (ComputeTarget(32)). Each lane turns its own bit of the compare mask into a result bit, so a wrong high half of VCC/EXEC shows up in wave64 lanes 32-63.

No translator change: every compare already matches the hardware. core/libs/tests/VectorCompareInt64F16.cpp (#310) is untouched.

Behaviour measured on HW

Expected values come from an RDNA2 GPU (gfx1035, wave32 and wave64), on 2048 random and edge rows per wave size. A Python model matches the hardware on every row:

  • 16-bit integer compares read only the low half of the source. The high half is garbage in the test rows.
  • f32/f16 relations follow IEEE: o/u and the n* forms are true when either input is NaN, lg is false, and -0 == +0.
  • class decides on the raw bits, with the mask bits 0 = sNaN, 1 = qNaN, 2 = -inf ... 9 = +inf. It reports denormals as denormals with f32/f16 denorm modes both 0 and 3. The test has edge rows for the max denormal, the min normal and sNaN vs qNaN, each with a single-class mask.
  • Denormal inputs are kept out of the relational f32/f16 rows (Vulkan lets drivers flush them). class gets them, because it works on the bits.

Tested

Linux, agc_driver_vopc_compare_table passes on RADV (Mesa 26.2), on local lavapipe, and on the lavapipe CI uses (Mesa 25.2.8). Full Release ctest: 183/184. agc_driver_pixel_helper_lanes fails on local RADV on main too.
Negative checks: each mutation below makes the test fail on RADV and lavapipe: i16 compare read as unsigned, u64 order read as signed, nlt_f32 made ordered, cmpx_ngt_f16 read as f32, class_f32 writing EXEC, t_i64 returning false, the f16 class denormal limit moved to 0x3ff, the f16 quiet bit moved to 0x100.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4735784133 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/539). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-04T16:12:54Z. --- ### What Execution test for the VOPC compares that no test runs today: all 156 non-f64 compare opcodes (f32, f16, i16/u16, i32/u32, i64/u64, `class_f32`/`class_f16`, `v_cmp_*` and `v_cmpx_*`). Each one runs in its VOPC (`_e32`) form and its VOP3 (`_e64`) form, so 312 compares in total. The VOP3 forms swap the operands and write to an SGPR pair instead of VCC. f64 compares are already covered by `VopcCompareF64` and are left out. The shader runs three times: as wave32, as native wave64, and as wave64 split into two halves (`ComputeTarget(32)`). Each lane turns its own bit of the compare mask into a result bit, so a wrong high half of VCC/EXEC shows up in wave64 lanes 32-63. No translator change: every compare already matches the hardware. `core/libs/tests/VectorCompareInt64F16.cpp` (#310) is untouched. #### Behaviour measured on HW Expected values come from an RDNA2 GPU (gfx1035, wave32 and wave64), on 2048 random and edge rows per wave size. A Python model matches the hardware on every row: - 16-bit integer compares read only the low half of the source. The high half is garbage in the test rows. - f32/f16 relations follow IEEE: `o`/`u` and the `n*` forms are true when either input is NaN, `lg` is false, and -0 == +0. - `class` decides on the raw bits, with the mask bits 0 = sNaN, 1 = qNaN, 2 = -inf ... 9 = +inf. It reports denormals as denormals with f32/f16 denorm modes both 0 and 3. The test has edge rows for the max denormal, the min normal and sNaN vs qNaN, each with a single-class mask. - Denormal inputs are kept out of the relational f32/f16 rows (Vulkan lets drivers flush them). `class` gets them, because it works on the bits. ### Tested Linux, `agc_driver_vopc_compare_table` passes on RADV (Mesa 26.2), on local lavapipe, and on the lavapipe CI uses (Mesa 25.2.8). Full Release ctest: 183/184. `agc_driver_pixel_helper_lanes` fails on local RADV on `main` too. Negative checks: each mutation below makes the test fail on RADV and lavapipe: i16 compare read as unsigned, u64 order read as signed, `nlt_f32` made ordered, `cmpx_ngt_f16` read as f32, `class_f32` writing EXEC, `t_i64` returning false, the f16 class denormal limit moved to 0x3ff, the f16 quiet bit moved to 0x100. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
oneandonlydean commented 2026-10-04 21:19:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T21:19:18Z.


Thanks. I disassembled both shaders with llvm-mc for gfx1013: 312 compares, 156 distinct opcodes, which is the whole non-f64 VOPC set (f32, f16, i16/u16, i32/u32, i64/u64 and the four class forms, each as v_cmp and v_cmpx), with no decode errors. The three runs (wave32, native wave64, wave64 split) also check the high half of VCC and EXEC, which is a good addition. The relational rows avoid denormals and class works on the bits, so nothing depends on the driver. It passes on my NVIDIA machine. Test only, ready to merge from my side.

If agc_driver_vopc_compare_table ever goes red on CI only on f16 rows, it is probably the same llvmpipe f16 compare issue agc_driver_vopc_compare had, not this test.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5984494566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/539#issuecomment-5984494566). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T21:19:18Z. --- Thanks. I disassembled both shaders with llvm-mc for gfx1013: 312 compares, 156 distinct opcodes, which is the whole non-f64 VOPC set (f32, f16, i16/u16, i32/u32, i64/u64 and the four class forms, each as v_cmp and v_cmpx), with no decode errors. The three runs (wave32, native wave64, wave64 split) also check the high half of VCC and EXEC, which is a good addition. The relational rows avoid denormals and class works on the bits, so nothing depends on the driver. It passes on my NVIDIA machine. Test only, ready to merge from my side. If `agc_driver_vopc_compare_table` ever goes red on CI only on f16 rows, it is probably the same llvmpipe f16 compare issue `agc_driver_vopc_compare` had, not this test.
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!539
No description provided.