mirror of
https://github.com/facefusion/facefusion.git
synced 2026-05-12 10:31:33 +02:00
add driver version back for amd
This commit is contained in:
@@ -22,15 +22,17 @@ def create_static_library() -> Optional[ctypes.CDLL]:
|
||||
return None
|
||||
|
||||
|
||||
def define_driver_info() -> ctypes.Structure:
|
||||
return type('AMDSMI_DRIVER_INFO', (ctypes.Structure,),
|
||||
def define_driver_version() -> ctypes.Structure:
|
||||
return type('AMDSMI_VERSION', (ctypes.Structure,),
|
||||
{
|
||||
'_pack_': 1,
|
||||
'_fields_':
|
||||
[
|
||||
('driver_version', ctypes.c_char * 256),
|
||||
('driver_date', ctypes.c_char * 256),
|
||||
('driver_name', ctypes.c_char * 256)
|
||||
('major', ctypes.c_uint32),
|
||||
('minor', ctypes.c_uint32),
|
||||
('release', ctypes.c_uint32),
|
||||
('padding', ctypes.c_ubyte * 4),
|
||||
('build', ctypes.POINTER(ctypes.c_char))
|
||||
]
|
||||
})()
|
||||
|
||||
@@ -92,15 +94,15 @@ def init_ctypes(amd_smi : ctypes.CDLL) -> ctypes.CDLL:
|
||||
amd_smi.amdsmi_shut_down.argtypes = []
|
||||
amd_smi.amdsmi_shut_down.restype = ctypes.c_uint32
|
||||
|
||||
amd_smi.amdsmi_get_lib_version.argtypes = [ ctypes.c_void_p ]
|
||||
amd_smi.amdsmi_get_lib_version.restype = ctypes.c_uint32
|
||||
|
||||
amd_smi.amdsmi_get_socket_handles.argtypes = [ ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_void_p) ]
|
||||
amd_smi.amdsmi_get_socket_handles.restype = ctypes.c_uint32
|
||||
|
||||
amd_smi.amdsmi_get_processor_handles.argtypes = [ ctypes.c_void_p, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_void_p) ]
|
||||
amd_smi.amdsmi_get_processor_handles.restype = ctypes.c_uint32
|
||||
|
||||
amd_smi.amdsmi_get_gpu_driver_info.argtypes = [ ctypes.c_void_p, ctypes.c_void_p ]
|
||||
amd_smi.amdsmi_get_gpu_driver_info.restype = ctypes.c_uint32
|
||||
|
||||
amd_smi.amdsmi_get_gpu_vram_usage.argtypes = [ ctypes.c_void_p, ctypes.c_void_p ]
|
||||
amd_smi.amdsmi_get_gpu_vram_usage.restype = ctypes.c_uint32
|
||||
|
||||
|
||||
@@ -123,6 +123,9 @@ def detect_amd_graphic_devices() -> List[GraphicDevice]:
|
||||
if amd_smi_library:
|
||||
amd_smi_library.amdsmi_init(ctypes.c_uint64(2))
|
||||
|
||||
driver_version = amd_smi_module.define_driver_version()
|
||||
amd_smi_library.amdsmi_get_lib_version(ctypes.byref(driver_version))
|
||||
|
||||
rocm_core_library = rocm_core_module.create_static_library()
|
||||
rocm_major_version = ctypes.c_uint()
|
||||
rocm_minor_version = ctypes.c_uint()
|
||||
@@ -132,9 +135,6 @@ def detect_amd_graphic_devices() -> List[GraphicDevice]:
|
||||
rocm_core_library.getROCmVersion(ctypes.byref(rocm_major_version), ctypes.byref(rocm_minor_version), ctypes.byref(rocm_patch_version))
|
||||
|
||||
for device_handle in amd_smi_module.find_device_handles(amd_smi_library):
|
||||
driver_info = amd_smi_module.define_driver_info()
|
||||
amd_smi_library.amdsmi_get_gpu_driver_info(device_handle, ctypes.byref(driver_info))
|
||||
|
||||
product_info = amd_smi_module.define_product_info()
|
||||
amd_smi_library.amdsmi_get_gpu_asic_info(device_handle, ctypes.byref(product_info))
|
||||
|
||||
@@ -149,7 +149,7 @@ def detect_amd_graphic_devices() -> List[GraphicDevice]:
|
||||
|
||||
graphic_devices.append(
|
||||
{
|
||||
'driver_version': driver_info.driver_version.decode(),
|
||||
'driver_version': str(driver_version.major) + '.' + str(driver_version.minor) + '.' + str(driver_version.release),
|
||||
'framework':
|
||||
{
|
||||
'name': 'ROCm',
|
||||
|
||||
Reference in New Issue
Block a user