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 <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21347>
This commit is contained in:
Gert Wollny 2023-02-10 16:57:43 +01:00 committed by Marge Bot
parent f4816d2a72
commit 669aba02b0
2 changed files with 25 additions and 13 deletions

View file

@ -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;

View file

@ -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)
{