Mesa (staging/20.1): aco: fix WQM handling in nested loops

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 19 20:07:10 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: b7ba7e49fb62cf34758f0731e2bf0cccb967f3f3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7ba7e49fb62cf34758f0731e2bf0cccb967f3f3

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Wed Jun 17 12:41:09 2020 +0100

aco: fix WQM handling in nested loops

If on a nested loop
- the outer loop needs WQM but
- the inner loop doesn't need WQM and
- the break condition of the inner loop is computed in the outer loop
then it could happen that we transitioned to Exact before entering the inner loop
which could create an empty exec mask and lead to an infinite loop.

Fixes a GPU hang with RDR2

Cc: 20.1 <mesa-stable at lists.freedesktop.org>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5518>
(cherry picked from commit 3817fa7a4d1f51c385b28a2e45a1edf227526028)

---

 .pick_status.json                         | 2 +-
 src/amd/compiler/aco_insert_exec_mask.cpp | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index e5384460aa5..2c2cde94dcf 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -580,7 +580,7 @@
         "description": "aco: fix WQM handling in nested loops",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/compiler/aco_insert_exec_mask.cpp b/src/amd/compiler/aco_insert_exec_mask.cpp
index fe0dc54ccca..7246fb74e0c 100644
--- a/src/amd/compiler/aco_insert_exec_mask.cpp
+++ b/src/amd/compiler/aco_insert_exec_mask.cpp
@@ -189,11 +189,14 @@ void get_block_needs(wqm_ctx &ctx, exec_ctx &exec_ctx, Block* block)
 
    if (block->kind & block_kind_top_level) {
       if (ctx.loop && ctx.wqm) {
-         /* mark all break conditions as WQM */
          unsigned block_idx = block->index + 1;
          while (!(ctx.program->blocks[block_idx].kind & block_kind_top_level)) {
+            /* flag all break conditions as WQM:
+             * the conditions might be computed outside the nested CF */
             if (ctx.program->blocks[block_idx].kind & block_kind_break)
                mark_block_wqm(ctx, block_idx);
+            /* flag all blocks as WQM to ensure we enter all (nested) loops in WQM */
+            exec_ctx.info[block_idx].block_needs |= WQM;
             block_idx++;
          }
       } else if (ctx.loop && !ctx.wqm) {



More information about the mesa-commit mailing list