Mesa (master): pan/bi: Split special class in two

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 3 14:55:05 UTC 2020


Module: Mesa
Branch: master
Commit: 0ed8eee706927a83794508986c6534d64cbd2379
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ed8eee706927a83794508986c6534d64cbd2379

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Wed Oct 28 13:27:07 2020 +0100

pan/bi: Split special class in two

Some special instructions are scheduled on the FMA unit, let's add a
new class for this case and rename the old one accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

---

 src/panfrost/bifrost/bi_pack.c           | 2 +-
 src/panfrost/bifrost/bi_print.c          | 5 +++--
 src/panfrost/bifrost/bi_special.c        | 2 +-
 src/panfrost/bifrost/bi_tables.c         | 3 ++-
 src/panfrost/bifrost/bifrost_compile.c   | 4 ++--
 src/panfrost/bifrost/compiler.h          | 3 ++-
 src/panfrost/bifrost/test/bi_interpret.c | 3 ++-
 src/panfrost/bifrost/test/bi_test_pack.c | 2 +-
 8 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index fbf7bcbf493..044452df04f 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -872,7 +872,7 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, bi_registers *regs, gl_shader_s
                 }
         case BI_STORE_VAR:
                 return pan_pack_add_st_cvt(clause, bundle.add, regs);
-        case BI_SPECIAL:
+        case BI_SPECIAL_ADD:
                 return bi_pack_add_special(clause, bundle.add, regs);
         case BI_TABLE:
                 assert(bundle.add->dest_type == nir_type_float32);
diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c
index 447f89982ce..ea0b61a8581 100644
--- a/src/panfrost/bifrost/bi_print.c
+++ b/src/panfrost/bifrost/bi_print.c
@@ -68,7 +68,8 @@ bi_class_name(enum bi_class cl)
         case BI_SELECT: return "select";
         case BI_STORE: return "store";
         case BI_STORE_VAR: return "store_var";
-        case BI_SPECIAL: return "special";
+        case BI_SPECIAL_ADD: return "special";
+        case BI_SPECIAL_FMA: return "special";
         case BI_TABLE: return "table";
         case BI_TEXS: return "texs";
         case BI_TEXC: return "texc";
@@ -256,7 +257,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
                 fprintf(fp, "%s", bi_bitwise_op_name(ins->op.bitwise));
         else if (ins->type == BI_IMATH)
                 fprintf(fp, "%s", bi_imath_op_name(ins->op.imath));
-        else if (ins->type == BI_SPECIAL)
+        else if (ins->type == BI_SPECIAL_ADD || ins->type == BI_SPECIAL_FMA)
                 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));
diff --git a/src/panfrost/bifrost/bi_special.c b/src/panfrost/bifrost/bi_special.c
index 16e4d2eb892..13ce3abd13a 100644
--- a/src/panfrost/bifrost/bi_special.c
+++ b/src/panfrost/bifrost/bi_special.c
@@ -76,7 +76,7 @@ bi_emit_fexp2_new(bi_context *ctx, nir_alu_instr *instr)
         /* FEXP2_FAST T, T, X */
 
         bi_instruction fexp = {
-                .type = BI_SPECIAL,
+                .type = BI_SPECIAL_ADD,
                 .op = { .special = BI_SPECIAL_EXP2_LOW },
                 .dest = pan_dest_index(&instr->dest.dest),
                 .dest_type = nir_type_float32,
diff --git a/src/panfrost/bifrost/bi_tables.c b/src/panfrost/bifrost/bi_tables.c
index 19352e5faf7..261786128c1 100644
--- a/src/panfrost/bifrost/bi_tables.c
+++ b/src/panfrost/bifrost/bi_tables.c
@@ -52,7 +52,8 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
         [BI_REDUCE_FMA]         = BI_SCHED_FMA,
         [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,
-        [BI_SPECIAL] 		= BI_SCHED_ADD | BI_SCHED_SLOW,
+        [BI_SPECIAL_ADD]	= BI_SCHED_ADD | BI_SCHED_SLOW,
+        [BI_SPECIAL_FMA]	= BI_SCHED_FMA | BI_SCHED_SLOW,
         [BI_TABLE]              = BI_SCHED_ADD,
         [BI_SELECT]             = BI_SCHED_ALL | BI_SWIZZLABLE,
         [BI_TEXS] 		= BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index c2aa43d66ce..5ecfe7d46ac 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -836,7 +836,7 @@ bi_class_for_nir_alu(nir_op op)
         case nir_op_frcp:
         case nir_op_frsq:
         case nir_op_iabs:
-                return BI_SPECIAL;
+                return BI_SPECIAL_ADD;
 
         default:
                 unreachable("Unknown ALU op");
@@ -984,7 +984,7 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
         };
 
         /* TODO: Implement lowering of special functions for older Bifrost */
-        assert((alu.type != BI_SPECIAL) || !(ctx->quirks & BIFROST_NO_FAST_OP));
+        assert(alu.type != BI_SPECIAL_ADD || !(ctx->quirks & BIFROST_NO_FAST_OP));
 
         unsigned comps = nir_dest_num_components(instr->dest.dest);
         bool vector = comps > MAX2(1, 32 / nir_dest_bit_size(instr->dest.dest));
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 176f7fd858a..1cb936cfd41 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -73,7 +73,8 @@ enum bi_class {
         BI_SELECT,
         BI_STORE,
         BI_STORE_VAR,
-        BI_SPECIAL, /* _FAST on supported GPUs */
+        BI_SPECIAL_ADD, /* _FAST on supported GPUs */
+        BI_SPECIAL_FMA, /* _FAST on supported GPUs */
         BI_TABLE,
         BI_TEXS,
         BI_TEXC,
diff --git a/src/panfrost/bifrost/test/bi_interpret.c b/src/panfrost/bifrost/test/bi_interpret.c
index bc2aa327225..b975a1ddeab 100644
--- a/src/panfrost/bifrost/test/bi_interpret.c
+++ b/src/panfrost/bifrost/test/bi_interpret.c
@@ -582,7 +582,8 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA)
                 break;
         }
 
-        case BI_SPECIAL: {
+        case BI_SPECIAL_FMA:
+        case BI_SPECIAL_ADD: {
                 assert(nir_alu_type_get_base_type(ins->dest_type) == nir_type_float);
                 assert(ins->dest_type != nir_type_float64);
 
diff --git a/src/panfrost/bifrost/test/bi_test_pack.c b/src/panfrost/bifrost/test/bi_test_pack.c
index e95577989d9..a564689578b 100644
--- a/src/panfrost/bifrost/test/bi_test_pack.c
+++ b/src/panfrost/bifrost/test/bi_test_pack.c
@@ -295,7 +295,7 @@ static void
 bit_special_helper(struct panfrost_device *dev,
                 unsigned size, uint32_t *input, enum bit_debug debug)
 {
-        bi_instruction ins = bit_ins(BI_SPECIAL, 2, nir_type_float, size);
+        bi_instruction ins = bit_ins(BI_SPECIAL_ADD, 2, nir_type_float, size);
         uint32_t exp_input[4];
 
         for (enum bi_special_op op = BI_SPECIAL_FRCP; op <= BI_SPECIAL_EXP2_LOW; ++op) {



More information about the mesa-commit mailing list