summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2020-07-06 18:26:14 +0200
committerMarge Bot <eric+marge@anholt.net>2020-09-29 16:16:05 +0000
commit6982e8510b56991532533bf7da70344bdbb695b9 (patch)
treea342597bd98f245cb62eec989f8c8e1d04ff32b7
parent41a5a2185827257820af37ee8752a839d6f2d519 (diff)
ir3, tu: Run optimization loop twice
This call to ir3_optimize_nir() mirrors what st/mesa does for us in Gallium, and will be necessary for cross-stage linking and the multiview lowering. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6515>
-rw-r--r--src/freedreno/ir3/ir3_nir.c2
-rw-r--r--src/freedreno/ir3/ir3_nir.h1
-rw-r--r--src/freedreno/vulkan/tu_shader.c2
3 files changed, 4 insertions, 1 deletions
diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index f33f048a505..9b406166007 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -153,7 +153,7 @@ ir3_get_compiler_options(struct ir3_compiler *compiler)
#define OPT_V(nir, pass, ...) NIR_PASS_V(nir, pass, ##__VA_ARGS__)
-static void
+void
ir3_optimize_loop(nir_shader *s)
{
bool progress;
diff --git a/src/freedreno/ir3/ir3_nir.h b/src/freedreno/ir3/ir3_nir.h
index 4126d4e4868..e9fe495767b 100644
--- a/src/freedreno/ir3/ir3_nir.h
+++ b/src/freedreno/ir3/ir3_nir.h
@@ -52,6 +52,7 @@ void ir3_nir_lower_tess_eval(nir_shader *shader, unsigned topology);
void ir3_nir_lower_gs(nir_shader *shader);
const nir_shader_compiler_options * ir3_get_compiler_options(struct ir3_compiler *compiler);
+void ir3_optimize_loop(nir_shader *s);
void ir3_finalize_nir(struct ir3_compiler *compiler, nir_shader *s);
void ir3_nir_post_finalize(struct ir3_compiler *compiler, nir_shader *s);
void ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s);
diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c
index 7c671de0138..f0d2e50d8a6 100644
--- a/src/freedreno/vulkan/tu_shader.c
+++ b/src/freedreno/vulkan/tu_shader.c
@@ -175,6 +175,8 @@ tu_spirv_to_nir(struct tu_device *dev,
NIR_PASS_V(nir, nir_lower_frexp);
+ ir3_optimize_loop(nir);
+
return nir;
}