pan/bi: Use canonical next_clause_prefetch

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-02 13:46:35 -04:00
parent 6c1cabc288
commit 4131bc3b0c
6 changed files with 22 additions and 18 deletions

View File

@ -48,7 +48,7 @@ bi_pack_header(bi_clause *clause, bi_clause *next_1, bi_clause *next_2, bool is_
.back_to_back = clause->back_to_back,
.no_end_of_shader = (next_1 != NULL),
.terminate_discarded_threads = is_fragment,
.branch_cond = clause->branch_conditional || clause->back_to_back,
.next_clause_prefetch = clause->next_clause_prefetch,
.datareg_writebarrier = clause->data_register_write_barrier,
.datareg = clause->data_register,
.scoreboard_deps = scoreboard_deps,
@ -59,8 +59,6 @@ bi_pack_header(bi_clause *clause, bi_clause *next_1, bi_clause *next_2, bool is_
.suppress_nan = true,
};
header.branch_cond |= header.back_to_back;
uint64_t u = 0;
memcpy(&u, &header, sizeof(header));
return u;

View File

@ -410,7 +410,10 @@ bi_print_clause(bi_clause *clause, FILE *fp)
}
if (!clause->back_to_back)
fprintf(fp, " nbb %s", clause->branch_conditional ? "branch-cond" : "branch-uncond");
fprintf(fp, " nbb");
if (!clause->next_clause_prefetch)
fprintf(fp, " no_prefetch");
if (clause->data_register_write_barrier)
fprintf(fp, " drwb");

View File

@ -227,11 +227,13 @@ bi_schedule(bi_context *ctx)
u->constants[0] = ins->constant.u64;
/* No indirect jumps yet */
if (ins->type == BI_BRANCH) {
if (ins->type == BI_BRANCH)
u->branch_constant = true;
u->branch_conditional =
(ins->cond != BI_COND_ALWAYS);
}
/* We always prefetch except unconditional branches */
u->next_clause_prefetch = !(
(ins->type == BI_BRANCH) &&
(ins->cond == BI_COND_ALWAYS));
u->clause_type = bi_clause_type_for_ins(ins);
u->block = (struct bi_block *) block;

View File

@ -88,11 +88,10 @@ struct bifrost_header {
* for fragment shaders for standard GL behaviour of DISCARD. */
unsigned terminate_discarded_threads : 1;
// If backToBack is off:
// - true for conditional branches and fallthrough
// - false for unconditional branches
// The blob seems to always set it to true if back-to-back is on.
unsigned branch_cond : 1;
/* If set, the hardware may prefetch the next clause. If false, the
* hardware may not. Clear for unconditional branches. */
unsigned next_clause_prefetch : 1;
// This bit is set when the next clause writes to the data register of some
// previous clause.
unsigned datareg_writebarrier: 1;

View File

@ -400,7 +400,10 @@ typedef struct {
* the emitted code it's always set if back-to-bit is, whereas we use
* the actual value (without back-to-back so to speak) internally */
bool back_to_back;
bool branch_conditional;
/* Can we prefetch the next clause? Usually it makes sense, except for
* clauses ending in unconditional branches */
bool next_clause_prefetch;
/* Assigned data register */
unsigned data_register;

View File

@ -109,10 +109,6 @@ static void dump_header(FILE *fp, struct bifrost_header header, bool verbose)
if (!header.back_to_back) {
fprintf(fp, "nbb ");
if (header.branch_cond)
fprintf(fp, "branch-cond ");
else
fprintf(fp, "branch-uncond ");
}
if (header.suppress_inf)
@ -146,6 +142,9 @@ static void dump_header(FILE *fp, struct bifrost_header header, bool verbose)
if (header.terminate_discarded_threads)
fprintf(fp, "td ");
if (header.next_clause_prefetch)
fprintf(fp, "ncph ");
fprintf(fp, "\n");
if (verbose) {