diff options
author | Erico Nunes <[email protected]> | 2020-04-13 15:26:16 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-09 11:30:07 +0000 |
commit | 09003ba0700ed0ddc57d85e82320f15a2a90c8dd (patch) | |
tree | ebc601c144fb01674f488996d44c9f1b6af7c4ee /src/gallium/drivers/lima/ir | |
parent | c6a3987f320fa26fa88e6d86cf236d7e426aab84 (diff) |
lima/ppir: combine varying loads in node_to_instr
Varying loads with a single successor have a high potential to be
combined with its successor node, like ppir does for uniforms, rather
than being in a separate instruction.
Even if ppir becomes capable of combining instructions in a separate
step, combining varying loads during node_to_instr is trivial enough
that it seems to be worth doing it in this stage, and this benefits
pretty much every program that uses varyings.
Signed-off-by: Erico Nunes <[email protected]>
Reviewed-by: Vasily Khoruzhick <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4535>
Diffstat (limited to 'src/gallium/drivers/lima/ir')
-rw-r--r-- | src/gallium/drivers/lima/ir/pp/node_to_instr.c | 30 |
1 files changed, 22 insertions, 8 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 9882951db46..35cf5f10f63 100644 --- a/src/gallium/drivers/lima/ir/pp/node_to_instr.c +++ b/src/gallium/drivers/lima/ir/pp/node_to_instr.c @@ -42,23 +42,37 @@ static bool create_new_instr(ppir_block *block, ppir_node *node) * successor. * Since it has a pipeline dest, it must have only one successor and since we * schedule nodes backwards, its successor must have already been scheduled. + * Load varyings can't output to a pipeline register but are also potentially + * trivial to insert and save an instruction if they have a single successor. */ -static bool ppir_do_node_to_instr_pipeline(ppir_block *block, ppir_node *node) +static bool ppir_do_node_to_instr_try_insert(ppir_block *block, ppir_node *node) { ppir_dest *dest = ppir_node_get_dest(node); - if (!dest || dest->type != ppir_target_pipeline) + if (dest && dest->type == ppir_target_pipeline) { + assert(ppir_node_has_single_src_succ(node)); + ppir_node *succ = ppir_node_first_succ(node); + assert(succ); + assert(succ->instr); + + return ppir_instr_insert_node(succ->instr, node); + } + + switch (node->type) { + case ppir_node_type_load: + break; + default: + return false; + } + + if (!ppir_node_has_single_src_succ(node)) return false; - assert(ppir_node_has_single_src_succ(node)); ppir_node *succ = ppir_node_first_succ(node); assert(succ); assert(succ->instr); - if (!ppir_instr_insert_node(succ->instr, node)) - return false; - - return true; + return ppir_instr_insert_node(succ->instr, node); } static bool ppir_do_one_node_to_instr(ppir_block *block, ppir_node *node, ppir_node **next) @@ -184,7 +198,7 @@ static bool ppir_do_node_to_instr(ppir_block *block, ppir_node *node) ppir_node *next = node; /* first try pipeline sched, if that didn't succeed try normal scheduling */ - if (!ppir_do_node_to_instr_pipeline(block, node)) + if (!ppir_do_node_to_instr_try_insert(block, node)) if (!ppir_do_one_node_to_instr(block, node, &next)) return false; |