pan/bi: Move bi_registers to common IR structures
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 5 May 2020 18:23:41 +0000 (14:23 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 May 2020 20:34:55 +0000 (20:34 +0000)
Port assignments are critical to scheduling, this can't just live in
bi_pack.

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

src/panfrost/bifrost/bi_pack.c
src/panfrost/bifrost/bi_print.c
src/panfrost/bifrost/bi_print.h
src/panfrost/bifrost/compiler.h

index 5719e66..852dd07 100644 (file)
@@ -59,50 +59,6 @@ bi_pack_header(bi_clause *clause, bi_clause *next, bool is_fragment)
         return u;
 }
 
-/* Represents the assignment of ports for a given bundle */
-
-struct bi_registers {
-        /* Register to assign to each port */
-        unsigned port[4];
-
-        /* Read ports can be disabled */
-        bool enabled[2];
-
-        /* Should we write FMA? what about ADD? If only a single port is
-         * enabled it is in port 2, else ADD/FMA is 2/3 respectively */
-        bool write_fma, write_add;
-
-        /* Should we read with port 3? */
-        bool read_port3;
-
-        /* Packed uniform/constant */
-        uint8_t uniform_constant;
-
-        /* Whether writes are actually for the last instruction */
-        bool first_instruction;
-};
-
-static inline void
-bi_print_ports(struct bi_registers *regs)
-{
-        for (unsigned i = 0; i < 2; ++i) {
-                if (regs->enabled[i])
-                        printf("port %u: %u\n", i, regs->port[i]);
-        }
-
-        if (regs->write_fma || regs->write_add) {
-                printf("port 2 (%s): %u\n",
-                                regs->write_add ? "ADD" : "FMA",
-                                regs->port[2]);
-        }
-
-        if ((regs->write_fma && regs->write_add) || regs->read_port3) {
-                printf("port 3 (%s): %u\n",
-                                regs->read_port3 ? "read" : "FMA",
-                                regs->port[3]);
-        }
-}
-
 /* The uniform/constant slot allows loading a contiguous 64-bit immediate or
  * pushed uniform per bundle. Figure out which one we need in the bundle (the
  * scheduler needs to ensure we only have one type per bundle), validate
index 1d2807f..8c78aa9 100644 (file)
@@ -412,6 +412,27 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
 }
 
 void
+bi_print_ports(struct bi_registers *regs)
+{
+        for (unsigned i = 0; i < 2; ++i) {
+                if (regs->enabled[i])
+                        printf("port %u: %u\n", i, regs->port[i]);
+        }
+
+        if (regs->write_fma || regs->write_add) {
+                printf("port 2 (%s): %u\n",
+                                regs->write_add ? "ADD" : "FMA",
+                                regs->port[2]);
+        }
+
+        if ((regs->write_fma && regs->write_add) || regs->read_port3) {
+                printf("port 3 (%s): %u\n",
+                                regs->read_port3 ? "read" : "FMA",
+                                regs->port[3]);
+        }
+}
+
+void
 bi_print_bundle(bi_bundle *bundle, FILE *fp)
 {
         bi_instruction *ins[2] = { bundle->fma, bundle->add };
index dfc916a..294d69e 100644 (file)
@@ -47,6 +47,7 @@ const char * bi_frexp_op_name(enum bi_frexp_op op);
 const char * bi_tex_op_name(enum bi_tex_op op);
 
 void bi_print_instruction(bi_instruction *ins, FILE *fp);
+void bi_print_ports(struct bi_registers *regs);
 void bi_print_bundle(bi_bundle *bundle, FILE *fp);
 void bi_print_clause(bi_clause *clause, FILE *fp);
 void bi_print_block(bi_block *block, FILE *fp);
index ed3c357..349aff4 100644 (file)
@@ -301,6 +301,29 @@ typedef struct {
         };
 } bi_instruction;
 
+/* Represents the assignment of ports for a given bi_bundle */
+
+struct bi_registers {
+        /* Register to assign to each port */
+        unsigned port[4];
+
+        /* Read ports can be disabled */
+        bool enabled[2];
+
+        /* Should we write FMA? what about ADD? If only a single port is
+         * enabled it is in port 2, else ADD/FMA is 2/3 respectively */
+        bool write_fma, write_add;
+
+        /* Should we read with port 3? */
+        bool read_port3;
+
+        /* Packed uniform/constant */
+        uint8_t uniform_constant;
+
+        /* Whether writes are actually for the last instruction */
+        bool first_instruction;
+};
+
 /* A bi_bundle contains two paired instruction pointers. If a slot is unfilled,
  * leave it NULL; the emitter will fill in a nop.
  */