From edbdf4f4e7b9e356adbc2a05f15e00dceb5a56f6 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 9 Jun 2021 13:17:04 -0400 Subject: [PATCH] pan/mdg: Use more accurate ld/st reg estimates And assert that we got them right. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/midgard_schedule.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index de261d3..085d465 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -530,13 +530,21 @@ mir_pipeline_count(midgard_instruction *ins) /* Skip empty source */ if (ins->src[i] == ~0) continue; - unsigned bytemask = mir_bytemask_of_read_components_index(ins, i); - - unsigned max = util_logbase2(bytemask) + 1; - bytecount += max; + if (i == 0) { + /* First source is a vector, worst-case the mask */ + unsigned bytemask = mir_bytemask_of_read_components_index(ins, i); + unsigned max = util_logbase2(bytemask) + 1; + bytecount += max; + } else { + /* Sources 1 on are scalars */ + bytecount += 4; + } } - return DIV_ROUND_UP(bytecount, 16); + unsigned dwords = DIV_ROUND_UP(bytecount, 16); + assert(dwords <= 2); + + return dwords; } /* Matches FADD x, x with modifiers compatible. Since x + x = x * 2, for -- 2.7.4