Skip to content

r300: merge ALU instructions writing different channels of the same destination using the constant swizzles

Pavel Ondračka requested to merge ondracka/mesa:r300_merge_channels into main

This series is intended to implement some of the optimizations discussed in #6188 (closed)

It merge instructions writing different channels of the same destination. It can merge two MOVs into ADD, and MOVs with ADD/MUL (into ADD/MULL if they share a source) or into MAD if not. There is still quite a lot of possibilities, specifically: ADD+ADD, MUL+ADD or MOV+MAD (if they share a source) and maybe some others.

total instructions in shared programs: 155488 -> 149176 (-4.06%)
instructions in affected programs: 126672 -> 120360 (-4.98%)
helped: 1530
HURT: 123

total presub in shared programs: 8226 -> 7983 (-2.95%)
presub in affected programs: 970 -> 727 (-25.05%)
helped: 25
HURT: 13

total temps in shared programs: 20841 -> 20617 (-1.07%)
temps in affected programs: 3492 -> 3268 (-6.41%)
helped: 207
HURT: 65

total lits in shared programs: 4328 -> 4196 (-3.05%)
lits in affected programs: 558 -> 426 (-23.66%)
helped: 39
HURT: 30

There is a 0.3 fps increase in Lightsmark (29.9 -> 30.2, N=3) and almost negligible 0.05 fps increase in Unigine Sanctuary (12.07->12.12, N=5). No measurable change in glmark2 or Unigine Tropics.

CC @gawin

Edited by Pavel Ondračka

Merge request reports