Mesa (master): panfrost/util: Move nir_undef_to_zero into core nir and add 'lower'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 18 04:25:33 UTC 2020
Module: Mesa
Branch: master
Commit: b94b827add3bd840b407f190099deff7c8c7e26f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b94b827add3bd840b407f190099deff7c8c7e26f
Author: Jesse Natalie <jenatali at microsoft.com>
Date: Tue Jun 2 08:30:35 2020 -0700
panfrost/util: Move nir_undef_to_zero into core nir and add 'lower'
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565>
---
src/compiler/Makefile.sources | 1 +
src/compiler/nir/meson.build | 1 +
src/compiler/nir/nir.h | 2 ++
.../nir_undef_to_zero.c => compiler/nir/nir_lower_undef_to_zero.c} | 7 ++-----
src/panfrost/Makefile.sources | 1 -
src/panfrost/bifrost/bifrost_compile.c | 2 +-
src/panfrost/midgard/midgard_compile.c | 2 +-
src/panfrost/util/meson.build | 1 -
src/panfrost/util/pan_ir.h | 3 ---
9 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index af0b97d5c85..4822b0ee952 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -300,6 +300,7 @@ NIR_FILES = \
nir/nir_lower_two_sided_color.c \
nir/nir_lower_ubo_vec4.c \
nir/nir_lower_uniforms_to_ubo.c \
+ nir/nir_lower_undef_to_zero.c \
nir/nir_lower_vars_to_ssa.c \
nir/nir_lower_var_copies.c \
nir/nir_lower_vec_to_movs.c \
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index 9297c7e1ea0..32ef91294ca 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -178,6 +178,7 @@ files_libnir = files(
'nir_lower_tex.c',
'nir_lower_to_source_mods.c',
'nir_lower_two_sided_color.c',
+ 'nir_lower_undef_to_zero.c',
'nir_lower_vars_to_ssa.c',
'nir_lower_var_copies.c',
'nir_lower_vec_to_movs.c',
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 24253b55645..a69f5598255 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -5124,6 +5124,8 @@ bool nir_opt_trivial_continues(nir_shader *shader);
bool nir_opt_undef(nir_shader *shader);
+bool nir_lower_undef_to_zero(nir_shader *shader);
+
bool nir_opt_uniform_atomics(nir_shader *shader);
typedef bool (*nir_opt_vectorize_cb)(const nir_instr *a, const nir_instr *b,
diff --git a/src/panfrost/util/nir_undef_to_zero.c b/src/compiler/nir/nir_lower_undef_to_zero.c
similarity index 95%
rename from src/panfrost/util/nir_undef_to_zero.c
rename to src/compiler/nir/nir_lower_undef_to_zero.c
index ed0bb5402ce..e75086b5097 100644
--- a/src/panfrost/util/nir_undef_to_zero.c
+++ b/src/compiler/nir/nir_lower_undef_to_zero.c
@@ -38,13 +38,10 @@
* able to kick in to reduce stuff consuming the zero.
*/
-#include "compiler/nir/nir.h"
-#include "compiler/nir/nir_builder.h"
-
-bool nir_undef_to_zero(nir_shader *shader);
+#include "nir_builder.h"
bool
-nir_undef_to_zero(nir_shader *shader)
+nir_lower_undef_to_zero(nir_shader *shader)
{
bool progress = false;
diff --git a/src/panfrost/Makefile.sources b/src/panfrost/Makefile.sources
index 4dec2629602..05a51d2cb63 100644
--- a/src/panfrost/Makefile.sources
+++ b/src/panfrost/Makefile.sources
@@ -94,7 +94,6 @@ util_FILES := \
util/lcra.c \
util/lcra.h \
util/nir_mod_helpers.c \
- util/nir_undef_to_zero.c \
util/pan_ir.c \
util/pan_ir.h \
util/pan_liveness.c \
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index cec7c36303f..2e25bec482b 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -2406,7 +2406,7 @@ bi_optimize_nir(nir_shader *nir)
}
NIR_PASS(progress, nir, nir_opt_undef);
- NIR_PASS(progress, nir, nir_undef_to_zero);
+ NIR_PASS(progress, nir, nir_lower_undef_to_zero);
NIR_PASS(progress, nir, nir_opt_loop_unroll,
nir_var_shader_in |
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index bb0b0b52172..b08d9127bd4 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -300,7 +300,7 @@ optimise_nir(nir_shader *nir, unsigned quirks, bool is_blend)
}
NIR_PASS(progress, nir, nir_opt_undef);
- NIR_PASS(progress, nir, nir_undef_to_zero);
+ NIR_PASS(progress, nir, nir_lower_undef_to_zero);
NIR_PASS(progress, nir, nir_opt_loop_unroll,
nir_var_shader_in |
diff --git a/src/panfrost/util/meson.build b/src/panfrost/util/meson.build
index 8ac6ee99e43..eecdd640c17 100644
--- a/src/panfrost/util/meson.build
+++ b/src/panfrost/util/meson.build
@@ -23,7 +23,6 @@ libpanfrost_util_files = files(
'lcra.c',
'lcra.h',
'nir_mod_helpers.c',
- 'nir_undef_to_zero.c',
'pan_ir.c',
'pan_ir.h',
'pan_liveness.c',
diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h
index d0a5208d388..fd91263e6e4 100644
--- a/src/panfrost/util/pan_ir.h
+++ b/src/panfrost/util/pan_ir.h
@@ -81,9 +81,6 @@ panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, void *memctx, nir_shad
int
panfrost_sysval_for_instr(nir_instr *instr, nir_dest *dest);
-bool
-nir_undef_to_zero(nir_shader *shader);
-
typedef struct {
int work_register_count;
int uniform_cutoff;
More information about the mesa-commit
mailing list