From 575f24d19f1664f92f7cc2833f30a66799bebecc Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Tue, 3 Sep 2024 10:53:43 +0100 Subject: [PATCH] aco: don't emit early exit over dealloc_vgprs fossil-db (navi31): Totals from 3308 (4.17% of 79395) affected shaders: Instrs: 387145 -> 375373 (-3.04%) CodeSize: 2018276 -> 1964380 (-2.67%) Latency: 6588004 -> 6549068 (-0.59%) InvThroughput: 458792 -> 457025 (-0.39%); split: -0.39%, +0.00% Branches: 10710 -> 7402 (-30.89%) Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Part-of: --- src/amd/compiler/aco_lower_to_hw_instr.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_lower_to_hw_instr.cpp b/src/amd/compiler/aco_lower_to_hw_instr.cpp index f0b2ac191de..864063b624a 100644 --- a/src/amd/compiler/aco_lower_to_hw_instr.cpp +++ b/src/amd/compiler/aco_lower_to_hw_instr.cpp @@ -2331,7 +2331,7 @@ lower_to_hw_instr(Program* program) } case aco_opcode::p_exit_early_if: { /* don't bother with an early exit near the end of the program */ - if ((block->instructions.size() - 1 - instr_idx) <= 4 && + if ((block->instructions.size() - 1 - instr_idx) <= 5 && block->instructions.back()->opcode == aco_opcode::s_endpgm) { unsigned null_exp_dest = program->gfx_level >= GFX11 ? V_008DFC_SQ_EXP_MRT : V_008DFC_SQ_EXP_NULL; @@ -2350,6 +2350,9 @@ lower_to_hw_instr(Program* program) instr2->definitions[0].isFixed() && instr2->definitions[0].physReg() == exec) continue; + else if (instr2->opcode == aco_opcode::s_sendmsg && + instr2->salu().imm == sendmsg_dealloc_vgprs) + continue; ignore_early_exit = false; }