Mesa (master): r600/sfn: Use register keep-alive also when scanning the shader

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 16 12:09:06 UTC 2020


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Wed Oct 14 14:57:38 2020 +0200

r600/sfn: Use register keep-alive also when scanning the shader

Temporaries don't appear in the mapping, so they are not in the initial
register list.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7142>

---

 src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.cpp |  1 +
 src/gallium/drivers/r600/sfn/sfn_liverange.cpp           | 13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.cpp b/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.cpp
index 181f6eeb048..28387e55082 100644
--- a/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_emitssboinstruction.cpp
@@ -248,6 +248,7 @@ bool EmitSSBOInstruction::emit_atomic_add(const nir_intrinsic_instr* instr)
 bool EmitSSBOInstruction::load_atomic_inc_limits()
 {
    m_atomic_update = get_temp_register();
+   m_atomic_update->set_keep_alive();
    emit_instruction(new AluInstruction(op1_mov, m_atomic_update, literal(1),
    {alu_write, alu_last_instr}));
    return true;
diff --git a/src/gallium/drivers/r600/sfn/sfn_liverange.cpp b/src/gallium/drivers/r600/sfn/sfn_liverange.cpp
index 0c568c8bad1..83e5b3625a6 100644
--- a/src/gallium/drivers/r600/sfn/sfn_liverange.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_liverange.cpp
@@ -777,15 +777,18 @@ void LiverangeEvaluator::run(const Shader& shader,
 
    for (auto& v: shader.m_temp) {
       if (v.second->type() == Value::gpr) {
+         sfn_log << SfnLog::merge << "Record " << *v.second << "\n";
          const auto& g = static_cast<const GPRValue&>(*v.second);
          if (g.is_input()) {
             sfn_log << SfnLog::merge << "Record INPUT write for "
                     << g << " in " << temp_acc.size() << " temps\n";
             temp_acc[g.sel()].record_write(line, cur_scope, 1 << g.chan(), false);
-            if (g.keep_alive())
-               temp_acc[g.sel()].record_read(0x7fffff, cur_scope, 1 << g.chan(), false);
-            else
-               temp_acc[g.sel()].record_read(line, cur_scope, 1 << g.chan(), false);
+            temp_acc[g.sel()].record_read(line, cur_scope, 1 << g.chan(), false);
+         }
+         if (g.keep_alive()) {
+            sfn_log << SfnLog::merge << "Record KEEP ALIVE for "
+                    << g << " in " << temp_acc.size() << " temps\n";
+            temp_acc[g.sel()].record_read(0x7fffff, cur_scope, 1 << g.chan(), false);
          }
       }
    }
@@ -812,7 +815,7 @@ void LiverangeEvaluator::record_read(const Value& src, bool is_array_elm)
    if (src.type() == Value::gpr) {
       const GPRValue& v = static_cast<const GPRValue&>(src);
       if (v.chan() < 4)
-         temp_acc[v.sel()].record_read(line, cur_scope, 1 << v.chan(), is_array_elm);
+         temp_acc[v.sel()].record_read(v.keep_alive() ? 0x7fffff: line, cur_scope, 1 << v.chan(), is_array_elm);
       return;
    } else if (src.type() == Value::gpr_array_value) {
       const GPRArrayValue& v = static_cast<const GPRArrayValue&>(src);



More information about the mesa-commit mailing list