diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-03-30 12:25:20 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-31 01:12:26 +0000 |
commit | bd19e7634027036dfc67633579750f1d45a45b74 (patch) | |
tree | 8c38f1f77f5cbb8097359b913300794d4de1e4be /src/panfrost/bifrost/bi_schedule.c | |
parent | c88f816169cf2efa0bfcbe1e9a5b0c7948fb1ade (diff) |
pan/bi: Handle fp16/abs scheduling restriction
See previous commit for the packing side. Here we update the scheduler
to accomodate this. Note we don't actually hit this path yet, but it's
good to be proactive.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4382>
Diffstat (limited to 'src/panfrost/bifrost/bi_schedule.c')
-rw-r--r-- | src/panfrost/bifrost/bi_schedule.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index f112553c05a..0f72fc12713 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -71,6 +71,24 @@ bi_clause_type_for_ins(bi_instruction *ins) } } +/* There is an encoding restriction against FMA fp16 add/min/max + * having both sources with abs(..) with a duplicated source. This is + * due to the packing being order-sensitive, so the ports must end up distinct + * to handle both having abs(..). The swizzle doesn't matter here. Note + * BIR_INDEX_REGISTER generally should not be used pre-schedule (TODO: enforce + * this). + */ + +static bool +bi_ambiguous_abs(bi_instruction *ins) +{ + bool classy = bi_class_props[ins->type] & BI_NO_ABS_ABS_FP16_FMA; + bool typey = ins->dest_type == nir_type_float16; + bool absy = ins->src_abs[0] && ins->src_abs[1]; + + return classy && typey && absy; +} + /* Eventually, we'll need a proper scheduling, grouping instructions * into clauses and ordering/assigning grouped instructions to the * appropriate FMA/ADD slots. Right now we do the dumbest possible @@ -95,7 +113,16 @@ bi_schedule(bi_context *ctx) bi_clause *u = rzalloc(ctx, bi_clause); u->bundle_count = 1; - if (props & BI_SCHED_FMA) + /* Check for scheduling restrictions */ + + bool can_fma = props & BI_SCHED_FMA; + bool can_add = props & BI_SCHED_ADD; + + can_fma &= !bi_ambiguous_abs(ins); + + assert(can_fma || can_add); + + if (can_fma) u->bundles[0].fma = ins; else u->bundles[0].add = ins; |