pan/bi: Add format field to IR
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 31 Jul 2020 22:48:27 +0000 (18:48 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 16 Sep 2020 20:05:34 +0000 (20:05 +0000)
To make register_format packing explicit, and possibly in the future
support the auto mode.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>

src/panfrost/bifrost/bi_print.c
src/panfrost/bifrost/bifrost_compile.c
src/panfrost/bifrost/compiler.h
src/panfrost/bifrost/test/bi_test_pack.c

index 88d2c1e..502ceb0 100644 (file)
@@ -293,6 +293,9 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
         if (ins->dest)
                 pan_print_alu_type(ins->dest_type, fp);
 
+        if (ins->format && ins->dest != ins->format)
+                pan_print_alu_type(ins->format, fp);
+
         if (bi_has_outmod(ins))
                 fprintf(fp, "%s", bi_output_mod_name(ins->outmod));
 
index 2c017ce..841e5b6 100644 (file)
@@ -111,6 +111,7 @@ bi_emit_ld_vary(bi_context *ctx, nir_intrinsic_instr *instr)
         ins.load_vary.reuse = false; /* TODO */
         ins.load_vary.flat = instr->intrinsic != nir_intrinsic_load_interpolated_input;
         ins.dest_type = nir_type_float | nir_dest_bit_size(instr->dest);
+        ins.format = ins.dest_type;
 
         if (nir_src_is_const(*nir_get_io_offset_src(instr))) {
                 /* Zero it out for direct */
@@ -187,6 +188,7 @@ bi_load_with_r61(enum bi_class T, nir_intrinsic_instr *instr)
         ld.src_types[1] = nir_type_uint32;
         ld.src_types[2] = nir_type_uint32;
         ld.src_types[3] = nir_intrinsic_type(instr);
+        ld.format = nir_intrinsic_type(instr);
         return ld;
 }
 
@@ -333,6 +335,7 @@ bi_emit_ld_frag_coord(bi_context *ctx, nir_intrinsic_instr *instr)
                         },
                         .vector_channels = 1,
                         .dest_type = nir_type_float32,
+                        .format = nir_type_float32,
                         .dest = bi_make_temp(ctx),
                         .src = { BIR_INDEX_CONSTANT, BIR_INDEX_ZERO },
                         .src_types = { nir_type_uint32, nir_type_uint32 },
index b839156..24d26b2 100644 (file)
@@ -286,6 +286,9 @@ typedef struct {
         /* Source types if required by the class */
         nir_alu_type src_types[BIR_SRC_COUNT];
 
+        /* register_format if applicable */
+        nir_alu_type format;
+
         /* If the source type is 8-bit or 16-bit such that SIMD is possible,
          * and the class has BI_SWIZZLABLE, this is a swizzle in the usual
          * sense. On non-SIMD instructions, it can be used for component
index 179da3c..f41f148 100644 (file)
@@ -65,6 +65,7 @@ bit_test_single(struct panfrost_device *dev,
                 .vector_channels = 3,
                 .dest = BIR_INDEX_REGISTER | 32,
                 .dest_type = nir_type_uint32,
+                .format = nir_type_uint32,
                 .src = {
                         BIR_INDEX_CONSTANT,
                         BIR_INDEX_REGISTER | 61,