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 <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5260>
This commit is contained in:
Alyssa Rosenzweig 2020-05-05 14:23:41 -04:00 committed by Marge Bot
parent 59f8f20306
commit 79f30d8a86
4 changed files with 45 additions and 44 deletions

View 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

View file

@ -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)
{

View 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);

View 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.
*/