summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2020-09-23 13:14:26 -0500
committerDylan Baker <dylan.c.baker@intel.com>2020-09-24 15:17:58 -0700
commitf1b6e501080fdfe5ae5afcebcbb5d1d9b20632a6 (patch)
treee9a0a018ae28110230b5e1076495b283df1e4105
parenta2f1b6d268bc2afca357a6bf3c9aebc763840f46 (diff)
radeonsi: Only call nir_lower_var_copies at the end of the opt loop
In 283ad85944b5d, radeonsi started using nir_find_var_copies. However, it was also calling nir_lower_var_copies in the optimization loop and the two can end up fighting. The simple solution is to wait to lower copies until the end of the optimization loop. Fixes: 283ad85944b5d Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3550 Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6841> (cherry picked from commit 472a20c5fc0feda0f074b4ff95fd7c7a6305c8cd)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_nir.c18
2 files changed, 5 insertions, 15 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 809f5ee3f32..1725f05fa65 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
"description": "radeonsi: Only call nir_lower_var_copies at the end of the opt loop",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "283ad85944b5d9082f0ede7ab41fb353db53fee8"
},
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 19c9332408a..727a5160866 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -753,23 +753,11 @@ static void si_nir_opts(struct nir_shader *nir, bool first)
bool lower_phis_to_scalar = false;
if (first) {
- bool opt_find_array_copies = false;
-
NIR_PASS(progress, nir, nir_split_array_vars, nir_var_function_temp);
NIR_PASS(lower_alu_to_scalar, nir, nir_shrink_vec_array_vars, nir_var_function_temp);
- NIR_PASS(opt_find_array_copies, nir, nir_opt_find_array_copies);
- NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
-
- /* Call nir_lower_var_copies() to remove any copies introduced
- * by nir_opt_find_array_copies().
- */
- if (opt_find_array_copies)
- NIR_PASS(progress, nir, nir_lower_var_copies);
- progress |= opt_find_array_copies;
- } else {
- NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
+ NIR_PASS(progress, nir, nir_opt_find_array_copies);
}
-
+ NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
NIR_PASS(progress, nir, nir_opt_dead_write_vars);
NIR_PASS(lower_alu_to_scalar, nir, nir_opt_trivial_continues);
@@ -819,6 +807,8 @@ static void si_nir_opts(struct nir_shader *nir, bool first)
NIR_PASS(progress, nir, nir_opt_loop_unroll, 0);
}
} while (progress);
+
+ NIR_PASS_V(nir, nir_lower_var_copies);
}
static int type_size_vec4(const struct glsl_type *type, bool bindless)