summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiang Yu <yuq825@gmail.com>2017-10-13 18:22:20 +0800
committerQiang Yu <yuq825@gmail.com>2017-10-13 18:56:44 +0800
commit43d75ec232e260da24907ecd5847fe7c2f3b4ff0 (patch)
tree970167067788490efc87e6b892c85a8ae8db56b4
parent821c3017cb458b161d9390966461c464b1358721 (diff)
lima/gpir: fix instr free alu calc when insert store
After support reg load/store, child may be inserted before store node. Signed-off-by: Qiang Yu <yuq825@gmail.com>
-rw-r--r--src/gallium/drivers/lima/ir/gp/instr.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/lima/ir/gp/instr.c b/src/gallium/drivers/lima/ir/gp/instr.c
index 1c0d5168bc..719da19f78 100644
--- a/src/gallium/drivers/lima/ir/gp/instr.c
+++ b/src/gallium/drivers/lima/ir/gp/instr.c
@@ -165,8 +165,17 @@ static bool gpir_instr_insert_store_check(gpir_instr *instr, gpir_node *node)
goto out;
}
- /* no store node has the same child as this node, so instr must
- * have some free alu slot to insert this node's child
+ /* check if the child is alrady in this instr's alu slot,
+ * this may happen when store an scheduled alu node to reg
+ */
+ for (int j = GPIR_INSTR_SLOT_MUL0; j <= GPIR_INSTR_SLOT_PASS; j++) {
+ if (store->child == instr->slots[j])
+ goto out;
+ }
+
+ /* no store node has the same child as this node, and child is not
+ * already in this instr's alu slot, so instr must have some free
+ * alu slot to insert this node's child
*/
if (!instr->alu_num_slot_free)
return false;