From: Erico Nunes Date: Tue, 14 Apr 2020 00:52:48 +0000 (+0200) Subject: lima/ppir: add fallback mov option for const scheduler X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0c58867cddcf199cf85d270b42965678ad8af10;p=mesa.git 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 Reviewed-by: Vasily Khoruzhick Part-of: --- 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) {