Mesa (master): r600/sb: use different stacks for tracking lds and queue usage.

Dave Airlie airlied at kemper.freedesktop.org
Thu Jan 18 03:39:44 UTC 2018


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 10 05:49:16 2018 +0000

r600/sb: use different stacks for tracking lds and queue usage.

The normal ssa renumbering isn't sufficient for LDS queue access,
this uses two stacks, one for the lds queue, and one for the
lds r/w ordering.

The LDS oq values are incremented in their use in a linear
fashion.
The LDS rw values are incremented in their definitions and used
in the next lds operation to ensure reordering doesn't occur.

Acked-By: Roland Scheidegger <sroland at vmware.com>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/drivers/r600/sb/sb_pass.h          |  4 ++++
 src/gallium/drivers/r600/sb/sb_ssa_builder.cpp | 23 ++++++++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/sb/sb_pass.h b/src/gallium/drivers/r600/sb/sb_pass.h
index b5818039c2..a21b0bf997 100644
--- a/src/gallium/drivers/r600/sb/sb_pass.h
+++ b/src/gallium/drivers/r600/sb/sb_pass.h
@@ -634,7 +634,11 @@ class ssa_rename : public vpass {
 	typedef sb_map<value*, unsigned> def_map;
 
 	def_map def_count;
+	def_map lds_oq_count;
+	def_map lds_rw_count;
 	std::stack<def_map> rename_stack;
+	std::stack<def_map> rename_lds_oq_stack;
+	std::stack<def_map> rename_lds_rw_stack;
 
 	typedef std::map<uint32_t, value*> val_map;
 	val_map values;
diff --git a/src/gallium/drivers/r600/sb/sb_ssa_builder.cpp b/src/gallium/drivers/r600/sb/sb_ssa_builder.cpp
index 3ad628bb68..5cd41c2aab 100644
--- a/src/gallium/drivers/r600/sb/sb_ssa_builder.cpp
+++ b/src/gallium/drivers/r600/sb/sb_ssa_builder.cpp
@@ -132,6 +132,8 @@ bool ssa_prepare::visit(depart_node& n, bool enter) {
 
 int ssa_rename::init() {
 	rename_stack.push(def_map());
+	rename_lds_oq_stack.push(def_map());
+	rename_lds_rw_stack.push(def_map());
 	return 0;
 }
 
@@ -287,8 +289,16 @@ void ssa_rename::pop() {
 value* ssa_rename::rename_use(node *n, value* v) {
 	if (v->version)
 		return v;
+	unsigned index;
+	if (v->is_lds_access()) {
+		index = get_index(rename_lds_rw_stack.top(), v);
+	} else if (v->is_lds_oq()) {
+		index = new_index(lds_oq_count, v);
+		set_index(rename_lds_oq_stack.top(), v, index);
+	} else {
+		index = get_index(rename_stack.top(), v);
+	}
 
-	unsigned index = get_index(rename_stack.top(), v);
 	v = sh.get_value_version(v, index);
 
 	// if (alu) instruction is predicated and source arg comes from psi node
@@ -313,8 +323,15 @@ value* ssa_rename::rename_use(node *n, value* v) {
 }
 
 value* ssa_rename::rename_def(node *n, value* v) {
-	unsigned index = new_index(def_count, v);
-	set_index(rename_stack.top(), v, index);
+	unsigned index;
+
+	if (v->is_lds_access()) {
+		index = new_index(lds_rw_count, v);
+		set_index(rename_lds_rw_stack.top(), v, index);
+	} else {
+		index = new_index(def_count, v);
+		set_index(rename_stack.top(), v, index);
+	}
 	value *r = sh.get_value_version(v, index);
 	return r;
 }




More information about the mesa-commit mailing list