Mesa (master): aco: ensure predecessors' p_logical_end is in WQM when a p_phi is in WQM

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 29 13:56:25 UTC 2020


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Thu Jan  2 19:13:53 2020 +0000

aco: ensure predecessors' p_logical_end is in WQM when a p_phi is in WQM

We want any copies to be in WQM. I don't know if this fixes any real
application, but I can create a vkrunner test than reproduces the issue.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Fixes: 93c8ebfa780 ('aco: Initial commit of independent AMD compiler')
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3273>

---

 src/amd/compiler/aco_insert_exec_mask.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/amd/compiler/aco_insert_exec_mask.cpp b/src/amd/compiler/aco_insert_exec_mask.cpp
index 7aafdc21917..9981828bad3 100644
--- a/src/amd/compiler/aco_insert_exec_mask.cpp
+++ b/src/amd/compiler/aco_insert_exec_mask.cpp
@@ -84,6 +84,7 @@ struct block_info {
    std::vector<WQMState> instr_needs;
    uint8_t block_needs;
    uint8_t ever_again_needs;
+   bool logical_end_wqm;
    /* more... */
 };
 
@@ -238,8 +239,16 @@ void get_block_needs(wqm_ctx &ctx, exec_ctx &exec_ctx, Block* block)
 
       /* ensure the condition controlling the control flow for this phi is in WQM */
       if (needs == WQM && instr->opcode == aco_opcode::p_phi) {
-         for (unsigned pred_idx : block->logical_preds)
+         for (unsigned pred_idx : block->logical_preds) {
             mark_block_wqm(ctx, pred_idx);
+            exec_ctx.info[pred_idx].logical_end_wqm = true;
+            ctx.worklist.insert(pred_idx);
+         }
+      }
+
+      if (instr->opcode == aco_opcode::p_logical_end && info.logical_end_wqm) {
+         assert(needs == Unspecified);
+         needs = WQM;
       }
 
       instr_needs[i] = needs;



More information about the mesa-commit mailing list