Mesa (main): aco: Remove s_and with exec when all lanes are active.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 16 14:48:33 UTC 2021


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

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Fri Jun 18 15:25:35 2021 +0200

aco: Remove s_and with exec when all lanes are active.

This helps NGG GS and culling shaders.
No Fossil DB changes without NGG culling.

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/11458>

---

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

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index af7dc3a3f68..8e4daaa8167 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -1642,6 +1642,13 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
             ctx.info[instr->definitions[0].tempId()].set_uniform_bool(
                ctx.info[instr->operands[0].tempId()].instr->definitions[1].getTemp());
             break;
+         } else if ((ctx.program->stage.num_sw_stages() > 1 ||
+                     ctx.program->stage.hw == HWStage::NGG) &&
+                    instr->pass_flags == 1) {
+            /* In case of merged shaders, pass_flags=1 means that all lanes are active (exec=-1), so
+             * s_and is unnecessary. */
+            ctx.info[instr->definitions[0].tempId()].set_temp(instr->operands[0].getTemp());
+            break;
          } else if (ctx.info[instr->operands[0].tempId()].is_vopc()) {
             Instruction* vopc_instr = ctx.info[instr->operands[0].tempId()].instr;
             /* Remove superfluous s_and when the VOPC instruction uses the same exec and thus



More information about the mesa-commit mailing list