Mesa (main): aco: make Preserve_WQM independent from block_kind_uses_discard_if

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 8 16:39:36 UTC 2022


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

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Tue Feb  1 12:21:15 2022 +0100

aco: make Preserve_WQM independent from block_kind_uses_discard_if

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

---

 src/amd/compiler/aco_insert_exec_mask.cpp | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/amd/compiler/aco_insert_exec_mask.cpp b/src/amd/compiler/aco_insert_exec_mask.cpp
index cdff7cbb9ff..5d78c14311e 100644
--- a/src/amd/compiler/aco_insert_exec_mask.cpp
+++ b/src/amd/compiler/aco_insert_exec_mask.cpp
@@ -56,6 +56,7 @@ struct wqm_ctx {
    std::vector<uint16_t> defined_in;
    std::vector<bool> needs_wqm;
    std::vector<bool> branch_wqm; /* true if the branch condition in this block should be in wqm */
+   bool ever_again_needs_wqm = false;
    wqm_ctx(Program* program_)
        : program(program_), defined_in(program->peekAllocationId(), 0xFFFF),
          needs_wqm(program->peekAllocationId()), branch_wqm(program->blocks.size())
@@ -180,7 +181,9 @@ get_block_needs(wqm_ctx& ctx, exec_ctx& exec_ctx, Block* block)
                set_needs_wqm(ctx, op.getTemp());
             }
          }
-      } else if (preserve_wqm && info.block_needs & WQM) {
+         ctx.ever_again_needs_wqm = true;
+      } else if (preserve_wqm & ctx.ever_again_needs_wqm) {
+         /* Preserve WQM if WQM is needed later */
          needs = Preserve_WQM;
       }
 
@@ -316,10 +319,6 @@ calculate_wqm_needs(exec_ctx& exec_ctx)
       if (block.kind & block_kind_needs_lowering)
          exec_ctx.info[i].block_needs |= Exact;
 
-      /* if discard is used somewhere in nested CF, we need to preserve the WQM mask */
-      if (block.kind & block_kind_uses_discard_if && ever_again_needs & WQM)
-         exec_ctx.info[i].block_needs |= Preserve_WQM;
-
       ever_again_needs |= exec_ctx.info[i].block_needs & ~Exact_Branch;
       if (block.kind & block_kind_uses_discard_if || block.kind & block_kind_uses_demote)
          ever_again_needs |= Exact;



More information about the mesa-commit mailing list