Reviewed-by: Iago Toral Quiroga <ito...@igalia.com>
On Wed, 2018-10-17 at 14:49 +1100, Timothy Arceri wrote: > For example: > > vec1 32 ssa_386 = feq ssa_333.x, ssa_6 > vec1 32 ssa_387 = feq ssa_333.x, ssa_2 > vec1 32 ssa_391 = bcsel ssa_387, ssa_388, ssa_324 > vec1 32 ssa_396 = bcsel ssa_386, ssa_324, ssa_391 > > Can be simplified to: > > vec1 32 ssa_386 = feq ssa_333.x, ssa_6 > vec1 32 ssa_391 = bcsel ssa_387, ssa_388, ssa_324 > > There are a bunch of these in Rise of The Tomb Raiders Vulkan > shaders. There are also a hadful of shaders helped in shader-db > but the changes there are smaller. > > For RADV: > > Totals from affected shaders: > SGPRS: 11184 -> 11168 (-0.14 %) > VGPRS: 11484 -> 11484 (0.00 %) > Spilled SGPRs: 1119 -> 1116 (-0.27 %) > Spilled VGPRs: 0 -> 0 (0.00 %) > Private memory VGPRs: 0 -> 0 (0.00 %) > Scratch size: 0 -> 0 (0.00 %) dwords per thread > Code Size: 1210856 -> 1210372 (-0.04 %) bytes > LDS: 0 -> 0 (0.00 %) blocks > Max Waves: 360 -> 360 (0.00 %) > Wait states: 0 -> 0 (0.00 %) > --- > src/compiler/nir/nir_opt_algebraic.py | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/compiler/nir/nir_opt_algebraic.py > b/src/compiler/nir/nir_opt_algebraic.py > index cc747250ba5..7530710cbe0 100644 > --- a/src/compiler/nir/nir_opt_algebraic.py > +++ b/src/compiler/nir/nir_opt_algebraic.py > @@ -34,6 +34,7 @@ a = 'a' > b = 'b' > c = 'c' > d = 'd' > +e = 'e' > > # Written in the form (<search>, <replace>) where <search> is an > expression > # and <replace> is either an expression or a value. An expression > is > @@ -525,6 +526,9 @@ optimizations = [ > # The result of this should be hit by constant propagation and, > in the > # next round of opt_algebraic, get picked up by one of the above > two. > (('bcsel', '#a', b, c), ('bcsel', ('ine', 'a', 0), b, c)), > + # Remove redundant bcsel > + (('bcsel', ('ieq', '#a', b), c, ('bcsel', ('ieq', '#d', b), e, > c)), ('bcsel', ('ieq', d, b), e, c)), > + (('bcsel', ('feq', '#a', b), c, ('bcsel', ('feq', '#d', b), e, > c)), ('bcsel', ('feq', d, b), e, c)), > > (('bcsel', a, b, b), b), > (('fcsel', a, b, b), b), _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev