fix(shader): refuse DPP16 on opcodes with no DPP form #522

Merged
adriadam10 merged 2 commits from upstream-pr/522 into main 2026-10-05 02:50:29 +00:00
adriadam10 commented 2026-10-04 14:38:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-04T14:38:01Z.


What

The VOP1/VOP2 DPP16 decoder (src0 = 0xfa) accepted every opcode, including the ones that have no DPP form, and then applied a lane permute that the hardware doesn't define for them (64-bit operands, scalar destination, literal operand, register swaps). They now throw DPP modifier is not supported for opcode, the same way VOPC already refuses DPP for opcodes without supportsDpp.

The opcodes come from a sweep of every VOP1 (0x00-0x7f) and VOP2 (0x00-0x3d) opcode with a DPP16 word, decoded with llvm-mc --disassemble -mcpu=gfx1013 (same result on gfx1011, gfx1012, gfx1030): the decoder accepted 23 encodings that LLVM rejects as DPP:

  • VOP1: v_readfirstlane_b32, v_cvt_{i32,u32,f32}_f64, v_cvt_f64_{i32,u32,f32}, v_trunc/ceil/rndne/floor/fract_f64, v_frexp_exp_i32_f64, v_frexp_mant_f64, v_swap_b32, v_swaprel_b32.
  • VOP2: v_mac_legacy_f32, v_madmk_f32, v_madak_f32, v_fmamk_f32, v_fmaak_f32 (both decode to VMadmkF32/VMadakF32), v_fmamk_f16, v_fmaak_f16.

This is the same set #513 refuses for DPP8, so the list is now one predicate (hasDppForm) shared by both; acceptsDpp8 keeps on top of it the four opcodes that have a DPP16 form but no DPP8 path yet (v_pk_fmac_f16, v_movrels*).

Left out: v_nop/v_pipeflush/v_clrexcp (no operands, nothing to permute).

Tested

Linux, RADV and lavapipe. New agc_driver_dpp_no_form_tests (tests/execution/DppNoForm.cpp, compile only, so it also runs on lavapipe): each of the 23 encodings is refused with DPP16, DPP8 and DPP8 fi:1, and v_mov_b32/v_add_nc_u32 with DPP16 still compile.

Fails without the fix, each piece reverted separately: VOP1 DPP16 ignoring the list (v_readfirstlane_b32 with DPP16), VOP2 DPP16 ignoring it (v_mac_legacy_f32 with DPP16), DPP8 no longer using the shared list (v_readfirstlane_b32 with DPP8), and refusing every opcode fails the accepted cases.

Full Release build + ctest: everything passes except agc_driver_pixel_helper_lanes, which also fails on main with local RADV.

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: #513 (stacked on it; the first commit is #513's)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4735145152 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/522). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-04T14:38:01Z. --- ### What The VOP1/VOP2 DPP16 decoder (`src0 = 0xfa`) accepted every opcode, including the ones that have no DPP form, and then applied a lane permute that the hardware doesn't define for them (64-bit operands, scalar destination, literal operand, register swaps). They now throw `DPP modifier is not supported for opcode`, the same way VOPC already refuses DPP for opcodes without `supportsDpp`. The opcodes come from a sweep of every VOP1 (0x00-0x7f) and VOP2 (0x00-0x3d) opcode with a DPP16 word, decoded with `llvm-mc --disassemble -mcpu=gfx1013` (same result on gfx1011, gfx1012, gfx1030): the decoder accepted 23 encodings that LLVM rejects as DPP: - VOP1: `v_readfirstlane_b32`, `v_cvt_{i32,u32,f32}_f64`, `v_cvt_f64_{i32,u32,f32}`, `v_trunc/ceil/rndne/floor/fract_f64`, `v_frexp_exp_i32_f64`, `v_frexp_mant_f64`, `v_swap_b32`, `v_swaprel_b32`. - VOP2: `v_mac_legacy_f32`, `v_madmk_f32`, `v_madak_f32`, `v_fmamk_f32`, `v_fmaak_f32` (both decode to `VMadmkF32`/`VMadakF32`), `v_fmamk_f16`, `v_fmaak_f16`. This is the same set #513 refuses for DPP8, so the list is now one predicate (`hasDppForm`) shared by both; `acceptsDpp8` keeps on top of it the four opcodes that have a DPP16 form but no DPP8 path yet (`v_pk_fmac_f16`, `v_movrels*`). Left out: `v_nop`/`v_pipeflush`/`v_clrexcp` (no operands, nothing to permute). ### Tested Linux, RADV and lavapipe. New `agc_driver_dpp_no_form_tests` (`tests/execution/DppNoForm.cpp`, compile only, so it also runs on lavapipe): each of the 23 encodings is refused with DPP16, DPP8 and DPP8 `fi:1`, and `v_mov_b32`/`v_add_nc_u32` with DPP16 still compile. Fails without the fix, each piece reverted separately: VOP1 DPP16 ignoring the list (`v_readfirstlane_b32 with DPP16`), VOP2 DPP16 ignoring it (`v_mac_legacy_f32 with DPP16`), DPP8 no longer using the shared list (`v_readfirstlane_b32 with DPP8`), and refusing every opcode fails the accepted cases. Full Release build + ctest: everything passes except `agc_driver_pixel_helper_lanes`, which also fails on `main` with local RADV. ### 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: #513 (stacked on it; the first commit is #513's) - [x] AI-assisted: yes
oneandonlydean commented 2026-10-04 21:08:12 +00:00 (Migrated from github.com)

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


Thanks. I swept every VOP1 and VOP2 opcode with a DPP16 word through llvm-mc --disassemble -mcpu=gfx1013 and got the same 23 encodings, plus v_rcp_f64, v_rsq_f64 and v_sqrt_f64, which main doesn't decode yet, so they already throw.

One thing to keep in mind: #447 (and #474) add those three to the VOP1 decoder, and since hasDppForm defaults to true they would accept DPP16 again once both are in, permuting only the low dword of the 64-bit source. Whichever of the two lands second should add VRcpF64, VRsqF64 and VSqrtF64 to the list.

It goes in after #513, and I'll run it through my PPSA21564 check with the rest of the shader batch. Ready to merge from my side.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5984397733 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/522#issuecomment-5984397733). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T21:08:12Z. --- Thanks. I swept every VOP1 and VOP2 opcode with a DPP16 word through `llvm-mc --disassemble -mcpu=gfx1013` and got the same 23 encodings, plus `v_rcp_f64`, `v_rsq_f64` and `v_sqrt_f64`, which main doesn't decode yet, so they already throw. One thing to keep in mind: #447 (and #474) add those three to the VOP1 decoder, and since `hasDppForm` defaults to true they would accept DPP16 again once both are in, permuting only the low dword of the 64-bit source. Whichever of the two lands second should add `VRcpF64`, `VRsqF64` and `VSqrtF64` to the list. It goes in after #513, and I'll run it through my PPSA21564 check with the rest of the shader batch. Ready to merge from my side.
adriadam10 commented 2026-10-05 01:33:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-05T01:33:27Z.


Rebased on current main, carrying #513's rebased head (after #587). This commit applied unchanged; agc_driver_dpp_no_form_tests and the full ctest pass on RADV and lavapipe (only the known agc_driver_pixel_helper_lanes on RADV).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5986604517 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/522#issuecomment-5986604517). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-05T01:33:27Z. --- Rebased on current main, carrying #513's rebased head (after #587). This commit applied unchanged; `agc_driver_dpp_no_form_tests` and the full ctest pass on RADV and lavapipe (only the known `agc_driver_pixel_helper_lanes` on RADV).
oneandonlydean commented 2026-10-05 02:47:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T02:47:11Z.


Thanks, this carries #513's rebased head and your commit applied unchanged (same patch as the one I reviewed). agc_driver_dpp_no_form passes here on the merged branch. Every DPP16 instruction PPSA21564 uses (v_mov_b32, v_sub_f32, v_or_b32, v_max_f32, v_min_f32, v_add_f32, v_subrev_f32, v_add_nc_u32) has a DPP form, so nothing it runs is refused. Ready to merge from my side after #513.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5987228301 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/522#issuecomment-5987228301). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T02:47:11Z. --- Thanks, this carries #513's rebased head and your commit applied unchanged (same patch as the one I reviewed). `agc_driver_dpp_no_form` passes here on the merged branch. Every DPP16 instruction PPSA21564 uses (`v_mov_b32`, `v_sub_f32`, `v_or_b32`, `v_max_f32`, `v_min_f32`, `v_add_f32`, `v_subrev_f32`, `v_add_nc_u32`) has a DPP form, so nothing it runs is refused. Ready to merge from my side after #513.
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!522
No description provided.