aco/builder: support new disable_wqm

Create the additional undef operands that are filled by insert_exec.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35970>
This commit is contained in:
Georg Lehmann 2025-07-06 21:27:18 +02:00 committed by Marge Bot
parent 0e66f2b2cc
commit bd6647e21e
2 changed files with 18 additions and 1 deletions

View file

@ -617,17 +617,23 @@ formats = [(f if len(f) == 5 else f + ('',)) for f in formats]
% for num_definitions, num_operands in shapes:
<%
args = ['aco_opcode opcode']
has_disable_wqm = False
for i in range(num_definitions):
args.append('Definition def%d' % i)
for i in range(num_operands):
args.append('Op op%d' % i)
for f in formats:
args += f.get_builder_field_decls()
has_disable_wqm |= f.has_disable_wqm()
%>\\
Result ${name}(${', '.join(args)})
{
Instruction* instr = create_instruction(opcode, (Format)(${'|'.join('(int)Format::%s' % f.name for f in formats)}), ${num_operands}, ${num_definitions});
unsigned num_ops = ${num_operands};
% if has_disable_wqm:
num_ops += disable_wqm * 2;
%endif
Instruction* instr = create_instruction(opcode, (Format)(${'|'.join('(int)Format::%s' % f.name for f in formats)}), num_ops, ${num_definitions});
% for i in range(num_definitions):
instr->definitions[${i}] = def${i};
instr->definitions[${i}].setPrecise(is_precise);
@ -639,6 +645,14 @@ formats = [(f if len(f) == 5 else f + ('',)) for f in formats]
% for i in range(num_operands):
instr->operands[${i}] = op${i}.op;
% endfor
% if has_disable_wqm:
if (disable_wqm) {
instr_exact_mask(instr) = Operand();
instr_wqm_mask(instr) = Operand();
}
%endif
% for f in formats:
% for dest, field_name in zip(f.get_builder_field_dests(), f.get_builder_field_names()):
instr->${f.get_accessor()}().${dest} = ${field_name};

View file

@ -201,6 +201,9 @@ class Format(IntEnum):
def get_builder_field_decls(self):
return [('%s %s=%s' % (f[0], f[1], f[2]) if f[2] != None else '%s %s' % (f[0], f[1])) for f in self.get_builder_fields()]
def has_disable_wqm(self):
return any([f[1] == 'disable_wqm' for f in self.get_builder_fields()])
def get_builder_initialization(self, num_operands):
res = ''
if self == Format.SDWA: