aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErico Nunes <[email protected]>2020-04-23 20:12:01 +0200
committerErico Nunes <[email protected]>2020-05-16 17:24:03 +0200
commit632a921bd0dd40ad3167a0b8a74fe7054a78256a (patch)
treec139063f1c71dc4bbc8adc5a53158210e23ae69e
parenta4b7699d849d28adfd057136812b00a6b4838ed0 (diff)
lima/ppir: optimize tex loads with single successor
These don't need a mov, and can be used directly with pipeline output. Signed-off-by: Erico Nunes <[email protected]> Reviewed-by: Vasily Khoruzhick <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4975>
-rw-r--r--src/gallium/drivers/lima/ir/pp/lower.c19
-rw-r--r--src/gallium/drivers/lima/ir/pp/nir.c1
2 files changed, 18 insertions, 2 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/lower.c b/src/gallium/drivers/lima/ir/pp/lower.c
index ada735a160e..2480d79ffc0 100644
--- a/src/gallium/drivers/lima/ir/pp/lower.c
+++ b/src/gallium/drivers/lima/ir/pp/lower.c
@@ -162,7 +162,22 @@ static bool ppir_lower_texture(ppir_block *block, ppir_node *node)
{
ppir_dest *dest = ppir_node_get_dest(node);
- /* Always create move node since there can be successors in other blocks */
+ if (ppir_node_has_single_succ(node)) {
+ ppir_node *succ = ppir_node_first_succ(node);
+ dest->type = ppir_target_pipeline;
+ dest->pipeline = ppir_pipeline_reg_sampler;
+
+ for (int i = 0; i < ppir_node_get_src_num(succ); i++) {
+ ppir_src *src = ppir_node_get_src(succ, i);
+ if (src && src->node == node) {
+ src->type = ppir_target_pipeline;
+ src->pipeline = ppir_pipeline_reg_sampler;
+ }
+ }
+ return true;
+ }
+
+ /* Create move node as fallback */
ppir_node *move = ppir_node_insert_mov(node);
if (unlikely(!move))
return false;
@@ -170,7 +185,7 @@ static bool ppir_lower_texture(ppir_block *block, ppir_node *node)
ppir_debug("lower texture create move %d for %d\n",
move->index, node->index);
- ppir_src *mov_src= ppir_node_get_src(move, 0);
+ ppir_src *mov_src = ppir_node_get_src(move, 0);
mov_src->type = dest->type = ppir_target_pipeline;
mov_src->pipeline = dest->pipeline = ppir_pipeline_reg_sampler;
diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index bb42c35dd76..a2f3406e414 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -349,6 +349,7 @@ static bool ppir_emit_intrinsic(ppir_block *block, nir_instr *ni)
node = block->comp->var_nodes[instr->src->ssa->index];
switch (node->op) {
case ppir_op_load_uniform:
+ case ppir_op_load_texture:
case ppir_op_const:
break;
default: