aco: remove create_instruction() template parameter

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28370>
This commit is contained in:
Daniel Schürmann
2024-03-25 15:55:27 +01:00
committed by Marge Bot
parent 4cb73cb5f3
commit a863c7951e
21 changed files with 273 additions and 337 deletions

View File

@@ -536,9 +536,9 @@ public:
int num_defs = carry_out ? 2 : 1;
aco_ptr<Instruction> sub;
if (vop3)
sub.reset(create_instruction<VALU_instruction>(op, Format::VOP3, num_ops, num_defs));
sub.reset(create_instruction(op, Format::VOP3, num_ops, num_defs));
else
sub.reset(create_instruction<VALU_instruction>(op, Format::VOP2, num_ops, num_defs));
sub.reset(create_instruction(op, Format::VOP2, num_ops, num_defs));
sub->operands[0] = a.op;
sub->operands[1] = b.op;
if (!borrow.op.isUndefined())
@@ -565,58 +565,58 @@ public:
}
<%
import itertools
formats = [("pseudo", [Format.PSEUDO], 'Pseudo_instruction', list(itertools.product(range(5), range(6))) + [(8, 1), (1, 8), (2, 6), (3, 6), (1, 6)]),
("sop1", [Format.SOP1], 'SALU_instruction', [(0, 1), (1, 0), (1, 1), (2, 1), (3, 2)]),
("sop2", [Format.SOP2], 'SALU_instruction', itertools.product([1, 2], [2, 3])),
("sopk", [Format.SOPK], 'SALU_instruction', itertools.product([0, 1, 2], [0, 1])),
("sopp", [Format.SOPP], 'SALU_instruction', itertools.product([0, 1], [0, 1])),
("sopc", [Format.SOPC], 'SALU_instruction', [(1, 2)]),
("smem", [Format.SMEM], 'SMEM_instruction', [(0, 4), (0, 3), (1, 0), (1, 3), (1, 2), (1, 1), (0, 0)]),
("ds", [Format.DS], 'DS_instruction', [(1, 1), (1, 2), (1, 3), (0, 3), (0, 4)]),
("ldsdir", [Format.LDSDIR], 'LDSDIR_instruction', [(1, 1)]),
("mubuf", [Format.MUBUF], 'MUBUF_instruction', [(0, 4), (1, 3)]),
("mtbuf", [Format.MTBUF], 'MTBUF_instruction', [(0, 4), (1, 3)]),
("mimg", [Format.MIMG], 'MIMG_instruction', itertools.product([0, 1], [3, 4, 5, 6, 7])),
("exp", [Format.EXP], 'Export_instruction', [(0, 4), (0, 5)]),
("branch", [Format.PSEUDO_BRANCH], 'Pseudo_branch_instruction', itertools.product([1], [0, 1])),
("barrier", [Format.PSEUDO_BARRIER], 'Pseudo_barrier_instruction', [(0, 0)]),
("reduction", [Format.PSEUDO_REDUCTION], 'Pseudo_reduction_instruction', [(3, 3)]),
("vop1", [Format.VOP1], 'VALU_instruction', [(0, 0), (1, 1), (2, 2)]),
("vop1_sdwa", [Format.VOP1, Format.SDWA], 'SDWA_instruction', [(1, 1)]),
("vop2", [Format.VOP2], 'VALU_instruction', itertools.product([1, 2], [2, 3])),
("vop2_sdwa", [Format.VOP2, Format.SDWA], 'SDWA_instruction', itertools.product([1, 2], [2, 3])),
("vopc", [Format.VOPC], 'VALU_instruction', itertools.product([1, 2], [2])),
("vopc_sdwa", [Format.VOPC, Format.SDWA], 'SDWA_instruction', itertools.product([1, 2], [2])),
("vop3", [Format.VOP3], 'VALU_instruction', [(1, 3), (1, 2), (1, 1), (2, 2)]),
("vop3p", [Format.VOP3P], 'VALU_instruction', [(1, 2), (1, 3)]),
("vopd", [Format.VOPD], 'VOPD_instruction', [(2, 2), (2, 3), (2, 4), (2, 5), (2, 6)]),
("vinterp_inreg", [Format.VINTERP_INREG], 'VINTERP_inreg_instruction', [(1, 3)]),
("vintrp", [Format.VINTRP], 'VINTRP_instruction', [(1, 2), (1, 3)]),
("vop1_dpp", [Format.VOP1, Format.DPP16], 'DPP16_instruction', [(1, 1)]),
("vop2_dpp", [Format.VOP2, Format.DPP16], 'DPP16_instruction', itertools.product([1, 2], [2, 3])),
("vopc_dpp", [Format.VOPC, Format.DPP16], 'DPP16_instruction', itertools.product([1, 2], [2])),
("vop3_dpp", [Format.VOP3, Format.DPP16], 'DPP16_instruction', [(1, 3), (1, 2), (1, 1), (2, 2)]),
("vop3p_dpp", [Format.VOP3P, Format.DPP16], 'DPP16_instruction', [(1, 2), (1, 3)]),
("vop1_dpp8", [Format.VOP1, Format.DPP8], 'DPP8_instruction', [(1, 1)]),
("vop2_dpp8", [Format.VOP2, Format.DPP8], 'DPP8_instruction', itertools.product([1, 2], [2, 3])),
("vopc_dpp8", [Format.VOPC, Format.DPP8], 'DPP8_instruction', itertools.product([1, 2], [2])),
("vop3_dpp8", [Format.VOP3, Format.DPP8], 'DPP8_instruction', [(1, 3), (1, 2), (1, 1), (2, 2)]),
("vop3p_dpp8", [Format.VOP3P, Format.DPP8], 'DPP8_instruction', [(1, 2), (1, 3)]),
("vop1_e64", [Format.VOP1, Format.VOP3], 'VALU_instruction', itertools.product([1], [1])),
("vop2_e64", [Format.VOP2, Format.VOP3], 'VALU_instruction', itertools.product([1, 2], [2, 3])),
("vopc_e64", [Format.VOPC, Format.VOP3], 'VALU_instruction', itertools.product([1, 2], [2])),
("vop1_e64_dpp", [Format.VOP1, Format.VOP3, Format.DPP16], 'DPP16_instruction', itertools.product([1], [1])),
("vop2_e64_dpp", [Format.VOP2, Format.VOP3, Format.DPP16], 'DPP16_instruction', itertools.product([1, 2], [2, 3])),
("vopc_e64_dpp", [Format.VOPC, Format.VOP3, Format.DPP16], 'DPP16_instruction', itertools.product([1, 2], [2])),
("vop1_e64_dpp8", [Format.VOP1, Format.VOP3, Format.DPP8], 'DPP8_instruction', itertools.product([1], [1])),
("vop2_e64_dpp8", [Format.VOP2, Format.VOP3, Format.DPP8], 'DPP8_instruction', itertools.product([1, 2], [2, 3])),
("vopc_e64_dpp8", [Format.VOPC, Format.VOP3, Format.DPP8], 'DPP8_instruction', itertools.product([1, 2], [2])),
("flat", [Format.FLAT], 'FLAT_instruction', [(0, 3), (1, 2)]),
("global", [Format.GLOBAL], 'FLAT_instruction', [(0, 3), (1, 2)]),
("scratch", [Format.SCRATCH], 'FLAT_instruction', [(0, 3), (1, 2)])]
formats = [("pseudo", [Format.PSEUDO], list(itertools.product(range(5), range(6))) + [(8, 1), (1, 8), (2, 6), (3, 6), (1, 6)]),
("sop1", [Format.SOP1], [(0, 1), (1, 0), (1, 1), (2, 1), (3, 2)]),
("sop2", [Format.SOP2], itertools.product([1, 2], [2, 3])),
("sopk", [Format.SOPK], itertools.product([0, 1, 2], [0, 1])),
("sopp", [Format.SOPP], itertools.product([0, 1], [0, 1])),
("sopc", [Format.SOPC], [(1, 2)]),
("smem", [Format.SMEM], [(0, 4), (0, 3), (1, 0), (1, 3), (1, 2), (1, 1), (0, 0)]),
("ds", [Format.DS], [(1, 1), (1, 2), (1, 3), (0, 3), (0, 4)]),
("ldsdir", [Format.LDSDIR], [(1, 1)]),
("mubuf", [Format.MUBUF], [(0, 4), (1, 3)]),
("mtbuf", [Format.MTBUF], [(0, 4), (1, 3)]),
("mimg", [Format.MIMG], itertools.product([0, 1], [3, 4, 5, 6, 7])),
("exp", [Format.EXP], [(0, 4), (0, 5)]),
("branch", [Format.PSEUDO_BRANCH], itertools.product([1], [0, 1])),
("barrier", [Format.PSEUDO_BARRIER], [(0, 0)]),
("reduction", [Format.PSEUDO_REDUCTION], [(3, 3)]),
("vop1", [Format.VOP1], [(0, 0), (1, 1), (2, 2)]),
("vop1_sdwa", [Format.VOP1, Format.SDWA], [(1, 1)]),
("vop2", [Format.VOP2], itertools.product([1, 2], [2, 3])),
("vop2_sdwa", [Format.VOP2, Format.SDWA], itertools.product([1, 2], [2, 3])),
("vopc", [Format.VOPC], itertools.product([1, 2], [2])),
("vopc_sdwa", [Format.VOPC, Format.SDWA], itertools.product([1, 2], [2])),
("vop3", [Format.VOP3], [(1, 3), (1, 2), (1, 1), (2, 2)]),
("vop3p", [Format.VOP3P], [(1, 2), (1, 3)]),
("vopd", [Format.VOPD], [(2, 2), (2, 3), (2, 4), (2, 5), (2, 6)]),
("vinterp_inreg", [Format.VINTERP_INREG], [(1, 3)]),
("vintrp", [Format.VINTRP], [(1, 2), (1, 3)]),
("vop1_dpp", [Format.VOP1, Format.DPP16], [(1, 1)]),
("vop2_dpp", [Format.VOP2, Format.DPP16], itertools.product([1, 2], [2, 3])),
("vopc_dpp", [Format.VOPC, Format.DPP16], itertools.product([1, 2], [2])),
("vop3_dpp", [Format.VOP3, Format.DPP16], [(1, 3), (1, 2), (1, 1), (2, 2)]),
("vop3p_dpp", [Format.VOP3P, Format.DPP16], [(1, 2), (1, 3)]),
("vop1_dpp8", [Format.VOP1, Format.DPP8], [(1, 1)]),
("vop2_dpp8", [Format.VOP2, Format.DPP8], itertools.product([1, 2], [2, 3])),
("vopc_dpp8", [Format.VOPC, Format.DPP8], itertools.product([1, 2], [2])),
("vop3_dpp8", [Format.VOP3, Format.DPP8], [(1, 3), (1, 2), (1, 1), (2, 2)]),
("vop3p_dpp8", [Format.VOP3P, Format.DPP8], [(1, 2), (1, 3)]),
("vop1_e64", [Format.VOP1, Format.VOP3], itertools.product([1], [1])),
("vop2_e64", [Format.VOP2, Format.VOP3], itertools.product([1, 2], [2, 3])),
("vopc_e64", [Format.VOPC, Format.VOP3], itertools.product([1, 2], [2])),
("vop1_e64_dpp", [Format.VOP1, Format.VOP3, Format.DPP16], itertools.product([1], [1])),
("vop2_e64_dpp", [Format.VOP2, Format.VOP3, Format.DPP16], itertools.product([1, 2], [2, 3])),
("vopc_e64_dpp", [Format.VOPC, Format.VOP3, Format.DPP16], itertools.product([1, 2], [2])),
("vop1_e64_dpp8", [Format.VOP1, Format.VOP3, Format.DPP8], itertools.product([1], [1])),
("vop2_e64_dpp8", [Format.VOP2, Format.VOP3, Format.DPP8], itertools.product([1, 2], [2, 3])),
("vopc_e64_dpp8", [Format.VOPC, Format.VOP3, Format.DPP8], itertools.product([1, 2], [2])),
("flat", [Format.FLAT], [(0, 3), (1, 2)]),
("global", [Format.GLOBAL], [(0, 3), (1, 2)]),
("scratch", [Format.SCRATCH], [(0, 3), (1, 2)])]
formats = [(f if len(f) == 5 else f + ('',)) for f in formats]
%>\\
% for name, formats, struct, shapes, extra_field_setup in formats:
% for name, formats, shapes, extra_field_setup in formats:
% for num_definitions, num_operands in shapes:
<%
args = ['aco_opcode opcode']
@@ -630,7 +630,7 @@ formats = [(f if len(f) == 5 else f + ('',)) for f in formats]
Result ${name}(${', '.join(args)})
{
Instruction* instr = create_instruction<${struct}>(opcode, (Format)(${'|'.join('(int)Format::%s' % f.name for f in formats)}), ${num_operands}, ${num_definitions});
Instruction* instr = create_instruction(opcode, (Format)(${'|'.join('(int)Format::%s' % f.name for f in formats)}), ${num_operands}, ${num_definitions});
% for i in range(num_definitions):
instr->definitions[${i}] = def${i};
instr->definitions[${i}].setPrecise(is_precise);