Mesa (master): r600/sfn: Don't reuse registers for workgroup ID and local invocation ID

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


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Wed Sep 30 20:14:39 2020 +0200

r600/sfn: Don't reuse registers for workgroup ID and local invocation ID

This fixes a number of compute shader tests. I'm not sure why though.

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_liverange.cpp      | 9 ++++-----
 src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp | 2 ++
 src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp      | 6 ++++--
 src/gallium/drivers/r600/sfn/sfn_value_gpr.h        | 3 +++
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_liverange.cpp b/src/gallium/drivers/r600/sfn/sfn_liverange.cpp
index fec80826cda..9c9340ac5a5 100644
--- a/src/gallium/drivers/r600/sfn/sfn_liverange.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_liverange.cpp
@@ -359,10 +359,6 @@ register_live_range temp_access::get_required_live_range()
    }
    result.is_array_elm = is_array_element;
 
-   /* This fixes a few tests, but it is not clear why. */
-   if (result.end != result.begin)
-      ++result.end;
-
    return result;
 }
 
@@ -785,7 +781,10 @@ void LiverangeEvaluator::run(const Shader& shader,
             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);
-            temp_acc[g.sel()].record_read(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);
          }
       }
    }
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp
index f7e9ce564e4..d2edc999d63 100644
--- a/src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_shader_compute.cpp
@@ -51,11 +51,13 @@ bool ComputeShaderFromNir::do_allocate_reserved_registers()
    for (int i = 0; i < 3; ++i) {
       auto tmp = new GPRValue(thread_id_sel, i);
       tmp->set_as_input();
+      tmp->set_keep_alive();
       m_local_invocation_id[i] = PValue(tmp);
       inject_register(tmp->sel(), i, m_local_invocation_id[i], false);
 
       tmp = new GPRValue(wg_id_sel, i);
       tmp->set_as_input();
+      tmp->set_keep_alive();
       m_workgroup_id[i] = PValue(tmp);
       inject_register(tmp->sel(), i, m_workgroup_id[i], false);
    }
diff --git a/src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp b/src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp
index f4dcb68ca2f..b818cd3d498 100644
--- a/src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_value_gpr.cpp
@@ -39,7 +39,8 @@ GPRValue::GPRValue(uint32_t sel, uint32_t chan, int base_offset):
    m_sel(sel),
    m_base_offset(base_offset),
    m_input(false),
-   m_pin_to_channel(false)
+   m_pin_to_channel(false),
+   m_keep_alive(false)
 {
 }
 
@@ -48,7 +49,8 @@ GPRValue::GPRValue(uint32_t sel, uint32_t chan):
    m_sel(sel),
    m_base_offset(0),
    m_input(false),
-   m_pin_to_channel(false)
+   m_pin_to_channel(false),
+   m_keep_alive(false)
 {
 }
 
diff --git a/src/gallium/drivers/r600/sfn/sfn_value_gpr.h b/src/gallium/drivers/r600/sfn/sfn_value_gpr.h
index 199b5233ac0..1ab494001c9 100644
--- a/src/gallium/drivers/r600/sfn/sfn_value_gpr.h
+++ b/src/gallium/drivers/r600/sfn/sfn_value_gpr.h
@@ -54,6 +54,8 @@ public:
 
    void set_as_input(){ m_input = true; }
    bool is_input() const {return  m_input; }
+   void set_keep_alive() { m_keep_alive = true; }
+   bool keep_alive() const {return  m_keep_alive; }
    void set_pin_to_channel() override { m_pin_to_channel = true;}
    bool pin_to_channel()  const { return m_pin_to_channel;}
 
@@ -65,6 +67,7 @@ private:
    bool m_base_offset;
    bool m_input;
    bool m_pin_to_channel;
+   bool m_keep_alive;
 };
 
 class GPRVector : public Value {



More information about the mesa-commit mailing list