Mesa (main): r600/sb: Don't create three source ops with all kcache values

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 17 18:49:54 UTC 2022


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Tue May 10 20:04:09 2022 +0200

r600/sb: Don't create three source ops with all kcache values

There is a good chance that the created instruction can't be
scheduled, so avoid this case.

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

---

 src/gallium/drivers/r600/sb/sb_gvn.cpp      | 3 ++-
 src/gallium/drivers/r600/sb/sb_peephole.cpp | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/sb/sb_gvn.cpp b/src/gallium/drivers/r600/sb/sb_gvn.cpp
index caea4ec6660..c994ff6a8af 100644
--- a/src/gallium/drivers/r600/sb/sb_gvn.cpp
+++ b/src/gallium/drivers/r600/sb/sb_gvn.cpp
@@ -174,10 +174,11 @@ void gvn::process_alu_src_constants(node &n, value* &v) {
 		}
 	}
 
+	unsigned kcache_count = 0;
 	for (vvec::iterator I = n.src.begin(), E = n.src.end(); I != E; ++I) {
 		value *c = (*I);
 
-		if (c->is_kcache() && !kc.try_reserve(c->select)) {
+		if (c->is_kcache() && (!kc.try_reserve(c->select) || ++kcache_count == 2)) {
 			process_src(v, false);
 			return;
 		}
diff --git a/src/gallium/drivers/r600/sb/sb_peephole.cpp b/src/gallium/drivers/r600/sb/sb_peephole.cpp
index 979f4bc130b..5e336310a7f 100644
--- a/src/gallium/drivers/r600/sb/sb_peephole.cpp
+++ b/src/gallium/drivers/r600/sb/sb_peephole.cpp
@@ -268,6 +268,12 @@ void peephole::optimize_CNDcc_op(alu_node* a) {
 	if (d->bc.src[nds].abs)
 		return;
 
+	// Don't create an instruction that uses three kcache values
+	// chances are high that it can't be scheduled
+	if (d->src[0]->is_kcache() && a->src[1]->is_kcache() &&
+		 a->src[2]->is_kcache())
+		return;
+
 	// TODO we can handle some cases for uint comparison
 	if (dcmp_type == AF_UINT_CMP)
 		return;



More information about the mesa-commit mailing list