summaryrefslogtreecommitdiff
path: root/src/panfrost/midgard
diff options
context:
space:
mode:
authorIcecream95 <ixn@disroot.org>2020-12-29 00:53:27 +1300
committerMarge Bot <eric+marge@anholt.net>2021-01-18 20:49:45 +0000
commit24fcc032efc85cdf25ea23895de3858729b7b0b8 (patch)
tree98b58ff4eb8096ed31f842233fecbb072ba7e47c /src/panfrost/midgard
parentf0109e9ac01b9747d28dbc482b0ec5e0ef9f2dfd (diff)
pan/mdg: Limit int64 vectorization
Previously, nir_opt_vectorize was sometimes vectorizing 64-bit load_const instructions to vec4. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r--src/panfrost/midgard/midgard_compile.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 64123ea5311..ec219df7415 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -229,6 +229,29 @@ mdg_is_64(const nir_instr *instr, const void *_unused)
}
}
+/* Only vectorize int64 up to vec2 */
+static bool
+midgard_vectorize_filter(const nir_instr *instr, void *data)
+{
+ if (instr->type != nir_instr_type_alu)
+ return true;
+
+ const nir_alu_instr *alu = nir_instr_as_alu(instr);
+
+ unsigned num_components = alu->dest.dest.ssa.num_components;
+
+ int src_bit_size = nir_src_bit_size(alu->src[0].src);
+ int dst_bit_size = nir_dest_bit_size(alu->dest.dest);
+
+ if (src_bit_size == 64 || dst_bit_size == 64) {
+ if (num_components > 1)
+ return false;
+ }
+
+ return true;
+}
+
+
/* Flushes undefined values to zero */
static void
@@ -308,7 +331,8 @@ optimise_nir(nir_shader *nir, unsigned quirks, bool is_blend)
nir_var_shader_out |
nir_var_function_temp);
- NIR_PASS(progress, nir, nir_opt_vectorize, NULL, NULL);
+ NIR_PASS(progress, nir, nir_opt_vectorize,
+ midgard_vectorize_filter, NULL);
} while (progress);
NIR_PASS_V(nir, nir_lower_alu_to_scalar, mdg_is_64, NULL);