aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-18 12:18:30 -0400
committerMarge Bot <[email protected]>2020-03-19 03:23:07 +0000
commit42af9f47c8a91caad6803fdaccf111053e9303c4 (patch)
tree6a3c61c21dec29663bcfc7691bc3eb636497b794
parentd4fbf751cfb863ee4b8e7963c0c37961519da774 (diff)
pan/bi: Route through clause header
We already track almost all the information we need, let's dump it onto the wire now. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4242>
-rw-r--r--src/panfrost/bifrost/bi_pack.c25
-rw-r--r--src/panfrost/bifrost/compiler.h6
2 files changed, 26 insertions, 5 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index 65218b23010..2f961650d3e 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -34,11 +34,19 @@
* bits on the wire (as well as fixup branches) */
static uint64_t
-bi_pack_header(bi_clause *clause, bi_clause *next)
+bi_pack_header(bi_clause *clause, bi_clause *next, bool is_fragment)
{
struct bifrost_header header = {
- /* stub */
+ .back_to_back = clause->back_to_back,
.no_end_of_shader = (next != NULL),
+ .elide_writes = is_fragment,
+ .branch_cond = clause->branch_conditional,
+ .datareg_writebarrier = clause->data_register_write_barrier,
+ .datareg = clause->data_register,
+ .scoreboard_deps = clause->dependencies,
+ .scoreboard_index = clause->scoreboard_id,
+ .clause_type = clause->clause_type,
+ .next_clause_type = next ? next->clause_type : 0,
};
uint64_t u = 0;
@@ -384,7 +392,7 @@ bi_pack_fma(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
}
static unsigned
-bi_pack_add_ld_vary(bi_instruction *ins, struct bi_registers *regs)
+bi_pack_add_ld_vary(bi_clause *clause, bi_instruction *ins, struct bi_registers *regs)
{
unsigned size = nir_alu_type_get_type_size(ins->dest_type);
assert(size == 32 || size == 16);
@@ -408,6 +416,10 @@ bi_pack_add_ld_vary(bi_instruction *ins, struct bi_registers *regs)
packed_addr = bi_get_src(ins, regs, 0, false) | 0b11000;
}
+ /* The destination is thrown in the data register */
+ assert(ins->dest & BIR_INDEX_REGISTER);
+ clause->data_register = ins->dest & ~BIR_INDEX_REGISTER;
+
assert(channels >= 1 && channels <= 4);
struct bifrost_ld_var pack = {
@@ -445,7 +457,7 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
case BI_LOAD_ATTR:
return BIFROST_ADD_NOP;
case BI_LOAD_VAR:
- return bi_pack_add_ld_vary(bundle.add, regs);
+ return bi_pack_add_ld_vary(clause, bundle.add, regs);
case BI_LOAD_VAR_ADDRESS:
case BI_MINMAX:
case BI_MOV:
@@ -492,9 +504,12 @@ bi_pack_clause(bi_context *ctx, bi_clause *clause, bi_clause *next,
struct bi_packed_bundle ins_1 = bi_pack_bundle(clause, clause->bundles[0], clause->bundles[0], true);
assert(clause->bundle_count == 1);
+ /* Used to decide if we elide writes */
+ bool is_fragment = ctx->stage == MESA_SHADER_FRAGMENT;
+
struct bifrost_fmt1 quad_1 = {
.tag = BIFROST_FMT1_FINAL,
- .header = bi_pack_header(clause, next),
+ .header = bi_pack_header(clause, next, is_fragment),
.ins_1 = ins_1.lo,
.ins_2 = ins_1.hi & ((1 << 11) - 1),
.ins_0 = (ins_1.hi >> 11) & 0b111,
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 2d3633502ec..3c84c2671d5 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -307,12 +307,18 @@ typedef struct {
bool back_to_back;
bool branch_conditional;
+ /* Assigned data register */
+ unsigned data_register;
+
/* Corresponds to the usual bit but shifted by a clause */
bool data_register_write_barrier;
/* Constants read by this clause. ISA limit. */
uint64_t constants[8];
unsigned constant_count;
+
+ /* What type of high latency instruction is here, basically */
+ unsigned clause_type;
} bi_clause;
typedef struct bi_block {