aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-05-13 18:41:52 -0400
committerMarge Bot <[email protected]>2020-06-01 15:46:23 +0000
commite9c780b1d08092880a1ad769fffbad571f094c46 (patch)
tree4595ea66f00f93d1dfd0183e0dc46580a4b99adc /src/panfrost/midgard
parentc495c6c2957c7c30cedeaa218c2caf443ac04797 (diff)
pan/mdg: Treat packs "specially"
We maybe would prefer synthetic ops? We'll find out in due time.. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5265>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r--src/panfrost/midgard/compiler.h5
-rw-r--r--src/panfrost/midgard/midgard_compile.c4
-rw-r--r--src/panfrost/midgard/midgard_opt_copy_prop.c2
-rw-r--r--src/panfrost/midgard/midgard_ra.c3
4 files changed, 14 insertions, 0 deletions
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index c26f82613f8..3cb65b0a015 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -101,6 +101,11 @@ typedef struct midgard_instruction {
nir_alu_type src_types[MIR_SRC_COUNT];
nir_alu_type dest_type;
+ /* Packing ops have non-32-bit dest types even though they functionally
+ * work at the 32-bit level, use this as a signal to disable copyprop.
+ * We maybe need synthetic pack ops instead. */
+ bool is_pack;
+
/* Modifiers, depending on type */
union {
struct {
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 59341feba9b..196c600078a 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -1089,15 +1089,19 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
} else if (instr->op == nir_op_pack_32_2x16) {
ins.dest_type = nir_type_uint16;
ins.mask = mask_of(nr_components * 2);
+ ins.is_pack = true;
} else if (instr->op == nir_op_pack_32_4x8) {
ins.dest_type = nir_type_uint8;
ins.mask = mask_of(nr_components * 4);
+ ins.is_pack = true;
} else if (instr->op == nir_op_unpack_32_2x16) {
ins.dest_type = nir_type_uint32;
ins.mask = mask_of(nr_components >> 1);
+ ins.is_pack = true;
} else if (instr->op == nir_op_unpack_32_4x8) {
ins.dest_type = nir_type_uint32;
ins.mask = mask_of(nr_components >> 2);
+ ins.is_pack = true;
}
/* Arrange for creation of iandnot/iornot */
diff --git a/src/panfrost/midgard/midgard_opt_copy_prop.c b/src/panfrost/midgard/midgard_opt_copy_prop.c
index d747040edfd..c27536f989e 100644
--- a/src/panfrost/midgard/midgard_opt_copy_prop.c
+++ b/src/panfrost/midgard/midgard_opt_copy_prop.c
@@ -35,6 +35,7 @@ midgard_opt_copy_prop_reg(compiler_context *ctx, midgard_block *block)
mir_foreach_instr_in_block_safe(block, ins) {
if (ins->type != TAG_ALU_4) continue;
if (!OP_IS_MOVE(ins->alu.op)) continue;
+ if (ins->is_pack) continue;
unsigned from = ins->src[1];
unsigned to = ins->dest;
@@ -68,6 +69,7 @@ midgard_opt_copy_prop(compiler_context *ctx, midgard_block *block)
mir_foreach_instr_in_block_safe(block, ins) {
if (ins->type != TAG_ALU_4) continue;
if (!OP_IS_MOVE(ins->alu.op)) continue;
+ if (ins->is_pack) continue;
unsigned from = ins->src[1];
unsigned to = ins->dest;
diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c
index 8c6210e0634..112485b8b83 100644
--- a/src/panfrost/midgard/midgard_ra.c
+++ b/src/panfrost/midgard/midgard_ra.c
@@ -511,6 +511,9 @@ allocate_registers(compiler_context *ctx, bool *spilled)
unsigned size = nir_alu_type_get_type_size(ins->dest_type);
+ if (ins->is_pack)
+ size = 32;
+
/* 0 for x, 1 for xy, 2 for xyz, 3 for xyzw */
int comps1 = util_logbase2(ins->mask);