From 797fa87ec9891384fee7588fda36c80dfed1a39d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 6 Jul 2020 10:57:04 -0400 Subject: [PATCH] pan/mdg: Fix indirect UBO swizzles MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Helps a lot of vertex shaders dramatically. total instructions in shared programs: 48491 -> 48252 (-0.49%) instructions in affected programs: 3091 -> 2852 (-7.73%) helped: 30 HURT: 0 helped stats (abs) min: 1 max: 35 x̄: 7.97 x̃: 5 helped stats (rel) min: 0.57% max: 21.60% x̄: 7.98% x̃: 6.85% 95% mean confidence interval for instructions value: -11.11 -4.83 95% mean confidence interval for instructions %-change: -10.17% -5.80% Instructions are helped. total bundles in shared programs: 23392 -> 23105 (-1.23%) bundles in affected programs: 2017 -> 1730 (-14.23%) helped: 35 HURT: 0 helped stats (abs) min: 1 max: 34 x̄: 8.20 x̃: 7 helped stats (rel) min: 1.11% max: 34.69% x̄: 15.52% x̃: 18.42% 95% mean confidence interval for bundles value: -10.91 -5.49 95% mean confidence interval for bundles %-change: -19.28% -11.77% Bundles are helped. total quadwords in shared programs: 39586 -> 39611 (0.06%) quadwords in affected programs: 1717 -> 1742 (1.46%) helped: 5 HURT: 24 helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 helped stats (rel) min: 0.83% max: 3.57% x̄: 2.45% x̃: 2.78% HURT stats (abs) min: 1 max: 2 x̄: 1.25 x̃: 1 HURT stats (rel) min: 1.00% max: 3.77% x̄: 2.17% x̃: 1.89% 95% mean confidence interval for quadwords value: 0.50 1.22 95% mean confidence interval for quadwords %-change: 0.61% 2.13% Quadwords are HURT. total registers in shared programs: 3337 -> 3272 (-1.95%) registers in affected programs: 373 -> 308 (-17.43%) helped: 34 HURT: 0 helped stats (abs) min: 1 max: 5 x̄: 1.91 x̃: 1 helped stats (rel) min: 6.25% max: 33.33% x̄: 16.76% x̃: 16.03% 95% mean confidence interval for registers value: -2.31 -1.51 95% mean confidence interval for registers %-change: -19.15% -14.37% Registers are helped. total threads in shared programs: 2593 -> 2615 (0.85%) threads in affected programs: 22 -> 44 (100.00%) helped: 21 HURT: 0 helped stats (abs) min: 1 max: 2 x̄: 1.05 x̃: 1 helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00% 95% mean confidence interval for threads value: 0.95 1.15 95% mean confidence interval for threads %-change: 100.00% 100.00% Threads are [helped]. total loops in shared programs: 6 -> 6 (0.00%) loops in affected programs: 0 -> 0 helped: 0 HURT: 0 total spills in shared programs: 17 -> 1 (-94.12%) spills in affected programs: 16 -> 0 helped: 2 HURT: 0 total fills in shared programs: 35 -> 5 (-85.71%) fills in affected programs: 30 -> 0 helped: 2 HURT: 0 Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/midgard_compile.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index fe8b5c4..5691895 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -1330,6 +1330,11 @@ emit_ubo_read( ins.src[2] = nir_src_index(ctx, indirect_offset); ins.src_types[2] = nir_type_uint32; ins.load_store.arg_2 = (indirect_shift << 5); + + /* X component for the whole swizzle to prevent register + * pressure from ballooning from the extra components */ + for (unsigned i = 0; i < ARRAY_SIZE(ins.swizzle[2]); ++i) + ins.swizzle[2][i] = 0; } else { ins.load_store.arg_2 = 0x1E; } -- 2.7.4