Mesa (main): lima/ppir: check if mul node is a source of add node before inserting

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 24 02:36:37 UTC 2021


Module: Mesa
Branch: main
Commit: 98a7c4c6f8e0dd8aca665ff1ae475ab3cdd53b12
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=98a7c4c6f8e0dd8aca665ff1ae475ab3cdd53b12

Author: Vasily Khoruzhick <anarsoul at gmail.com>
Date:   Tue Nov 16 20:24:25 2021 -0800

lima/ppir: check if mul node is a source of add node before inserting

We can't insert mul node into add node instruction if it's a virtual dep
(sequence or write_or_read dep), so use ppir_node_has_single_src_succ
in addition to ppir_node_has_single_succ.

We can't use ppir_node_has_single_src_succ alone, since node may have
a virtual dependency in addition to source dependency, and we can't
insert it either in this case.

Reviewed-by: Andreas Baierl <ichgeh at imkreisrum.de>
Reviewed-by: Erico Nunes <nunes.erico at gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13830>

---

 src/gallium/drivers/lima/ir/pp/node_to_instr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 a54be74ccfc..0d5d37f4927 100644
--- a/src/gallium/drivers/lima/ir/pp/node_to_instr.c
+++ b/src/gallium/drivers/lima/ir/pp/node_to_instr.c
@@ -88,7 +88,8 @@ static bool ppir_do_one_node_to_instr(ppir_block *block, ppir_node *node)
        * by using pipeline reg ^vmul/^fmul */
       ppir_alu_node *alu = ppir_node_to_alu(node);
       if (alu->dest.type == ppir_target_ssa &&
-          ppir_node_has_single_succ(node)) {
+          ppir_node_has_single_succ(node) &&
+          ppir_node_has_single_src_succ(node)) {
          ppir_node *succ = ppir_node_first_succ(node);
          if (succ->instr_pos == PPIR_INSTR_SLOT_ALU_VEC_ADD) {
             node->instr_pos = PPIR_INSTR_SLOT_ALU_VEC_MUL;



More information about the mesa-commit mailing list