Mesa (main): nir: Check all sizes in nir_alu_instr_is_comparison
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Feb 18 20:19:16 UTC 2022
Module: Mesa
Branch: main
Commit: 2d6233d04f81d0fbee349a5d9856964e8a891be5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d6233d04f81d0fbee349a5d9856964e8a891be5
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Thu Feb 17 20:18:58 2022 -0500
nir: Check all sizes in nir_alu_instr_is_comparison
nir_alu_instr_is_comparison needs to consider all comparison opcodes regardless
of size. Otherwise, they will be missed by nir_opt_move/sink.
Without this change, lowering booleans to integers regresses register
pressure (and spills/fills) significantly in certain shaders on Panfrost,
like android/com.miHoYo.GenshinImpact/1420.shader_test.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15073>
---
src/compiler/nir/nir.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 1ec73e41909..5a33ce82c66 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -3057,22 +3057,34 @@ nir_ssa_alu_instr_src_components(const nir_alu_instr *instr, unsigned src)
return nir_dest_num_components(instr->dest.dest);
}
+#define CASE_ALL_SIZES(op) \
+ case op: \
+ case op ## 8: \
+ case op ## 16: \
+ case op ## 32: \
+
bool
nir_alu_instr_is_comparison(const nir_alu_instr *instr)
{
switch (instr->op) {
- case nir_op_flt:
- case nir_op_fge:
- case nir_op_feq:
- case nir_op_fneu:
- case nir_op_ilt:
- case nir_op_ult:
- case nir_op_ige:
- case nir_op_uge:
- case nir_op_ieq:
- case nir_op_ine:
+ CASE_ALL_SIZES(nir_op_flt)
+ CASE_ALL_SIZES(nir_op_fge)
+ CASE_ALL_SIZES(nir_op_feq)
+ CASE_ALL_SIZES(nir_op_fneu)
+ CASE_ALL_SIZES(nir_op_ilt)
+ CASE_ALL_SIZES(nir_op_ult)
+ CASE_ALL_SIZES(nir_op_ige)
+ CASE_ALL_SIZES(nir_op_uge)
+ CASE_ALL_SIZES(nir_op_ieq)
+ CASE_ALL_SIZES(nir_op_ine)
case nir_op_i2b1:
+ case nir_op_i2b8:
+ case nir_op_i2b16:
+ case nir_op_i2b32:
case nir_op_f2b1:
+ case nir_op_f2b8:
+ case nir_op_f2b16:
+ case nir_op_f2b32:
case nir_op_inot:
return true;
default:
@@ -3080,6 +3092,7 @@ nir_alu_instr_is_comparison(const nir_alu_instr *instr)
}
}
+#undef CASE_ALL_SIZES
unsigned
nir_intrinsic_src_components(const nir_intrinsic_instr *intr, unsigned srcn)
More information about the mesa-commit
mailing list