Mesa (master): aco: remove special handling of load_helper_invocation

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 17 22:14:06 UTC 2021


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

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Tue Feb 16 10:33:25 2021 +0100

aco: remove special handling of load_helper_invocation

These should now behave the same as is_helper_invocation.

Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9058>

---

 src/amd/compiler/aco_insert_exec_mask.cpp      | 19 ++-----------------
 src/amd/compiler/aco_instruction_selection.cpp | 10 +++-------
 src/amd/compiler/aco_opcodes.py                |  1 -
 3 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/src/amd/compiler/aco_insert_exec_mask.cpp b/src/amd/compiler/aco_insert_exec_mask.cpp
index d6f7f921756..ea6e1218a90 100644
--- a/src/amd/compiler/aco_insert_exec_mask.cpp
+++ b/src/amd/compiler/aco_insert_exec_mask.cpp
@@ -43,7 +43,6 @@ enum mask_type : uint8_t {
    mask_type_exact = 1 << 1,
    mask_type_wqm = 1 << 2,
    mask_type_loop = 1 << 3, /* active lanes of a loop */
-   mask_type_initial = 1 << 4, /* initially active lanes */
 };
 
 struct wqm_ctx {
@@ -386,7 +385,7 @@ unsigned add_coupling_code(exec_ctx& ctx, Block* block,
       }
 
       if (ctx.handle_wqm) {
-         ctx.info[0].exec.emplace_back(Temp(0, bld.lm), mask_type_global | mask_type_exact | mask_type_initial);
+         ctx.info[0].exec.emplace_back(Temp(0, bld.lm), mask_type_global | mask_type_exact);
          /* if this block only needs WQM, initialize already */
          if (ctx.info[0].block_needs == WQM)
             transition_to_WQM(ctx, bld, 0);
@@ -696,7 +695,7 @@ void process_instructions(exec_ctx& ctx, Block* block,
          state = Exact;
       }
 
-      if (instr->opcode == aco_opcode::p_is_helper || instr->opcode == aco_opcode::p_load_helper) {
+      if (instr->opcode == aco_opcode::p_is_helper) {
          Definition dst = instr->definitions[0];
          assert(dst.size() == bld.lm.size());
          if (state == Exact) {
@@ -705,19 +704,6 @@ void process_instructions(exec_ctx& ctx, Block* block,
             instr->definitions[0] = dst;
          } else {
             std::pair<Temp, uint8_t>& exact_mask = ctx.info[block->index].exec[0];
-            if (instr->opcode == aco_opcode::p_load_helper &&
-                !(ctx.info[block->index].exec[0].second & mask_type_initial)) {
-               /* find last initial exact mask */
-               for (int i = block->index; i >= 0; i--) {
-                  if (ctx.program->blocks[i].kind & block_kind_top_level &&
-                      ctx.info[i].exec[0].second & mask_type_initial) {
-                     exact_mask = ctx.info[i].exec[0];
-                     break;
-                  }
-               }
-            }
-
-            assert(instr->opcode == aco_opcode::p_is_helper || exact_mask.second & mask_type_initial);
             assert(exact_mask.second & mask_type_exact);
 
             instr.reset(create_instruction<SOP2_instruction>(bld.w64or32(Builder::s_andn2), Format::SOP2, 2, 2));
@@ -729,7 +715,6 @@ void process_instructions(exec_ctx& ctx, Block* block,
       } else if (instr->opcode == aco_opcode::p_demote_to_helper) {
          /* turn demote into discard_if with only exact masks */
          assert((ctx.info[block->index].exec[0].second & (mask_type_exact | mask_type_global)) == (mask_type_exact | mask_type_global));
-         ctx.info[block->index].exec[0].second &= ~mask_type_initial;
 
          int num;
          Temp cond, exit_cond;
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 639b033dbee..80834236486 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -8560,14 +8560,10 @@ void visit_intrinsic(isel_context *ctx, nir_intrinsic_instr *instr)
       emit_wqm(bld, wqm_tmp, dst);
       break;
    }
-   case nir_intrinsic_load_helper_invocation: {
-      Temp dst = get_ssa_temp(ctx, &instr->dest.ssa);
-      bld.pseudo(aco_opcode::p_load_helper, Definition(dst));
-      ctx->block->kind |= block_kind_needs_lowering;
-      ctx->program->needs_exact = true;
-      break;
-   }
+   case nir_intrinsic_load_helper_invocation:
    case nir_intrinsic_is_helper_invocation: {
+      /* load_helper() after demote() get lowered to is_helper().
+       * Otherwise, these two behave the same. */
       Temp dst = get_ssa_temp(ctx, &instr->dest.ssa);
       bld.pseudo(aco_opcode::p_is_helper, Definition(dst));
       ctx->block->kind |= block_kind_needs_lowering;
diff --git a/src/amd/compiler/aco_opcodes.py b/src/amd/compiler/aco_opcodes.py
index 20f5006c186..a2ae4f17308 100644
--- a/src/amd/compiler/aco_opcodes.py
+++ b/src/amd/compiler/aco_opcodes.py
@@ -281,7 +281,6 @@ opcode("p_end_linear_vgpr")
 
 opcode("p_wqm")
 opcode("p_discard_if")
-opcode("p_load_helper")
 opcode("p_demote_to_helper")
 opcode("p_is_helper")
 opcode("p_exit_early_if")



More information about the mesa-commit mailing list