panfrost: Make the unit to use for instructions explicit

We were using the first character of names to indicate the execution unit
('+' for add, '*' for fma). Change the ISA.xml file to have an explicit
`unit` attribute for instructions; this makes the XML more flexible
for future architectures and matches what the valhall ISA.xml does.

Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30179>
This commit is contained in:
Eric R. Smith 2024-07-04 17:10:15 -03:00 committed by Marge Bot
parent f4bd99fb0d
commit 470c2637fb
2 changed files with 381 additions and 363 deletions

File diff suppressed because it is too large Load diff

View file

@ -195,6 +195,23 @@ def parse_instruction(ins, include_pseudo):
return variants
def ins_name(ins, group = False):
# a historical artifact: the first character of the name should contain
# a single character tag to indicate the unit: '+' for add, '*' for fma
# bifrost has only those two units, valhall has others but for those
# it doesn't matter (pretend they are '+')
if not group:
group = ins
base_name = ins.attrib['name']
if group.attrib['unit'] == 'fma':
tagged_name = '*' + base_name
elif group.attrib.get('ir_unit', '') == 'fma':
tagged_name = '*' + base_name
else:
tagged_name = '+' + base_name
return tagged_name
def parse_instructions(xml, include_unused = False, include_pseudo = False):
final = {}
instructions = ET.parse(xml).getroot().findall('ins')
@ -211,7 +228,8 @@ def parse_instructions(xml, include_unused = False, include_pseudo = False):
if parsed[0][1]["pseudo"] and not include_pseudo:
continue
final[ins.attrib['name']] = parsed
tagged_name = ins_name(ins)
final[tagged_name] = parsed
return final