panfrost/util: Move nir_undef_to_zero into core nir and add 'lower'

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565>
This commit is contained in:
Jesse Natalie
2020-06-02 08:30:35 -07:00
committed by Marge Bot
parent c730ace12b
commit b94b827add
9 changed files with 8 additions and 12 deletions

View File

@@ -300,6 +300,7 @@ NIR_FILES = \
nir/nir_lower_two_sided_color.c \ nir/nir_lower_two_sided_color.c \
nir/nir_lower_ubo_vec4.c \ nir/nir_lower_ubo_vec4.c \
nir/nir_lower_uniforms_to_ubo.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_vars_to_ssa.c \
nir/nir_lower_var_copies.c \ nir/nir_lower_var_copies.c \
nir/nir_lower_vec_to_movs.c \ nir/nir_lower_vec_to_movs.c \

View File

@@ -178,6 +178,7 @@ files_libnir = files(
'nir_lower_tex.c', 'nir_lower_tex.c',
'nir_lower_to_source_mods.c', 'nir_lower_to_source_mods.c',
'nir_lower_two_sided_color.c', 'nir_lower_two_sided_color.c',
'nir_lower_undef_to_zero.c',
'nir_lower_vars_to_ssa.c', 'nir_lower_vars_to_ssa.c',
'nir_lower_var_copies.c', 'nir_lower_var_copies.c',
'nir_lower_vec_to_movs.c', 'nir_lower_vec_to_movs.c',

View File

@@ -5124,6 +5124,8 @@ bool nir_opt_trivial_continues(nir_shader *shader);
bool nir_opt_undef(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); bool nir_opt_uniform_atomics(nir_shader *shader);
typedef bool (*nir_opt_vectorize_cb)(const nir_instr *a, const nir_instr *b, typedef bool (*nir_opt_vectorize_cb)(const nir_instr *a, const nir_instr *b,

View File

@@ -38,13 +38,10 @@
* able to kick in to reduce stuff consuming the zero. * able to kick in to reduce stuff consuming the zero.
*/ */
#include "compiler/nir/nir.h" #include "nir_builder.h"
#include "compiler/nir/nir_builder.h"
bool nir_undef_to_zero(nir_shader *shader);
bool bool
nir_undef_to_zero(nir_shader *shader) nir_lower_undef_to_zero(nir_shader *shader)
{ {
bool progress = false; bool progress = false;

View File

@@ -94,7 +94,6 @@ util_FILES := \
util/lcra.c \ util/lcra.c \
util/lcra.h \ util/lcra.h \
util/nir_mod_helpers.c \ util/nir_mod_helpers.c \
util/nir_undef_to_zero.c \
util/pan_ir.c \ util/pan_ir.c \
util/pan_ir.h \ util/pan_ir.h \
util/pan_liveness.c \ util/pan_liveness.c \

View File

@@ -2406,7 +2406,7 @@ bi_optimize_nir(nir_shader *nir)
} }
NIR_PASS(progress, nir, nir_opt_undef); 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_PASS(progress, nir, nir_opt_loop_unroll,
nir_var_shader_in | nir_var_shader_in |

View File

@@ -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_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_PASS(progress, nir, nir_opt_loop_unroll,
nir_var_shader_in | nir_var_shader_in |

View File

@@ -23,7 +23,6 @@ libpanfrost_util_files = files(
'lcra.c', 'lcra.c',
'lcra.h', 'lcra.h',
'nir_mod_helpers.c', 'nir_mod_helpers.c',
'nir_undef_to_zero.c',
'pan_ir.c', 'pan_ir.c',
'pan_ir.h', 'pan_ir.h',
'pan_liveness.c', 'pan_liveness.c',

View File

@@ -81,9 +81,6 @@ panfrost_nir_assign_sysvals(struct panfrost_sysvals *ctx, void *memctx, nir_shad
int int
panfrost_sysval_for_instr(nir_instr *instr, nir_dest *dest); panfrost_sysval_for_instr(nir_instr *instr, nir_dest *dest);
bool
nir_undef_to_zero(nir_shader *shader);
typedef struct { typedef struct {
int work_register_count; int work_register_count;
int uniform_cutoff; int uniform_cutoff;