etnaviv: nir: Preserve dot product instructions

Modify the ALU width callback to return 0 for dot product operations,
preventing nir_lower_alu_width from decomposing them into multiply-add
chains. This preserves fdot2, fdot3, and fdot4 as single instructions
rather than expanding them into multiple fmul+fadd operations.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13531

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36130>
This commit is contained in:
Christian Gmeiner 2025-07-01 20:37:27 +02:00 committed by Marge Bot
parent 76f2735fe2
commit 004abdc767

View file

@ -1182,8 +1182,17 @@ fill_vs_mystery(struct etna_shader_variant *v)
}
static uint8_t
alu_width_cb(UNUSED const nir_instr *instr, UNUSED const void *cb_data)
alu_width_cb(const nir_instr *instr, UNUSED const void *cb_data)
{
if (instr->type == nir_instr_type_alu) {
nir_alu_instr *alu = nir_instr_as_alu(instr);
if (alu->op == nir_op_fdot2 ||
alu->op == nir_op_fdot3 ||
alu->op == nir_op_fdot4)
return 0;
}
return 4;
}