From 65db6b0e7ca4394e7e4c5091e06d957becc1ded1 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 11 Mar 2022 12:47:21 -0600 Subject: [PATCH] bifrost: Constant fold after lower_explicit_io nir_lower_explicit_io generates mul+add chains even for constants. One round of constant folding should get rid of these. This fixes all of the dEQP-VK.glsl.conversions.* tests on panvk. GoGoGoGo'd-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index cae0830..e58e1ee 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -3947,6 +3947,12 @@ bi_finalize_nir(nir_shader *nir, unsigned gpu_id, bool is_blend) NIR_PASS_V(nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out, glsl_type_size, 0); + /* nir_lower[_explicit]_io is lazy and emits mul+add chains even for + * offsets it could figure out are constant. Do some constant folding + * before bifrost_nir_lower_store_component below. + */ + NIR_PASS_V(nir, nir_opt_constant_folding); + if (nir->info.stage == MESA_SHADER_FRAGMENT) { NIR_PASS_V(nir, nir_lower_mediump_io, nir_var_shader_out, ~0, false); -- 2.7.4