Module: Mesa
Branch: staging/23.0
Commit: 1ea135b8420c1f68a02b15f5defd515e9de6356a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ea135b8420c1f68a02b15f5defd515e9de6356a

Author: Timur Kristóf <[email protected]>
Date:   Sun Apr  2 22:08:51 2023 +0200

aco: Consider p_cbranch_nz as divergent branch too.

A p_cbranch_nz instruction that reads exec is divergent too.

Fixes: f030b75b7d2c359b90c18ee4ed83fa05265c12e0
Reviewed-by: Daniel Schürmann <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21493>
(cherry picked from commit 54da8639569776486db1ae11c53c94263ed5edf5)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index ed84e34bc50..1b2b8ccc3ac 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -85,7 +85,7 @@
         "description": "aco: Consider p_cbranch_nz as divergent branch too.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "f030b75b7d2c359b90c18ee4ed83fa05265c12e0"
     },
diff --git a/src/amd/compiler/aco_lower_to_hw_instr.cpp 
b/src/amd/compiler/aco_lower_to_hw_instr.cpp
index 97bace94960..4b03df5c73d 100644
--- a/src/amd/compiler/aco_lower_to_hw_instr.cpp
+++ b/src/amd/compiler/aco_lower_to_hw_instr.cpp
@@ -2622,7 +2622,8 @@ lower_to_hw_instr(Program* program)
          } else if (instr->isBranch()) {
             Pseudo_branch_instruction* branch = &instr->branch();
             const uint32_t target = branch->target[0];
-            const bool uniform_branch = !(branch->opcode == 
aco_opcode::p_cbranch_z &&
+            const bool uniform_branch = !((branch->opcode == 
aco_opcode::p_cbranch_z ||
+                                           branch->opcode == 
aco_opcode::p_cbranch_nz) &&
                                           branch->operands[0].physReg() == 
exec);
 
             /* Check if the branch instruction can be removed.

Reply via email to