pan/bi: Use canonical texture op names in IR

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
This commit is contained in:
Alyssa Rosenzweig 2020-10-06 10:31:04 -04:00
parent 93f9052935
commit 6ed1bdfee4
8 changed files with 29 additions and 41 deletions

View File

@ -853,17 +853,17 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, bi_registers *regs, gl_shader_s
case BI_SELECT:
assert(nir_alu_type_get_type_size(bundle.add->src_types[0]) == 16);
return pan_pack_add_mkvec_v2i16(clause, bundle.add, regs);
case BI_TEX:
if (bundle.add->op.texture == BI_TEX_COMPACT) {
assert(f16 || f32);
case BI_TEXC:
case BI_TEXC_DUAL:
unreachable("Packing todo");
case BI_TEXS:
assert(f16 || f32);
if (f16)
return pan_pack_add_texs_2d_f16(clause, bundle.add, regs);
else
return pan_pack_add_texs_2d_f32(clause, bundle.add, regs);
} else
unreachable("Unknown tex type");
case BI_ROUND:
if (f16)
return pan_pack_add_texs_2d_f16(clause, bundle.add, regs);
else
return pan_pack_add_texs_2d_f32(clause, bundle.add, regs);
case BI_ROUND:
unreachable("Packing todo");
default:
unreachable("Cannot encode class as ADD");

View File

@ -69,7 +69,9 @@ bi_class_name(enum bi_class cl)
case BI_STORE_VAR: return "store_var";
case BI_SPECIAL: return "special";
case BI_TABLE: return "table";
case BI_TEX: return "tex";
case BI_TEXS: return "texs";
case BI_TEXC: return "texc";
case BI_TEXC_DUAL: return "texc_dual";
case BI_ROUND: return "round";
case BI_IMUL: return "imul";
default: return "unknown_class";
@ -205,17 +207,6 @@ bi_frexp_op_name(enum bi_frexp_op op)
}
}
const char *
bi_tex_op_name(enum bi_tex_op op)
{
switch (op) {
case BI_TEX_NORMAL: return "normal";
case BI_TEX_COMPACT: return "compact";
case BI_TEX_DUAL: return "dual";
default: return "invalid";
}
}
static void
bi_print_load_vary(struct bi_load_vary *load, FILE *fp)
{
@ -280,9 +271,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
bi_print_load_vary(&ins->load_vary, fp);
else if (ins->type == BI_BLEND)
fprintf(fp, ".loc%u", ins->blend_location);
else if (ins->type == BI_TEX) {
fprintf(fp, ".%s", bi_tex_op_name(ins->op.texture));
} else if (ins->type == BI_BITWISE)
else if (ins->type == BI_BITWISE)
fprintf(fp, ".%cshift", ins->bitwise.rshift ? 'r' : 'l');
if (bi_class_props[ins->type] & BI_CONDITIONAL)
@ -336,7 +325,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
} else {
fprintf(fp, "-> void");
}
} else if (ins->type == BI_TEX) {
} else if (ins->type == BI_TEXS) {
bi_print_texture(&ins->texture, fp);
}

View File

@ -42,7 +42,6 @@ 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);
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_slots(bi_registers *regs, FILE *fp);

View File

@ -62,7 +62,9 @@ bi_message_type_for_ins(bi_instruction *ins)
case BI_LOAD_VAR_ADDRESS:
return BIFROST_MESSAGE_ATTRIBUTE;
case BI_TEX:
case BI_TEXS:
case BI_TEXC:
case BI_TEXC_DUAL:
return BIFROST_MESSAGE_TEX;
case BI_LOAD:

View File

@ -54,7 +54,9 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
[BI_SPECIAL] = BI_SCHED_ADD | BI_SCHED_SLOW,
[BI_TABLE] = BI_SCHED_ADD,
[BI_SELECT] = BI_SCHED_ALL | BI_SWIZZLABLE,
[BI_TEX] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
[BI_TEXS] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
[BI_TEXC] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
[BI_TEXC_DUAL] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
[BI_ROUND] = BI_ROUNDMODE | BI_SCHED_ALL,
[BI_IMUL] = BI_SCHED_FMA,
};

View File

@ -951,15 +951,14 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
bi_emit(ctx, alu);
}
/* TEX_COMPACT instructions assume normal 2D f32 operation but are more
/* TEXS instructions assume normal 2D f32 operation but are more
* space-efficient and with simpler RA/scheduling requirements*/
static void
emit_tex_compact(bi_context *ctx, nir_tex_instr *instr)
{
bi_instruction tex = {
.type = BI_TEX,
.op = { .texture = BI_TEX_COMPACT },
.type = BI_TEXS,
.texture = {
.texture_index = instr->texture_index,
.sampler_index = instr->sampler_index,

View File

@ -74,7 +74,9 @@ enum bi_class {
BI_STORE_VAR,
BI_SPECIAL, /* _FAST on supported GPUs */
BI_TABLE,
BI_TEX,
BI_TEXS,
BI_TEXC,
BI_TEXC_DUAL,
BI_ROUND,
BI_IMUL,
BI_NUM_CLASSES
@ -231,12 +233,6 @@ enum bi_special_op {
BI_SPECIAL_IABS,
};
enum bi_tex_op {
BI_TEX_NORMAL,
BI_TEX_COMPACT,
BI_TEX_DUAL
};
struct bi_bitwise {
bool dest_invert;
bool src1_invert;
@ -320,7 +316,6 @@ typedef struct {
enum bi_reduce_op reduce;
enum bi_table_op table;
enum bi_frexp_op frexp;
enum bi_tex_op texture;
enum bi_imath_op imath;
enum bi_imul_op imul;

View File

@ -666,7 +666,9 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA)
case BI_LOAD:
case BI_STORE:
case BI_STORE_VAR:
case BI_TEX:
case BI_TEXS:
case BI_TEXC:
case BI_TEXC_DUAL:
unreachable("Unsupported I/O in interpreter");
default: