From 6982e8510b56991532533bf7da70344bdbb695b9 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Mon, 6 Jul 2020 18:26:14 +0200 Subject: [PATCH] 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: --- src/freedreno/ir3/ir3_nir.c | 2 +- src/freedreno/ir3/ir3_nir.h | 1 + src/freedreno/vulkan/tu_shader.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) 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; }