From 0c4de24f15400e0cdd85a7a8deb62bef8d4f5307 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 10 Jun 2021 20:37:35 -0400 Subject: [PATCH] pan/bi: Fuse fclamp_pos and fsat_signed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mostly interesting now that we fuse clamps. total instructions in shared programs: 149562 -> 148927 (-0.42%) instructions in affected programs: 37195 -> 36560 (-1.71%) helped: 233 HURT: 0 helped stats (abs) min: 1 max: 10 x̄: 2.73 x̃: 2 helped stats (rel) min: 0.22% max: 17.39% x̄: 2.19% x̃: 1.72% 95% mean confidence interval for instructions value: -2.97 -2.48 95% mean confidence interval for instructions %-change: -2.44% -1.94% Instructions are helped. total tuples in shared programs: 130487 -> 130122 (-0.28%) tuples in affected programs: 25693 -> 25328 (-1.42%) helped: 179 HURT: 12 helped stats (abs) min: 1 max: 10 x̄: 2.11 x̃: 2 helped stats (rel) min: 0.26% max: 25.00% x̄: 2.52% x̃: 1.70% HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 HURT stats (rel) min: 0.61% max: 0.68% x̄: 0.65% x̃: 0.66% 95% mean confidence interval for tuples value: -2.15 -1.68 95% mean confidence interval for tuples %-change: -2.74% -1.91% Tuples are helped. total clauses in shared programs: 27827 -> 27761 (-0.24%) clauses in affected programs: 1407 -> 1341 (-4.69%) helped: 56 HURT: 0 helped stats (abs) min: 1 max: 4 x̄: 1.18 x̃: 1 helped stats (rel) min: 1.79% max: 14.29% x̄: 6.11% x̃: 5.26% 95% mean confidence interval for clauses value: -1.32 -1.03 95% mean confidence interval for clauses %-change: -7.00% -5.23% Clauses are helped. total quadwords in shared programs: 118563 -> 118248 (-0.27%) quadwords in affected programs: 19859 -> 19544 (-1.59%) helped: 144 HURT: 16 helped stats (abs) min: 1 max: 10 x̄: 2.30 x̃: 2 helped stats (rel) min: 0.29% max: 16.00% x̄: 2.65% x̃: 2.13% HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 HURT stats (rel) min: 0.47% max: 2.00% x̄: 0.80% x̃: 0.76% 95% mean confidence interval for quadwords value: -2.27 -1.66 95% mean confidence interval for quadwords %-change: -2.67% -1.93% Quadwords are helped. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_nir_algebraic.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_nir_algebraic.py b/src/panfrost/bifrost/bifrost_nir_algebraic.py index 586b19e0991..fdbc8ec1ec8 100644 --- a/src/panfrost/bifrost/bifrost_nir_algebraic.py +++ b/src/panfrost/bifrost/bifrost_nir_algebraic.py @@ -31,6 +31,11 @@ c = 'c' algebraic_late = [ # Canonical form. The scheduler will convert back if it makes sense. (('fmul', a, 2.0), ('fadd', a, a)), + + # Fuse Mali-specific clamps + (('fmin', ('fmax', a, -1.0), 1.0), ('fsat_signed', a)), + (('fmax', ('fmin', a, 1.0), -1.0), ('fsat_signed', a)), + (('fmax', a, 0.0), ('fclamp_pos', a)), ]