Mesa (master): aco: don't constant-propagate into subdword PSEUDO instructions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 10 07:29:03 UTC 2020


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

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Tue Apr  7 10:46:37 2020 +0100

aco: don't constant-propagate into subdword PSEUDO instructions

PSEUDO instructions are lowered using SDWA, and thus,
cannot take literals and before GFX9 cannot take constants
at all. As the in-register representation differs between
32bit and 16bit floats, we first need to ensure correct
behavior.

Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4492>

---

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

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 72ae710f838..5e80d9afe7f 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -699,13 +699,15 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
 
       /* SALU / PSEUDO: propagate inline constants */
       if (instr->isSALU() || instr->format == Format::PSEUDO) {
+         const bool is_subdword = std::any_of(instr->definitions.begin(), instr->definitions.end(),
+                                              [] (const Definition& def) { return def.regClass().is_subdword();});
+         // TODO: optimize SGPR and constant propagation for subdword pseudo instructions on gfx9+
+         if (is_subdword)
+            continue;
+
          if (info.is_temp() && info.temp.type() == RegType::sgpr) {
-            const bool is_subdword = std::any_of(instr->definitions.begin(), instr->definitions.end(),
-                                                 [] (const Definition& def) { return def.regClass().is_subdword();});
-            if (instr->isSALU() || !is_subdword) {
-               instr->operands[i].setTemp(info.temp);
-               info = ctx.info[info.temp.id()];
-            }
+            instr->operands[i].setTemp(info.temp);
+            info = ctx.info[info.temp.id()];
          } else if (info.is_temp() && info.temp.type() == RegType::vgpr) {
             /* propagate vgpr if it can take it */
             switch (instr->opcode) {



More information about the mesa-commit mailing list