panfrost/midgard: Fix scalarification
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 2 Jul 2019 03:23:50 +0000 (20:23 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 10 Jul 2019 13:12:05 +0000 (06:12 -0700)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/midgard/midgard_emit.c
src/gallium/drivers/panfrost/midgard/midgard_schedule.c

index 2a71d1c0da1ff8109cbcbe142f0715caddabc632..f5d2d7212b3914016677fc878cd0c2509eddeba6 100644 (file)
@@ -89,12 +89,13 @@ vector_to_scalar_alu(midgard_vector_alu v, midgard_instruction *ins)
 {
         bool is_int = midgard_is_integer_op(v.op);
         bool is_full = v.reg_mode == midgard_reg_mode_32;
+        bool is_inline_constant = ins->ssa_args.inline_constant;
 
         /* The output component is from the mask */
         midgard_scalar_alu s = {
                 .op = v.op,
                 .src1 = vector_to_scalar_source(v.src1, is_int, is_full),
-                .src2 = vector_to_scalar_source(v.src2, is_int, is_full),
+                .src2 = !is_inline_constant ? vector_to_scalar_source(v.src2, is_int, is_full) : 0,
                 .unknown = 0,
                 .outmod = v.outmod,
                 .output_full = is_full,
index ebbabae10bf386e355ea408e536d0fc4116362b8..191017671cda389b788ffd57dbdd3f8a852f5533 100644 (file)
@@ -191,7 +191,6 @@ schedule_bundle(compiler_context *ctx, midgard_block *block, midgard_instruction
                                 int op = ains->alu.op;
                                 int units = alu_opcode_props[op].props;
 
-                                bool vectorable = units & UNITS_ANY_VECTOR;
                                 bool scalarable = units & UNITS_SCALAR;
                                 bool could_scalar = is_single_component_mask(ains->mask);
 
@@ -200,15 +199,35 @@ schedule_bundle(compiler_context *ctx, midgard_block *block, midgard_instruction
                                 could_scalar &= ains->alu.reg_mode != midgard_reg_mode_64;
                                 could_scalar &= ains->alu.dest_override == midgard_dest_override_none;
 
-                                bool vector = vectorable && !(could_scalar && scalarable);
+                                if (ains->alu.reg_mode == midgard_reg_mode_16) {
+                                        /* If we're running in 16-bit mode, we
+                                         * can't have any 8-bit sources on the
+                                         * scalar unit (since the scalar unit
+                                         * doesn't understand 8-bit) */
+
+                                        midgard_vector_alu_src s1 =
+                                                vector_alu_from_unsigned(ains->alu.src1);
+
+                                        could_scalar &= !s1.half;
+
+                                        if (!ains->ssa_args.inline_constant) {
+                                                midgard_vector_alu_src s2 =
+                                                        vector_alu_from_unsigned(ains->alu.src2);
+
+                                                could_scalar &= !s2.half;
+                                        }
+
+                                }
+
+                                bool scalar = could_scalar && scalarable;
 
                                 /* TODO: Check ahead-of-time for other scalar
                                  * hazards that otherwise get aborted out */
 
-                                if (!vector)
+                                if (scalar)
                                         assert(units & UNITS_SCALAR);
 
-                                if (vector) {
+                                if (!scalar) {
                                        if (last_unit >= UNIT_VADD) {
                                                 if (units & UNIT_VLUT)
                                                         unit = UNIT_VLUT;