Mesa (master): lima/ppir: add fallback mov option for const scheduler

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat May 9 13:52:02 UTC 2020


Module: Mesa
Branch: master
Commit: a0c58867cddcf199cf85d270b42965678ad8af10
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0c58867cddcf199cf85d270b42965678ad8af10

Author: Erico Nunes <nunes.erico at gmail.com>
Date:   Tue Apr 14 02:52:48 2020 +0200

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 <nunes.erico at gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4632>

---

 src/gallium/drivers/lima/ir/pp/node_to_instr.c | 30 +++++++++++++++++++++++---
 1 file 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) {



More information about the mesa-commit mailing list