From: Alyssa Rosenzweig Date: Tue, 5 May 2020 18:23:41 +0000 (-0400) Subject: pan/bi: Move bi_registers to common IR structures X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=79f30d8a86e9f9fe0f542c75f8ebf2e617f13135;p=mesa.git pan/bi: Move bi_registers to common IR structures Port assignments are critical to scheduling, this can't just live in bi_pack. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index 5719e66a58d..852dd07a136 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -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 diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c index 1d2807f2262..8c78aa91348 100644 --- a/src/panfrost/bifrost/bi_print.c +++ b/src/panfrost/bifrost/bi_print.c @@ -411,6 +411,27 @@ bi_print_instruction(bi_instruction *ins, FILE *fp) fprintf(fp, "\n"); } +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) { diff --git a/src/panfrost/bifrost/bi_print.h b/src/panfrost/bifrost/bi_print.h index dfc916a593c..294d69ea55e 100644 --- a/src/panfrost/bifrost/bi_print.h +++ b/src/panfrost/bifrost/bi_print.h @@ -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); diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index ed3c3572f8a..349aff48cef 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -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. */