aco/vn: Don't combine expressions across calls

This increases live state across calls, which in turn increases spilling
and makes for slower shaders overall.

On top of RT function calls:
Totals from 7 (0.01% of 81072) affected shaders:

Instrs: 8980 -> 8955 (-0.28%); split: -0.88%, +0.60%
CodeSize: 51976 -> 51684 (-0.56%); split: -1.02%, +0.46%
SpillSGPRs: 248 -> 244 (-1.61%); split: -3.63%, +2.02%
SpillVGPRs: 367 -> 365 (-0.54%); split: -1.09%, +0.54%
Scratch: 32768 -> 31744 (-3.12%)
Latency: 135669 -> 128720 (-5.12%); split: -5.13%, +0.01%
InvThroughput: 35301 -> 34783 (-1.47%); split: -1.51%, +0.05%
VClause: 241 -> 242 (+0.41%)
SClause: 117 -> 120 (+2.56%)
Copies: 1311 -> 1338 (+2.06%); split: -0.69%, +2.75%
PreSGPRs: 899 -> 895 (-0.44%); split: -1.56%, +1.11%
PreVGPRs: 1103 -> 1099 (-0.36%)
VALU: 6143 -> 6098 (-0.73%); split: -1.22%, +0.49%
SALU: 913 -> 933 (+2.19%); split: -0.11%, +2.30%
VMEM: 989 -> 967 (-2.22%)
SMEM: 201 -> 214 (+6.47%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34531>
This commit is contained in:
Natalie Vock
2025-02-17 18:42:49 +01:00
committed by Marge Bot
parent 575d3adbf5
commit a06f38e5ae
+10 -1
View File
@@ -226,7 +226,8 @@ struct InstrPred {
case Format::EXP:
case Format::SOPP:
case Format::PSEUDO_BRANCH:
case Format::PSEUDO_BARRIER: UNREACHABLE("unsupported instruction format");
case Format::PSEUDO_BARRIER:
case Format::PSEUDO_CALL: UNREACHABLE("unsupported instruction format");
default: return true;
}
}
@@ -360,6 +361,14 @@ process_block(vn_ctx& ctx, Block& block)
if (instr->opcode == aco_opcode::p_discard_if ||
instr->opcode == aco_opcode::p_demote_to_helper || instr->opcode == aco_opcode::p_end_wqm)
ctx.exec_id++;
/* Clear all recorded values when encountering a call instruction to prevent replacing
* values across call instructions. The live state that can be kept in registers during
* function calls is typically very limited, so it's better to compute the same thing twice
* instead of increasing live ranges. This also disables value numbering of call instructions
* themselves, which is obviously invalid because callees can have side effects.
*/
if (instr->isCall())
ctx.expr_values.clear();
/* simple copy-propagation through renaming */
bool copy_instr =