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@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>
This commit is contained in:
Boris Brezillon 2020-10-28 13:27:07 +01:00 committed by Marge Bot
parent 20cc63815c
commit 0ed8eee706
8 changed files with 14 additions and 10 deletions

View file

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

View file

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

View file

@ -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,

View file

@ -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,

View file

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

View file

@ -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,

View file

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

View file

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