pan/bi: Add op for ADD_FREXPM

Used in log2. Needs a new class as well due to scheduling silliness.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4615>
This commit is contained in:
Alyssa Rosenzweig
2020-04-14 12:33:08 -04:00
parent cc61156626
commit 62c8c3445e
5 changed files with 23 additions and 0 deletions

View File

@@ -272,6 +272,15 @@ bi_special_op_name(enum bi_special_op op)
}
}
const char *
bi_reduce_op_name(enum bi_reduce_op op)
{
switch (op) {
case BI_REDUCE_ADD_FREXPM: return "add_frexpm";
default: return "invalid";
}
}
static void
bi_print_load_vary(struct bi_load_vary *load, FILE *fp)
{
@@ -339,6 +348,8 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
fprintf(fp, "%s", bi_special_op_name(ins->op.special));
else if (ins->type == BI_TABLE)
fprintf(fp, "%s", bi_table_op_name(ins->op.table));
else if (ins->type == BI_REDUCE_FMA)
fprintf(fp, "%s", bi_reduce_op_name(ins->op.reduce));
else if (ins->type == BI_CMP)
fprintf(fp, "%s", bi_cond_name(ins->op.compare));
else

View File

@@ -42,6 +42,7 @@ const char * bi_class_name(enum bi_class cl);
const char * bi_cond_name(enum bi_cond cond);
const char * bi_special_op_name(enum bi_special_op op);
const char * bi_table_op_name(enum bi_table_op op);
const char * bi_reduce_op_name(enum bi_reduce_op op);
void bi_print_instruction(bi_instruction *ins, FILE *fp);
void bi_print_bundle(bi_bundle *bundle, FILE *fp);

View File

@@ -48,6 +48,7 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
[BI_MINMAX] = BI_GENERIC | BI_SCHED_ADD | BI_NO_ABS_ABS_FP16_FMA | BI_MODS, /* | FMA on some? */
[BI_MOV] = BI_SCHED_ALL,
[BI_FMOV] = BI_MODS | BI_SCHED_ALL,
[BI_REDUCE_FMA] = BI_SCHED_FMA,
[BI_SHIFT] = BI_SCHED_ALL,
[BI_STORE] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_SRC,
[BI_STORE_VAR] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_SRC,

View File

@@ -68,6 +68,7 @@ enum bi_class {
BI_LOAD_VAR_ADDRESS,
BI_MINMAX,
BI_MOV,
BI_REDUCE_FMA,
BI_SHIFT,
BI_STORE,
BI_STORE_VAR,
@@ -192,6 +193,13 @@ enum bi_table_op {
BI_TABLE_LOG2_U_OVER_U_1_LOW,
};
enum bi_reduce_op {
/* Takes two fp32 arguments and returns x + frexp(y). Used in
* low-precision log2 argument reduction on newer models. */
BI_REDUCE_ADD_FREXPM,
};
enum bi_special_op {
BI_SPECIAL_FRCP,
BI_SPECIAL_FRSQ,
@@ -259,6 +267,7 @@ typedef struct {
enum bi_bitwise_op bitwise;
enum bi_round_op round;
enum bi_special_op special;
enum bi_reduce_op reduce;
enum bi_table_op table;
enum bi_cond compare;
} op;

View File

@@ -553,6 +553,7 @@ static const struct fma_op_info FMAOpInfos[] = {
{ true, 0x01e08, "SEL.YX.i16", FMA_TWO_SRC },
{ true, 0x01e10, "SEL.XY.i16", FMA_TWO_SRC },
{ true, 0x01e18, "SEL.YY.i16", FMA_TWO_SRC },
{ true, 0x01e80, "ADD_FREXPM.f32", FMA_TWO_SRC },
{ true, 0x00800, "IMAD", FMA_THREE_SRC },
{ true, 0x078db, "POPCNT", FMA_ONE_SRC },
};