diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp index 0b0f29c5ff9..6d40e185500 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp @@ -15,7 +15,11 @@ namespace r600 { -AluGroup::AluGroup() { std::fill(m_slots.begin(), m_slots.end(), nullptr); } +AluGroup::AluGroup() +{ + std::fill(m_slots.begin(), m_slots.end(), nullptr); + m_free_slots = has_t() ? 0x1f : 0xf; +} bool AluGroup::add_instruction(AluInstr *instr) @@ -114,6 +118,7 @@ AluGroup::add_trans_instructions(AluInstr *instr) update_indirect_access(instr)) { m_readports_evaluator = readports_evaluator; m_slots[4] = instr; + m_free_slots &= ~0x10; instr->pin_sources_to_chan(); sfn_log << SfnLog::schedule << "T: " << *instr << "\n"; @@ -127,17 +132,6 @@ AluGroup::add_trans_instructions(AluInstr *instr) return false; } -int -AluGroup::free_slots() const -{ - int free_mask = 0; - for (int i = 0; i < s_max_slots; ++i) { - if (!m_slots[i]) - free_mask |= 1 << i; - } - return free_mask; -} - bool AluGroup::add_vec_instructions(AluInstr *instr) { @@ -261,6 +255,7 @@ AluGroup::try_readport(AluInstr *instr, AluBankSwizzle cycle) update_indirect_access(instr)) { m_readports_evaluator = readports_evaluator; m_slots[preferred_chan] = instr; + m_free_slots &= ~(1 << preferred_chan); m_has_lds_op |= instr->has_lds_access(); sfn_log << SfnLog::schedule << "V: " << *instr << "\n"; auto dest = instr->dest(); diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.h b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.h index e8cb0aff18e..a16d6e67ea6 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.h +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.h @@ -46,11 +46,13 @@ public: static void set_chipclass(r600_chip_class chip_class); - int free_slots() const; - auto addr() const { return std::make_pair(m_addr_used, m_addr_is_index); } uint32_t slots() const override; + uint8_t free_slot_mask() const + { + return m_free_slots; + } AluInstr::SrcValues get_kconsts() const; @@ -105,6 +107,8 @@ private: bool m_addr_for_src{false}; bool m_has_kill_op{false}; AluInstr *m_origin{nullptr}; + + uint8_t m_free_slots; }; } // namespace r600 diff --git a/src/gallium/drivers/r600/sfn/sfn_scheduler.cpp b/src/gallium/drivers/r600/sfn/sfn_scheduler.cpp index adbe69c3bda..e1f03d01ff7 100644 --- a/src/gallium/drivers/r600/sfn/sfn_scheduler.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_scheduler.cpp @@ -591,7 +591,7 @@ BlockScheduler::schedule_alu(Shader::ShaderBlocks& out_blocks) assert(group); - int free_slots = group->free_slots(); + int free_slots = group->free_slot_mask(); while (free_slots && has_alu_ready) { if (!alu_vec_ready.empty())