summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiang Yu <yuq825@gmail.com>2017-10-15 09:59:02 +0800
committerQiang Yu <yuq825@gmail.com>2017-10-15 10:06:32 +0800
commit72aee17192ea36bc94eb7b8d04baf504ce78aa69 (patch)
tree1e70f7dd0b02e2fdc89d5adc51576ea9bcfcc511
parentf120eb42dad13561983e6973a64b700cdc01865d (diff)
lima/gpir: fix free slot calc when instr insert for complex1
Signed-off-by: Qiang Yu <yuq825@gmail.com>
-rw-r--r--src/gallium/drivers/lima/ir/gp/instr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/drivers/lima/ir/gp/instr.c b/src/gallium/drivers/lima/ir/gp/instr.c
index 719da19f78..32f359bec5 100644
--- a/src/gallium/drivers/lima/ir/gp/instr.c
+++ b/src/gallium/drivers/lima/ir/gp/instr.c
@@ -35,7 +35,10 @@ void gpir_instr_init(gpir_instr *instr)
static bool gpir_instr_insert_alu_check(gpir_instr *instr, gpir_node *node)
{
- /* check if this node is child of one store node */
+ /* check if this node is child of one store node.
+ * complex1 won't be any of this instr's store node's child,
+ * because it has two instr latency before store can use it.
+ */
for (int i = GPIR_INSTR_SLOT_STORE0; i < GPIR_INSTR_SLOT_STORE3; i++) {
gpir_store_node *s = gpir_node_to_store(instr->slots[i]);
if (s && s->child == node) {
@@ -45,11 +48,14 @@ static bool gpir_instr_insert_alu_check(gpir_instr *instr, gpir_node *node)
}
}
+ int consume_slot = node->op == gpir_op_complex1 ? 2 : 1;
+
/* not a child of any store node, so must reserve alu slot for store node */
- if (instr->alu_num_slot_free <= instr->alu_num_slot_needed_by_store)
+ if (instr->alu_num_slot_free - consume_slot <
+ instr->alu_num_slot_needed_by_store)
return false;
- instr->alu_num_slot_free--;
+ instr->alu_num_slot_free -= consume_slot;
return true;
}