pan/bi: Track instruction size in opcode table

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
This commit is contained in:
Alyssa Rosenzweig 2021-06-10 20:08:18 -04:00 committed by Marge Bot
parent 91a2804d8f
commit 16bf1ae935
2 changed files with 18 additions and 4 deletions

View File

@ -29,6 +29,7 @@ struct bi_op_props bi_opcode_props[BI_NUM_OPCODES] = {
% for opcode in sorted(mnemonics):
<%
add = instructions["+" + opcode][0][1] if "+" + opcode in instructions else None
size = typesize(opcode)
message = add["message"].upper() if add else "NONE"
sr_count = add["staging_count"].upper() if add else "0"
sr_read = int(add["staging"] in ["r", "rw"] if add else False)
@ -46,9 +47,10 @@ struct bi_op_props bi_opcode_props[BI_NUM_OPCODES] = {
m_not = hasmod(mods, 'not1')
%>
[BI_OPCODE_${opcode.replace('.', '_').upper()}] = {
"${opcode}", BIFROST_MESSAGE_${message}, BI_SR_COUNT_${sr_count},
${sr_read}, ${sr_write}, ${last}, ${branch}, ${table}, ${has_fma}, ${has_add},
${clamp}, ${not_result}, ${abs}, ${neg}, ${m_not},
"${opcode}", BIFROST_MESSAGE_${message}, BI_SIZE_${size},
BI_SR_COUNT_${sr_count}, ${sr_read}, ${sr_write}, ${last}, ${branch},
${table}, ${has_fma}, ${has_add}, ${clamp}, ${not_result}, ${abs},
${neg}, ${m_not},
},
% endfor
};"""
@ -61,4 +63,4 @@ instructions = parse_instructions(sys.argv[1], include_pseudo = True)
ir_instructions = partition_mnemonics(instructions)
mnemonics = set(x[1:] for x in instructions.keys())
print(Template(COPYRIGHT + TEMPLATE).render(ops = ir_instructions, mnemonics = mnemonics, instructions = instructions))
print(Template(COPYRIGHT + TEMPLATE).render(ops = ir_instructions, mnemonics = mnemonics, instructions = instructions, typesize = typesize))

View File

@ -64,11 +64,23 @@ enum bi_sr_count {
BI_SR_COUNT_SR_COUNT = 7
};
enum bi_size {
BI_SIZE_8 = 0,
BI_SIZE_16,
BI_SIZE_24,
BI_SIZE_32,
BI_SIZE_48,
BI_SIZE_64,
BI_SIZE_96,
BI_SIZE_128,
};
/* Description of an opcode in the IR */
struct bi_op_props {
const char *name;
enum bifrost_message_type message : 4;
enum bi_size size : 3;
enum bi_sr_count sr_count : 3;
bool sr_read : 1;
bool sr_write : 1;