From 470c2637fbbd8c1539179905ce93c8ff386e19c5 Mon Sep 17 00:00:00 2001 From: "Eric R. Smith" Date: Thu, 4 Jul 2024 17:10:15 -0300 Subject: [PATCH] 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 Acked-by: Boris Brezillon Part-of: --- src/panfrost/compiler/ISA.xml | 724 +++++++++++++-------------- src/panfrost/compiler/bifrost_isa.py | 20 +- 2 files changed, 381 insertions(+), 363 deletions(-) diff --git a/src/panfrost/compiler/ISA.xml b/src/panfrost/compiler/ISA.xml index 7ddd9993e1a..462d068b3bb 100644 --- a/src/panfrost/compiler/ISA.xml +++ b/src/panfrost/compiler/ISA.xml @@ -23,7 +23,7 @@ - + @@ -35,7 +35,7 @@ - + @@ -77,7 +77,7 @@ - + @@ -102,7 +102,7 @@ - + @@ -117,7 +117,7 @@ - + @@ -140,7 +140,7 @@ - + @@ -163,7 +163,7 @@ - + @@ -175,7 +175,7 @@ - + @@ -187,7 +187,7 @@ - + @@ -199,7 +199,7 @@ - + @@ -211,7 +211,7 @@ - + @@ -234,7 +234,7 @@ - + @@ -257,7 +257,7 @@ - + @@ -279,7 +279,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -324,16 +324,16 @@ - + - + - + @@ -344,12 +344,12 @@ - + - + @@ -386,7 +386,7 @@ - + @@ -413,7 +413,7 @@ - + @@ -440,7 +440,7 @@ - + @@ -467,7 +467,7 @@ - + @@ -504,7 +504,7 @@ - + @@ -531,7 +531,7 @@ - + @@ -558,7 +558,7 @@ - + @@ -585,7 +585,7 @@ - + @@ -606,7 +606,7 @@ - + attribute_1 @@ -616,7 +616,7 @@ - + h0 @@ -624,7 +624,7 @@ - + @@ -695,7 +695,7 @@ - + @@ -766,7 +766,7 @@ - + @@ -775,7 +775,7 @@ - + @@ -855,7 +855,7 @@ - + @@ -949,7 +949,7 @@ - + @@ -960,7 +960,7 @@ - + @@ -1056,7 +1056,7 @@ - + @@ -1117,7 +1117,7 @@ - + @@ -1205,7 +1205,7 @@ - + @@ -1288,7 +1288,7 @@ - + @@ -1299,12 +1299,12 @@ - + - + @@ -1329,7 +1329,7 @@ - + @@ -1354,7 +1354,7 @@ - + @@ -1382,7 +1382,7 @@ - + @@ -1410,7 +1410,7 @@ - + @@ -1441,7 +1441,7 @@ - + @@ -1472,7 +1472,7 @@ - + @@ -1483,13 +1483,13 @@ - + - + @@ -1502,7 +1502,7 @@ - + @@ -1565,7 +1565,7 @@ - + @@ -1582,7 +1582,7 @@ - + @@ -1615,7 +1615,7 @@ - + @@ -1624,13 +1624,13 @@ - + - + @@ -1646,7 +1646,7 @@ - + @@ -1661,7 +1661,7 @@ - + @@ -1678,7 +1678,7 @@ - + @@ -1725,7 +1725,7 @@ - + @@ -1755,7 +1755,7 @@ - + @@ -1770,7 +1770,7 @@ - + @@ -1787,7 +1787,7 @@ - + @@ -1834,7 +1834,7 @@ - + @@ -1864,7 +1864,7 @@ - + @@ -1877,7 +1877,7 @@ - + @@ -1920,7 +1920,7 @@ - + @@ -1946,7 +1946,7 @@ - + @@ -1959,7 +1959,7 @@ - + @@ -1982,21 +1982,21 @@ - + - + - + - + - + h00 @@ -2006,7 +2006,7 @@ - + @@ -2021,7 +2021,7 @@ - + @@ -2039,7 +2039,7 @@ - + @@ -2087,7 +2087,7 @@ - + @@ -2118,7 +2118,7 @@ - + @@ -2133,7 +2133,7 @@ - + @@ -2151,7 +2151,7 @@ - + @@ -2199,7 +2199,7 @@ - + @@ -2230,7 +2230,7 @@ - + @@ -2244,7 +2244,7 @@ - + @@ -2288,7 +2288,7 @@ - + @@ -2315,7 +2315,7 @@ - + h0 @@ -2323,7 +2323,7 @@ - + b0 @@ -2333,7 +2333,7 @@ - + @@ -2348,7 +2348,7 @@ - + @@ -2363,13 +2363,13 @@ - + - + @@ -2380,7 +2380,7 @@ - + @@ -2391,7 +2391,7 @@ - + h0 @@ -2399,7 +2399,7 @@ - + b0 @@ -2409,7 +2409,7 @@ - + @@ -2452,7 +2452,7 @@ - + @@ -2461,7 +2461,7 @@ - + @@ -2469,31 +2469,31 @@ - + - + - + - + - + - + @@ -7776,7 +7776,7 @@ - + @@ -7788,7 +7788,7 @@ - + @@ -7800,7 +7800,7 @@ - + @@ -7809,7 +7809,7 @@ - + @@ -7818,7 +7818,7 @@ - + h0 @@ -7826,7 +7826,7 @@ - + h0 @@ -7834,7 +7834,7 @@ - + none @@ -7857,7 +7857,7 @@ - + b0 @@ -7867,7 +7867,7 @@ - + b0 @@ -7877,7 +7877,7 @@ - + none @@ -7908,7 +7908,7 @@ - + none @@ -7939,7 +7939,7 @@ - + @@ -7982,7 +7982,7 @@ - + none @@ -8013,7 +8013,7 @@ - + b00 @@ -8035,7 +8035,7 @@ - + b00 @@ -8057,7 +8057,7 @@ - + none @@ -8088,7 +8088,7 @@ - + b00 @@ -8110,7 +8110,7 @@ - + b00 @@ -8132,7 +8132,7 @@ - + @@ -8162,7 +8162,7 @@ - + @@ -8192,7 +8192,7 @@ - + @@ -8206,12 +8206,12 @@ - + - + @@ -8221,7 +8221,7 @@ - + @@ -8245,7 +8245,7 @@ - + @@ -8262,7 +8262,7 @@ - + @@ -8288,7 +8288,7 @@ - + @@ -8302,7 +8302,7 @@ - + @@ -8327,7 +8327,7 @@ - + @@ -8336,32 +8336,32 @@ - + - + - + - + - + - + @@ -8372,7 +8372,7 @@ - + @@ -8384,7 +8384,7 @@ - + none @@ -8394,7 +8394,7 @@ - + none @@ -8404,7 +8404,7 @@ - + none @@ -8413,7 +8413,7 @@ - + @@ -8463,7 +8463,7 @@ - + @@ -8505,7 +8505,7 @@ - + @@ -8555,7 +8555,7 @@ - + @@ -8564,7 +8564,7 @@ - + @@ -8600,7 +8600,7 @@ - + @@ -8636,7 +8636,7 @@ - + @@ -8672,7 +8672,7 @@ - + @@ -8708,16 +8708,16 @@ - + - + - + @@ -8733,12 +8733,12 @@ - + - + @@ -8749,17 +8749,17 @@ - + - + - + @@ -8779,12 +8779,12 @@ - + - + @@ -8793,7 +8793,7 @@ - + @@ -8816,7 +8816,7 @@ - + @@ -8839,7 +8839,7 @@ - + @@ -8857,15 +8857,15 @@ - + - + - + - + @@ -8900,7 +8900,7 @@ - + @@ -8937,7 +8937,7 @@ - + @@ -8972,7 +8972,7 @@ - + @@ -9009,7 +9009,7 @@ - + @@ -9027,7 +9027,7 @@ - + @@ -9045,7 +9045,7 @@ - + @@ -9063,7 +9063,7 @@ - + @@ -9081,7 +9081,7 @@ - + @@ -9111,7 +9111,7 @@ - + @@ -9141,7 +9141,7 @@ - + @@ -9163,7 +9163,7 @@ - + @@ -9181,7 +9181,7 @@ - + @@ -9199,7 +9199,7 @@ - + @@ -9217,7 +9217,7 @@ - + @@ -9247,7 +9247,7 @@ - + @@ -9277,7 +9277,7 @@ - + @@ -9299,7 +9299,7 @@ - + diff --git a/src/panfrost/compiler/bifrost_isa.py b/src/panfrost/compiler/bifrost_isa.py index 7152509bc39..4be004c3417 100644 --- a/src/panfrost/compiler/bifrost_isa.py +++ b/src/panfrost/compiler/bifrost_isa.py @@ -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