Switch order of lspci and rocminfo for gfx arch query

rocminfo is a very heavyweight mechanism for learning a lot of
information about the GPUs that are attached to the system.
It opens up the limited /dev/kfd resource to gather lots of
information about each device, while rocm_agent_enumerator really
only wants the gfx number of AMD devices attached to the system.

To avoid this heavyweight lookup in most cases, this patch switches
the order of tests. Rather than starting with rocminfo and then
falling back to a poorly-maintained PCI ID list, this patch changes
the agent enumerator to start by checking in the PCI ID list (fast
case) and then falling back to rocminfo (slow case) if the PCI ID
list is out of date.

Change-Id: If24b8bc3baeeb6adad362abbb288ef3728383bce
Этот коммит содержится в:
Joseph Greathouse
2021-10-29 10:35:35 -05:00
коммит произвёл Sean Keely
родитель 0e1807c72d
Коммит e9b7de43be
+5 -5
Просмотреть файл
@@ -186,18 +186,18 @@ def main():
execution of "rocminfo" is not possible.
2. target.lst : user-supplied text file. This is used in a container setting
where ROCm stack may usually not available.
3. rocminfo : a tool shipped with this script to enumerate GPU agents
3. lspci : enumerate PCI bus and locate supported devices from a hard-coded
lookup table.
4. rocminfo : a tool shipped with this script to enumerate GPU agents
available on a working ROCm stack.
4. lspci : enumerate PCI bus and locate supported devices from a hard-coded
lookup table.
"""
target_list = readFromTargetLstFile()
if len(target_list) == 0:
target_list = readFromROCMINFO()
target_list = readFromLSPCI()
if len(target_list) == 0:
target_list = readFromLSPCI()
target_list = readFromROCMINFO()
# workaround to cope with existing rocm_agent_enumerator behavior where gfx000
# would always be returned