Skip to content

aco: Allow explicitly removing jumps on GFX10+ and remove some jumps.

Timur Kristóf requested to merge Venemo/mesa:aco_flatten_branch into main

"Removing jumps" in ACO means skipping the jump instruction at the beginning of a divergent branch (but still modify exec).

ACO already supports implicitly removing jumps when it decides that executing a branch with empty exec mask is more beneficial than a jump.

This commit adds the possibility to use this explicitly through nir_selection_control. ACO will respect this setting and remove the branch instructions when this is specified, unless it decides that this would cause bugs (eg. exp instruction).

There are two cases that benefit from the new change:

  1. When the application requests to "flatten" a branch (ie. remove control flow), we now respect that.
  2. When the compiler stack determines that a divergent branch is always taken.

Example cases:

  • in NGG culling shaders
  • in TCS (tess factor write)
  • when elect() is used as a branch condition: MR !18059 (closed)
Edited by Timur Kristóf

Merge request reports