diff --git a/src/amd/compiler/aco_ir.cpp b/src/amd/compiler/aco_ir.cpp index a678d05100e..fd7da14aa44 100644 --- a/src/amd/compiler/aco_ir.cpp +++ b/src/amd/compiler/aco_ir.cpp @@ -1380,8 +1380,11 @@ should_form_clause(const Instruction* a, const Instruction* b) if (a->definitions.empty() != b->definitions.empty()) return false; - if (a->format != b->format) + /* MUBUF and MTBUF can appear in the same clause. */ + if ((a->isMTBUF() && b->isMUBUF()) || (a->isMUBUF() && b->isMTBUF())) { + } else if (a->format != b->format) { return false; + } if (a->operands.empty() || b->operands.empty()) return false; diff --git a/src/amd/compiler/tests/test_hard_clause.cpp b/src/amd/compiler/tests/test_hard_clause.cpp index 82cc3fd97c4..50bf52ea889 100644 --- a/src/amd/compiler/tests/test_hard_clause.cpp +++ b/src/amd/compiler/tests/test_hard_clause.cpp @@ -282,16 +282,22 @@ BEGIN_TEST(form_hard_clauses.heuristic) create_smem_buffer(buf_desc0); create_smem(); - /* Only form clause between MUBUF and MTBUF if they load from the same binding. Ignore descriptor - * if they're te same binding. - */ + /* Form clause with MTBUF/MUBUF mix if they use the same descriptor. */ //>> p_unit_test 7 + //! s_clause imm:1 //; search_re('buffer_load_dword') //; search_re('tbuffer_load_format_x') bld.pseudo(aco_opcode::p_unit_test, Operand::c32(7u)); create_mubuf(buf_desc0); create_mtbuf(buf_desc0); + //>> p_unit_test 8 + //; search_re('buffer_load_dword') + //; search_re('tbuffer_load_format_x') + bld.pseudo(aco_opcode::p_unit_test, Operand::c32(8u)); + create_mubuf(buf_desc0); + create_mtbuf(buf_desc1); + finish_form_hard_clause_test(); END_TEST