mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-07 10:28:25 +02:00
nir/opt_varyings: Skip code-motion for upconversions
Code-motion should not move back upconversions without any other instruction, that would only increase memory pressure without any significant performance benefit (conversions are usually cheap). This should also help lowering mediump varyings early by not reversing their work. Signed-off-by: Lorenzo Rossi <lorenzo.rossi@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Eric R. Smith <eric.smith@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40273>
This commit is contained in:
parent
b97a1e6870
commit
75425f36dc
1 changed files with 12 additions and 0 deletions
|
|
@ -4092,6 +4092,18 @@ backward_inter_shader_code_motion(struct linkage_info *linkage,
|
|||
alu->src[1].src.ssa == load_def)))))
|
||||
continue;
|
||||
|
||||
/* Skip upconversions, those are usually cheap and moving them
|
||||
* back just increases memory pressure without helping performance.
|
||||
*/
|
||||
unsigned input_size = 0;
|
||||
for (int i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
|
||||
nir_src *src = &alu->src[i].src;
|
||||
input_size += nir_src_bit_size(*src) *
|
||||
nir_src_num_components(*src);
|
||||
}
|
||||
if (input_size < alu->def.bit_size * alu->def.num_components)
|
||||
continue;
|
||||
|
||||
bit_size = alu->def.bit_size;
|
||||
} else if (iter->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(iter);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue