diff --git a/src/gallium/drivers/r600/sfn/sfn_instr.cpp b/src/gallium/drivers/r600/sfn/sfn_instr.cpp index 6ab2518d3fa..28d3d73202d 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr.cpp @@ -337,10 +337,20 @@ bool Block::try_reserve_kcache(const AluInstr& instr) return true; } +void Block::set_chipclass(r600_chip_class chip_class) +{ + if (chip_class < ISA_CC_EVERGREEN) + s_max_kcache_banks = 2; + else + s_max_kcache_banks = 4; +} + +unsigned Block::s_max_kcache_banks = 4; + bool Block::try_reserve_kcache(const UniformValue& u, std::array& kcache) const { - const int kcache_banks = 4; // TODO: handle pre-evergreen + const int kcache_banks = s_max_kcache_banks; // TODO: handle pre-evergreen int bank = u.kcache_bank(); int sel = (u.sel() - 512); diff --git a/src/gallium/drivers/r600/sfn/sfn_instr.h b/src/gallium/drivers/r600/sfn/sfn_instr.h index 19f118149bd..39bd36d2574 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr.h +++ b/src/gallium/drivers/r600/sfn/sfn_instr.h @@ -210,6 +210,8 @@ public: bool kcache_reservation_failed() const { return m_kcache_alloc_failed;} + static void set_chipclass(r600_chip_class chip_class); + private: bool try_reserve_kcache(const UniformValue& u, std::array& kcache) const; @@ -231,7 +233,7 @@ private: int m_lds_group_requirement{0}; AluInstr *m_lds_group_start{nullptr}; - + static unsigned s_max_kcache_banks; }; class InstrWithVectorResult : public Instr { diff --git a/src/gallium/drivers/r600/sfn/sfn_scheduler.cpp b/src/gallium/drivers/r600/sfn/sfn_scheduler.cpp index 07cacbb53e5..fcdc78f875b 100644 --- a/src/gallium/drivers/r600/sfn/sfn_scheduler.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_scheduler.cpp @@ -224,6 +224,7 @@ private: Shader *schedule(Shader *original) { + Block::set_chipclass(original->chip_class()); AluGroup::set_chipclass(original->chip_class()); sfn_log << SfnLog::schedule << "Original shader\n";