aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/lima/ir
diff options
context:
space:
mode:
authorErico Nunes <[email protected]>2020-04-14 02:52:48 +0200
committerErico Nunes <[email protected]>2020-05-09 14:40:37 +0200
commita0c58867cddcf199cf85d270b42965678ad8af10 (patch)
treea4aa08dbd8ad503f469744487d65e110eb8c24ec /src/gallium/drivers/lima/ir
parent8c47640731303ed2607d28ce2cf19a7e8f0f4006 (diff)
lima/ppir: add fallback mov option for const scheduler
It turns out that with more aggressive combining, there can be cases where the available const slots are not enough for one instruction. In particular, fcsel can take up to two consts, and a previous alu slot, such as a comparison condition, might require an additional const. So add a fallback for it like for uniforms. Signed-off-by: Erico Nunes <[email protected]> Reviewed-by: Vasily Khoruzhick <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4632>
Diffstat (limited to 'src/gallium/drivers/lima/ir')
-rw-r--r--src/gallium/drivers/lima/ir/pp/node_to_instr.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/node_to_instr.c b/src/gallium/drivers/lima/ir/pp/node_to_instr.c
index 14b8c41f302..9f21fa31e26 100644
--- a/src/gallium/drivers/lima/ir/pp/node_to_instr.c
+++ b/src/gallium/drivers/lima/ir/pp/node_to_instr.c
@@ -162,10 +162,34 @@ static bool ppir_do_one_node_to_instr(ppir_block *block, ppir_node *node)
break;
}
- case ppir_node_type_const:
- /* Const nodes are supposed to go through do_node_to_instr_pipeline() */
- assert(false);
+ case ppir_node_type_const: {
+ /* Const cannot be pipelined, too many consts in the instruction.
+ * Create a mov. */
+
+ ppir_node *move = ppir_node_insert_mov(node);
+ if (!create_new_instr(block, move))
+ return false;
+
+ ppir_debug("node_to_instr create move %d for const %d\n",
+ move->index, node->index);
+
+ ppir_dest *dest = ppir_node_get_dest(node);
+ ppir_src *mov_src = ppir_node_get_src(move, 0);
+
+ /* update succ from ^const to ssa mov output */
+ ppir_dest *move_dest = ppir_node_get_dest(move);
+ move_dest->type = ppir_target_ssa;
+ ppir_node *succ = ppir_node_first_succ(move);
+ ppir_node_replace_child(succ, node, move);
+
+ mov_src->type = dest->type = ppir_target_pipeline;
+ mov_src->pipeline = dest->pipeline = ppir_pipeline_reg_const0;
+
+ if (!ppir_instr_insert_node(move->instr, node))
+ return false;
+
break;
+ }
case ppir_node_type_store:
{
if (node->op == ppir_op_store_temp) {