Mesa (main): ir3: Stop inserting nops during scheduling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 17 14:16:15 UTC 2021


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Mon Nov  8 19:36:36 2021 +0100

ir3: Stop inserting nops during scheduling

Not necessary since nothing uses it anymore. This might have a slight
effect on spilling with multiple blocks, but no shader-db difference
because nothing spills.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13722>

---

 src/freedreno/ir3/ir3.h           |  1 -
 src/freedreno/ir3/ir3_delay.c     | 20 --------------------
 src/freedreno/ir3/ir3_legalize.c  |  2 --
 src/freedreno/ir3/ir3_postsched.c |  8 --------
 src/freedreno/ir3/ir3_sched.c     |  7 -------
 5 files changed, 38 deletions(-)

diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h
index bfbfb3ba9f1..c5470d28ad4 100644
--- a/src/freedreno/ir3/ir3.h
+++ b/src/freedreno/ir3/ir3.h
@@ -1637,7 +1637,6 @@ unsigned ir3_delayslots_with_repeat(struct ir3_instruction *assigner,
                                     unsigned assigner_n, unsigned consumer_n);
 unsigned ir3_delay_calc(struct ir3_block *block,
                         struct ir3_instruction *instr, bool mergedregs);
-void ir3_remove_nops(struct ir3 *ir);
 
 /* unreachable block elimination: */
 bool ir3_remove_unreachable(struct ir3 *ir);
diff --git a/src/freedreno/ir3/ir3_delay.c b/src/freedreno/ir3/ir3_delay.c
index d1920b0b4c1..bc5ad6d9508 100644
--- a/src/freedreno/ir3/ir3_delay.c
+++ b/src/freedreno/ir3/ir3_delay.c
@@ -348,23 +348,3 @@ ir3_delay_calc(struct ir3_block *block, struct ir3_instruction *instr,
 
    return delay_calc(block, NULL, instr, 0, &mask, mergedregs);
 }
-
-/**
- * Remove nop instructions.  The scheduler can insert placeholder nop's
- * so that ir3_delay_calc() can account for nop's that won't be needed
- * due to nop's triggered by a previous instruction.  However, before
- * legalize, we want to remove these.  The legalize pass can insert
- * some nop's if needed to hold (for example) sync flags.  This final
- * remaining nops are inserted by legalize after this.
- */
-void
-ir3_remove_nops(struct ir3 *ir)
-{
-   foreach_block (block, &ir->block_list) {
-      foreach_instr_safe (instr, &block->instr_list) {
-         if (instr->opc == OPC_NOP) {
-            list_del(&instr->node);
-         }
-      }
-   }
-}
diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c
index 3919c09a8ed..59765f7317b 100644
--- a/src/freedreno/ir3/ir3_legalize.c
+++ b/src/freedreno/ir3/ir3_legalize.c
@@ -862,8 +862,6 @@ ir3_legalize(struct ir3 *ir, struct ir3_shader_variant *so, int *max_bary)
       block->data = bd;
    }
 
-   ir3_remove_nops(ir);
-
    /* We may have failed to pull all input loads into the first block.
     * In such case at the moment we aren't able to find a better place
     * to for (ei) than the end of the program.
diff --git a/src/freedreno/ir3/ir3_postsched.c b/src/freedreno/ir3/ir3_postsched.c
index 3e6cd9baf15..43a6223ee0a 100644
--- a/src/freedreno/ir3/ir3_postsched.c
+++ b/src/freedreno/ir3/ir3_postsched.c
@@ -687,14 +687,7 @@ sched_block(struct ir3_postsched_ctx *ctx, struct ir3_block *block)
       unsigned delay = node_delay(ctx, instr->data);
       d("delay=%u", delay);
 
-      /* and if we run out of instructions that can be scheduled,
-       * then it is time for nop's:
-       */
       debug_assert(delay <= 6);
-      while (delay > 0) {
-         ir3_NOP(block);
-         delay--;
-      }
 
       schedule(ctx, instr);
    }
@@ -756,7 +749,6 @@ ir3_postsched(struct ir3 *ir, struct ir3_shader_variant *v)
       .v = v,
    };
 
-   ir3_remove_nops(ir);
    cleanup_self_movs(ir);
 
    foreach_block (block, &ir->block_list) {
diff --git a/src/freedreno/ir3/ir3_sched.c b/src/freedreno/ir3/ir3_sched.c
index a3ad5b93b7a..f26de995044 100644
--- a/src/freedreno/ir3/ir3_sched.c
+++ b/src/freedreno/ir3/ir3_sched.c
@@ -1211,14 +1211,7 @@ sched_block(struct ir3_sched_ctx *ctx, struct ir3_block *block)
          unsigned delay = node_delay(ctx, instr->data);
          d("delay=%u", delay);
 
-         /* and if we run out of instructions that can be scheduled,
-          * then it is time for nop's:
-          */
          debug_assert(delay <= 6);
-         while (delay > 0) {
-            ir3_NOP(block);
-            delay--;
-         }
 
          schedule(ctx, instr);
 



More information about the mesa-commit mailing list