a G%@iè ã@s&ddlmZmZGdd„deeƒZdS)é)ÚPluginÚIndependentPluginc@s0eZdZdZdZdZdZedd„ƒZdd„Z d S) ÚSpyreuÖSpyre chip is IBM’s AI accelerator, designed to handle AI inferencing and workloads. The Spyre plugin collects data about the Spyre card’s VFIO device node tree, configuration files, and more. z!IBM Spyre Accelerator InformationZspyre)zppc.*c CsÜg}|s dS| ¡D]Â}| ¡s"qz*|jdd\}}}}| ¡ d¡\}}WntybYqYn0|dkr|dvr| d¡dkrŠd|}z"| d¡\} } } |  d ¡\} } WntyÂYqYn0| | | | | f¡q|S) aExtract PCI domain, bus, device, function for devices that match: - Vendor ID = 0x1014 (IBM) - Device ID = 0x06a7 or 0x06a8 Parameters ---------- lspci_out : str The output string from `lspci -n`. Returns ------- list of tuples A list of (domain, bus, device, function) tuples for each matching card. Né)Úmaxsplitú:Z1014)Z06a7Z06a8éz0000:Ú.)Ú splitlinesÚstripÚsplitÚlowerÚ ValueErrorÚcountÚappend)Z lspci_outputÚ spyre_cardsÚlineÚpci_addrZ_classZidsZ_restZvendorÚdeviceÚdomainÚbusZdev_funcZ pci_deviceÚfunction©rú s