Mesa (main): aco: Fix to_uniform_bool_instr when operands are not suitable.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 25 13:01:58 UTC 2021


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

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Wed Aug 25 12:13:39 2021 +0200

aco: Fix to_uniform_bool_instr when operands are not suitable.

Don't attempt to transform uniform boolean instructions when
their operands are unsuitable. This can happen eg. due to other
optimizations that combine SALU instructions which clear out
the uniform instruction labels.

Cc: mesa-stable
Fixes: 8a32f57fff56b3b94f1b5589feba38016f39427c
Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11573>

---

 src/amd/compiler/aco_optimizer.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index afc36a04022..acfdfd1accd 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -3448,6 +3448,14 @@ combine_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
 bool
 to_uniform_bool_instr(opt_ctx& ctx, aco_ptr<Instruction>& instr)
 {
+   /* Check every operand to make sure they are suitable. */
+   for (Operand& op : instr->operands) {
+      if (!op.isTemp())
+         return false;
+      if (!ctx.info[op.tempId()].is_uniform_bool() && !ctx.info[op.tempId()].is_uniform_bitwise())
+         return false;
+   }
+
    switch (instr->opcode) {
    case aco_opcode::s_and_b32:
    case aco_opcode::s_and_b64: instr->opcode = aco_opcode::s_and_b32; break;



More information about the mesa-commit mailing list