Add better PCI ID backup in rocm_agent_enumerator

The PCI ID backup method in rocm_agent_enumerator, where the
tool uses lspci to find all AMD GPU devices in the system and
manaully match them to gfx version, is extremely outdated. The
PCI ID list did not include anything after Vega 10, and the
actual call to lspci no longer returned anything due to some
missing conversions.

The patch adds all GPUs that might be needed by ROCr up through
Navy Flounder. The PCI ID to gfx matching pulls from the amdgpu
driver and libhsakmt.

Change-Id: I58b77bb6aa631f575352fc444d2542f265909706
Этот коммит содержится в:
Joseph Greathouse
2021-10-29 09:24:05 -05:00
коммит произвёл Sean Keely
родитель 2b4b0c8862
Коммит ea5ce46fb4
+47 -8
Просмотреть файл
@@ -10,7 +10,9 @@ CWD = os.path.dirname(os.path.realpath(__file__))
ISA_TO_ID = {
# Kaveri - Temporary
"gfx700" : [0x130f],
"gfx700" : [0x1304, 0x1305, 0x1306, 0x1307, 0x1309, 0x130a, 0x130b, 0x130c,
0x130d, 0x130e, 0x130f, 0x1310, 0x1311, 0x1312, 0x1313, 0x1315,
0x1316, 0x1317, 0x1318, 0x131b, 0x131c, 0x131d],
# Hawaii
"gfx701" : [0x67a0, 0x67a1, 0x67a2, 0x67a8, 0x67a9, 0x67aa, 0x67b0, 0x67b1,
0x67b8, 0x67b9, 0x67ba, 0x67be],
@@ -23,15 +25,52 @@ ISA_TO_ID = {
"gfx803" : [0x7300, 0x730f,
# Polaris10
0x67c0, 0x67c1, 0x67c2, 0x67c4, 0x67c7, 0x67c8, 0x67c9, 0x67ca,
0x67cc, 0x67cf,
0x67cc, 0x67cf, 0x6fdf,
# Polaris11
0x67d0, 0x67df, 0x67e0, 0x67e1, 0x67e3, 0x67e7, 0x67e8, 0x67e9,
0x67eb, 0x67ef, 0x67ff,
# Polaris12
0x6980, 0x6981, 0x6985, 0x6986, 0x6987, 0x6995, 0x6997, 0x699f],
0x6980, 0x6981, 0x6985, 0x6986, 0x6987, 0x6995, 0x6997, 0x699f,
# VegaM
0x694c, 0x694e, 0x694f],
# Vega10
"gfx900" : [0x6860, 0x6861, 0x6862, 0x6863, 0x6864, 0x6867, 0x6868, 0x686c,
0x687f]
"gfx900" : [0x6860, 0x6861, 0x6862, 0x6863, 0x6864, 0x6867, 0x6868, 0x6869,
0x6869, 0x686a, 0x686b, 0x686c, 0x686d, 0x686e, 0x686f, 0x687f],
# Raven
"gfx902" : [0x15dd, 0x15d8],
# Vega12
"gfx904" : [0x69a0, 0x69a1, 0x69a2, 0x69a3, 0x69af],
# Vega20
"gfx906" : [0x66a0, 0x66a1, 0x66a2, 0x66a3, 0x66a4, 0x66a7, 0x66af],
# Arcturus
"gfx908" : [0x738c, 0x7388, 0x738e, 0x7390],
# Aldebaran
"gfx90a" : [0x7408, 0x740c, 0x740f, 0x7410],
# Renoir
"gfx90c" : [0x15e7, 0x1636, 0x1638, 0x164c],
# Navi10
"gfx1010" : [0x7310, 0x7312, 0x7318, 0x7319, 0x731a, 0x731b, 0x731e, 0x731f],
# Navi12
"gfx1011" : [0x7360, 0x7362],
# Navi14
"gfx1012" : [0x7340, 0x7341, 0x7347, 0x734f],
# Cyan_Skillfish
"gfx1013" : [0x13f9, 0x13fa, 0x13fb, 0x13fc, 0x13f3],
# Sienna_Cichlid
"gfx1030" : [0x73a0, 0x73a1, 0x73a2, 0x73a3, 0x73a5, 0x73a8, 0x73a9, 0x73ab,
0x73ac, 0x73ad, 0x73ae, 0x73af, 0x73bf],
# Navy_Flounder
"gfx1031" : [0x73c0, 0x73c1, 0x73c3, 0x73da, 0x73db, 0x73dc, 0x73dd, 0x73de,
0x73df],
# Dimgray_Cavefish
"gfx1032" : [0x73e0, 0x73e1, 0x73e2, 0x73e3, 0x73e8, 0x73e9, 0x73ea, 0x73eb,
0x73ec, 0x73ed, 0x73ef, 0x73ff],
# Van Gogh
"gfx1033" : [0x163f],
# Beige_Goby
"gfx1034" : [0x7420, 0x7421, 0x7422, 0x7423, 0x743f],
# Yellow_Carp
"gfx1035" : [0x164d, 0x1681]
}
def staticVars(**kwargs):
@@ -112,7 +151,7 @@ def readFromLSPCI():
try:
# run lspci
lspci_output = subprocess.Popen(["/usr/bin/lspci", "-n", "-d", "1002:"], stdout=subprocess.PIPE).communicate()[0].split('\n')
lspci_output = subprocess.Popen(["/usr/bin/lspci", "-n", "-d", "1002:"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").split('\n')
except:
lspci_output = []
@@ -160,8 +199,8 @@ def main():
if len(target_list) == 0:
target_list = readFromLSPCI()
# workaround to cope with existing rocm_agent_enumerator behavior where gfx000
# would always be returned
# workaround to cope with existing rocm_agent_enumerator behavior where gfx000
# would always be returned
print("gfx000")
for gfx in target_list: