From: Alyssa Rosenzweig Date: Tue, 14 Apr 2020 16:21:25 +0000 (-0400) Subject: pan/bi: Add BI_TABLE for fast table accesses X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=af01378dce1873c520c52a536ee7d1731c18105d;p=mesa.git pan/bi: Add BI_TABLE for fast table accesses Used to implement SPECIAL ops. Separate class since they are faster which means you can pair them with actual work on FMA. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index d42b6d9fbd8..822d1ff10d9 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -1140,6 +1140,7 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs) return bi_pack_add_st_vary(clause, bundle.add, regs); case BI_SPECIAL: return bi_pack_add_special(bundle.add, regs); + case BI_TABLE: case BI_SWIZZLE: case BI_TEX: case BI_ROUND: diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c index 0b3af8a00c9..c9e6beb1249 100644 --- a/src/panfrost/bifrost/bi_print.c +++ b/src/panfrost/bifrost/bi_print.c @@ -152,6 +152,7 @@ bi_class_name(enum bi_class cl) case BI_STORE_VAR: return "store_var"; case BI_SPECIAL: return "special"; case BI_SWIZZLE: return "swizzle"; + case BI_TABLE: return "table"; case BI_TEX: return "tex"; case BI_ROUND: return "round"; default: return "unknown_class"; @@ -251,6 +252,15 @@ bi_bitwise_op_name(enum bi_bitwise_op op) } } +const char * +bi_table_op_name(enum bi_table_op op) +{ + switch (op) { + case BI_TABLE_LOG2_U_OVER_U_1_LOW: return "log2.help"; + default: return "invalid"; + } +} + const char * bi_special_op_name(enum bi_special_op op) { @@ -326,6 +336,8 @@ bi_print_instruction(bi_instruction *ins, FILE *fp) fprintf(fp, ins->op.round == BI_ROUND_MODE ? "roundMode": "round"); else if (ins->type == BI_SPECIAL) 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_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 07632c9ab54..050547add29 100644 --- a/src/panfrost/bifrost/bi_print.h +++ b/src/panfrost/bifrost/bi_print.h @@ -41,6 +41,7 @@ const char * bi_ldst_type_name(enum bifrost_ldst_type type); 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); 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 81511a9a147..88dd7136653 100644 --- a/src/panfrost/bifrost/bi_tables.c +++ b/src/panfrost/bifrost/bi_tables.c @@ -52,6 +52,7 @@ unsigned bi_class_props[BI_NUM_CLASSES] = { [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_TABLE] = BI_SCHED_ADD, [BI_SWIZZLE] = BI_SCHED_ALL | BI_SWIZZLABLE, [BI_TEX] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR, [BI_ROUND] = BI_GENERIC | BI_ROUNDMODE | BI_SCHED_ALL, diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 6a75de7fdc0..64baf8cc4c7 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -71,8 +71,9 @@ enum bi_class { BI_SHIFT, BI_STORE, BI_STORE_VAR, - BI_SPECIAL, /* _FAST, _TABLE on supported GPUs */ + BI_SPECIAL, /* _FAST on supported GPUs */ BI_SWIZZLE, + BI_TABLE, BI_TEX, BI_ROUND, BI_NUM_CLASSES @@ -182,6 +183,15 @@ enum bi_round_op { BI_ROUND_ROUND /* i.e.: fround() */ }; +enum bi_table_op { + /* fp32 log2() with low precision, suitable for GL or half_log2() in + * CL. In the first argument, takes x. Letting u be such that x = + * 2^{-m} u with m integer and 0.75 <= u < 1.5, returns + * log2(u) / (u - 1). */ + + BI_TABLE_LOG2_U_OVER_U_1_LOW, +}; + enum bi_special_op { BI_SPECIAL_FRCP, BI_SPECIAL_FRSQ, @@ -244,6 +254,7 @@ typedef struct { enum bi_bitwise_op bitwise; enum bi_round_op round; enum bi_special_op special; + enum bi_table_op table; enum bi_cond compare; } op;