r600/sfn: move tracking of kcache reservation failure to scheduler

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
This commit is contained in:
Gert Wollny 2026-04-23 15:16:45 +02:00 committed by Marge Bot
parent dfb0e209e9
commit 39d7251568
3 changed files with 11 additions and 14 deletions

View file

@ -386,7 +386,6 @@ bool
Block::update_kcache_reservation(const AluGroup& group)
{
auto [kcache, success] = try_reserve_kcache(group);
m_kcache_alloc_failed = !success;
if (!success)
return false;
@ -428,7 +427,6 @@ bool
Block::update_kcache_reservation(const AluInstr& instr)
{
auto [kcache, success] = try_reserve_kcache(instr);
m_kcache_alloc_failed = !success;
if (!success)
return false;
@ -441,7 +439,6 @@ void
Block::commit_kcache_reservation(const std::array<KCacheLine, 4>& kcache)
{
m_kcache = kcache;
m_kcache_alloc_failed = false;
}
void

View file

@ -207,7 +207,6 @@ public:
auto try_reserve_kcache(const AluInstr& group) const
-> std::pair<std::array<KCacheLine, 4>, bool>;
void commit_kcache_reservation(const std::array<KCacheLine, 4>& kcache);
void set_kcache_reservation_failed(bool failed) { m_kcache_alloc_failed = failed; }
bool update_kcache_reservation(const AluGroup& instr);
bool update_kcache_reservation(const AluInstr& instr);
@ -220,8 +219,6 @@ public:
size_t size() const { return m_instructions.size(); }
bool kcache_reservation_failed() const { return m_kcache_alloc_failed; }
int inc_rat_emitted() { return ++m_emitted_rat_instr; }
void set_expected_ar_uses(uint32_t n) {m_expected_ar_uses = n;}
@ -250,7 +247,6 @@ private:
uint32_t m_remaining_slots{0xffff};
std::array<KCacheLine, 4> m_kcache;
bool m_kcache_alloc_failed{false};
Instr *m_last_lds_instr{nullptr};

View file

@ -195,7 +195,8 @@ private:
int free_slots);
AluGroupFillResult handle_alu_group_fill_failure(Shader::ShaderBlocks& out_blocks,
AluGroup& group,
const AluScheduleContext& alu_ctx);
const AluScheduleContext& alu_ctx,
bool had_kcache_failure);
auto schedule_prebuilt_alu_group_first(Shader::ShaderBlocks& out_blocks,
bool& success,
const AluScheduleContext& alu_ctx) -> AluGroup*;
@ -267,6 +268,7 @@ private:
bool m_idx1_loading{false};
bool m_idx0_pending{false};
bool m_idx1_pending{false};
bool m_had_kcache_failure_in_fill{false};
bool m_nop_after_rel_dest{false};
bool m_nop_befor_rel_src{false};
@ -632,7 +634,8 @@ BlockScheduler::fill_alu_group(Shader::ShaderBlocks& out_blocks,
return result;
}
auto failure_type = handle_alu_group_fill_failure(out_blocks, group, alu_ctx);
auto failure_type = handle_alu_group_fill_failure(out_blocks, group, alu_ctx, m_had_kcache_failure_in_fill);
m_had_kcache_failure_in_fill = false;
if (failure_type != AluGroupFillResult::retry)
return failure_type;
@ -668,9 +671,10 @@ BlockScheduler::try_schedule_alu_trans_slot(AluGroup& group,
BlockScheduler::AluGroupFillResult
BlockScheduler::handle_alu_group_fill_failure(Shader::ShaderBlocks& out_blocks,
AluGroup& group,
const AluScheduleContext& alu_ctx)
const AluScheduleContext& alu_ctx,
bool had_kcache_failure)
{
if (m_current_block->kcache_reservation_failed()) {
if (had_kcache_failure) {
// LDS read groups should not lead to impossible
// kcache constellations
assert(!m_current_block->lds_group_active());
@ -1071,7 +1075,7 @@ BlockScheduler::schedule_alu_to_group_vec(AluGroup& group)
}
auto [kcache, reserved] = m_current_block->try_reserve_kcache(**i);
m_current_block->set_kcache_reservation_failed(!reserved);
m_had_kcache_failure_in_fill = !reserved;
if (!reserved) {
sfn_log << SfnLog::schedule << " failed (kcache)\n";
@ -1225,7 +1229,7 @@ BlockScheduler::schedule_alu_multislot_to_group_vec(AluGroup& group)
}
auto [kcache, reserved] = m_current_block->try_reserve_kcache(**i);
m_current_block->set_kcache_reservation_failed(!reserved);
m_had_kcache_failure_in_fill = !reserved;
if (!reserved) {
sfn_log << SfnLog::schedule << " failed (kcache)\n";
@ -1275,7 +1279,7 @@ BlockScheduler::schedule_alu_to_group_trans(AluGroup& group,
sfn_log << SfnLog::schedule << "Try schedule to trans " << **i;
auto [kcache, reserved] = m_current_block->try_reserve_kcache(**i);
m_current_block->set_kcache_reservation_failed(!reserved);
m_had_kcache_failure_in_fill = !reserved;
if (!reserved) {
sfn_log << SfnLog::schedule << " failed (kcache)\n";