Mesa (master): aco: don't affect isPrecise() after applying output modifiers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 26 22:32:01 UTC 2021


Module: Mesa
Branch: master
Commit: 0f178290caf6ee7ea33ef3293fc953870f4a6c5c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f178290caf6ee7ea33ef3293fc953870f4a6c5c

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue Jan 26 14:24:48 2021 +0000

aco: don't affect isPrecise() after applying output modifiers

fossil-db (GFX10.3):
Totals from 26679 (19.14% of 139391) affected shaders:
SGPRs: 1757155 -> 1757059 (-0.01%); split: -0.05%, +0.04%
VGPRs: 1175932 -> 1173556 (-0.20%); split: -0.21%, +0.01%
CodeSize: 86203592 -> 85572480 (-0.73%); split: -0.73%, +0.00%
MaxWaves: 315513 -> 315805 (+0.09%); split: +0.10%, -0.00%
Instrs: 16297785 -> 16143745 (-0.95%); split: -0.95%, +0.00%

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8718>

---

 src/amd/compiler/aco_ir.h          | 4 ++++
 src/amd/compiler/aco_optimizer.cpp | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h
index 94564ffa2cb..8f0e2f13f98 100644
--- a/src/amd/compiler/aco_ir.h
+++ b/src/amd/compiler/aco_ir.h
@@ -884,6 +884,10 @@ public:
       temp = t;
    }
 
+   void swapTemp(Definition& other) noexcept {
+      std::swap(temp, other.temp);
+   }
+
    constexpr RegClass regClass() const noexcept
    {
       return temp.regClass();
diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 4266696b9fb..d804faf1d8f 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -2674,7 +2674,7 @@ bool apply_omod_clamp(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
          return false;
    }
 
-   std::swap(instr->definitions[0], def_info.instr->definitions[0]);
+   instr->definitions[0].swapTemp(def_info.instr->definitions[0]);
    ctx.info[instr->definitions[0].tempId()].label &= label_clamp;
    ctx.uses[def_info.instr->definitions[0].tempId()]--;
 
@@ -2806,7 +2806,7 @@ void combine_vop3p(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
          VOP3P_instruction* candidate = &ctx.info[instr->operands[0].tempId()].instr->vop3p();
          candidate->clamp = true;
          propagate_swizzles(candidate, vop3p->opsel_lo, vop3p->opsel_hi);
-         std::swap(instr->definitions[0], candidate->definitions[0]);
+         instr->definitions[0].swapTemp(candidate->definitions[0]);
          ctx.info[candidate->definitions[0].tempId()].instr = candidate;
          ctx.uses[instr->definitions[0].tempId()]--;
          return;



More information about the mesa-commit mailing list