diff --git a/src/amd/compiler/aco_form_hard_clauses.cpp b/src/amd/compiler/aco_form_hard_clauses.cpp index 90ace0b9fb8..66f0ded6f8d 100644 --- a/src/amd/compiler/aco_form_hard_clauses.cpp +++ b/src/amd/compiler/aco_form_hard_clauses.cpp @@ -248,6 +248,10 @@ get_type(Program* program, aco_ptr& instr) void form_hard_clauses(Program* program) { + /* The ISA documentation says 63 is the maximum for GFX11/12, but according to + * LLVM there are HW bugs with more than 32 instructions. + */ + const unsigned max_clause_length = program->gfx_level >= GFX11 ? 32 : 63; for (Block& block : program->blocks) { unsigned num_instrs = 0; aco_ptr current_instrs[63]; @@ -261,7 +265,7 @@ form_hard_clauses(Program* program) aco_ptr& instr = block.instructions[i]; clause_type type = get_type(program, instr); - if (type != current_type || num_instrs == 63 || + if (type != current_type || num_instrs == max_clause_length || (num_instrs && !should_form_clause(current_instrs[0].get(), instr.get()))) { emit_clause(bld, num_instrs, current_instrs); num_instrs = 0;