From: Timothy Arceri Date: Thu, 21 Jan 2021 04:38:45 +0000 (+1100) Subject: nir: handle negatives in ffma reassociation optimisation X-Git-Tag: upstream/21.2.3~7509 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f474bd4b48954d0423856fd4ee1d676ee45e171;p=platform%2Fupstream%2Fmesa.git nir: handle negatives in ffma reassociation optimisation shader-db results Iris (BDW): total instructions in shared programs: 16632076 -> 16631057 (<.01%) instructions in affected programs: 48010 -> 46991 (-2.12%) helped: 47 HURT: 6 total cycles in shared programs: 915266726 -> 915263622 (<.01%) cycles in affected programs: 1182283 -> 1179179 (-0.26%) helped: 18 HURT: 27 total loops in shared programs: 4929 -> 4929 (0.00%) loops in affected programs: 0 -> 0 helped: 0 HURT: 0 total spills in shared programs: 18834 -> 18801 (-0.18%) spills in affected programs: 525 -> 492 (-6.29%) helped: 3 HURT: 0 total fills in shared programs: 23008 -> 22981 (-0.12%) fills in affected programs: 435 -> 408 (-6.21%) helped: 3 HURT: 0 Reviewed-by: Ian Romanick Part-of: --- diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index cc48c81..69dc628 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -2302,6 +2302,8 @@ late_optimizations = [ ('ffma', a, b, ('ffma', c, d, ('ffma', e, 'f', 'g'))), '(info->stage != MESA_SHADER_VERTEX && info->stage != MESA_SHADER_GEOMETRY) && !options->intel_vec4'), (('~fadd', ('ffma(is_used_once)', a, b, ('fmul', 'c(is_not_const_and_not_fsign)', 'd(is_not_const_and_not_fsign)') ), 'e(is_not_const)'), ('ffma', a, b, ('ffma', c, d, e)), '(info->stage != MESA_SHADER_VERTEX && info->stage != MESA_SHADER_GEOMETRY) && !options->intel_vec4'), + (('~fadd', ('fneg', ('ffma(is_used_once)', a, b, ('ffma', c, d, ('fmul', 'e(is_not_const_and_not_fsign)', 'f(is_not_const_and_not_fsign)')))), 'g(is_not_const)'), + ('ffma', ('fneg', a), b, ('ffma', ('fneg', c), d, ('ffma', ('fneg', e), 'f', 'g'))), '(info->stage != MESA_SHADER_VERTEX && info->stage != MESA_SHADER_GEOMETRY) && !options->intel_vec4'), # Section 8.8 (Integer Functions) of the GLSL 4.60 spec says: #