Skip to content

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

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
adriadam10:fix/dpp16-inactive-source
Oct 5, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
adriadam10:fix/dpp16-inactive-source

Conversation

@adriadam10

Copy link
Copy Markdown
Collaborator

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

@github-actions github-actions Bot added shader core/shader agc libSceAgc* labels Oct 4, 2026
@adriadam10
adriadam10 force-pushed the fix/dpp16-inactive-source branch from 3ae1bd2 to bd6afc7 Compare October 4, 2026 20:36
@adriadam10

Copy link
Copy Markdown
Collaborator Author

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 5, 2026
adriadam10 and others added 2 commits October 5, 2026 03:32
Co-Authored-By: Claude <noreply@anthropic.com>
Without bound_ctrl and fetch-inactive, a DPP16 lane whose source lane is
inactive keeps its old value instead of being written with 0. With
fetch-inactive, a source outside the row reads 0.

Co-Authored-By: Claude <noreply@anthropic.com>
@adriadam10

Copy link
Copy Markdown
Collaborator Author

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).

@adriadam10
adriadam10 force-pushed the fix/dpp16-inactive-source branch from bd6afc7 to fd159a6 Compare October 5, 2026 01:33
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 5, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Collaborator

Gated on PPSA21564: no visual or FPS change.

@oneandonlydean
oneandonlydean merged commit 1e0f62e into boykopovar:main Oct 5, 2026
3 checks passed
@adriadam10
adriadam10 deleted the fix/dpp16-inactive-source branch October 5, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants