From 3db49491978a72eaea8b4735f0ba805dbc87b7d7 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 5 Aug 2019 11:22:49 -0700 Subject: [PATCH] pan/midgard: Extend SSA concurrency checks to other args No glmark changes, but this seems like a good idea. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index f59ef260d36..f69e86e2f46 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -72,23 +72,22 @@ can_run_concurrent_ssa(midgard_instruction *first, midgard_instruction *second) int source_mask = first->mask; /* As long as the second doesn't read from the first, we're okay */ - if (second->ssa_args.src[0] == source) { - if (first->type == TAG_ALU_4) { - /* Figure out which components we just read from */ - - int q = second->alu.src1; - midgard_vector_alu_src *m = (midgard_vector_alu_src *) &q; + for (unsigned i = 0; i < ARRAY_SIZE(second->ssa_args.src); ++i) { + if (second->ssa_args.src[i] != source) + continue; - /* Check if there are components in common, and fail if so */ - if (swizzle_to_access_mask(m->swizzle) & source_mask) - return false; - } else + if (first->type != TAG_ALU_4) return false; - } + /* Figure out which components we just read from */ - if (second->ssa_args.src[1] == source) - return false; + int q = (i == 0) ? second->alu.src1 : second->alu.src2; + midgard_vector_alu_src *m = (midgard_vector_alu_src *) &q; + + /* Check if there are components in common, and fail if so */ + if (swizzle_to_access_mask(m->swizzle) & source_mask) + return false; + } /* Otherwise, it's safe in that regard. Another data hazard is both * writing to the same place, of course */ -- 2.30.2