Module: Mesa Branch: main Commit: b131f96aa83c115457e6bc5534dc0a5edb049b2e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b131f96aa83c115457e6bc5534dc0a5edb049b2e
Author: Alyssa Rosenzweig <[email protected]> Date: Thu May 13 19:33:23 2021 -0400 pan/mdg: Set lower_uniforms_to_ubo Rip off the band-aid. No other driver in Mesa has this combination, and there's a reason for that. It confuses nir_to_tgsi; this commit fixes GALLIUM_HUD (again) on Midgard. shader-db stats aren't as bad as they appear at first blush, since the added cycles are from added if-else branches (and only one side of the if is taken on Midgard, which does no warping*). total instructions in shared programs: 97036 -> 98107 (1.10%) instructions in affected programs: 8297 -> 9368 (12.91%) helped: 0 HURT: 45 HURT stats (abs) min: 1 max: 52 x̄: 23.80 x̃: 25 HURT stats (rel) min: 0.61% max: 61.90% x̄: 16.18% x̃: 14.66% 95% mean confidence interval for instructions value: 20.04 27.56 95% mean confidence interval for instructions %-change: 12.62% 19.74% Instructions are HURT. total bundles in shared programs: 45507 -> 46091 (1.28%) bundles in affected programs: 3138 -> 3722 (18.61%) helped: 2 HURT: 40 helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 helped stats (rel) min: 1.54% max: 2.17% x̄: 1.86% x̃: 1.86% HURT stats (abs) min: 2 max: 44 x̄: 14.65 x̃: 12 HURT stats (rel) min: 2.70% max: 50.00% x̄: 23.03% x̃: 21.25% 95% mean confidence interval for bundles value: 10.35 17.46 95% mean confidence interval for bundles %-change: 16.81% 26.88% Bundles are HURT. total quadwords in shared programs: 76952 -> 77849 (1.17%) quadwords in affected programs: 6556 -> 7453 (13.68%) helped: 2 HURT: 44 helped stats (abs) min: 1 max: 5 x̄: 3.00 x̃: 3 helped stats (rel) min: 1.73% max: 4.55% x̄: 3.14% x̃: 3.14% HURT stats (abs) min: 2 max: 58 x̄: 20.52 x̃: 18 HURT stats (rel) min: 2.11% max: 46.34% x̄: 17.20% x̃: 12.96% 95% mean confidence interval for quadwords value: 15.18 23.82 95% mean confidence interval for quadwords %-change: 12.68% 19.96% Quadwords are HURT. total registers in shared programs: 6966 -> 6925 (-0.59%) registers in affected programs: 347 -> 306 (-11.82%) helped: 26 HURT: 8 helped stats (abs) min: 1 max: 4 x̄: 2.04 x̃: 2 helped stats (rel) min: 6.67% max: 42.86% x̄: 20.92% x̃: 22.22% HURT stats (abs) min: 1 max: 5 x̄: 1.50 x̃: 1 HURT stats (rel) min: 9.09% max: 50.00% x̄: 17.19% x̃: 11.81% 95% mean confidence interval for registers value: -1.85 -0.56 95% mean confidence interval for registers %-change: -18.97% -4.93% Registers are helped. total threads in shared programs: 5040 -> 5050 (0.20%) threads in affected programs: 13 -> 23 (76.92%) helped: 10 HURT: 1 helped stats (abs) min: 1 max: 2 x̄: 1.10 x̃: 1 helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00% HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 HURT stats (rel) min: 50.00% max: 50.00% x̄: 50.00% x̃: 50.00% 95% mean confidence interval for threads value: 0.44 1.38 95% mean confidence interval for threads %-change: 55.98% 116.75% Threads are helped. Fixes: 24d7c413fe7 ("panfrost: Enable packed uniforms.") Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10866> --- src/panfrost/lib/pan_indirect_dispatch.c | 14 ++------------ src/panfrost/midgard/midgard_compile.c | 9 --------- src/panfrost/midgard/midgard_compile.h | 1 + 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/panfrost/lib/pan_indirect_dispatch.c b/src/panfrost/lib/pan_indirect_dispatch.c index 4d520f56d2d..8314e8757b6 100644 --- a/src/panfrost/lib/pan_indirect_dispatch.c +++ b/src/panfrost/lib/pan_indirect_dispatch.c @@ -82,20 +82,10 @@ get_ubos(struct pan_pool *pool, memcpy(inputs_buf.cpu, inputs, sizeof(*inputs)); - /* The midgard compiler calls the uniform -> UBO lowering pass which - * increments UBOs index even if there's no uniform to move to UBO0. - */ - unsigned num_ubos = pan_is_bifrost(pool->dev) ? 1 : 2; struct panfrost_ptr ubos_buf = - panfrost_pool_alloc_desc_array(pool, num_ubos, UNIFORM_BUFFER); + panfrost_pool_alloc_desc(pool, UNIFORM_BUFFER); - void *inputs_ubo = ubos_buf.cpu; - if (num_ubos > 1) { - memset(ubos_buf.cpu, 0, MALI_UNIFORM_BUFFER_LENGTH); - inputs_ubo += MALI_UNIFORM_BUFFER_LENGTH; - } - - pan_pack(inputs_ubo, UNIFORM_BUFFER, cfg) { + pan_pack(ubos_buf.cpu, UNIFORM_BUFFER, cfg) { cfg.entries = DIV_ROUND_UP(sizeof(*inputs), 16); cfg.pointer = inputs_buf.gpu; } diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 9d259592e25..c04d5911eda 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -334,15 +334,6 @@ optimise_nir(nir_shader *nir, unsigned quirks, bool is_blend) NIR_PASS(progress, nir, midgard_nir_lower_algebraic_early); - /* Peephole select is more effective before lowering uniforms to UBO, - * so do a round of that, and then call lower_uniforms_to_ubo - * explicitly (instead of relying on the state tracker to do it). Note - * the state tracker does run peephole_select before lowering uniforms - * to UBO ordinarily, but it isn't as aggressive as we need. */ - - NIR_PASS(progress, nir, nir_opt_peephole_select, 64, false, true); - NIR_PASS_V(nir, nir_lower_uniforms_to_ubo, true, false); - do { progress = false; diff --git a/src/panfrost/midgard/midgard_compile.h b/src/panfrost/midgard/midgard_compile.h index 5d22b4128eb..a4c9e1626bc 100644 --- a/src/panfrost/midgard/midgard_compile.h +++ b/src/panfrost/midgard/midgard_compile.h @@ -85,6 +85,7 @@ static const nir_shader_compiler_options midgard_nir_options = { .lower_doubles_options = nir_lower_dmod, .lower_bitfield_extract_to_shifts = true, + .lower_uniforms_to_ubo = true, .has_fsub = true, .has_isub = true, .vectorize_io = true, _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
