mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
nir: sink/move alu with two identical, non constant sources.
Foz-DB Navi21: Totals from 32363 (40.76% of 79395) affected shaders: MaxWaves: 787499 -> 787675 (+0.02%); split: +0.02%, -0.00% Instrs: 28783404 -> 28783464 (+0.00%); split: -0.01%, +0.01% CodeSize: 156763536 -> 156765148 (+0.00%); split: -0.01%, +0.02% VGPRs: 1493304 -> 1492848 (-0.03%); split: -0.04%, +0.01% Latency: 243022511 -> 243051994 (+0.01%); split: -0.08%, +0.09% InvThroughput: 57827398 -> 57828129 (+0.00%); split: -0.05%, +0.05% VClause: 582208 -> 582298 (+0.02%); split: -0.07%, +0.08% SClause: 959634 -> 959312 (-0.03%); split: -0.07%, +0.04% Copies: 1965821 -> 1965826 (+0.00%); split: -0.17%, +0.17% Branches: 710593 -> 710596 (+0.00%); split: -0.00%, +0.01% PreSGPRs: 1313513 -> 1313632 (+0.01%); split: -0.00%, +0.01% PreVGPRs: 1210596 -> 1209103 (-0.12%); split: -0.12%, +0.00% VALU: 19463445 -> 19463497 (+0.00%); split: -0.02%, +0.02% SALU: 3319529 -> 3319500 (-0.00%); split: -0.01%, +0.01% Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32783>
This commit is contained in:
parent
6a6b26dfa5
commit
b8fa9daf0c
1 changed files with 9 additions and 5 deletions
|
|
@ -76,21 +76,25 @@ can_sink_instr(nir_instr *instr, nir_move_options options, bool *can_mov_out_of_
|
|||
return options & nir_move_comparisons;
|
||||
|
||||
/* Assuming that constants do not contribute to register pressure, it is
|
||||
* beneficial to sink ALU instructions where all but one source is
|
||||
* constant. Detect that case last.
|
||||
* beneficial to sink ALU instructions where all non constant sources
|
||||
* are the same.
|
||||
*/
|
||||
if (!(options & nir_move_alu))
|
||||
return false;
|
||||
|
||||
unsigned inputs = nir_op_infos[alu->op].num_inputs;
|
||||
unsigned constant_inputs = 0;
|
||||
int non_const = -1;
|
||||
|
||||
for (unsigned i = 0; i < inputs; ++i) {
|
||||
if (is_constant_like(&alu->src[i].src))
|
||||
constant_inputs++;
|
||||
continue;
|
||||
else if (non_const < 0)
|
||||
non_const = i;
|
||||
else if (!nir_alu_srcs_equal(alu, alu, non_const, i))
|
||||
return false;
|
||||
}
|
||||
|
||||
return (constant_inputs + 1 >= inputs);
|
||||
return true;
|
||||
}
|
||||
case nir_instr_type_intrinsic: {
|
||||
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue