From 8db31e0fe6976a92b3b8c334baca6582dd675682 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Thu, 21 Jul 2022 17:52:05 +0200 Subject: [PATCH] r600/sfn: count LDS queue pop reads separately in assembler Otherwise the check whether the fetches and reads are balanced could fail. Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/sfn/sfn_assembler.cpp | 2 +- src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp | 18 ++++++++++++------ src/gallium/drivers/r600/sfn/sfn_instr_alu.h | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_assembler.cpp b/src/gallium/drivers/r600/sfn/sfn_assembler.cpp index dc8a76737d7..75c3e59e4a4 100644 --- a/src/gallium/drivers/r600/sfn/sfn_assembler.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_assembler.cpp @@ -309,7 +309,7 @@ void AssamblerVisitor::emit_alu_op(const AluInstr& ai) alu.src[i].kc_rel = 1; } - if (ai.has_lds_access()) { + if (ai.has_lds_queue_read()) { assert(m_bc->cf_last->nlds_read > 0); m_bc->cf_last->nlds_read--; } diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp index 886adf574e4..fa021811cc7 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp @@ -788,14 +788,20 @@ bool AluInstr::propagate_death() bool AluInstr::has_lds_access() const { - if (has_alu_flag(alu_is_lds)) - return true; + return has_alu_flag(alu_is_lds) || has_lds_queue_read(); +} - for (auto& s : m_src) - if (s->as_inline_const() && - (s->as_inline_const()->sel() == ALU_SRC_LDS_OQ_A_POP)) +bool AluInstr::has_lds_queue_read() const +{ + for (auto& s : m_src) { + auto ic = s->as_inline_const(); + if (!ic) + continue; + + if (ic->sel() == ALU_SRC_LDS_OQ_A_POP || + ic->sel() == ALU_SRC_LDS_OQ_B_POP) return true; - + } return false; } diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.h b/src/gallium/drivers/r600/sfn/sfn_instr_alu.h index 2d9a24e910d..1d54e30baf8 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.h +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.h @@ -127,6 +127,7 @@ public: bool is_equal_to(const AluInstr& lhs) const; bool has_lds_access() const; + bool has_lds_queue_read() const; static const std::map cf_map; static const std::map bank_swizzle_map;