@@ -54,6 +54,7 @@ def is_supported() -> bool:
5454 pci_devs = THeadDetector .detect_pci_devices ()
5555 if not pci_devs and not envs .GPUSTACK_RUNTIME_DETECT_NO_PCI_CHECK :
5656 logger .debug ("No T-Head PCI devices found" )
57+ return supported
5758
5859 try :
5960 pyhgml .hgmlInit ()
@@ -68,7 +69,7 @@ def is_supported() -> bool:
6869 @lru_cache
6970 def detect_pci_devices () -> dict [str , PCIDevice ]:
7071 # See https://pcisig.com/membership/member-companies?combine=Alibaba.
71- pci_devs = get_pci_devices (vendor = [ "0x05b7" , " 0x1ded"] )
72+ pci_devs = get_pci_devices (vendor = " 0x1ded" )
7273 if not pci_devs :
7374 return {}
7475 return {dev .address : dev for dev in pci_devs }
@@ -98,10 +99,23 @@ def detect(self) -> Devices | None:
9899
99100 sys_driver_ver = pyhgml .hgmlSystemGetDriverVersion ()
100101
101- sys_runtime_ver_original = pyhgml .hgmlSystemGetHGMLVersion ()
102- sys_runtime_ver = get_brief_version (
103- sys_runtime_ver_original ,
104- )
102+ sys_runtime_ver_original = None
103+ sys_runtime_ver = None
104+ with contextlib .suppress (pyhgml .HGMLError ):
105+ sys_runtime_ver_original = pyhgml .hgmlSystemGetHggcDriverVersion ()
106+ sys_runtime_ver_original = "." .join (
107+ map (
108+ str ,
109+ [
110+ sys_runtime_ver_original // 1000 ,
111+ (sys_runtime_ver_original % 1000 ) // 10 ,
112+ (sys_runtime_ver_original % 10 ),
113+ ],
114+ ),
115+ )
116+ sys_runtime_ver = get_brief_version (
117+ sys_runtime_ver_original ,
118+ )
105119
106120 dev_count = pyhgml .hgmlDeviceGetCount ()
107121 for dev_idx in range (dev_count ):
0 commit comments