From 63c4849e8bb6b585747e6e6085df3a0264fa2821 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 10 Nov 2022 22:13:46 +1100 Subject: [PATCH] nir: add another common ffract -> ffloor pattern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit shader-db results (BDW): total instructions in shared programs: 17527053 -> 17526931 (<.01%) instructions in affected programs: 5116 -> 4994 (-2.38%) helped: 25 HURT: 0 helped stats (abs) min: 2 max: 15 x̄: 4.88 x̃: 3 helped stats (rel) min: 0.25% max: 5.34% x̄: 3.39% x̃: 3.90% 95% mean confidence interval for instructions value: -6.19 -3.57 95% mean confidence interval for instructions %-change: -3.98% -2.81% Instructions are helped. total cycles in shared programs: 856680230 -> 856682009 (<.01%) cycles in affected programs: 6583780 -> 6585559 (0.03%) helped: 117 HURT: 77 helped stats (abs) min: 1 max: 854 x̄: 68.56 x̃: 16 helped stats (rel) min: <.01% max: 35.34% x̄: 2.12% x̃: 0.76% HURT stats (abs) min: 1 max: 2188 x̄: 127.27 x̃: 18 HURT stats (rel) min: 0.01% max: 22.66% x̄: 1.86% x̃: 0.67% 95% mean confidence interval for cycles value: -30.07 48.41 95% mean confidence interval for cycles %-change: -1.28% 0.19% Inconclusive result (value mean confidence interval includes 0). LOST: 3 GAINED: 1 Reviewed-by: Gert Wollny Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 55cb4a2a4a8..f35232a66ca 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -376,6 +376,9 @@ optimizations.extend([ (('ffloor@16', a), ('fsub', a, ('ffract', a)), 'options->lower_ffloor'), (('ffloor@32', a), ('fsub', a, ('ffract', a)), 'options->lower_ffloor'), (('ffloor@64', a), ('fsub', a, ('ffract', a)), '(options->lower_ffloor || (options->lower_doubles_options & nir_lower_dfloor)) && !(options->lower_doubles_options & nir_lower_dfract)'), + (('fadd@16', a, ('fadd@16', b, ('fneg', ('ffract', a)))), ('fadd@16', b, ('ffloor', a)), '!options->lower_ffloor'), + (('fadd@32', a, ('fadd@32', b, ('fneg', ('ffract', a)))), ('fadd@32', b, ('ffloor', a)), '!options->lower_ffloor'), + (('fadd@64', a, ('fadd@64', b, ('fneg', ('ffract', a)))), ('fadd@64', b, ('ffloor', a)), '!options->lower_ffloor && !(options->lower_doubles_options & nir_lower_dfloor)'), (('fadd@16', a, ('fneg', ('ffract', a))), ('ffloor', a), '!options->lower_ffloor'), (('fadd@32', a, ('fneg', ('ffract', a))), ('ffloor', a), '!options->lower_ffloor'), (('fadd@64', a, ('fneg', ('ffract', a))), ('ffloor', a), '!options->lower_ffloor && !(options->lower_doubles_options & nir_lower_dfloor)'),