fix(shader): DPP16 lanes whose source lane is inactive #515

Merged
adriadam10 merged 2 commits from upstream-pr/515 into main 2026-10-05 05:08:47 +00:00
adriadam10 commented 2026-10-04 14:31:01 +00:00 (Migrated from github.com)

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


What

DPP16 write rule when the source lane is inactive, measured on hardware (gfx1035, RDNA2):

  • bound_ctrl off, fi:0, source lane inactive: the lane is not written (keeps its old value). main wrote 0.
  • bound_ctrl off, fi:1, source lane inactive: the lane is written with the inactive lane's value (unchanged).
  • bound_ctrl on: the lane is written with 0 when the source is invalid (unchanged).
  • fi:1 with the source outside the row (row_shr:1 on lane 0 of a row) and bound_ctrl on: reads 0. main returned the shuffled value.

EmitDppWriteCondition now also requires the source lane to be active (ballot of exec at the target lane, same pair EmitDppMoveU32 uses for the read) when neither bound_ctrl nor fi is set. DPP8 keeps its own rule from #513 (an inactive source writes 0), so it is excluded via DppMoveFlags::Lanes8. With fi:1, EmitDppMoveU32 now returns 0 when the target lane is out of range.

Behaviour measured on HW

Python model valid = in_row && (exec[src] || fi), write = exec[lane] && row_mask && bank_mask && (valid || bound_ctrl), value valid ? src : 0: 0 mismatches against the GPU over 3 seeds x (32 lanes wave32 + 64 lanes wave64) x 15 cells, for v_mov_b32_dpp and v_add_nc_u32_dpp under quad_perm, row_shr, row_mirror with row_mask/bank_mask, each with and without fi and bound_ctrl, with a non-trivial exec mask.

Tested

Linux, RADV. New agc_driver_dpp16_inactive_source_tests (tests/execution/Dpp16InactiveSource.cpp, expected values from the hardware run): wave32, wave64 on the native target and wave64 on the two-half path (ComputeTarget(32)). It skips on lavapipe (8-lane subgroups), the same as Dpp8.cpp/ReadLane.cpp.

Fails without the fix, each piece reverted separately: dropping the source-active term (mov_quad_perm), returning the unselected shuffle for fi (mov_row_shr_bc_fi), ignoring fi in the write rule (mov_quad_perm_fi); applying the new rule to DPP8 too breaks agc_driver_dpp8_tests (mov_inactive).

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:4735103877 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/515). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-04T14:31:01Z. --- ### What DPP16 write rule when the source lane is inactive, measured on hardware (gfx1035, RDNA2): - `bound_ctrl` off, `fi:0`, source lane inactive: the lane is **not written** (keeps its old value). `main` wrote 0. - `bound_ctrl` off, `fi:1`, source lane inactive: the lane is written with the inactive lane's value (unchanged). - `bound_ctrl` on: the lane is written with 0 when the source is invalid (unchanged). - `fi:1` with the source outside the row (`row_shr:1` on lane 0 of a row) and `bound_ctrl` on: reads 0. `main` returned the shuffled value. `EmitDppWriteCondition` now also requires the source lane to be active (ballot of exec at the target lane, same pair `EmitDppMoveU32` uses for the read) when neither `bound_ctrl` nor `fi` is set. DPP8 keeps its own rule from #513 (an inactive source writes 0), so it is excluded via `DppMoveFlags::Lanes8`. With `fi:1`, `EmitDppMoveU32` now returns 0 when the target lane is out of range. #### Behaviour measured on HW Python model `valid = in_row && (exec[src] || fi)`, `write = exec[lane] && row_mask && bank_mask && (valid || bound_ctrl)`, value `valid ? src : 0`: 0 mismatches against the GPU over 3 seeds x (32 lanes wave32 + 64 lanes wave64) x 15 cells, for `v_mov_b32_dpp` and `v_add_nc_u32_dpp` under `quad_perm`, `row_shr`, `row_mirror` with `row_mask`/`bank_mask`, each with and without `fi` and `bound_ctrl`, with a non-trivial exec mask. ### Tested Linux, RADV. New `agc_driver_dpp16_inactive_source_tests` (`tests/execution/Dpp16InactiveSource.cpp`, expected values from the hardware run): wave32, wave64 on the native target and wave64 on the two-half path (`ComputeTarget(32)`). It skips on lavapipe (8-lane subgroups), the same as `Dpp8.cpp`/`ReadLane.cpp`. Fails without the fix, each piece reverted separately: dropping the source-active term (`mov_quad_perm`), returning the unselected shuffle for `fi` (`mov_row_shr_bc_fi`), ignoring `fi` in the write rule (`mov_quad_perm_fi`); applying the new rule to DPP8 too breaks `agc_driver_dpp8_tests` (`mov_inactive`). 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
adriadam10 commented 2026-10-04 20:36:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-04T20:36:31Z.


Rebased on current main: the only Windows failure was guest_audio_in_no_device, fixed by #532. No other changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5984142577 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/515#issuecomment-5984142577). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-04T20:36:31Z. --- Rebased on current main: the only Windows failure was `guest_audio_in_no_device`, fixed by #532. No other changes.
oneandonlydean commented 2026-10-04 21:30:40 +00:00 (Migrated from github.com)

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


Thanks, this matches the documented DPP16 rule: with fi:0 an inactive source lane is an invalid lane and bound_ctrl decides, so with bound_ctrl off the destination keeps its old value, and with fi:1 a source outside the row is still invalid (LLVM AMDGPUModifierSyntax, fi for dpp16 and bound_ctrl). I checked the lane 0 cells of the wave32 table against that model by hand and they agree. The rebased head has the same two commits as before; the DPP8 one is the same patch as #513, and #515 merges cleanly on top of #513, so after #513 lands only your own commit is left in the diff.

One note for anyone reading the CI results: the new test skips when the subgroup is narrower than 32, so lavapipe never runs it. I ran it on NVIDIA here (32-wide subgroups, so both wave64 runs take the two-half path): it fails on main's code ("lane 0 mov_quad_perm is 0x00000000, expected 0xdeaddead") and passes with the change, along with the existing DPP tests.

Since this changes every DPP16 move with bound_ctrl off under a partial EXEC, which is what compiler wave reductions emit, I'll run it through my PPSA21564 check before merging. It goes in after #513. Ready to merge from my side otherwise.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5984595785 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/515#issuecomment-5984595785). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T21:30:40Z. --- Thanks, this matches the documented DPP16 rule: with fi:0 an inactive source lane is an invalid lane and bound_ctrl decides, so with bound_ctrl off the destination keeps its old value, and with fi:1 a source outside the row is still invalid (LLVM AMDGPUModifierSyntax, `fi` for dpp16 and `bound_ctrl`). I checked the lane 0 cells of the wave32 table against that model by hand and they agree. The rebased head has the same two commits as before; the DPP8 one is the same patch as #513, and #515 merges cleanly on top of #513, so after #513 lands only your own commit is left in the diff. One note for anyone reading the CI results: the new test skips when the subgroup is narrower than 32, so lavapipe never runs it. I ran it on NVIDIA here (32-wide subgroups, so both wave64 runs take the two-half path): it fails on main's code ("lane 0 mov_quad_perm is 0x00000000, expected 0xdeaddead") and passes with the change, along with the existing DPP tests. Since this changes every DPP16 move with bound_ctrl off under a partial EXEC, which is what compiler wave reductions emit, I'll run it through my PPSA21564 check before merging. It goes in after #513. Ready to merge from my side otherwise.
adriadam10 commented 2026-10-05 01:33:06 +00:00 (Migrated from github.com)

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


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

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

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


Thanks, this carries #513's rebased head and your commit applied unchanged (same patch as the one I reviewed). agc_driver_dpp16_inactive_source passes here on the merged branch. PPSA21564 uses DPP16 (quad_perm and row_shr on v_mov_b32, v_sub_f32 and others) in about 2,400 shaders, so this goes through my PPSA21564 check before merging, after #513.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5987228115 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/515#issuecomment-5987228115). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T02:47:10Z. --- Thanks, this carries #513's rebased head and your commit applied unchanged (same patch as the one I reviewed). `agc_driver_dpp16_inactive_source` passes here on the merged branch. PPSA21564 uses DPP16 (`quad_perm` and `row_shr` on `v_mov_b32`, `v_sub_f32` and others) in about 2,400 shaders, so this goes through my PPSA21564 check before merging, after #513.
oneandonlydean commented 2026-10-05 05:04:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T05:04:04Z.


Gated on PPSA21564: no visual or FPS change.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5988442511 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/515#issuecomment-5988442511). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T05:04:04Z. --- Gated on PPSA21564: no visual or FPS change.
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!515
No description provided.