From d8e6abf54234906fc8cf893fd0bd60901f585f8d Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Tue, 10 May 2022 20:04:09 +0200 Subject: [PATCH] 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 Part-of: --- 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;