ir3: correctly count vectorized instructions for tex prefetch

The tex prefetch heuristic simply counts the number of NIR instructions.
Since a vectorized NIR instruction expands to an ir3 instruction per
component, we have to take this into account while counting them.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28341>
This commit is contained in:
Job Noorman 2024-08-15 08:46:35 +02:00 committed by Marge Bot
parent fe09ea29b9
commit ef162f9a6f

View file

@ -155,7 +155,15 @@ ir3_context_init(struct ir3_compiler *compiler, struct ir3_shader *shader,
unsigned instruction_count = 0;
nir_foreach_block (block, fxn) {
instruction_count += exec_list_length(&block->instr_list);
nir_foreach_instr (instr, block) {
/* Vectorized ALU instructions expand to one scalar instruction per
* component.
*/
if (instr->type == nir_instr_type_alu)
instruction_count += nir_instr_as_alu(instr)->def.num_components;
else
instruction_count++;
}
}
if (instruction_count < 50) {