diff options
author | Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> | 2021-02-10 12:39:09 -0500 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-02-11 17:24:37 +0000 |
commit | e9572ff3e98273680248735c060bf0d7589ad814 (patch) | |
tree | 469b806072ff28929a333c6b8030993e5a0251fc | |
parent | 0f27e24934ea55b614eb90d36ff8e2abd5cc4841 (diff) |
pan/bi: Generalize bi_update_fau with fast zero
Ensure we don't fall over if we have an instruction like
FADD.f32 u0, #0
In this case, the tuple's FAU requirement implies the instruction can be
scheduler without lowering to the FMA slot but not the ADD slot.
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/8973>
-rw-r--r-- | src/panfrost/bifrost/bi_schedule.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index be52c5c68b8..470a2a41a75 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -423,8 +423,9 @@ bi_space_for_more_constants(struct bi_clause_state *clause) } /* Updates the FAU assignment for a tuple. A valid FAU assignment must be - * possible (as a precondition); this is gauranteed per-instruction by - * bi_lower_fau and per-tuple by bi_instr_schedulable */ + * possible (as a precondition), though not necessarily on the selected unit; + * this is gauranteed per-instruction by bi_lower_fau and per-tuple by + * bi_instr_schedulable */ static bool bi_update_fau(struct bi_clause_state *clause, @@ -435,6 +436,7 @@ bi_update_fau(struct bi_clause_state *clause, uint32_t copied_constants[2], copied_count; unsigned *constant_count = &tuple->constant_count; uint32_t *constants = tuple->constants; + enum bir_fau fau = tuple->fau; if (!destructive) { memcpy(copied_constants, tuple->constants, @@ -450,7 +452,7 @@ bi_update_fau(struct bi_clause_state *clause, if (src.type == BI_INDEX_FAU) { bool no_constants = *constant_count == 0; - bool no_other_fau = (tuple->fau == src.value) || !tuple->fau; + bool no_other_fau = (fau == src.value) || !fau; bool mergable = no_constants && no_other_fau; if (destructive) { @@ -459,6 +461,8 @@ bi_update_fau(struct bi_clause_state *clause, } else if (!mergable) { return false; } + + fau = src.value; } else if (src.type == BI_INDEX_CONSTANT) { /* No need to reserve space if we have a fast 0 */ if (src.value == 0 && fma && bi_reads_zero(instr)) @@ -478,7 +482,7 @@ bi_update_fau(struct bi_clause_state *clause, if (found && !pcrel) continue; - bool no_fau = (*constant_count > 0) || !tuple->fau; + bool no_fau = (*constant_count > 0) || !fau; bool mergable = no_fau && ((*constant_count) < 2); if (destructive) { |