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_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 \

View File

@@ -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',

View File

@@ -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,

View File

@@ -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;

View File

@@ -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 \

View File

@@ -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 |

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_undef_to_zero);
NIR_PASS(progress, nir, nir_lower_undef_to_zero);
NIR_PASS(progress, nir, nir_opt_loop_unroll,
nir_var_shader_in |

View File

@@ -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',

View File

@@ -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;