aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/panfrost/bifrost/bi_print.c11
-rw-r--r--src/panfrost/bifrost/bi_print.h1
-rw-r--r--src/panfrost/bifrost/bi_tables.c1
-rw-r--r--src/panfrost/bifrost/compiler.h9
-rw-r--r--src/panfrost/bifrost/disassemble.c1
5 files changed, 23 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c
index 2e6ef452899..2ce6e7c7158 100644
--- a/src/panfrost/bifrost/bi_print.c
+++ b/src/panfrost/bifrost/bi_print.c
@@ -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
diff --git a/src/panfrost/bifrost/bi_print.h b/src/panfrost/bifrost/bi_print.h
index 050547add29..816ceeb50b2 100644
--- a/src/panfrost/bifrost/bi_print.h
+++ b/src/panfrost/bifrost/bi_print.h
@@ -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);
diff --git a/src/panfrost/bifrost/bi_tables.c b/src/panfrost/bifrost/bi_tables.c
index 88dd7136653..62c0ab85100 100644
--- a/src/panfrost/bifrost/bi_tables.c
+++ b/src/panfrost/bifrost/bi_tables.c
@@ -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,
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 90f0e94a6e0..06ef51bafbd 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -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;
diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c
index 3d7d6e40d90..fe5c2220e5e 100644
--- a/src/panfrost/bifrost/disassemble.c
+++ b/src/panfrost/bifrost/disassemble.c
@@ -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 },
};