Mesa (staging/19.3): aco: don't propagate vgprs into v_readlane/v_writelane

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 13 20:35:45 UTC 2019


Module: Mesa
Branch: staging/19.3
Commit: 001e7305abcaf0854ae0c7b9046b7c7b280af530
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=001e7305abcaf0854ae0c7b9046b7c7b280af530

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue Nov 12 15:53:15 2019 +0000

aco: don't propagate vgprs into v_readlane/v_writelane

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Fixes: 93c8ebfa ('aco: Initial commit of independent AMD compiler')
(cherry picked from commit 2c98d79d114d3ed82a9e60519d666f51a1172cd3)

---

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

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 9501073debb..d8a97354602 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -474,6 +474,13 @@ bool valu_can_accept_literal(opt_ctx& ctx, aco_ptr<Instruction>& instr, unsigned
           operand == 0 && can_accept_constant(instr, operand);
 }
 
+bool valu_can_accept_vgpr(aco_ptr<Instruction>& instr, unsigned operand)
+{
+   if (instr->opcode == aco_opcode::v_readlane_b32 || instr->opcode == aco_opcode::v_writelane_b32)
+      return operand != 1;
+   return true;
+}
+
 bool parse_base_offset(opt_ctx &ctx, Instruction* instr, unsigned op_index, Temp *base, uint32_t *offset)
 {
    Operand op = instr->operands[op_index];
@@ -576,7 +583,7 @@ void label_instruction(opt_ctx &ctx, aco_ptr<Instruction>& instr)
 
       /* VALU: propagate neg, abs & inline constants */
       else if (instr->isVALU()) {
-         if (info.is_temp() && info.temp.type() == RegType::vgpr) {
+         if (info.is_temp() && info.temp.type() == RegType::vgpr && valu_can_accept_vgpr(instr, i)) {
             instr->operands[i].setTemp(info.temp);
             info = ctx.info[info.temp.id()];
          }




More information about the mesa-commit mailing list