diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c index f517557f743..f9fa637215c 100644 --- a/src/panfrost/bifrost/bi_print.c +++ b/src/panfrost/bifrost/bi_print.c @@ -347,7 +347,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp) fprintf(fp, "%s", bi_output_mod_name(ins->clamp)); if (bi_class_props[ins->type] & BI_ROUNDMODE) - fprintf(fp, "%s", bi_round_mode_name(ins->roundmode)); + fprintf(fp, "%s", bi_round_mode_name(ins->round)); if (ins->type == BI_BITWISE && ins->bitwise.dest_invert) fprintf(fp, ".not"); diff --git a/src/panfrost/bifrost/bi_print.h b/src/panfrost/bifrost/bi_print.h index 7b34378baf6..b19dd3a8457 100644 --- a/src/panfrost/bifrost/bi_print.h +++ b/src/panfrost/bifrost/bi_print.h @@ -34,7 +34,7 @@ const char * bi_message_type_name(enum bifrost_message_type T); const char * bi_output_mod_name(enum bi_clamp mod); const char * bi_minmax_mode_name(enum bifrost_minmax_mode mod); -const char * bi_round_mode_name(enum bifrost_roundmode mod); +const char * bi_round_mode_name(enum bi_round mod); const char * bi_interp_mode_name(enum bifrost_interp_mode mode); const char * bi_class_name(enum bi_class cl); const char * bi_cond_name(enum bi_cond cond); diff --git a/src/panfrost/bifrost/bi_print_common.c b/src/panfrost/bifrost/bi_print_common.c index e446a3a8f93..c64342c47cb 100644 --- a/src/panfrost/bifrost/bi_print_common.c +++ b/src/panfrost/bifrost/bi_print_common.c @@ -76,13 +76,13 @@ bi_minmax_mode_name(enum bifrost_minmax_mode mod) } const char * -bi_round_mode_name(enum bifrost_roundmode mod) +bi_round_mode_name(enum bi_round mod) { switch (mod) { - case BIFROST_RTE: return ""; - case BIFROST_RTP: return ".rtp"; - case BIFROST_RTN: return ".rtn"; - case BIFROST_RTZ: return ".rtz"; + case BI_ROUND_NONE: return ""; + case BI_ROUND_RTP: return ".rtp"; + case BI_ROUND_RTN: return ".rtn"; + case BI_ROUND_RTZ: return ".rtz"; default: return "invalid"; } } diff --git a/src/panfrost/bifrost/bi_print_common.h b/src/panfrost/bifrost/bi_print_common.h index 85cfa8e0979..daec5432416 100644 --- a/src/panfrost/bifrost/bi_print_common.h +++ b/src/panfrost/bifrost/bi_print_common.h @@ -33,7 +33,7 @@ const char * bi_message_type_name(enum bifrost_message_type T); const char * bi_output_mod_name(enum bi_clamp mod); const char * bi_minmax_mode_name(enum bifrost_minmax_mode mod); -const char * bi_round_mode_name(enum bifrost_roundmode mod); +const char * bi_round_mode_name(enum bi_round mod); const char * bi_interp_mode_name(enum bifrost_interp_mode mode); const char * bi_flow_control_name(enum bifrost_flow mode); diff --git a/src/panfrost/bifrost/bi_special.c b/src/panfrost/bifrost/bi_special.c index 8ee62e9e3ca..ffca2329df0 100644 --- a/src/panfrost/bifrost/bi_special.c +++ b/src/panfrost/bifrost/bi_special.c @@ -70,7 +70,7 @@ bi_emit_fexp2_new(bi_context *ctx, nir_alu_instr *instr) .dest_type = nir_type_int32, .src = { mscale.dest }, .src_types = { nir_type_float32 }, - .roundmode = BIFROST_RTE + .round = BI_ROUND_NONE }; /* FEXP2_FAST T, T, X */ @@ -113,7 +113,7 @@ bi_emit_flog2_new(bi_context *ctx, nir_alu_instr *instr) .dest_type = nir_type_float32, .src = { frexpe.dest }, .src_types = { nir_type_int32 }, - .roundmode = BIFROST_RTZ + .round = BI_ROUND_RTZ }; /* ADD_FREXPM (x-1), -1.0, X */ diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index e03e2212336..48410bc43b9 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -188,11 +188,11 @@ enum bi_clamp { BI_CLAMP_CLAMP_0_1 = 3, }; -enum bifrost_roundmode { - BIFROST_RTE = 0x0, /* round to even */ - BIFROST_RTP = 0x1, /* round to positive */ - BIFROST_RTN = 0x2, /* round to negative */ - BIFROST_RTZ = 0x3 /* round to zero */ +enum bi_round { + BI_ROUND_NONE = 0x0, /* round to even */ + BI_ROUND_RTP = 0x1, /* round to positive */ + BI_ROUND_RTN = 0x2, /* round to negative */ + BI_ROUND_RTZ = 0x3 /* round to zero */ }; /* NONE: Same as fmax() and fmin() -- return the other diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 9fa68eb332d..a7295a5687f 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -1330,16 +1330,16 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr) alu.cond = bi_cond_for_nir(instr->op, false); break; case nir_op_fround_even: - alu.roundmode = BIFROST_RTE; + alu.round = BI_ROUND_NONE; break; case nir_op_fceil: - alu.roundmode = BIFROST_RTP; + alu.round = BI_ROUND_RTP; break; case nir_op_ffloor: - alu.roundmode = BIFROST_RTN; + alu.round = BI_ROUND_RTN; break; case nir_op_ftrunc: - alu.roundmode = BIFROST_RTZ; + alu.round = BI_ROUND_RTZ; break; case nir_op_iand: alu.op.bitwise = BI_BITWISE_AND; @@ -1361,7 +1361,7 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr) break; case nir_op_f2i32: case nir_op_f2u32: - alu.roundmode = BIFROST_RTZ; + alu.round = BI_ROUND_RTZ; break; case nir_op_f2f16: @@ -1508,7 +1508,7 @@ bi_emit_array_index(bi_context *ctx, unsigned idx, nir_alu_type T, unsigned *c) /* OpenGL ES 3.2 specification section 8.14.2 ("Coordinate Wrapping and * Texel Selection") defines the layer to be taken from clamp(RNE(r), - * 0, dt - 1). So we use roundmode RTE, clamping is handled at the data + * 0, dt - 1). So we use round RTE, clamping is handled at the data * structure level */ bi_instruction f2i = { .type = BI_CONVERT, @@ -1517,7 +1517,7 @@ bi_emit_array_index(bi_context *ctx, unsigned idx, nir_alu_type T, unsigned *c) .src = { idx }, .src_types = { T }, .swizzle = { { 2 } }, - .roundmode = BIFROST_RTE + .round = BI_ROUND_NONE }; *c = 0; @@ -1550,7 +1550,7 @@ bi_emit_lod_88(bi_context *ctx, unsigned lod, bool fp16) .src = { lod, BIR_INDEX_CONSTANT, BIR_INDEX_ZERO }, .src_types = { T, nir_type_float32, nir_type_float32 }, .clamp = BI_CLAMP_CLAMP_M1_1, - .roundmode = BIFROST_RTE, + .round = BI_ROUND_NONE, .constant = { .u64 = fui(1.0 / max_lod) }, @@ -1563,7 +1563,7 @@ bi_emit_lod_88(bi_context *ctx, unsigned lod, bool fp16) .dest_type = T, .src = { fsat.dest, BIR_INDEX_CONSTANT, BIR_INDEX_ZERO }, .src_types = { nir_type_float32, nir_type_float32, nir_type_float32 }, - .roundmode = BIFROST_RTE, + .round = BI_ROUND_NONE, .constant = { .u64 = fui(max_lod * 256.0) }, @@ -1576,7 +1576,7 @@ bi_emit_lod_88(bi_context *ctx, unsigned lod, bool fp16) .dest_type = nir_type_int32, .src = { fmul.dest }, .src_types = { T }, - .roundmode = BIFROST_RTZ + .round = BI_ROUND_RTZ }; /* MKVEC.v2i16 s32.h0, #0 */ diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 42beea1a456..21e968e3ce8 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -94,7 +94,7 @@ extern unsigned bi_class_props[BI_NUM_CLASSES]; /* Accepts a bi_cond */ #define BI_CONDITIONAL (1 << 1) -/* Accepts a bifrost_roundmode */ +/* Accepts a bi_round */ #define BI_ROUNDMODE (1 << 2) /* Can be scheduled to FMA */ @@ -341,7 +341,7 @@ typedef struct { bool src_neg[BIR_SRC_COUNT]; /* Round mode (requires BI_ROUNDMODE) */ - enum bifrost_roundmode roundmode; + enum bi_round round; /* Destination type. Usually the type of the instruction * itself, but if sources and destination have different diff --git a/src/panfrost/bifrost/gen_pack.py b/src/panfrost/bifrost/gen_pack.py index bb4aca0abcd..3f188a076d6 100644 --- a/src/panfrost/bifrost/gen_pack.py +++ b/src/panfrost/bifrost/gen_pack.py @@ -88,19 +88,19 @@ def pack_widen(mod, opts, body, pack_exprs): def pack_absneg(mod, opts, body, pack_exprs): return 'ins->src_{}[{}]'.format(mod[0:-1] if mod[-1] in "0123" else mod, mod_arg(mod)) -# ins->roundmode is the native format (RTE/RTP/RTN/RTZ) for most ops. But there +# ins->round is the native format (RTE/RTP/RTN/RTZ) for most ops. But there # are some others we might encounter that we don't support in the IR at this # point, and there are a few that force a subset of round modes. def pack_round(mod, opts, body, pack_exprs): if opts == ['none', 'rtz']: - body.append('assert(ins->roundmode == BIFROST_RTE || ins->roundmode == BIFROST_RTZ);') - return '(ins->roundmode == BIFROST_RTZ) ? 1 : 0' + body.append('assert(ins->round == BI_ROUND_NONE || ins->round == BI_ROUND_RTZ);') + return '(ins->round == BI_ROUND_RTZ) ? 1 : 0' elif opts == ['rtn', 'rtp']: - body.append('assert(ins->roundmode == BIFROST_RTN || ins->roundmode == BIFROST_RTP);') - return '(ins->roundmode == BIFROST_RTP) ? 1 : 0' + body.append('assert(ins->round == BI_ROUND_RTN || ins->round == BI_ROUND_RTP);') + return '(ins->round == BI_ROUND_RTP) ? 1 : 0' elif opts[0:4] == ['none', 'rtp', 'rtn', 'rtz']: - return 'ins->roundmode' + return 'ins->round' else: assert False