aco/optimizer: add less agressive pattern matching option

Still a bit more aggresive than the classic is_used_once,
but it should still prevent most regressions for patterns
that use min/max/mul as outer instruction.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38150>
This commit is contained in:
Georg Lehmann 2025-10-29 20:34:33 +01:00 committed by Marge Bot
parent 2c05aa34aa
commit 5d02eae052

View file

@ -3288,6 +3288,11 @@ struct combine_instr_pattern {
unsigned operand_mask;
const char* swizzle;
combine_instr_callback callback;
/* Limit to pattern matching to avoid unlike combining for instructions
* that might be used as src_opcode for other patterns.
*/
bool less_aggressive;
};
bool
@ -3372,6 +3377,9 @@ match_and_apply_patterns(opt_ctx& ctx, alu_opt_info& info,
op_instr.opcode != pattern.src_opcode)
continue;
if (pattern.less_aggressive && ctx.uses[tmp.id()] > ctx.uses[info.defs[0].tempId()])
continue;
alu_opt_info new_info = info;
unsigned rem = info.operands.size() - 1;