From 669aba02b09e962b00fbe5b5dcba813871972ceb Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 10 Feb 2023 16:57:43 +0100 Subject: [PATCH] r600/sfn: Don't copy-propagate indirect access into LDS instr Propagating array elements has the problem that we would have to check whether the last load is not overwritten by an indirect store. Indirect kcache buffer loads require starting a new CF, and we would have to make sure that we don't split the LDS fetch/read group with that, so don't do this. Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/sfn/sfn_instr_lds.cpp | 33 ++++++++++++++-------- .../drivers/r600/sfn/sfn_split_address_loads.cpp | 5 ++-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_lds.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_lds.cpp index f007dca..dd8f71f 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_lds.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_lds.cpp @@ -356,25 +356,34 @@ LDSAtomicInstr::replace_source(PRegister old_src, PVirtualValue new_src) { bool process = false; - if (new_src->as_uniform() && m_srcs.size() > 2) { - int nconst = 0; - for (auto& s : m_srcs) { - if (s->as_uniform() && !s->equal_to(*old_src)) - ++nconst; + if (new_src->as_uniform()) { + if (m_srcs.size() > 2) { + int nconst = 0; + for (auto& s : m_srcs) { + if (s->as_uniform() && !s->equal_to(*old_src)) + ++nconst; + } + /* Conservative check: with two kcache values can always live, + * tree might be a problem, don't care for now, just reject + */ + if (nconst > 2) + return false; } - /* Conservative check: with two kcache values can always live, - * tree might be a problem, don't care for now, just reject - */ - if (nconst > 2) + + /* indirect constant buffer access means new CF, and this is something + * we can't do in the middle of an LDS read group */ + auto u = new_src->as_uniform(); + if (u->buf_addr()) return false; } - /* If the old source is an array element, we assume that there + /* If the source is an array element, we assume that there * might have been an (untracked) indirect access, so don't replace * this source */ - if (old_src->pin() == pin_array) + if (old_src->pin() == pin_array || new_src->pin() == pin_array) return false; +<<<<<<< HEAD if (new_src->get_addr()) { for (auto& s : m_srcs) { auto addr = s->get_addr(); @@ -384,6 +393,8 @@ LDSAtomicInstr::replace_source(PRegister old_src, PVirtualValue new_src) } } +======= +>>>>>>> 74c0ddf158e (r600/sfn: Don't copy-propagate indirect access into LDS instr) for (unsigned i = 0; i < m_srcs.size(); ++i) { if (old_src->equal_to(*m_srcs[i])) { m_srcs[i] = new_src; diff --git a/src/gallium/drivers/r600/sfn/sfn_split_address_loads.cpp b/src/gallium/drivers/r600/sfn/sfn_split_address_loads.cpp index 11ccae6..137d911 100644 --- a/src/gallium/drivers/r600/sfn/sfn_split_address_loads.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_split_address_loads.cpp @@ -363,11 +363,12 @@ void AddressSplitVisitor::visit(WriteTFInstr *instr) void AddressSplitVisitor::visit(LDSAtomicInstr *instr) { - + (void)instr; } + void AddressSplitVisitor::visit(LDSReadInstr *instr) { - + (void)instr; } void AddressSplitVisitor::visit(RatInstr *instr) { -- 2.7.4