Mesa (main): zink: always scalarize pack/unpack alu ops
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 10 02:49:39 UTC 2022
Module: Mesa
Branch: main
Commit: 3d8131341b6f4f3f785d4a34a971dd992d0ed8b6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d8131341b6f4f3f785d4a34a971dd992d0ed8b6
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Sat May 21 14:48:26 2022 -0400
zink: always scalarize pack/unpack alu ops
these are tricky
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16669>
---
src/gallium/drivers/zink/zink_compiler.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c
index c07b4d1ad91..19ad4d78126 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -449,6 +449,25 @@ filter_64_bit_instr(const nir_instr *const_instr, UNUSED const void *data)
return lower;
}
+static bool
+filter_pack_instr(const nir_instr *const_instr, UNUSED const void *data)
+{
+ nir_instr *instr = (nir_instr *)const_instr;
+ nir_alu_instr *alu = nir_instr_as_alu(instr);
+ switch (alu->op) {
+ case nir_op_pack_64_2x32_split:
+ case nir_op_pack_32_2x16_split:
+ case nir_op_unpack_32_2x16_split_x:
+ case nir_op_unpack_32_2x16_split_y:
+ case nir_op_unpack_64_2x32_split_x:
+ case nir_op_unpack_64_2x32_split_y:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
static void
optimize_nir(struct nir_shader *s)
{
@@ -456,6 +475,7 @@ optimize_nir(struct nir_shader *s)
do {
progress = false;
NIR_PASS_V(s, nir_lower_vars_to_ssa);
+ NIR_PASS(progress, s, nir_lower_alu_to_scalar, filter_pack_instr, NULL);
NIR_PASS(progress, s, nir_copy_prop);
NIR_PASS(progress, s, nir_opt_remove_phis);
if (s->options->lower_int64_options) {
More information about the mesa-commit
mailing list