From: Ian Romanick <ian.d.roman...@intel.com> All of the affected shaders are in Mad Max. The inner part of the pattern is itself an open-coded sign(a). I tried using that as a pattern, but the results were not good. A bunch of shaders were helped for instructions, but overall cycles, spill, and fills were hurt.
All Gen7+ platforms had similar results. (Skylake shown) total instructions in shared programs: 15090997 -> 15090929 (<.01%) instructions in affected programs: 6157 -> 6089 (-1.10%) helped: 17 HURT: 0 helped stats (abs) min: 4 max: 4 x̄: 4.00 x̃: 4 helped stats (rel) min: 1.01% max: 2.16% x̄: 1.14% x̃: 1.06% 95% mean confidence interval for instructions value: -4.00 -4.00 95% mean confidence interval for instructions %-change: -1.29% -1.00% Instructions are helped. total cycles in shared programs: 565827580 -> 565826044 (<.01%) cycles in affected programs: 32387 -> 30851 (-4.74%) helped: 17 HURT: 0 helped stats (abs) min: 21 max: 213 x̄: 90.35 x̃: 50 helped stats (rel) min: 1.37% max: 21.69% x̄: 5.10% x̃: 2.60% 95% mean confidence interval for cycles value: -127.73 -52.97 95% mean confidence interval for cycles %-change: -7.78% -2.41% Cycles are helped. No changes on any Gen6 or earlier platforms. Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> --- src/compiler/nir/nir_opt_algebraic.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 422a8794d38..6d963cede93 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -372,6 +372,12 @@ optimizations = [ (('iand', ('uge(is_used_once)', a, b), ('uge', a, c)), ('uge', a, ('umax', b, c))), (('iand', ('uge(is_used_once)', a, c), ('uge', b, c)), ('uge', ('umin', a, b), c)), + # The (i2f32, ...) part is an open-coded fsign. When that is combined with + # the bcsel, it's basically copysign(a, 1.0). There is no copysign in NIR, + # so emit an open-coded version of that. + (('bcsel@32', ('feq', a, 0.0), 1.0, ('i2f32', ('iadd', ('ineg', ('flt', 0.0, 'a@32')), ('flt', 'a@32', 0.0)))), + ('ior', 0x3f800000, ('iand', a, 0x80000000))), + (('ior', 'a@bool', ('ieq', a, False)), True), (('ior', 'a@bool', ('inot', a)), True), -- 2.14.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev