feat(shader): implement the DPP16 row_share controls #660

Merged
Celegans12 merged 1 commit from upstream-pr/660 into main 2026-10-05 18:53:23 +00:00
Celegans12 commented 2026-10-05 12:05:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-05T12:05:21Z.


What

EmitDppTargetLane threw SPIR-V module emission failed: DPP control 336 is not supported for the DPP16 row_share controls (0x150-0x15F), so shaders that use them could not be recompiled.

  • row_share:sel now reads lane (lane & ~15) | sel, lane sel of the reading lane's own row. The source never leaves the row, so the target is always valid; an inactive source then follows the fi/bound_ctrl rule from #515, as row_xmask already did.
  • Source: the DPP_CTRL table of AMD's RDNA2 ISA (DPP_ROW_SHARE 0x150-0x15F, DPP_ROW_XMASK 0x160-0x16F); LLVM's AMDGPU DppCtrl enum has the same ranges.
  • Still thrown: the DPP16 controls RDNA2 leaves unused (0x100, 0x110, 0x120, 0x130-0x13F, 0x142-0x14F, 0x170-0x1FF), which include GFX9's wave shifts and row broadcasts.
  • PPSA26344 v1.008: the wave64 compute shader at 0x80003dc800 uses v_mov_b32 with row_share 0, 12 and 8 and v_max_f32 with row_share:4, all with bound_ctrl:1.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main 53dc19cf: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 285/285 tests pass (ctest --output-on-failure)
  • New agc_driver_dpp16_row_share_xmask: v_mov_b32, v_add_nc_u32, v_sub_nc_u32 and v_max_f32 with row_share and row_xmask (untested until now) under partial exec, fi, bound_ctrl and row/bank masks, as wave32 and wave64. Expected values come from an ISA model with #515's write rule; a wrong lane map fails it. On main it fails at the first recompile with the message above.
  • PPSA26344 v1.008: on main the shader at 0x80003dc800 fails with that message; with this change it and two other row_share shaders are emitted and pass spirv-val.
  • Not tested: 64-lane subgroups (this GPU has 32; wave64 ran two lanes per invocation), PPSA21564 and Dreaming Sarah (expect a PPSA21564 gate), Linux (CI), console behaviour.

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:4744626788 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/660). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-05T12:05:21Z. --- ### What `EmitDppTargetLane` threw `SPIR-V module emission failed: DPP control 336 is not supported` for the DPP16 `row_share` controls (0x150-0x15F), so shaders that use them could not be recompiled. - `row_share:sel` now reads lane `(lane & ~15) | sel`, lane `sel` of the reading lane's own row. The source never leaves the row, so the target is always valid; an inactive source then follows the `fi`/`bound_ctrl` rule from #515, as `row_xmask` already did. - Source: the DPP_CTRL table of AMD's RDNA2 ISA (DPP_ROW_SHARE 0x150-0x15F, DPP_ROW_XMASK 0x160-0x16F); LLVM's AMDGPU `DppCtrl` enum has the same ranges. - Still thrown: the DPP16 controls RDNA2 leaves unused (0x100, 0x110, 0x120, 0x130-0x13F, 0x142-0x14F, 0x170-0x1FF), which include GFX9's wave shifts and row broadcasts. - PPSA26344 v1.008: the wave64 compute shader at 0x80003dc800 uses `v_mov_b32` with `row_share` 0, 12 and 8 and `v_max_f32` with `row_share:4`, all with `bound_ctrl:1`. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` 53dc19cf: configure `-DBUILD_TESTING=ON`, full build, `--target libs`, `ctest`: - 285/285 tests pass (`ctest --output-on-failure`) - New `agc_driver_dpp16_row_share_xmask`: `v_mov_b32`, `v_add_nc_u32`, `v_sub_nc_u32` and `v_max_f32` with `row_share` and `row_xmask` (untested until now) under partial exec, `fi`, `bound_ctrl` and row/bank masks, as wave32 and wave64. Expected values come from an ISA model with #515's write rule; a wrong lane map fails it. On `main` it fails at the first recompile with the message above. - PPSA26344 v1.008: on `main` the shader at 0x80003dc800 fails with that message; with this change it and two other `row_share` shaders are emitted and pass `spirv-val`. - Not tested: 64-lane subgroups (this GPU has 32; wave64 ran two lanes per invocation), PPSA21564 and Dreaming Sarah (expect a PPSA21564 gate), Linux (CI), console behaviour. ### Checklist - [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
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!660
No description provided.