aco/gfx11+: limit hard clauses to 32 instructions

https://github.com/llvm/llvm-project/pull/81287

Foz-DB Navi31:
Totals from 406 (0.52% of 78112) affected shaders:
Instrs: 585342 -> 585750 (+0.07%)
CodeSize: 3077856 -> 3079456 (+0.05%); split: -0.00%, +0.05%
Latency: 3263165 -> 3263326 (+0.00%); split: -0.00%, +0.01%
InvThroughput: 664092 -> 664114 (+0.00%); split: -0.00%, +0.00%
VClause: 11143 -> 11537 (+3.54%)
SClause: 11878 -> 11884 (+0.05%)
Copies: 39807 -> 39815 (+0.02%)

Cc: mesa-stable
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27569>
(cherry picked from commit 6121497228)
This commit is contained in:
Georg Lehmann
2024-02-12 11:56:44 +01:00
committed by Eric Engestrom
parent ba1737d799
commit fdcaf82c6d
2 changed files with 6 additions and 2 deletions

View File

@@ -714,7 +714,7 @@
"description": "aco/gfx11+: limit hard clauses to 32 instructions",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@@ -248,6 +248,10 @@ get_type(Program* program, aco_ptr<Instruction>& 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<Instruction> current_instrs[63];
@@ -261,7 +265,7 @@ form_hard_clauses(Program* program)
aco_ptr<Instruction>& 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;