diff --git a/README.md b/README.md index 0b6b3f5be5..a9e122cde8 100755 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ int main() { for (uint32_t i=0; i < socket_count; i++) { // Get Socket info char socket_info[128]; - ret = amdsmi_get_socket_info(sockets[i], socket_info, 128); + ret = amdsmi_get_socket_info(sockets[i], 128, socket_info); std::cout << "Socket " << socket_info<< std::endl; // Get the device count for the socket. diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index 6385c58f21..a899e3b850 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -57,15 +57,9 @@ class AMDSMICommands(): Args: args (Namespace): Namespace containing the parsed CLI args """ - kernel_component = amdsmi_interface.AmdSmiSwComponent.DRIVER try: - kernel_version = amdsmi_interface.amdsmi_get_version_str(sw_component=kernel_component) - except amdsmi_exception.AmdSmiLibraryException as e: - kernel_version = e.get_error_info() - - try: - amdsmi_lib_version = amdsmi_interface.amdsmi_get_version() + amdsmi_lib_version = amdsmi_interface.amdsmi_get_lib_version() except amdsmi_exception.AmdSmiLibraryException as e: amdsmi_lib_version = e.get_error_info() @@ -77,12 +71,10 @@ class AMDSMICommands(): self.logger.output['tool'] = 'AMDSMI Tool' self.logger.output['version'] = f'{__version__}' self.logger.output['amdsmi_library_version'] = f'{amdsmi_lib_version_str}' - self.logger.output['kernel_version'] = f'{kernel_version}' if self.logger.is_human_readable_format(): print(f'AMDSMI Tool: {__version__} | '\ - f'AMDSMI Library version: {amdsmi_lib_version_str} | '\ - f'Kernel version: {kernel_version}') + f'AMDSMI Library version: {amdsmi_lib_version_str}') elif self.logger.is_json_format() or self.logger.is_csv_format(): self.logger.print_output() @@ -341,7 +333,7 @@ class AMDSMICommands(): try: static_dict['ras'] = amdsmi_interface.amdsmi_get_gpu_ras_block_features_enabled(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NOT_SUPPORTED: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NOT_SUPPORTED: static_dict['ras'] = 'N/A' else: static_dict['ras'] = e.get_error_info() @@ -795,14 +787,14 @@ class AMDSMICommands(): power_measure = amdsmi_interface.amdsmi_get_power_info(args.gpu) power_dict = {'average_socket_power': power_measure['average_socket_power'], 'gfx_voltage': power_measure['gfx_voltage'], - 'soc_voltage': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info, - 'mem_voltage': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info} + 'soc_voltage': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.STATUS_NOT_YET_IMPLEMENTED).err_info, + 'mem_voltage': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.STATUS_NOT_YET_IMPLEMENTED).err_info} if self.logger.is_human_readable_format(): power_dict['average_socket_power'] = f"{power_dict['average_socket_power']} W" power_dict['gfx_voltage'] = f"{power_dict['gfx_voltage']} mV" - power_dict['soc_voltage'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info - power_dict['mem_voltage'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info + power_dict['soc_voltage'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.STATUS_NOT_YET_IMPLEMENTED).err_info + power_dict['mem_voltage'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.STATUS_NOT_YET_IMPLEMENTED).err_info except amdsmi_exception.AmdSmiLibraryException as e: power_dict = {'average_socket_power': e.get_error_info(), @@ -881,13 +873,13 @@ class AMDSMICommands(): if args.ecc: ecc_count = {} try: - ecc_count = amdsmi_interface.amdsmi_get_gpu_ecc_error_count(args.gpu) + ecc_count = amdsmi_interface.amdsmi_get_gpu_total_ecc_count(args.gpu) ecc_count['correctable'] = ecc_count.pop('correctable_count') ecc_count['uncorrectable'] = ecc_count.pop('uncorrectable_count') values_dict['ecc'] = ecc_count except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NOT_SUPPORTED: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NOT_SUPPORTED: ecc_count['correctable'] = 'N/A' ecc_count['uncorrectable'] = 'N/A' values_dict['ecc'] = ecc_count @@ -1013,7 +1005,7 @@ class AMDSMICommands(): if not self.all_arguments: raise e if args.mem_overdrive: - values_dict['mem_overdrive'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info + values_dict['mem_overdrive'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.STATUS_NOT_YET_IMPLEMENTED).err_info if args.perf_level: try: perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) @@ -1035,7 +1027,7 @@ class AMDSMICommands(): try: values_dict['xgmi_err'] = amdsmi_interface.amdsmi_gpu_xgmi_error_status(args.gpu) except amdsmi_interface.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NOT_SUPPORTED: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NOT_SUPPORTED: values_dict['xgmi_err'] = 'N/A' elif not self.all_arguments: raise e @@ -1454,8 +1446,8 @@ class AMDSMICommands(): src_gpu_link_type[dest_gpu_key] = e.get_error_info() try: - min_bw = amdsmi_interface.amdsmi_get_minmax_bandwidth(src_gpu, dest_gpu)['min_bandwidth'] - max_bw = amdsmi_interface.amdsmi_get_minmax_bandwidth(src_gpu, dest_gpu)['max_bandwidth'] + min_bw = amdsmi_interface.admsmi_get_minmax_bandwith_between_processors(src_gpu, dest_gpu)['min_bandwidth'] + max_bw = amdsmi_interface.admsmi_get_minmax_bandwith_between_processors(src_gpu, dest_gpu)['max_bandwidth'] src_gpu_link_type[dest_gpu_key] = f'{min_bw}-{max_bw}' except amdsmi_exception.AmdSmiLibraryException as e: @@ -1574,15 +1566,15 @@ class AMDSMICommands(): try: perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to get performance level of {gpu_string}") from e if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e @@ -1590,14 +1582,14 @@ class AMDSMICommands(): try: amdsmi_interface.amdsmi_set_clk_freq(args.gpu, clock_type, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the {clock_type} clock frequency on {gpu_string}") from e else: try: amdsmi_interface.amdsmi_set_gpu_pci_bandwidth(args.gpu, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the {clock_type} clock frequency on {gpu_string}") from e @@ -1609,22 +1601,22 @@ class AMDSMICommands(): try: perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to get performance level of {gpu_string}") from e if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e try: amdsmi_interface.amdsmi_set_clk_freq(args.gpu, clock_type, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the {clock_type} clock frequency on {gpu_string}") from e @@ -1636,22 +1628,22 @@ class AMDSMICommands(): try: perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to get performance level of {gpu_string}") from e if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e try: amdsmi_interface.amdsmi_set_clk_freq(args.gpu, clock_type, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the {clock_type} clock frequency on {gpu_string}") from e @@ -1663,21 +1655,21 @@ class AMDSMICommands(): try: perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to get performance level of {gpu_string}") from e if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e try: amdsmi_interface.amdsmi_set_gpu_pci_bandwidth(args.gpu, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the {clock_type} clock frequency on {gpu_string}") from e @@ -1690,7 +1682,7 @@ class AMDSMICommands(): try: amdsmi_interface.amdsmi_set_gpu_od_clk_info(args.gpu, level, value, clock_type) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to change the {clock_type} clock frequency in the PowerPlay table on {gpu_string}") from e @@ -1702,7 +1694,7 @@ class AMDSMICommands(): try: amdsmi_interface.amdsmi_set_gpu_od_clk_info(args.gpu, level, value, clock_type) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to change the {clock_type} clock frequency in the PowerPlay table on {gpu_string}") from e @@ -1712,7 +1704,7 @@ class AMDSMICommands(): try: amdsmi_interface.amdsmi_set_gpu_od_volt_info(args.gpu, point, clk, volt) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the Voltage Curve point {point} to {clk}(MHz) {volt}(mV) on {gpu_string}") from e @@ -1723,7 +1715,7 @@ class AMDSMICommands(): try: amdsmi_interface.amdsmi_set_gpu_clk_range(args.gpu, min_value, max_value, clock_type) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set {clock_type} from {min_value}(MHz) to {max_value}(MHz) on {gpu_string}") from e @@ -1734,7 +1726,7 @@ class AMDSMICommands(): try: amdsmi_interface.amdsmi_set_gpu_clk_range(args.gpu, min_value, max_value, clock_type) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set {clock_type} from {min_value}(MHz) to {max_value}(MHz) on {gpu_string}") from e @@ -1743,7 +1735,7 @@ class AMDSMICommands(): try: amdsmi_interface.amdsmi_set_gpu_fan_speed(args.gpu, 0, args.fan) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set fan speed {args.fan} on {gpu_string}") from e @@ -1751,9 +1743,9 @@ class AMDSMICommands(): if args.perflevel: perf_level = amdsmi_interface.AmdSmiDevPerfLevel[args.perflevel] try: - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, perf_level) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, perf_level) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set performance level {args.perflevel} on {gpu_string}") from e @@ -1763,22 +1755,22 @@ class AMDSMICommands(): try: perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to get performance level of {gpu_string}") from e if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e try: - amdsmi_interface.amdsmi_set_gpu_overdrive_level_v1(args.gpu, args.overdrive) + amdsmi_interface.amdsmi_set_gpu_overdrive_level(args.gpu, args.overdrive) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set overdrive {args.overdrive} to {gpu_string}") from e @@ -1788,15 +1780,15 @@ class AMDSMICommands(): try: perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to get performance level of {gpu_string}") from e if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e @@ -1806,11 +1798,11 @@ class AMDSMICommands(): try: power_caps = amdsmi_interface.amdsmi_get_power_cap_info(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to get the power cap info for {gpu_string}") from e if overdrive_power_cap == 0: - overdrive_power_cap = power_caps['power_cap_default'] + overdrive_power_cap = power_caps['default_power_cap'] else: overdrive_power_cap *= 1000000 @@ -1826,14 +1818,14 @@ class AMDSMICommands(): try: amdsmi_interface.amdsmi_set_power_cap(args.gpu, 0, overdrive_power_cap) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set power cap to {overdrive_power_cap} on {gpu_string}") from e try: power_caps = amdsmi_interface.amdsmi_get_power_cap_info(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to get the power cap info for {gpu_string} post set") from e @@ -1847,7 +1839,7 @@ class AMDSMICommands(): try: amdsmi_interface.amdsmi_set_gpu_perf_determinism_mode(args.gpu, args.perfdeterminism) except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set performance determinism and clock frequency to {args.perfdeterminism} on {gpu_string}") from e @@ -1919,7 +1911,7 @@ class AMDSMICommands(): amdsmi_interface.amdsmi_reset_gpu(args.gpu) result = 'Successfully reset GPU' except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e result = e.get_error_info() else: @@ -1931,28 +1923,28 @@ class AMDSMICommands(): 'clocks' : '', 'performance': ''} try: - amdsmi_interface.amdsmi_set_gpu_overdrive_level_v1(args.gpu, 0) + amdsmi_interface.amdsmi_set_gpu_overdrive_level(args.gpu, 0) reset_clocks_results['overdrive'] = 'Overdrive set to 0' except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e reset_clocks_results['overdrive'] = e.get_error_info() try: level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, level_auto) reset_clocks_results['clocks'] = 'Successfully reset clocks' except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e reset_clocks_results['clocks'] = e.get_error_info() try: level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, level_auto) reset_clocks_results['performance'] = 'Performance level reset to auto' except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e reset_clocks_results['performance'] = e.get_error_info() @@ -1962,7 +1954,7 @@ class AMDSMICommands(): amdsmi_interface.amdsmi_reset_gpu_fan(args.gpu, 0) result = 'Successfully reset fan speed to driver control' except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e result = e.get_error_info() @@ -1975,16 +1967,16 @@ class AMDSMICommands(): amdsmi_interface.amdsmi_set_gpu_power_profile(args.gpu, 0, power_profile_mask) reset_profile_results['power_profile'] = 'Successfully reset Power Profile' except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e reset_profile_results['power_profile'] = e.get_error_info() try: level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, level_auto) reset_profile_results['performance_level'] = 'Successfully reset Performance Level' except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e reset_profile_results['performance_level'] = e.get_error_info() @@ -1994,17 +1986,17 @@ class AMDSMICommands(): amdsmi_interface.amdsmi_reset_gpu_xgmi_error(args.gpu) result = 'Successfully reset XGMI Error count' except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e result = e.get_error_info() self.logger.store_output(args.gpu, 'reset_xgmi_err', result) if args.perfdeterminism: try: level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO - amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto) + amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, level_auto) result = 'Successfully disabled performance determinism' except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e result = e.get_error_info() @@ -2041,7 +2033,7 @@ class AMDSMICommands(): commands.logger.store_output(device, 'values', values_dict) commands.logger.print_output() except amdsmi_exception.AmdSmiLibraryException as e: - if e.err_code != amdsmi_exception.AmdSmiRetCode.NO_DATA: + if e.err_code != amdsmi_exception.AmdSmiRetCode.STATUS_NO_DATA: print(e) except Exception as e: print(e) diff --git a/amdsmi_cli/amdsmi_init.py b/amdsmi_cli/amdsmi_init.py index cb0656252e..5f201d7d15 100644 --- a/amdsmi_cli/amdsmi_init.py +++ b/amdsmi_cli/amdsmi_init.py @@ -53,7 +53,7 @@ def check_amdgpu_driver(): return False -def init_amdsmi(flag=amdsmi_interface.AmdSmiInitFlags.AMD_GPUS): +def init_amdsmi(flag=amdsmi_interface.AmdSmiInitFlags.INIT_AMD_GPUS): """ Initializes AMDSMI Raises: diff --git a/example/amd_smi_drm_example.cc b/example/amd_smi_drm_example.cc index 7d12be4ba8..fe384ae05b 100644 --- a/example/amd_smi_drm_example.cc +++ b/example/amd_smi_drm_example.cc @@ -238,7 +238,7 @@ int main() { for (uint32_t i = 0; i < socket_count; i++) { // Get Socket info char socket_info[128]; - ret = amdsmi_get_socket_info(sockets[i], socket_info, 128); + ret = amdsmi_get_socket_info(sockets[i], 128, socket_info); CHK_AMDSMI_RET(ret) std::cout << "Socket " << socket_info << std::endl; @@ -508,13 +508,13 @@ int main() { freq_ranges.current_freq_range.upper_bound); uint32_t num_process = 0; - ret = amdsmi_get_gpu_process_list(processor_handles[j], nullptr, - &num_process); + ret = amdsmi_get_gpu_process_list(processor_handles[j], &num_process, + nullptr); CHK_AMDSMI_RET(ret) if (!num_process) { printf("No processes found.\n"); } else { - amdsmi_process_handle process_list[num_process]; + amdsmi_process_handle_t process_list[num_process]; amdsmi_proc_info_t info_list[num_process]; amdsmi_proc_info_t process = {}; uint64_t mem = 0, gtt_mem = 0, cpu_mem = 0, vram_mem = 0; @@ -523,8 +523,8 @@ int main() { sprintf(bdf_str, "%04lx:%02x:%02x.%d", bdf.domain_number, bdf.bus_number, bdf.device_number, bdf.function_number); int num = 0; - ret = amdsmi_get_gpu_process_list(processor_handles[j], process_list, - &num_process); + ret = amdsmi_get_gpu_process_list(processor_handles[j], &num_process, + process_list); CHK_AMDSMI_RET(ret) for (uint32_t it = 0; it < num_process; it += 1) { if (getpid() == process_list[it]) { diff --git a/example/amd_smi_nodrm_example.cc b/example/amd_smi_nodrm_example.cc index 51bc2ff1b9..f287281c72 100644 --- a/example/amd_smi_nodrm_example.cc +++ b/example/amd_smi_nodrm_example.cc @@ -90,7 +90,7 @@ int main() { for (uint32_t i = 0; i < socket_count; i++) { // Get Socket info char socket_info[128]; - ret = amdsmi_get_socket_info(sockets[i], socket_info, 128); + ret = amdsmi_get_socket_info(sockets[i], 128, socket_info); CHK_AMDSMI_RET(ret) std::cout << "Socket " << socket_info << std::endl; diff --git a/include/amd_smi/amdsmi.h b/include/amd_smi/amdsmi.h index 69cdefd1ea..2d8591ba0c 100644 --- a/include/amd_smi/amdsmi.h +++ b/include/amd_smi/amdsmi.h @@ -63,7 +63,7 @@ extern "C" { * Initialization flags may be OR'd together and passed to ::amdsmi_init(). */ typedef enum { - AMDSMI_INIT_ALL_DEVICES = 0x0, // Default option + AMDSMI_INIT_ALL_PROCESSORS = 0x0, // Default option AMDSMI_INIT_AMD_CPUS = (1 << 0), AMDSMI_INIT_AMD_GPUS = (1 << 1), AMDSMI_INIT_NON_AMD_CPUS = (1 << 2), @@ -257,6 +257,38 @@ typedef enum { FW_ID_MC, FW_ID_PSP_BL, FW_ID_CP_PM4, + FW_ID_RLC_P, + FW_ID_SEC_POLICY_STAGE2, + FW_ID_REG_ACCESS_WHITELIST, + FW_ID_IMU_DRAM, + FW_ID_IMU_IRAM, + FW_ID_SDMA_TH0, + FW_ID_SDMA_TH1, + FW_ID_CP_MES, + FW_ID_MES_STACK, + FW_ID_MES_THREAD1, + FW_ID_MES_THREAD1_STACK, + FW_ID_RLX6, + FW_ID_RLX6_DRAM_BOOT, + FW_ID_RS64_ME, + FW_ID_RS64_ME_P0_DATA, + FW_ID_RS64_ME_P1_DATA, + FW_ID_RS64_PFP, + FW_ID_RS64_PFP_P0_DATA, + FW_ID_RS64_PFP_P1_DATA, + FW_ID_RS64_MEC, + FW_ID_RS64_MEC_P0_DATA, + FW_ID_RS64_MEC_P1_DATA, + FW_ID_RS64_MEC_P2_DATA, + FW_ID_RS64_MEC_P3_DATA, + FW_ID_PPTABLE, + FW_ID_PSP_SOC, + FW_ID_PSP_DBG, + FW_ID_PSP_INTF, + FW_ID_RLX6_CORE1, + FW_ID_RLX6_DRAM_BOOT_CORE1, + FW_ID_RLCV_LX7, + FW_ID_RLC_SAVE_RESTORE_LIST, FW_ID_ASD, FW_ID_TA_RAS, FW_ID_XGMI, @@ -287,6 +319,7 @@ typedef struct { typedef struct { uint32_t vram_total; uint32_t vram_used; + uint32_t reserved[2]; } amdsmi_vram_info_t; typedef struct { @@ -319,7 +352,7 @@ typedef struct { char build_date[AMDSMI_MAX_DATE_LENGTH]; char part_number[AMDSMI_MAX_STRING_LENGTH]; char version[AMDSMI_NORMAL_STRING_LENGTH]; - uint32_t reserved[15]; + uint32_t reserved[16]; } amdsmi_vbios_info_t; typedef struct { @@ -339,6 +372,7 @@ typedef struct { uint64_t device_id; //< The unique id of a GPU uint32_t rev_id; char asic_serial[AMDSMI_NORMAL_STRING_LENGTH]; + uint32_t reserved[3]; } amdsmi_asic_info_t; typedef struct { @@ -364,7 +398,7 @@ typedef struct { uint32_t cur_clk; uint32_t min_clk; uint32_t max_clk; - uint32_t reserved[4]; + uint32_t reserved[5]; } amdsmi_clk_info_t; typedef struct { @@ -374,20 +408,22 @@ typedef struct { uint32_t reserved[13]; } amdsmi_engine_usage_t; -typedef uint32_t amdsmi_process_handle; +typedef uint32_t amdsmi_process_handle_t; typedef struct { char name[AMDSMI_NORMAL_STRING_LENGTH]; - amdsmi_process_handle pid; + amdsmi_process_handle_t pid; uint64_t mem; /** in bytes */ struct { uint64_t gfx; uint64_t enc; + uint32_t reserved[12]; } engine_usage; /** How much time the process spend using these engines in ns */ struct { uint64_t gtt_mem; uint64_t cpu_mem; uint64_t vram_mem; + uint32_t reserved[10]; } memory_usage; /** in bytes */ char container_name[AMDSMI_NORMAL_STRING_LENGTH]; uint32_t reserved[4]; @@ -1147,7 +1183,7 @@ amdsmi_status_t amdsmi_get_socket_handles(uint32_t *socket_count, */ amdsmi_status_t amdsmi_get_socket_info( amdsmi_socket_handle socket_handle, - char *name, size_t len); + size_t len, char *name); /** * @brief Get the list of the processor handles associated to a socket. @@ -3354,19 +3390,19 @@ amdsmi_get_gpu_target_frequency_range(amdsmi_processor_handle processor_handle, * * @param[in] processor_handle Device which to query * + * @param[in,out] max_processes Reference to the size of the list buffer in + * number of elements. Returns the return number of elements + * in list or the number of running processes if equal to 0. + * * @param[out] list Reference to a user-provided buffer where the process * list will be returned. This buffer must contain at least * max_processes entries of type smi_process_handle. Must be allocated * by user. * - * @param[in,out] max_processes Reference to the size of the list buffer in - * number of elements. Returns the return number of elements - * in list or the number of running processes if equal to 0. - * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, amdsmi_process_handle *list, uint32_t *max_processes); +amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, uint32_t *max_processes, amdsmi_process_handle_t *list); /** * @brief Returns the process information of a given process. @@ -3382,7 +3418,7 @@ amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, amdsmi_pro * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_gpu_process_info(amdsmi_processor_handle processor_handle, amdsmi_process_handle process, amdsmi_proc_info_t *info); +amdsmi_get_gpu_process_info(amdsmi_processor_handle processor_handle, amdsmi_process_handle_t process, amdsmi_proc_info_t *info); /** @} End processinfo */ diff --git a/py-interface/README.md b/py-interface/README.md index 99ed3ac6ea..9ecec833f6 100644 --- a/py-interface/README.md +++ b/py-interface/README.md @@ -52,7 +52,7 @@ try: print("No GPUs on machine") except AmdSmiException as e: print("Error code: {}".format(e.err_code)) - if e.err_code == AmdSmiRetCode.ERR_RETRY: + if e.err_code == AmdSmiRetCode.STATUS_RETRY: print("Error info: {}".format(e.err_info)) ``` * `AmdSmiRetryException` : Derives `AmdSmiLibraryException` class and signals device is busy and call should be retried. @@ -335,7 +335,7 @@ Field | Description ---|--- `power_cap` | power capability `dpm_cap` | dynamic power management capability -`power_cap_default` | default power capability +`default_power_cap` | default power capability `min_power_cap` | min power capability `max_power_cap` | max power capability @@ -355,7 +355,7 @@ try: power_info = amdsmi_get_power_cap_info(device) print(power_info['power_cap']) print(power_info['dpm_cap']) - print(power_info['power_cap_default']) + print(power_info['default_power_cap']) print(power_info['min_power_cap']) print(power_info['max_power_cap']) except AmdSmiException as e: @@ -559,8 +559,8 @@ Output: Dictionary with fields Field | Description ---|--- `cur_clk`| Current clock for given clock type -`min_clk` | Minimum clock for given clock type `max_clk` | Maximum clock for given clock type +`min_clk` | Minimum clock for given clock type Exceptions that can be thrown by `amdsmi_get_clock_info` function: * `AmdSmiLibraryException` @@ -827,7 +827,7 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_get_gpu_ecc_error_count +## amdsmi_get_gpu_total_ecc_count Description: Returns the ECC error count for the given GPU Input parameters: @@ -841,7 +841,7 @@ Field | Description `correctable_count`| Correctable ECC error count `uncorrectable_count`| Uncorrectable ECC error count -Exceptions that can be thrown by `amdsmi_get_gpu_ecc_error_count` function: +Exceptions that can be thrown by `amdsmi_get_gpu_total_ecc_count` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -854,7 +854,7 @@ try: print("No GPUs on machine") else: for device in devices: - ecc_error_count = amdsmi_get_gpu_ecc_error_count(device) + ecc_error_count = amdsmi_get_gpu_total_ecc_count(device) print(ecc_error_count["correctable_count"]) print(ecc_error_count["uncorrectable_count"]) except AmdSmiException as e: @@ -993,160 +993,6 @@ except AmdSmiException as e: ``` -## amdsmi_open_supported_func_iterator -Description: Get a function name iterator of supported AMDSMI functions for a device - -Input parameters: - -* `processor_handle` device which to query - -Output: Handle for a function iterator - -Exceptions that can be thrown by `amdsmi_open_supported_func_iterator` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - obj_handle = amdsmi_open_supported_func_iterator(device) - print(obj_handle) - amdsmi_close_supported_func_iterator(obj_handle) -except AmdSmiException as e: - print(e) -``` - -## amdsmi_open_supported_variant_iterator -Description: Get a variant iterator for a given handle - -Input parameters: - -* `obj_handle` Object handle for witch to return a variant handle - -Output: Variant iterator handle - -Exceptions that can be thrown by `amdsmi_open_supported_variant_iterator` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - obj_handle = amdsmi_open_supported_func_iterator(device) - var_iter = amdsmi_open_supported_variant_iterator(obj_handle) - print(var_iter) - amdsmi_close_supported_func_iterator(obj_handle) - amdsmi_close_supported_func_iterator(var_iter) -except AmdSmiException as e: - print(e) -``` - -## amdsmi_next_func_iter -Description: Advance an object identifier iterator - -Input parameters: - -* `obj_handle` Object handle to advance - -Output: Next iterator handle - -Exceptions that can be thrown by `amdsmi_next_func_iter` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - obj_handle = amdsmi_open_supported_func_iterator(device) - print(obj_handle) - obj_handle = amdsmi_next_func_iter(obj_handle) - print(obj_handle) - amdsmi_close_supported_func_iterator(obj_handle) -except AmdSmiException as e: - print(e) -``` - -## amdsmi_close_supported_func_iterator -Description: Close a variant iterator handle - -Input parameters: - -* `obj_handle` Object handle to be closed - -Output: None - -Exceptions that can be thrown by `amdsmi_close_supported_func_iterator` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - obj_handle = amdsmi_open_supported_func_iterator(device) - amdsmi_close_supported_func_iterator(obj_handle) -except AmdSmiException as e: - print(e) -``` - -## amdsmi_get_func_iter_value -Description: Get the value associated with a function/variant iterator - -Input parameters: - -* `obj_handle` Object handle to query - -Output: Data associated with a function/variant iterator - -Field | Description ----|--- -`id`| Internal ID of the function/variant -`name`| Descriptive name of the function/variant -`amd_id_0` |
Subfield Description
`memory_type`Memory type
`temp_metric`Temperature metric
`evnt_type`Event type
`evnt_group`Event group
`clk_type`Clock type
`fw_block`Firmware block
`gpu_block_type`GPU block type
- -Exceptions that can be thrown by `amdsmi_get_func_iter_value` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - obj_handle = amdsmi_open_supported_func_iterator(device) - value = amdsmi_get_func_iter_value(obj_handle) - print(value) - amdsmi_close_supported_func_iterator(obj_handle) -except AmdSmiException as e: - print(e) -``` ## amdsmi_set_gpu_pci_bandwidth Description: Control the set of allowed PCIe bandwidths that can be used @@ -1265,7 +1111,7 @@ except AmdSmiException as e: ``` -## amdsmi_get_gpu_pci_id +## admsmi_get_gpu_bdf_id Description: Get the unique PCI device identifier associated for a device Input parameters: @@ -1287,7 +1133,7 @@ BDFID = ((DOMAIN & 0xffffffff) << 32) | ((BUS & 0xff) << 8) | | Function | [ 2: 0] | -Exceptions that can be thrown by `amdsmi_get_gpu_pci_id` function: +Exceptions that can be thrown by `admsmi_get_gpu_bdf_id` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1300,7 +1146,7 @@ try: print("No GPUs on machine") else: for device in devices: - bdfid = amdsmi_get_gpu_pci_id(device) + bdfid = admsmi_get_gpu_bdf_id(device) print(bdfid) except AmdSmiException as e: print(e) @@ -1609,64 +1455,6 @@ except AmdSmiException as e: ``` -## amdsmi_get_gpu_memory_busy_percent - -Description: Get percentage of time any device memory is being used - -Input parameters: - -* `processor_handle` device which to query - -Output: percentage of time that any device memory is being used for the specified device. - -Exceptions that can be thrown by `amdsmi_get_gpu_memory_busy_percent` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = gpuvsmi_get_devices() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - busy_percent = amdsmi_get_gpu_memory_busy_percent(device) - print(busy_percent) -except AmdSmiException as e: - print(e) -``` - - - -## amdsmi_set_gpu_perf_level_v1 -Description: Set the PowerPlay performance level associated with the device -with provided device handle with the provided value - -Input parameters: -* `processor_handle` handle for the given device -* `perf_lvl` the value to which the performance level should be set - -Output: None - -Exceptions that can be thrown by ` amdsmi_set_gpu_perf_level_v1` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - amdsmi_set_gpu_perf_level_v1(device, AmdSmiDevPerfLevel.AMDSMI_DEV_PERF_LEVEL_HIGH) -except AmdSmiException as e: - print(e) -``` ## amdsmi_get_gpu_fan_rpms Description: Get the fan speed in RPMs of the device with the specified device handle and 0-based sensor index. @@ -1813,32 +1601,7 @@ try: except AmdSmiException as e: print(e) ``` -## amdsmi_get_busy_percent -Description: Get percentage of time device is busy doing any processing -Input parameters: -* `processor_handle` handle for the given device - -Output: How busy the device is (as percentage of time) - -Exceptions that can be thrown by `amdsmi_get_busy_percent` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - busy = amdsmi_get_busy_percent(dev) - print(busy) -except AmdSmiException as e: - print(e) -``` ## amdsmi_get_utilization_count Description: Get coarse grain utilization counter of the specified device @@ -2497,33 +2260,8 @@ try: except AmdSmiException as e: print(e) ``` -## amdsmi_set_gpu_overdrive_level_v1 -Description: Set the overdrive percent associated with the device with provided -device handle with the provided value -Input parameters: -* `processor_handle` handle for the given device -* `overdrive_value` value to which the overdrive level should be set -Output: None - -Exceptions that can be thrown by ` amdsmi_set_gpu_overdrive_level_v1` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - amdsmi_set_gpu_overdrive_level_v1(device, 0) -except AmdSmiException as e: - print(e) -``` ## amdsmi_set_gpu_overdrive_level Description: **deprecated** Set the overdrive percent associated with the device with provided device handle with the provided value @@ -2640,7 +2378,7 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_status_string +## amdsmi_status_code_to_string Description: Get a description of a provided AMDSMI error status Input parameters: @@ -2648,13 +2386,13 @@ Input parameters: Output: String description of the provided error code -Exceptions that can be thrown by `amdsmi_status_string` function: +Exceptions that can be thrown by `amdsmi_status_code_to_string` function: * `AmdSmiParameterException` Example: ```python try: - status_str = amdsmi_status_string(ctypes.c_uint32(0)) + status_str = amdsmi_status_code_to_string(ctypes.c_uint32(0)) print(status_str) except AmdSmiException as e: print(e) @@ -2879,33 +2617,6 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_get_gpu_drm_render_minor -Description: Get the drm minor number associated with this device. - -Input parameters: - -* `processor_handle` device which to query - -Output: drm minor number - -Exceptions that can be thrown by `amdsmi_get_gpu_drm_render_minor` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - render_minor = amdsmi_get_gpu_drm_render_minor(device) - print(render_minor) -except AmdSmiException as e: - print(e) -``` ## amdsmi_get_gpu_subsystem_id Description: Get the subsystem device id associated with the device with provided device handle. @@ -2965,12 +2676,12 @@ except AmdSmiException as e: ``` -## amdsmi_get_version +## amdsmi_get_lib_version Description: Get the build version information for the currently running build of AMDSMI. Output: amdsmi build version -Exceptions that can be thrown by `amdsmi_get_version` function: +Exceptions that can be thrown by `amdsmi_get_lib_version` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2983,36 +2694,7 @@ try: print("No GPUs on machine") else: for device in devices: - version = amdsmi_get_version() - print(version) -except AmdSmiException as e: - print(e) -``` - - -## amdsmi_get_version_str -Description: Get the driver version string for the current system. - -Input parameters: - -* `sw_component` software component which to query - -Output: driver version string - -Exceptions that can be thrown by `amdsmi_get_version_str` function: -* `AmdSmiLibraryException` -* `AmdSmiRetryException` -* `AmdSmiParameterException` - -Example: -```python -try: - devices = amdsmi_get_processor_handles() - if len(devices) == 0: - print("No GPUs on machine") - else: - for device in devices: - version = amdsmi_get_version_str(AmdSmiSwComponent.DRIVER) + version = amdsmi_get_lib_version() print(version) except AmdSmiException as e: print(e) @@ -3078,7 +2760,7 @@ except AmdSmiException as e: ``` -## amdsmi_get_minmax_bandwidth +## admsmi_get_minmax_bandwith_between_processors Description: Retreive minimal and maximal io link bandwidth between 2 GPUs. Input parameters: @@ -3093,7 +2775,7 @@ Field | Description `min_bandwidth` | minimal bandwidth for the connection `max_bandwidth` | maximal bandwidth for the connection -Exceptions that can be thrown by ` amdsmi_get_minmax_bandwidth` function: +Exceptions that can be thrown by `admsmi_get_minmax_bandwith_between_processors` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -3107,7 +2789,7 @@ try: else: processor_handle_src = devices[0] processor_handle_dest = devices[1] - bandwith = amdsmi_get_minmax_bandwidth(processor_handle_src, processor_handle_dest) + bandwith = admsmi_get_minmax_bandwith_between_processors(processor_handle_src, processor_handle_dest) print(bandwith['min_bandwidth']) print(bandwith['max_bandwidth']) except AmdSmiException as e: diff --git a/py-interface/__init__.py b/py-interface/__init__.py index ef7732c84e..e7c939a8e5 100644 --- a/py-interface/__init__.py +++ b/py-interface/__init__.py @@ -62,7 +62,7 @@ from .amdsmi_interface import amdsmi_get_gpu_process_list from .amdsmi_interface import amdsmi_get_gpu_process_info # # ECC Error Information -from .amdsmi_interface import amdsmi_get_gpu_ecc_error_count +from .amdsmi_interface import amdsmi_get_gpu_total_ecc_count # # Board Information from .amdsmi_interface import amdsmi_get_gpu_board_info @@ -70,13 +70,6 @@ from .amdsmi_interface import amdsmi_get_gpu_board_info # # Ras Information from .amdsmi_interface import amdsmi_get_gpu_ras_block_features_enabled -# # Supported Function Checks -from .amdsmi_interface import amdsmi_open_supported_func_iterator -from .amdsmi_interface import amdsmi_open_supported_variant_iterator -from .amdsmi_interface import amdsmi_close_supported_func_iterator -from .amdsmi_interface import amdsmi_next_func_iter -from .amdsmi_interface import amdsmi_get_func_iter_value - # # Unsupported Functions In Virtual Environment from .amdsmi_interface import amdsmi_set_gpu_pci_bandwidth from .amdsmi_interface import amdsmi_set_power_cap @@ -84,7 +77,6 @@ from .amdsmi_interface import amdsmi_set_gpu_power_profile from .amdsmi_interface import amdsmi_set_gpu_clk_range from .amdsmi_interface import amdsmi_set_gpu_od_clk_info from .amdsmi_interface import amdsmi_set_gpu_od_volt_info -from .amdsmi_interface import amdsmi_set_gpu_perf_level_v1 from .amdsmi_interface import amdsmi_set_gpu_perf_level from .amdsmi_interface import amdsmi_get_gpu_power_profile_presets from .amdsmi_interface import amdsmi_reset_gpu @@ -92,7 +84,6 @@ from .amdsmi_interface import amdsmi_set_gpu_perf_determinism_mode from .amdsmi_interface import amdsmi_set_gpu_fan_speed from .amdsmi_interface import amdsmi_reset_gpu_fan from .amdsmi_interface import amdsmi_set_clk_freq -from .amdsmi_interface import amdsmi_set_gpu_overdrive_level_v1 from .amdsmi_interface import amdsmi_set_gpu_overdrive_level # # Physical State Queries @@ -103,7 +94,6 @@ from .amdsmi_interface import amdsmi_get_temp_metric from .amdsmi_interface import amdsmi_get_gpu_volt_metric # # Clock, Power and Performance Query -from .amdsmi_interface import amdsmi_get_busy_percent from .amdsmi_interface import amdsmi_get_utilization_count from .amdsmi_interface import amdsmi_get_gpu_perf_level from .amdsmi_interface import amdsmi_set_gpu_perf_determinism_mode @@ -126,7 +116,7 @@ from .amdsmi_interface import amdsmi_get_gpu_available_counters from .amdsmi_interface import amdsmi_get_gpu_ecc_count from .amdsmi_interface import amdsmi_get_gpu_ecc_enabled from .amdsmi_interface import amdsmi_get_gpu_ecc_status -from .amdsmi_interface import amdsmi_status_string +from .amdsmi_interface import amdsmi_status_code_to_string # # System Information Query from .amdsmi_interface import amdsmi_get_gpu_compute_process_info @@ -136,7 +126,7 @@ from .amdsmi_interface import amdsmi_gpu_xgmi_error_status from .amdsmi_interface import amdsmi_reset_gpu_xgmi_error # # PCIE information -from .amdsmi_interface import amdsmi_get_gpu_pci_id +from .amdsmi_interface import admsmi_get_gpu_bdf_id from .amdsmi_interface import amdsmi_get_gpu_pci_bandwidth from .amdsmi_interface import amdsmi_get_gpu_pci_throughput from .amdsmi_interface import amdsmi_get_gpu_pci_replay_counter @@ -148,7 +138,6 @@ from .amdsmi_interface import amdsmi_get_energy_count # # Memory information from .amdsmi_interface import amdsmi_get_gpu_memory_total from .amdsmi_interface import amdsmi_get_gpu_memory_usage -from .amdsmi_interface import amdsmi_get_gpu_memory_busy_percent from .amdsmi_interface import amdsmi_get_gpu_memory_reserved_pages # # Events @@ -158,18 +147,16 @@ from .amdsmi_interface import AmdSmiEventReader from .amdsmi_interface import amdsmi_get_gpu_vendor_name from .amdsmi_interface import amdsmi_get_gpu_id from .amdsmi_interface import amdsmi_get_gpu_vram_vendor -from .amdsmi_interface import amdsmi_get_gpu_drm_render_minor from .amdsmi_interface import amdsmi_get_gpu_subsystem_id from .amdsmi_interface import amdsmi_get_gpu_subsystem_name # # Version information -from .amdsmi_interface import amdsmi_get_version -from .amdsmi_interface import amdsmi_get_version_str +from .amdsmi_interface import amdsmi_get_lib_version # # Hardware topology query from .amdsmi_interface import amdsmi_topo_get_numa_node_number from .amdsmi_interface import amdsmi_topo_get_link_weight -from .amdsmi_interface import amdsmi_get_minmax_bandwidth +from .amdsmi_interface import admsmi_get_minmax_bandwith_between_processors from .amdsmi_interface import amdsmi_topo_get_link_type from .amdsmi_interface import amdsmi_is_P2P_accessible from .amdsmi_interface import amdsmi_get_xgmi_info @@ -183,7 +170,6 @@ from .amdsmi_interface import AmdSmiFwBlock from .amdsmi_interface import AmdSmiClkType from .amdsmi_interface import AmdSmiTemperatureType from .amdsmi_interface import AmdSmiDevPerfLevel -from .amdsmi_interface import AmdSmiSwComponent from .amdsmi_interface import AmdSmiEventGroup from .amdsmi_interface import AmdSmiEventType from .amdsmi_interface import AmdSmiCounterCommand @@ -200,8 +186,7 @@ from .amdsmi_interface import AmdSmiXgmiStatus from .amdsmi_interface import AmdSmiMemoryPageStatus from .amdsmi_interface import AmdSmiIoLinkType from .amdsmi_interface import AmdSmiUtilizationCounterType -from .amdsmi_interface import AmdSmiSwComponent -from .amdsmi_interface import AmdSmiIoLinkType +from .amdsmi_interface import AmdSmiProcessorType # Exceptions from .amdsmi_exception import AmdSmiLibraryException diff --git a/py-interface/amdsmi_exception.py b/py-interface/amdsmi_exception.py index 8dcf3fa625..046659e459 100644 --- a/py-interface/amdsmi_exception.py +++ b/py-interface/amdsmi_exception.py @@ -24,32 +24,32 @@ from . import amdsmi_wrapper class AmdSmiRetCode(IntEnum): SUCCESS = amdsmi_wrapper.AMDSMI_STATUS_SUCCESS - ERR_INVAL = amdsmi_wrapper.AMDSMI_STATUS_INVAL - ERR_NOT_SUPPORTED = amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED - FILE_ERROR = amdsmi_wrapper.AMDSMI_STATUS_FILE_ERROR - ERR_NO_PERM = amdsmi_wrapper.AMDSMI_STATUS_NO_PERM - ERR_OUT_OF_RESOURCES = amdsmi_wrapper.AMDSMI_STATUS_OUT_OF_RESOURCES - INTERNAL_EXCEPTION = amdsmi_wrapper.AMDSMI_STATUS_INTERNAL_EXCEPTION - INPUT_OUT_OF_BOUNDS = amdsmi_wrapper.AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS - INIT_ERROR = amdsmi_wrapper.AMDSMI_STATUS_INIT_ERROR - NOT_IMPLEMENTED = amdsmi_wrapper.AMDSMI_STATUS_NOT_YET_IMPLEMENTED - ERR_NOT_FOUND = amdsmi_wrapper.AMDSMI_STATUS_NOT_FOUND - INSUFFICIENT_SIZE = amdsmi_wrapper.AMDSMI_STATUS_INSUFFICIENT_SIZE - INTERRUPT = amdsmi_wrapper.AMDSMI_STATUS_INTERRUPT - UNEXPECTED_SIZE = amdsmi_wrapper.AMDSMI_STATUS_UNEXPECTED_SIZE - NO_DATA = amdsmi_wrapper.AMDSMI_STATUS_NO_DATA - UNEXPECTED_DATA = amdsmi_wrapper.AMDSMI_STATUS_UNEXPECTED_DATA - ERR_BUSY = amdsmi_wrapper.AMDSMI_STATUS_BUSY - REFCOUNT_OVERFLOW = amdsmi_wrapper.AMDSMI_STATUS_REFCOUNT_OVERFLOW - FAIL_LOAD_MODULE = amdsmi_wrapper.AMDSMI_STATUS_FAIL_LOAD_MODULE - FAIL_LOAD_SYMBOL = amdsmi_wrapper.AMDSMI_STATUS_FAIL_LOAD_SYMBOL - DRM_ERROR = amdsmi_wrapper.AMDSMI_STATUS_DRM_ERROR - ERR_IO = amdsmi_wrapper.AMDSMI_STATUS_IO - API_FAILED = amdsmi_wrapper.AMDSMI_STATUS_API_FAILED - TIMEOUT = amdsmi_wrapper.AMDSMI_STATUS_TIMEOUT - NO_SLOT = amdsmi_wrapper.AMDSMI_STATUS_NO_SLOT - RETRY = amdsmi_wrapper.AMDSMI_STATUS_RETRY - NOT_INIT = amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT + STATUS_INVAL = amdsmi_wrapper.AMDSMI_STATUS_INVAL + STATUS_NOT_SUPPORTED = amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED + STATUS_FILE_ERROR = amdsmi_wrapper.AMDSMI_STATUS_FILE_ERROR + STATUS_NO_PERM = amdsmi_wrapper.AMDSMI_STATUS_NO_PERM + STATUS_OUT_OF_RESOURCES = amdsmi_wrapper.AMDSMI_STATUS_OUT_OF_RESOURCES + STATUS_INTERNAL_EXCEPTION = amdsmi_wrapper.AMDSMI_STATUS_INTERNAL_EXCEPTION + STATUS_INPUT_OUT_OF_BOUNDS = amdsmi_wrapper.AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS + STATUS_INIT_ERROR = amdsmi_wrapper.AMDSMI_STATUS_INIT_ERROR + STATUS_NOT_YET_IMPLEMENTED = amdsmi_wrapper.AMDSMI_STATUS_NOT_YET_IMPLEMENTED + STATUS_NOT_FOUND = amdsmi_wrapper.AMDSMI_STATUS_NOT_FOUND + STATUS_INSUFFICIENT_SIZE = amdsmi_wrapper.AMDSMI_STATUS_INSUFFICIENT_SIZE + STATUS_INTERRUPT = amdsmi_wrapper.AMDSMI_STATUS_INTERRUPT + STATUS_UNEXPECTED_SIZE = amdsmi_wrapper.AMDSMI_STATUS_UNEXPECTED_SIZE + STATUS_NO_DATA = amdsmi_wrapper.AMDSMI_STATUS_NO_DATA + STATUS_UNEXPECTED_DATA = amdsmi_wrapper.AMDSMI_STATUS_UNEXPECTED_DATA + STATUS_BUSY = amdsmi_wrapper.AMDSMI_STATUS_BUSY + STATUS_REFCOUNT_OVERFLOW = amdsmi_wrapper.AMDSMI_STATUS_REFCOUNT_OVERFLOW + STATUS_FAIL_LOAD_MODULE = amdsmi_wrapper.AMDSMI_STATUS_FAIL_LOAD_MODULE + STATUS_FAIL_LOAD_SYMBOL = amdsmi_wrapper.AMDSMI_STATUS_FAIL_LOAD_SYMBOL + STATUS_DRM_ERROR = amdsmi_wrapper.AMDSMI_STATUS_DRM_ERROR + STATUS_IO = amdsmi_wrapper.AMDSMI_STATUS_IO + STATUS_API_FAILED = amdsmi_wrapper.AMDSMI_STATUS_API_FAILED + STATUS_TIMEOUT = amdsmi_wrapper.AMDSMI_STATUS_TIMEOUT + STATUS_NO_SLOT = amdsmi_wrapper.AMDSMI_STATUS_NO_SLOT + STATUS_RETRY = amdsmi_wrapper.AMDSMI_STATUS_RETRY + STATUS_NOT_INIT = amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT UNKNOWN_ERROR = amdsmi_wrapper.AMDSMI_STATUS_UNKNOWN_ERROR @@ -79,32 +79,32 @@ class AmdSmiLibraryException(AmdSmiException): def set_err_info(self): switch = { - AmdSmiRetCode.ERR_INVAL: "AMDSMI_STATUS_INVAL - Invalid parameters", - AmdSmiRetCode.ERR_NOT_SUPPORTED: "AMDSMI_STATUS_NOT_SUPPORTED - Feature not supported", - AmdSmiRetCode.FILE_ERROR: "AMDSMI_STATUS_FILE_ERROR - Error opening file", - AmdSmiRetCode.ERR_OUT_OF_RESOURCES: "AMDSMI_STATUS_OUT_OF_RESOURCES - Not enough memory", - AmdSmiRetCode.INTERNAL_EXCEPTION: "AMDSMI_STATUS_INTERNAL_EXCEPTION - Internal error", - AmdSmiRetCode.ERR_NO_PERM: "AMDSMI_STATUS_NO_PERM - Permission Denied", - AmdSmiRetCode.INPUT_OUT_OF_BOUNDS: "AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS - Out of bounds", - AmdSmiRetCode.INIT_ERROR: "AMDSMI_STATUS_INIT_ERROR - Initialization error", - AmdSmiRetCode.ERR_BUSY: "AMDSMI_STATUS_BUSY - Device busy", - AmdSmiRetCode.ERR_NOT_FOUND: "AMDSMI_STATUS_NOT_FOUND - Device Not found", - AmdSmiRetCode.ERR_IO: "AMDSMI_STATUS_IO - I/O Error", - AmdSmiRetCode.NOT_IMPLEMENTED: "AMDSMI_STATUS_NOT_YET_IMPLEMENTED - Feature not yet implemented", - AmdSmiRetCode.INSUFFICIENT_SIZE: "AMDSMI_STATUS_INSUFFICIENT_SIZE - Insufficient size for operation", - AmdSmiRetCode.INTERRUPT: "AMDSMI_STATUS_INTERRUPT - Interrupt ocurred during execution", - AmdSmiRetCode.UNEXPECTED_SIZE: "AMDSMI_STATUS_UNEXPECTED_SIZE - unexpected size of data was read", - AmdSmiRetCode.NO_DATA: "AMDSMI_STATUS_NO_DATA - No data was found for given input", - AmdSmiRetCode.UNEXPECTED_DATA: "AMDSMI_STATUS_UNEXPECTED_DATA - The data read or provided was unexpected", - AmdSmiRetCode.REFCOUNT_OVERFLOW: "AMDSMI_STATUS_REFCOUNT_OVERFLOW - Internal reference counter exceeded INT32_MAX", - AmdSmiRetCode.FAIL_LOAD_MODULE: "AMDSMI_STATUS_FAIL_LOAD_MODULE - Fail to load lib", - AmdSmiRetCode.FAIL_LOAD_SYMBOL: "AMDSMI_STATUS_FAIL_LOAD_SYMBOL - Fail to load symbol", - AmdSmiRetCode.DRM_ERROR: "AMDSMI_STATUS_DRM_ERROR - Error when called libdrm", - AmdSmiRetCode.API_FAILED: "AMDSMI_STATUS_API_FAILED - API call failed", - AmdSmiRetCode.TIMEOUT: "AMDSMI_STATUS_TIMEOUT - Timeout in API call", - AmdSmiRetCode.NO_SLOT: "AMDSMI_STATUS_NO_SLOT - No more free slot", - AmdSmiRetCode.RETRY: "AMDSMI_STATUS_RETRY - Retry operation", - AmdSmiRetCode.NOT_INIT: "AMDSMI_STATUS_NOT_INIT - Device not initialized", + AmdSmiRetCode.STATUS_INVAL: "AMDSMI_STATUS_INVAL - Invalid parameters", + AmdSmiRetCode.STATUS_NOT_SUPPORTED: "AMDSMI_STATUS_NOT_SUPPORTED - Feature not supported", + AmdSmiRetCode.STATUS_FILE_ERROR: "AMDSMI_STATUS_FILE_ERROR - Error opening file", + AmdSmiRetCode.STATUS_OUT_OF_RESOURCES: "AMDSMI_STATUS_OUT_OF_RESOURCES - Not enough memory", + AmdSmiRetCode.STATUS_INTERNAL_EXCEPTION: "AMDSMI_STATUS_INTERNAL_EXCEPTION - Internal error", + AmdSmiRetCode.STATUS_NO_PERM: "AMDSMI_STATUS_NO_PERM - Permission Denied", + AmdSmiRetCode.STATUS_INPUT_OUT_OF_BOUNDS: "AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS - Out of bounds", + AmdSmiRetCode.STATUS_INIT_ERROR: "AMDSMI_STATUS_INIT_ERROR - Initialization error", + AmdSmiRetCode.STATUS_BUSY: "AMDSMI_STATUS_BUSY - Device busy", + AmdSmiRetCode.STATUS_NOT_FOUND: "AMDSMI_STATUS_NOT_FOUND - Device Not found", + AmdSmiRetCode.STATUS_IO: "AMDSMI_STATUS_IO - I/O Error", + AmdSmiRetCode.STATUS_NOT_YET_IMPLEMENTED: "AMDSMI_STATUS_NOT_YET_IMPLEMENTED - Feature not yet implemented", + AmdSmiRetCode.STATUS_INSUFFICIENT_SIZE: "AMDSMI_STATUS_INSUFFICIENT_SIZE - Insufficient size for operation", + AmdSmiRetCode.STATUS_INTERRUPT: "AMDSMI_STATUS_INTERRUPT - Interrupt ocurred during execution", + AmdSmiRetCode.STATUS_UNEXPECTED_SIZE: "AMDSMI_STATUS_UNEXPECTED_SIZE - unexpected size of data was read", + AmdSmiRetCode.STATUS_NO_DATA: "AMDSMI_STATUS_NO_DATA - No data was found for given input", + AmdSmiRetCode.STATUS_UNEXPECTED_DATA: "AMDSMI_STATUS_UNEXPECTED_DATA - The data read or provided was unexpected", + AmdSmiRetCode.STATUS_REFCOUNT_OVERFLOW: "AMDSMI_STATUS_REFCOUNT_OVERFLOW - Internal reference counter exceeded INT32_MAX", + AmdSmiRetCode.STATUS_FAIL_LOAD_MODULE: "AMDSMI_STATUS_FAIL_LOAD_MODULE - Fail to load lib", + AmdSmiRetCode.STATUS_FAIL_LOAD_SYMBOL: "AMDSMI_STATUS_FAIL_LOAD_SYMBOL - Fail to load symbol", + AmdSmiRetCode.STATUS_DRM_ERROR: "AMDSMI_STATUS_DRM_ERROR - Error when called libdrm", + AmdSmiRetCode.STATUS_API_FAILED: "AMDSMI_STATUS_API_FAILED - API call failed", + AmdSmiRetCode.STATUS_TIMEOUT: "AMDSMI_STATUS_TIMEOUT - Timeout in API call", + AmdSmiRetCode.STATUS_NO_SLOT: "AMDSMI_STATUS_NO_SLOT - No more free slot", + AmdSmiRetCode.STATUS_RETRY: "AMDSMI_STATUS_RETRY - Retry operation", + AmdSmiRetCode.STATUS_NOT_INIT: "AMDSMI_STATUS_NOT_INIT - Device not initialized", } self.err_info = switch.get(self.err_code, "AMDSMI_STATUS_UNKNOWN_ERROR - An unknown error occurred") diff --git a/py-interface/amdsmi_interface.py b/py-interface/amdsmi_interface.py index cafe277edb..6c4f5e996b 100644 --- a/py-interface/amdsmi_interface.py +++ b/py-interface/amdsmi_interface.py @@ -29,11 +29,11 @@ from . import amdsmi_wrapper from .amdsmi_exception import * class AmdSmiInitFlags(IntEnum): - ALL_DEVICES = amdsmi_wrapper.AMDSMI_INIT_ALL_DEVICES - AMD_CPUS = amdsmi_wrapper.AMDSMI_INIT_AMD_CPUS - AMD_GPUS = amdsmi_wrapper.AMDSMI_INIT_AMD_GPUS - NON_AMD_CPUS = amdsmi_wrapper.AMDSMI_INIT_NON_AMD_CPUS - NON_AMD_GPUS = amdsmi_wrapper.AMDSMI_INIT_NON_AMD_GPUS + INIT_ALL_PROCESSORS = amdsmi_wrapper.AMDSMI_INIT_ALL_PROCESSORS + INIT_AMD_CPUS = amdsmi_wrapper.AMDSMI_INIT_AMD_CPUS + INIT_AMD_GPUS = amdsmi_wrapper.AMDSMI_INIT_AMD_GPUS + INIT_NON_AMD_CPUS = amdsmi_wrapper.AMDSMI_INIT_NON_AMD_CPUS + INIT_NON_AMD_GPUS = amdsmi_wrapper.AMDSMI_INIT_NON_AMD_GPUS class AmdSmiContainerTypes(IntEnum): @@ -94,6 +94,38 @@ class AmdSmiFwBlock(IntEnum): FW_ID_MC = amdsmi_wrapper.FW_ID_MC FW_ID_PSP_BL = amdsmi_wrapper.FW_ID_PSP_BL FW_ID_CP_PM4 = amdsmi_wrapper.FW_ID_CP_PM4 + FW_ID_RLC_P = amdsmi_wrapper.FW_ID_RLC_P + FW_ID_SEC_POLICY_STAGE2 = amdsmi_wrapper.FW_ID_SEC_POLICY_STAGE2 + FW_ID_REG_ACCESS_WHITELIST = amdsmi_wrapper.FW_ID_REG_ACCESS_WHITELIST + FW_ID_IMU_DRAM = amdsmi_wrapper.FW_ID_IMU_DRAM + FW_ID_IMU_IRAM = amdsmi_wrapper.FW_ID_IMU_IRAM + FW_ID_SDMA_TH0 = amdsmi_wrapper.FW_ID_SDMA_TH0 + FW_ID_SDMA_TH1 = amdsmi_wrapper.FW_ID_SDMA_TH1 + FW_ID_CP_MES = amdsmi_wrapper.FW_ID_CP_MES + FW_ID_MES_STACK = amdsmi_wrapper.FW_ID_MES_STACK + FW_ID_MES_THREAD1 = amdsmi_wrapper.FW_ID_MES_THREAD1 + FW_ID_MES_THREAD1_STACK = amdsmi_wrapper.FW_ID_MES_THREAD1_STACK + FW_ID_RLX6 = amdsmi_wrapper.FW_ID_RLX6 + FW_ID_RLX6_DRAM_BOOT = amdsmi_wrapper.FW_ID_RLX6_DRAM_BOOT + FW_ID_RS64_ME = amdsmi_wrapper.FW_ID_RS64_ME + FW_ID_RS64_ME_P0_DATA = amdsmi_wrapper.FW_ID_RS64_ME_P0_DATA + FW_ID_RS64_ME_P1_DATA = amdsmi_wrapper.FW_ID_RS64_ME_P1_DATA + FW_ID_RS64_PFP = amdsmi_wrapper.FW_ID_RS64_PFP + FW_ID_RS64_PFP_P0_DATA = amdsmi_wrapper.FW_ID_RS64_PFP_P0_DATA + FW_ID_RS64_PFP_P1_DATA = amdsmi_wrapper.FW_ID_RS64_PFP_P1_DATA + FW_ID_RS64_MEC = amdsmi_wrapper.FW_ID_RS64_MEC + FW_ID_RS64_MEC_P0_DATA = amdsmi_wrapper.FW_ID_RS64_MEC_P0_DATA + FW_ID_RS64_MEC_P1_DATA = amdsmi_wrapper.FW_ID_RS64_MEC_P1_DATA + FW_ID_RS64_MEC_P2_DATA = amdsmi_wrapper.FW_ID_RS64_MEC_P2_DATA + FW_ID_RS64_MEC_P3_DATA = amdsmi_wrapper.FW_ID_RS64_MEC_P3_DATA + FW_ID_PPTABLE = amdsmi_wrapper.FW_ID_PPTABLE + FW_ID_PSP_SOC = amdsmi_wrapper.FW_ID_PSP_SOC + FW_ID_PSP_DBG = amdsmi_wrapper.FW_ID_PSP_DBG + FW_ID_PSP_INTF = amdsmi_wrapper.FW_ID_PSP_INTF + FW_ID_RLX6_CORE1 = amdsmi_wrapper.FW_ID_RLX6_CORE1 + FW_ID_RLX6_DRAM_BOOT_CORE1 = amdsmi_wrapper.FW_ID_RLX6_DRAM_BOOT_CORE1 + FW_ID_RLCV_LX7 = amdsmi_wrapper.FW_ID_RLCV_LX7 + FW_ID_RLC_SAVE_RESTORE_LIST = amdsmi_wrapper.FW_ID_RLC_SAVE_RESTORE_LIST FW_ID_ASD = amdsmi_wrapper.FW_ID_ASD FW_ID_TA_RAS = amdsmi_wrapper.FW_ID_TA_RAS FW_ID_XGMI = amdsmi_wrapper.FW_ID_XGMI @@ -141,10 +173,6 @@ class AmdSmiDevPerfLevel(IntEnum): UNKNOWN = amdsmi_wrapper.AMDSMI_DEV_PERF_LEVEL_UNKNOWN -class AmdSmiSwComponent(IntEnum): - DRIVER = amdsmi_wrapper.AMDSMI_SW_COMP_DRIVER - - class AmdSmiEventGroup(IntEnum): XGMI = amdsmi_wrapper.AMDSMI_EVNT_GRP_XGMI XGMI_DATA_OUT = amdsmi_wrapper.AMDSMI_EVNT_GRP_XGMI_DATA_OUT @@ -290,6 +318,13 @@ class AmdSmiUtilizationCounterType(IntEnum): COARSE_GRAIN_GFX_ACTIVITY = amdsmi_wrapper.AMDSMI_COARSE_GRAIN_GFX_ACTIVITY COARSE_GRAIN_MEM_ACTIVITY = amdsmi_wrapper.AMDSMI_COARSE_GRAIN_MEM_ACTIVITY +class AmdSmiProcessorType(IntEnum): + UNKNOWN = amdsmi_wrapper.UNKNOWN + AMD_GPU = amdsmi_wrapper.AMD_GPU + AMD_CPU = amdsmi_wrapper.AMD_CPU + NON_AMD_GPU = amdsmi_wrapper.NON_AMD_GPU + NON_AMD_CPU = amdsmi_wrapper.NON_AMD_CPU + class AmdSmiEventReader: def __init__( @@ -503,7 +538,7 @@ def amdsmi_get_socket_info(socket_handle): _check_res( amdsmi_wrapper.amdsmi_get_socket_info( - socket_handle, socket_info, ctypes.c_size_t(128)) + socket_handle, ctypes.c_size_t(128), socket_info) ) return socket_info.value.decode() @@ -540,7 +575,7 @@ def amdsmi_get_processor_handles() -> List[amdsmi_wrapper.amdsmi_processor_handl return devices -def amdsmi_init(flag=AmdSmiInitFlags.AMD_GPUS): +def amdsmi_init(flag=AmdSmiInitFlags.INIT_AMD_GPUS): if not isinstance(flag, AmdSmiInitFlags): raise AmdSmiParameterException(flag, AmdSmiInitFlags) _check_res(amdsmi_wrapper.amdsmi_init(flag)) @@ -563,7 +598,10 @@ def amdsmi_get_processor_type( amdsmi_wrapper.amdsmi_get_processor_type( processor_handle, ctypes.byref(dev_type)) ) - return dev_type.value + + return { + "processor_type": AmdSmiProcessorType(dev_type.value).name + } def amdsmi_get_gpu_device_bdf(processor_handle: amdsmi_wrapper.amdsmi_processor_handle) -> str: @@ -598,6 +636,7 @@ def amdsmi_get_gpu_asic_info( return { "market_name": asic_info.market_name.decode("utf-8"), "vendor_id": asic_info.vendor_id, + "subvendor_id": asic_info.subvendor_id, "device_id": asic_info.device_id, "rev_id": asic_info.rev_id, "asic_serial": asic_info.asic_serial.decode("utf-8"), @@ -620,8 +659,8 @@ def amdsmi_get_power_cap_info( ) return {"power_cap": power_info.power_cap, + "default_power_cap": power_info.default_power_cap, "dpm_cap": power_info.dpm_cap, - "power_cap_default": power_info.default_power_cap, "min_power_cap": power_info.min_power_cap, "max_power_cap": power_info.max_power_cap} @@ -642,9 +681,9 @@ def amdsmi_get_gpu_vbios_info( return { "name": vbios_info.name.decode("utf-8"), - "version": vbios_info.version.decode("utf-8"), "build_date": vbios_info.build_date.decode("utf-8"), "part_number": vbios_info.part_number.decode("utf-8"), + "version": vbios_info.version.decode("utf-8"), } @@ -672,7 +711,7 @@ def amdsmi_get_gpu_activity( def amdsmi_get_clock_info( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, - clock_type: amdsmi_wrapper.amdsmi_clk_type_t, + clock_type: AmdSmiClkType, ) -> Dict[str, Any]: if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( @@ -685,15 +724,15 @@ def amdsmi_get_clock_info( _check_res( amdsmi_wrapper.amdsmi_get_clock_info( processor_handle, - amdsmi_wrapper.amdsmi_clk_type_t(clock_type), + clock_type, ctypes.byref(clock_measure), ) ) return { "cur_clk": clock_measure.cur_clk, - "min_clk": clock_measure.min_clk, "max_clk": clock_measure.max_clk, + "min_clk": clock_measure.min_clk, } @@ -750,7 +789,7 @@ def amdsmi_get_gpu_target_frequency_range( } -def amdsmi_get_gpu_ecc_error_count( +def amdsmi_get_gpu_total_ecc_count( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): @@ -760,7 +799,7 @@ def amdsmi_get_gpu_ecc_error_count( error_count = amdsmi_wrapper.amdsmi_error_count_t() _check_res( - amdsmi_wrapper.amdsmi_get_gpu_ecc_error_count( + amdsmi_wrapper.amdsmi_get_gpu_total_ecc_count( processor_handle, ctypes.byref(error_count) ) ) @@ -828,44 +867,44 @@ def amdsmi_get_gpu_ras_block_features_enabled( def amdsmi_get_gpu_process_list( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, -) -> List[amdsmi_wrapper.amdsmi_process_handle]: +) -> List[amdsmi_wrapper.amdsmi_process_handle_t]: if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) max_processes = ctypes.c_uint32(0) - process_list = (amdsmi_wrapper.amdsmi_process_handle * + process_list = (amdsmi_wrapper.amdsmi_process_handle_t * max_processes.value)() _check_res( amdsmi_wrapper.amdsmi_get_gpu_process_list( - processor_handle, process_list, ctypes.byref(max_processes) + processor_handle, ctypes.byref(max_processes), process_list ) ) - process_list = (amdsmi_wrapper.amdsmi_process_handle * + process_list = (amdsmi_wrapper.amdsmi_process_handle_t * max_processes.value)() _check_res( amdsmi_wrapper.amdsmi_get_gpu_process_list( - processor_handle, process_list, ctypes.byref(max_processes) + processor_handle, ctypes.byref(max_processes), process_list ) ) - return [amdsmi_wrapper.amdsmi_process_handle(x) for x in list(process_list)] + return [amdsmi_wrapper.amdsmi_process_handle_t(x) for x in list(process_list)] def amdsmi_get_gpu_process_info( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, - process: amdsmi_wrapper.amdsmi_process_handle, + process: amdsmi_wrapper.amdsmi_process_handle_t, ) -> Dict[str, Any]: if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) - if not isinstance(process, amdsmi_wrapper.amdsmi_process_handle): + if not isinstance(process, amdsmi_wrapper.amdsmi_process_handle_t): raise AmdSmiParameterException( - process, amdsmi_wrapper.amdsmi_process_handle) + process, amdsmi_wrapper.amdsmi_process_handle_t) info = amdsmi_wrapper.amdsmi_proc_info_t() _check_res( @@ -950,6 +989,8 @@ def amdsmi_get_power_info( return { "average_socket_power": power_measure.average_socket_power, "gfx_voltage": power_measure.gfx_voltage, + 'soc_voltage': power_measure.soc_voltage, + 'mem_voltage': power_measure.mem_voltage, "power_limit" : power_measure.power_limit, } @@ -1023,7 +1064,7 @@ def amdsmi_get_pcie_link_caps( processor_handle, ctypes.byref(pcie_info)) ) - return {"pcie_lanes": pcie_info.pcie_lanes, "pcie_speed": pcie_info.pcie_speed} + return {"pcie_speed": pcie_info.pcie_speed, "pcie_lanes": pcie_info.pcie_lanes} def amdsmi_get_processor_handle_from_bdf(bdf): @@ -1090,22 +1131,6 @@ def amdsmi_get_gpu_vram_vendor(processor_handle: amdsmi_wrapper.amdsmi_processor return vram_vendor.value.decode("utf-8") -def amdsmi_get_gpu_drm_render_minor(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): - if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): - raise AmdSmiParameterException( - processor_handle, amdsmi_wrapper.amdsmi_processor_handle - ) - minor = ctypes.c_uint32() - - _check_res( - amdsmi_wrapper.amdsmi_get_gpu_drm_render_minor( - processor_handle, ctypes.byref(minor) - ) - ) - - return minor.value - - def amdsmi_get_gpu_subsystem_id(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( @@ -1140,10 +1165,10 @@ def amdsmi_get_gpu_subsystem_name(processor_handle: amdsmi_wrapper.amdsmi_proces return name.value.decode("utf-8") -def amdsmi_get_version(): +def amdsmi_get_lib_version(): version = amdsmi_wrapper.amdsmi_version_t() - _check_res(amdsmi_wrapper.amdsmi_get_version(ctypes.byref(version))) + _check_res(amdsmi_wrapper.amdsmi_get_lib_version(ctypes.byref(version))) return { "major": version.major, @@ -1153,21 +1178,6 @@ def amdsmi_get_version(): } -def amdsmi_get_version_str(sw_component: AmdSmiSwComponent): - if not isinstance(sw_component, AmdSmiSwComponent): - raise AmdSmiParameterException(sw_component, AmdSmiSwComponent) - - length = ctypes.c_uint32() - length.value = _AMDSMI_STRING_LENGTH - - ver_str = ctypes.create_string_buffer(_AMDSMI_STRING_LENGTH) - - _check_res(amdsmi_wrapper.amdsmi_get_version_str( - sw_component, ver_str, length)) - - return ver_str.value.decode("utf-8") - - def amdsmi_topo_get_numa_node_number( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ): @@ -1212,7 +1222,7 @@ def amdsmi_topo_get_link_weight( return weight.value -def amdsmi_get_minmax_bandwidth( +def admsmi_get_minmax_bandwith_between_processors( processor_handle_src: amdsmi_wrapper.amdsmi_processor_handle, processor_handle_dst: amdsmi_wrapper.amdsmi_processor_handle, ): @@ -1230,7 +1240,7 @@ def amdsmi_get_minmax_bandwidth( max_bandwidth = ctypes.c_uint64() _check_res( - amdsmi_wrapper. amdsmi_get_minmax_bandwidth( + amdsmi_wrapper. admsmi_get_minmax_bandwith_between_processors( processor_handle_src, processor_handle_dst, ctypes.byref(min_bandwidth), @@ -1543,23 +1553,6 @@ def amdsmi_set_clk_freq( ) -def amdsmi_set_gpu_overdrive_level_v1( - processor_handle: amdsmi_wrapper.amdsmi_processor_handle, overdrive_value: int -): - if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): - raise AmdSmiParameterException( - processor_handle, amdsmi_wrapper.amdsmi_processor_handle - ) - if not isinstance(overdrive_value, int): - raise AmdSmiParameterException(overdrive_value, int) - overdrive_value = ctypes.c_uint32(overdrive_value) - - _check_res( - amdsmi_wrapper. amdsmi_set_gpu_overdrive_level_v1( - processor_handle, overdrive_value) - ) - - def amdsmi_set_gpu_overdrive_level( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, overdrive_value: int ): @@ -1577,25 +1570,7 @@ def amdsmi_set_gpu_overdrive_level( ) -def amdsmi_open_supported_func_iterator( - processor_handle: amdsmi_wrapper.amdsmi_processor_handle, -) -> amdsmi_wrapper.amdsmi_func_id_iter_handle_t: - if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): - raise AmdSmiParameterException( - processor_handle, amdsmi_wrapper.amdsmi_processor_handle - ) - - obj_handle = amdsmi_wrapper.amdsmi_func_id_iter_handle_t() - _check_res( - amdsmi_wrapper.amdsmi_open_supported_func_iterator( - processor_handle, ctypes.byref(obj_handle) - ) - ) - - return obj_handle - - -def amdsmi_get_gpu_pci_id(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): +def admsmi_get_gpu_bdf_id(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( processor_handle, amdsmi_wrapper.amdsmi_processor_handle @@ -1603,88 +1578,12 @@ def amdsmi_get_gpu_pci_id(processor_handle: amdsmi_wrapper.amdsmi_processor_hand bdfid = ctypes.c_uint64() _check_res( - amdsmi_wrapper.amdsmi_get_gpu_pci_id( + amdsmi_wrapper.admsmi_get_gpu_bdf_id( processor_handle, ctypes.byref(bdfid)) ) return bdfid.value - -def amdsmi_open_supported_variant_iterator( - obj_handle: amdsmi_wrapper.amdsmi_func_id_iter_handle_t, -) -> amdsmi_wrapper.amdsmi_func_id_iter_handle_t: - if not isinstance(obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t): - raise AmdSmiParameterException( - obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t - ) - - var_iter = amdsmi_wrapper.amdsmi_func_id_iter_handle_t() - _check_res( - amdsmi_wrapper.amdsmi_open_supported_variant_iterator( - obj_handle, ctypes.byref(var_iter) - ) - ) - - return var_iter - - -def amdsmi_close_supported_func_iterator( - obj_handle: amdsmi_wrapper.amdsmi_func_id_iter_handle_t, -) -> None: - if not isinstance(obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t): - raise AmdSmiParameterException( - obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t - ) - - _check_res( - amdsmi_wrapper.amdsmi_close_supported_func_iterator( - obj_handle, ctypes.byref(obj_handle) - ) - ) - - -def amdsmi_next_func_iter( - obj_handle: amdsmi_wrapper.amdsmi_func_id_iter_handle_t, -) -> amdsmi_wrapper.amdsmi_func_id_iter_handle_t: - if not isinstance(obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t): - raise AmdSmiParameterException( - obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t - ) - - _check_res(amdsmi_wrapper.amdsmi_next_func_iter(obj_handle)) - - return obj_handle - - -def amdsmi_get_func_iter_value( - obj_handle: amdsmi_wrapper.amdsmi_func_id_iter_handle_t, -) -> amdsmi_wrapper.amdsmi_func_id_value_t: - if not isinstance(obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t): - raise AmdSmiParameterException( - obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t - ) - - value = amdsmi_wrapper.amdsmi_func_id_value_t() - _check_res( - amdsmi_wrapper.amdsmi_get_func_iter_value( - obj_handle, ctypes.byref(value)) - ) - - return { - "id": value.id, - "name": amdsmi_wrapper.string_cast(value.name), - "amd_id_0": { - "memory_type": value.amd_id_0.memory_type, - "temp_metric": value.amd_id_0.temp_metric, - "evnt_type": value.amd_id_0.evnt_type, - "evnt_group": value.amd_id_0.evnt_group, - "clk_type": value.amd_id_0.clk_type, - "fw_block": value.amd_id_0.fw_block, - "gpu_block_type": value.amd_id_0.gpu_block_type, - }, - } - - def amdsmi_set_gpu_pci_bandwidth( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, bitmask: int ) -> None: @@ -1981,37 +1880,6 @@ def amdsmi_set_gpu_od_volt_info( ) -def amdsmi_get_gpu_memory_busy_percent(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): - if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): - raise AmdSmiParameterException( - processor_handle, amdsmi_wrapper.amdsmi_processor_handle - ) - - busy_percent = ctypes.c_uint32() - - _check_res( - amdsmi_wrapper.amdsmi_get_gpu_memory_busy_percent( - processor_handle, ctypes.byref(busy_percent)) - ) - - return busy_percent.value - - -def amdsmi_set_gpu_perf_level_v1( - processor_handle: amdsmi_wrapper.amdsmi_processor_handle, - perf_lvl: AmdSmiDevPerfLevel, -) -> None: - if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): - raise AmdSmiParameterException( - processor_handle, amdsmi_wrapper.amdsmi_processor_handle - ) - - if not isinstance(perf_lvl, AmdSmiDevPerfLevel): - raise AmdSmiParameterException(perf_lvl, AmdSmiDevPerfLevel) - - _check_res(amdsmi_wrapper. amdsmi_set_gpu_perf_level_v1( - processor_handle, perf_lvl)) - def amdsmi_get_gpu_fan_rpms( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_idx: int @@ -2118,23 +1986,6 @@ def amdsmi_get_gpu_volt_metric( return voltage.value -def amdsmi_get_busy_percent( - processor_handle: amdsmi_wrapper.amdsmi_processor_handle, -) -> int: - if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): - raise AmdSmiParameterException( - processor_handle, amdsmi_wrapper.amdsmi_processor_handle - ) - - busy_percent = ctypes.c_uint32() - _check_res( - amdsmi_wrapper.amdsmi_get_busy_percent( - processor_handle, ctypes.byref(busy_percent) - ) - ) - - return busy_percent.value - def amdsmi_get_utilization_count( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, @@ -2476,13 +2327,13 @@ def amdsmi_get_gpu_ecc_status( return AmdSmiRasErrState(state.value) -def amdsmi_status_string(status: amdsmi_wrapper.amdsmi_status_t) -> str: +def amdsmi_status_code_to_string(status: amdsmi_wrapper.amdsmi_status_t) -> str: if not isinstance(status, amdsmi_wrapper.amdsmi_status_t): raise AmdSmiParameterException(status, amdsmi_wrapper.amdsmi_status_t) status_string_p_p = ctypes.pointer(ctypes.pointer(ctypes.c_char())) - _check_res(amdsmi_wrapper.amdsmi_status_string( + _check_res(amdsmi_wrapper.amdsmi_status_code_to_string( status, status_string_p_p)) return amdsmi_wrapper.string_cast(status_string_p_p.contents) diff --git a/py-interface/amdsmi_wrapper.py b/py-interface/amdsmi_wrapper.py index c69f13d1b5..5c65e7899f 100644 --- a/py-interface/amdsmi_wrapper.py +++ b/py-interface/amdsmi_wrapper.py @@ -165,8 +165,7 @@ def char_pointer_cast(string, encoding='utf-8'): return ctypes.cast(string, ctypes.POINTER(ctypes.c_char)) -### Match edits in generator.py from start to end -### Start match + _libraries = {} from pathlib import Path libamd_smi_cpack = Path("@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libamd_smi.so") @@ -186,19 +185,18 @@ elif libamd_smi_parent_dir.is_file(): else: # lastly - search in current working directory _libraries['libamd_smi.so'] = ctypes.CDLL(libamd_smi_cwd) -### End match # values for enumeration 'c__EA_amdsmi_init_flags_t' c__EA_amdsmi_init_flags_t__enumvalues = { - 0: 'AMDSMI_INIT_ALL_DEVICES', + 0: 'AMDSMI_INIT_ALL_PROCESSORS', 1: 'AMDSMI_INIT_AMD_CPUS', 2: 'AMDSMI_INIT_AMD_GPUS', 4: 'AMDSMI_INIT_NON_AMD_CPUS', 8: 'AMDSMI_INIT_NON_AMD_GPUS', } -AMDSMI_INIT_ALL_DEVICES = 0 +AMDSMI_INIT_ALL_PROCESSORS = 0 AMDSMI_INIT_AMD_CPUS = 1 AMDSMI_INIT_AMD_GPUS = 2 AMDSMI_INIT_NON_AMD_CPUS = 4 @@ -420,14 +418,46 @@ c__EA_amdsmi_fw_block_t__enumvalues = { 36: 'FW_ID_MC', 37: 'FW_ID_PSP_BL', 38: 'FW_ID_CP_PM4', - 39: 'FW_ID_ASD', - 40: 'FW_ID_TA_RAS', - 41: 'FW_ID_XGMI', - 42: 'FW_ID_RLC_SRLG', - 43: 'FW_ID_RLC_SRLS', - 44: 'FW_ID_SMC', - 45: 'FW_ID_DMCU', - 46: 'FW_ID__MAX', + 39: 'FW_ID_RLC_P', + 40: 'FW_ID_SEC_POLICY_STAGE2', + 41: 'FW_ID_REG_ACCESS_WHITELIST', + 42: 'FW_ID_IMU_DRAM', + 43: 'FW_ID_IMU_IRAM', + 44: 'FW_ID_SDMA_TH0', + 45: 'FW_ID_SDMA_TH1', + 46: 'FW_ID_CP_MES', + 47: 'FW_ID_MES_STACK', + 48: 'FW_ID_MES_THREAD1', + 49: 'FW_ID_MES_THREAD1_STACK', + 50: 'FW_ID_RLX6', + 51: 'FW_ID_RLX6_DRAM_BOOT', + 52: 'FW_ID_RS64_ME', + 53: 'FW_ID_RS64_ME_P0_DATA', + 54: 'FW_ID_RS64_ME_P1_DATA', + 55: 'FW_ID_RS64_PFP', + 56: 'FW_ID_RS64_PFP_P0_DATA', + 57: 'FW_ID_RS64_PFP_P1_DATA', + 58: 'FW_ID_RS64_MEC', + 59: 'FW_ID_RS64_MEC_P0_DATA', + 60: 'FW_ID_RS64_MEC_P1_DATA', + 61: 'FW_ID_RS64_MEC_P2_DATA', + 62: 'FW_ID_RS64_MEC_P3_DATA', + 63: 'FW_ID_PPTABLE', + 64: 'FW_ID_PSP_SOC', + 65: 'FW_ID_PSP_DBG', + 66: 'FW_ID_PSP_INTF', + 67: 'FW_ID_RLX6_CORE1', + 68: 'FW_ID_RLX6_DRAM_BOOT_CORE1', + 69: 'FW_ID_RLCV_LX7', + 70: 'FW_ID_RLC_SAVE_RESTORE_LIST', + 71: 'FW_ID_ASD', + 72: 'FW_ID_TA_RAS', + 73: 'FW_ID_XGMI', + 74: 'FW_ID_RLC_SRLG', + 75: 'FW_ID_RLC_SRLS', + 76: 'FW_ID_SMC', + 77: 'FW_ID_DMCU', + 78: 'FW_ID__MAX', } FW_ID_SMU = 1 FW_ID_FIRST = 1 @@ -468,14 +498,46 @@ FW_ID_DRV_CAP = 35 FW_ID_MC = 36 FW_ID_PSP_BL = 37 FW_ID_CP_PM4 = 38 -FW_ID_ASD = 39 -FW_ID_TA_RAS = 40 -FW_ID_XGMI = 41 -FW_ID_RLC_SRLG = 42 -FW_ID_RLC_SRLS = 43 -FW_ID_SMC = 44 -FW_ID_DMCU = 45 -FW_ID__MAX = 46 +FW_ID_RLC_P = 39 +FW_ID_SEC_POLICY_STAGE2 = 40 +FW_ID_REG_ACCESS_WHITELIST = 41 +FW_ID_IMU_DRAM = 42 +FW_ID_IMU_IRAM = 43 +FW_ID_SDMA_TH0 = 44 +FW_ID_SDMA_TH1 = 45 +FW_ID_CP_MES = 46 +FW_ID_MES_STACK = 47 +FW_ID_MES_THREAD1 = 48 +FW_ID_MES_THREAD1_STACK = 49 +FW_ID_RLX6 = 50 +FW_ID_RLX6_DRAM_BOOT = 51 +FW_ID_RS64_ME = 52 +FW_ID_RS64_ME_P0_DATA = 53 +FW_ID_RS64_ME_P1_DATA = 54 +FW_ID_RS64_PFP = 55 +FW_ID_RS64_PFP_P0_DATA = 56 +FW_ID_RS64_PFP_P1_DATA = 57 +FW_ID_RS64_MEC = 58 +FW_ID_RS64_MEC_P0_DATA = 59 +FW_ID_RS64_MEC_P1_DATA = 60 +FW_ID_RS64_MEC_P2_DATA = 61 +FW_ID_RS64_MEC_P3_DATA = 62 +FW_ID_PPTABLE = 63 +FW_ID_PSP_SOC = 64 +FW_ID_PSP_DBG = 65 +FW_ID_PSP_INTF = 66 +FW_ID_RLX6_CORE1 = 67 +FW_ID_RLX6_DRAM_BOOT_CORE1 = 68 +FW_ID_RLCV_LX7 = 69 +FW_ID_RLC_SAVE_RESTORE_LIST = 70 +FW_ID_ASD = 71 +FW_ID_TA_RAS = 72 +FW_ID_XGMI = 73 +FW_ID_RLC_SRLG = 74 +FW_ID_RLC_SRLS = 75 +FW_ID_SMC = 76 +FW_ID_DMCU = 77 +FW_ID__MAX = 78 c__EA_amdsmi_fw_block_t = ctypes.c_uint32 # enum amdsmi_fw_block_t = c__EA_amdsmi_fw_block_t amdsmi_fw_block_t__enumvalues = c__EA_amdsmi_fw_block_t__enumvalues @@ -500,8 +562,7 @@ struct_c__SA_amdsmi_xgmi_info_t._fields_ = [ ('xgmi_hive_id', ctypes.c_uint64), ('xgmi_node_id', ctypes.c_uint64), ('index', ctypes.c_uint32), - ('number_adapters', ctypes.c_uint32), - ('reserved', ctypes.c_uint32 * 8), + ('reserved', ctypes.c_uint32 * 9), ] amdsmi_xgmi_info_t = struct_c__SA_amdsmi_xgmi_info_t @@ -512,6 +573,7 @@ struct_c__SA_amdsmi_vram_info_t._pack_ = 1 # source:False struct_c__SA_amdsmi_vram_info_t._fields_ = [ ('vram_total', ctypes.c_uint32), ('vram_used', ctypes.c_uint32), + ('reserved', ctypes.c_uint32 * 2), ] amdsmi_vram_info_t = struct_c__SA_amdsmi_vram_info_t @@ -570,7 +632,7 @@ struct_c__SA_amdsmi_vbios_info_t._fields_ = [ ('build_date', ctypes.c_char * 32), ('part_number', ctypes.c_char * 64), ('version', ctypes.c_char * 32), - ('reserved', ctypes.c_uint32 * 15), + ('reserved', ctypes.c_uint32 * 16), ] amdsmi_vbios_info_t = struct_c__SA_amdsmi_vbios_info_t @@ -592,7 +654,7 @@ struct_c__SA_amdsmi_fw_info_t._pack_ = 1 # source:False struct_c__SA_amdsmi_fw_info_t._fields_ = [ ('num_fw_info', ctypes.c_ubyte), ('PADDING_0', ctypes.c_ubyte * 7), - ('fw_info_list', struct_c__SA_amdsmi_fw_info_t_0 * 46), + ('fw_info_list', struct_c__SA_amdsmi_fw_info_t_0 * 78), ('reserved', ctypes.c_uint32 * 7), ('PADDING_1', ctypes.c_ubyte * 4), ] @@ -609,7 +671,7 @@ struct_c__SA_amdsmi_asic_info_t._fields_ = [ ('device_id', ctypes.c_uint64), ('rev_id', ctypes.c_uint32), ('asic_serial', ctypes.c_char * 32), - ('PADDING_0', ctypes.c_ubyte * 4), + ('reserved', ctypes.c_uint32 * 3), ] amdsmi_asic_info_t = struct_c__SA_amdsmi_asic_info_t @@ -651,7 +713,7 @@ struct_c__SA_amdsmi_clk_info_t._fields_ = [ ('cur_clk', ctypes.c_uint32), ('min_clk', ctypes.c_uint32), ('max_clk', ctypes.c_uint32), - ('reserved', ctypes.c_uint32 * 4), + ('reserved', ctypes.c_uint32 * 5), ] amdsmi_clk_info_t = struct_c__SA_amdsmi_clk_info_t @@ -667,10 +729,20 @@ struct_c__SA_amdsmi_engine_usage_t._fields_ = [ ] amdsmi_engine_usage_t = struct_c__SA_amdsmi_engine_usage_t -amdsmi_process_handle = ctypes.c_uint32 +amdsmi_process_handle_t = ctypes.c_uint32 class struct_c__SA_amdsmi_proc_info_t(Structure): pass +class struct_c__SA_amdsmi_proc_info_t_0(Structure): + pass + +struct_c__SA_amdsmi_proc_info_t_0._pack_ = 1 # source:False +struct_c__SA_amdsmi_proc_info_t_0._fields_ = [ + ('gfx', ctypes.c_uint64), + ('enc', ctypes.c_uint64), + ('reserved', ctypes.c_uint32 * 12), +] + class struct_c__SA_amdsmi_proc_info_t_1(Structure): pass @@ -679,15 +751,7 @@ struct_c__SA_amdsmi_proc_info_t_1._fields_ = [ ('gtt_mem', ctypes.c_uint64), ('cpu_mem', ctypes.c_uint64), ('vram_mem', ctypes.c_uint64), -] - -class struct_c__SA_amdsmi_proc_info_t_0(Structure): - pass - -struct_c__SA_amdsmi_proc_info_t_0._pack_ = 1 # source:False -struct_c__SA_amdsmi_proc_info_t_0._fields_ = [ - ('gfx', ctypes.c_uint64), - ('enc', ctypes.c_uint64), + ('reserved', ctypes.c_uint32 * 10), ] struct_c__SA_amdsmi_proc_info_t._pack_ = 1 # source:False @@ -734,19 +798,6 @@ AMDSMI_DEV_PERF_LEVEL_UNKNOWN = 256 c__EA_amdsmi_dev_perf_level_t = ctypes.c_uint32 # enum amdsmi_dev_perf_level_t = c__EA_amdsmi_dev_perf_level_t amdsmi_dev_perf_level_t__enumvalues = c__EA_amdsmi_dev_perf_level_t__enumvalues - -# values for enumeration 'c__EA_amdsmi_sw_component_t' -c__EA_amdsmi_sw_component_t__enumvalues = { - 0: 'AMDSMI_SW_COMP_FIRST', - 0: 'AMDSMI_SW_COMP_DRIVER', - 0: 'AMDSMI_SW_COMP_LAST', -} -AMDSMI_SW_COMP_FIRST = 0 -AMDSMI_SW_COMP_DRIVER = 0 -AMDSMI_SW_COMP_LAST = 0 -c__EA_amdsmi_sw_component_t = ctypes.c_uint32 # enum -amdsmi_sw_component_t = c__EA_amdsmi_sw_component_t -amdsmi_sw_component_t__enumvalues = c__EA_amdsmi_sw_component_t__enumvalues amdsmi_event_handle_t = ctypes.c_uint64 # values for enumeration 'c__EA_amdsmi_event_group_t' @@ -1325,33 +1376,6 @@ struct_c__SA_amdsmi_process_info_t._fields_ = [ ] amdsmi_process_info_t = struct_c__SA_amdsmi_process_info_t -class struct_amdsmi_func_id_iter_handle(Structure): - pass - -amdsmi_func_id_iter_handle_t = ctypes.POINTER(struct_amdsmi_func_id_iter_handle) -class union_c__UA_amdsmi_func_id_value_t(Union): - pass - -class union_c__UA_amdsmi_func_id_value_t_0(Union): - _pack_ = 1 # source:False - _fields_ = [ - ('memory_type', amdsmi_memory_type_t), - ('temp_metric', amdsmi_temperature_metric_t), - ('evnt_type', amdsmi_event_type_t), - ('evnt_group', amdsmi_event_group_t), - ('clk_type', amdsmi_clk_type_t), - ('fw_block', amdsmi_fw_block_t), - ('gpu_block_type', amdsmi_gpu_block_t), - ] - -union_c__UA_amdsmi_func_id_value_t._pack_ = 1 # source:False -union_c__UA_amdsmi_func_id_value_t._fields_ = [ - ('id', ctypes.c_uint64), - ('name', ctypes.POINTER(ctypes.c_char)), - ('c__UA_amdsmi_func_id_value_t_0', union_c__UA_amdsmi_func_id_value_t_0), -] - -amdsmi_func_id_value_t = union_c__UA_amdsmi_func_id_value_t uint64_t = ctypes.c_uint64 amdsmi_init = _libraries['libamd_smi.so'].amdsmi_init amdsmi_init.restype = amdsmi_status_t @@ -1365,7 +1389,7 @@ amdsmi_get_socket_handles.argtypes = [ctypes.POINTER(ctypes.c_uint32), ctypes.PO size_t = ctypes.c_uint64 amdsmi_get_socket_info = _libraries['libamd_smi.so'].amdsmi_get_socket_info amdsmi_get_socket_info.restype = amdsmi_status_t -amdsmi_get_socket_info.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_char), size_t] +amdsmi_get_socket_info.argtypes = [amdsmi_socket_handle, size_t, ctypes.POINTER(ctypes.c_char)] amdsmi_get_processor_handles = _libraries['libamd_smi.so'].amdsmi_get_processor_handles amdsmi_get_processor_handles.restype = amdsmi_status_t amdsmi_get_processor_handles.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))] @@ -1391,15 +1415,12 @@ amdsmi_get_gpu_subsystem_id.argtypes = [amdsmi_processor_handle, ctypes.POINTER( amdsmi_get_gpu_subsystem_name = _libraries['libamd_smi.so'].amdsmi_get_gpu_subsystem_name amdsmi_get_gpu_subsystem_name.restype = amdsmi_status_t amdsmi_get_gpu_subsystem_name.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), size_t] -amdsmi_get_gpu_drm_render_minor = _libraries['libamd_smi.so'].amdsmi_get_gpu_drm_render_minor -amdsmi_get_gpu_drm_render_minor.restype = amdsmi_status_t -amdsmi_get_gpu_drm_render_minor.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] amdsmi_get_gpu_pci_bandwidth = _libraries['libamd_smi.so'].amdsmi_get_gpu_pci_bandwidth amdsmi_get_gpu_pci_bandwidth.restype = amdsmi_status_t amdsmi_get_gpu_pci_bandwidth.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_pcie_bandwidth_t)] -amdsmi_get_gpu_pci_id = _libraries['libamd_smi.so'].amdsmi_get_gpu_pci_id -amdsmi_get_gpu_pci_id.restype = amdsmi_status_t -amdsmi_get_gpu_pci_id.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +admsmi_get_gpu_bdf_id = _libraries['libamd_smi.so'].admsmi_get_gpu_bdf_id +admsmi_get_gpu_bdf_id.restype = amdsmi_status_t +admsmi_get_gpu_bdf_id.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] amdsmi_get_gpu_topo_numa_affinity = _libraries['libamd_smi.so'].amdsmi_get_gpu_topo_numa_affinity amdsmi_get_gpu_topo_numa_affinity.restype = amdsmi_status_t amdsmi_get_gpu_topo_numa_affinity.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] @@ -1433,9 +1454,6 @@ amdsmi_get_gpu_bad_page_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER amdsmi_get_gpu_ras_block_features_enabled = _libraries['libamd_smi.so'].amdsmi_get_gpu_ras_block_features_enabled amdsmi_get_gpu_ras_block_features_enabled.restype = amdsmi_status_t amdsmi_get_gpu_ras_block_features_enabled.argtypes = [amdsmi_processor_handle, amdsmi_gpu_block_t, ctypes.POINTER(c__EA_amdsmi_ras_err_state_t)] -amdsmi_get_gpu_memory_busy_percent = _libraries['libamd_smi.so'].amdsmi_get_gpu_memory_busy_percent -amdsmi_get_gpu_memory_busy_percent.restype = amdsmi_status_t -amdsmi_get_gpu_memory_busy_percent.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] amdsmi_get_gpu_memory_reserved_pages = _libraries['libamd_smi.so'].amdsmi_get_gpu_memory_reserved_pages amdsmi_get_gpu_memory_reserved_pages.restype = amdsmi_status_t amdsmi_get_gpu_memory_reserved_pages.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(struct_c__SA_amdsmi_retired_page_record_t)] @@ -1460,9 +1478,6 @@ amdsmi_reset_gpu_fan.argtypes = [amdsmi_processor_handle, uint32_t] amdsmi_set_gpu_fan_speed = _libraries['libamd_smi.so'].amdsmi_set_gpu_fan_speed amdsmi_set_gpu_fan_speed.restype = amdsmi_status_t amdsmi_set_gpu_fan_speed.argtypes = [amdsmi_processor_handle, uint32_t, uint64_t] -amdsmi_get_busy_percent = _libraries['libamd_smi.so'].amdsmi_get_busy_percent -amdsmi_get_busy_percent.restype = amdsmi_status_t -amdsmi_get_busy_percent.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] amdsmi_get_utilization_count = _libraries['libamd_smi.so'].amdsmi_get_utilization_count amdsmi_get_utilization_count.restype = amdsmi_status_t amdsmi_get_utilization_count.argtypes = [amdsmi_processor_handle, struct_c__SA_amdsmi_utilization_counter_t * 0, uint32_t, ctypes.POINTER(ctypes.c_uint64)] @@ -1511,24 +1526,15 @@ amdsmi_get_gpu_power_profile_presets.argtypes = [amdsmi_processor_handle, uint32 amdsmi_set_gpu_perf_level = _libraries['libamd_smi.so'].amdsmi_set_gpu_perf_level amdsmi_set_gpu_perf_level.restype = amdsmi_status_t amdsmi_set_gpu_perf_level.argtypes = [amdsmi_processor_handle, amdsmi_dev_perf_level_t] -amdsmi_set_gpu_perf_level_v1 = _libraries['libamd_smi.so'].amdsmi_set_gpu_perf_level_v1 -amdsmi_set_gpu_perf_level_v1.restype = amdsmi_status_t -amdsmi_set_gpu_perf_level_v1.argtypes = [amdsmi_processor_handle, amdsmi_dev_perf_level_t] amdsmi_set_gpu_overdrive_level = _libraries['libamd_smi.so'].amdsmi_set_gpu_overdrive_level amdsmi_set_gpu_overdrive_level.restype = amdsmi_status_t amdsmi_set_gpu_overdrive_level.argtypes = [amdsmi_processor_handle, uint32_t] -amdsmi_set_gpu_overdrive_level_v1 = _libraries['libamd_smi.so'].amdsmi_set_gpu_overdrive_level_v1 -amdsmi_set_gpu_overdrive_level_v1.restype = amdsmi_status_t -amdsmi_set_gpu_overdrive_level_v1.argtypes = [amdsmi_processor_handle, uint32_t] amdsmi_set_clk_freq = _libraries['libamd_smi.so'].amdsmi_set_clk_freq amdsmi_set_clk_freq.restype = amdsmi_status_t amdsmi_set_clk_freq.argtypes = [amdsmi_processor_handle, amdsmi_clk_type_t, uint64_t] -amdsmi_get_version = _libraries['libamd_smi.so'].amdsmi_get_version -amdsmi_get_version.restype = amdsmi_status_t -amdsmi_get_version.argtypes = [ctypes.POINTER(struct_c__SA_amdsmi_version_t)] -amdsmi_get_version_str = _libraries['libamd_smi.so'].amdsmi_get_version_str -amdsmi_get_version_str.restype = amdsmi_status_t -amdsmi_get_version_str.argtypes = [amdsmi_sw_component_t, ctypes.POINTER(ctypes.c_char), uint32_t] +amdsmi_get_lib_version = _libraries['libamd_smi.so'].amdsmi_get_lib_version +amdsmi_get_lib_version.restype = amdsmi_status_t +amdsmi_get_lib_version.argtypes = [ctypes.POINTER(struct_c__SA_amdsmi_version_t)] amdsmi_get_gpu_ecc_count = _libraries['libamd_smi.so'].amdsmi_get_gpu_ecc_count amdsmi_get_gpu_ecc_count.restype = amdsmi_status_t amdsmi_get_gpu_ecc_count.argtypes = [amdsmi_processor_handle, amdsmi_gpu_block_t, ctypes.POINTER(struct_c__SA_amdsmi_error_count_t)] @@ -1538,9 +1544,9 @@ amdsmi_get_gpu_ecc_enabled.argtypes = [amdsmi_processor_handle, ctypes.POINTER(c amdsmi_get_gpu_ecc_status = _libraries['libamd_smi.so'].amdsmi_get_gpu_ecc_status amdsmi_get_gpu_ecc_status.restype = amdsmi_status_t amdsmi_get_gpu_ecc_status.argtypes = [amdsmi_processor_handle, amdsmi_gpu_block_t, ctypes.POINTER(c__EA_amdsmi_ras_err_state_t)] -amdsmi_status_string = _libraries['libamd_smi.so'].amdsmi_status_string -amdsmi_status_string.restype = amdsmi_status_t -amdsmi_status_string.argtypes = [amdsmi_status_t, ctypes.POINTER(ctypes.POINTER(ctypes.c_char))] +amdsmi_status_code_to_string = _libraries['libamd_smi.so'].amdsmi_status_code_to_string +amdsmi_status_code_to_string.restype = amdsmi_status_t +amdsmi_status_code_to_string.argtypes = [amdsmi_status_t, ctypes.POINTER(ctypes.POINTER(ctypes.c_char))] amdsmi_gpu_counter_group_supported = _libraries['libamd_smi.so'].amdsmi_gpu_counter_group_supported amdsmi_gpu_counter_group_supported.restype = amdsmi_status_t amdsmi_gpu_counter_group_supported.argtypes = [amdsmi_processor_handle, amdsmi_event_group_t] @@ -1580,30 +1586,15 @@ amdsmi_topo_get_numa_node_number.argtypes = [amdsmi_processor_handle, ctypes.POI amdsmi_topo_get_link_weight = _libraries['libamd_smi.so'].amdsmi_topo_get_link_weight amdsmi_topo_get_link_weight.restype = amdsmi_status_t amdsmi_topo_get_link_weight.argtypes = [amdsmi_processor_handle, amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_get_minmax_bandwidth = _libraries['libamd_smi.so'].amdsmi_get_minmax_bandwidth -amdsmi_get_minmax_bandwidth.restype = amdsmi_status_t -amdsmi_get_minmax_bandwidth.argtypes = [amdsmi_processor_handle, amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64)] +admsmi_get_minmax_bandwith_between_processors = _libraries['libamd_smi.so'].admsmi_get_minmax_bandwith_between_processors +admsmi_get_minmax_bandwith_between_processors.restype = amdsmi_status_t +admsmi_get_minmax_bandwith_between_processors.argtypes = [amdsmi_processor_handle, amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64)] amdsmi_topo_get_link_type = _libraries['libamd_smi.so'].amdsmi_topo_get_link_type amdsmi_topo_get_link_type.restype = amdsmi_status_t amdsmi_topo_get_link_type.argtypes = [amdsmi_processor_handle, amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(c__EA_AMDSMI_IO_LINK_TYPE)] amdsmi_is_P2P_accessible = _libraries['libamd_smi.so'].amdsmi_is_P2P_accessible amdsmi_is_P2P_accessible.restype = amdsmi_status_t amdsmi_is_P2P_accessible.argtypes = [amdsmi_processor_handle, amdsmi_processor_handle, ctypes.POINTER(ctypes.c_bool)] -amdsmi_open_supported_func_iterator = _libraries['libamd_smi.so'].amdsmi_open_supported_func_iterator -amdsmi_open_supported_func_iterator.restype = amdsmi_status_t -amdsmi_open_supported_func_iterator.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.POINTER(struct_amdsmi_func_id_iter_handle))] -amdsmi_open_supported_variant_iterator = _libraries['libamd_smi.so'].amdsmi_open_supported_variant_iterator -amdsmi_open_supported_variant_iterator.restype = amdsmi_status_t -amdsmi_open_supported_variant_iterator.argtypes = [amdsmi_func_id_iter_handle_t, ctypes.POINTER(ctypes.POINTER(struct_amdsmi_func_id_iter_handle))] -amdsmi_next_func_iter = _libraries['libamd_smi.so'].amdsmi_next_func_iter -amdsmi_next_func_iter.restype = amdsmi_status_t -amdsmi_next_func_iter.argtypes = [amdsmi_func_id_iter_handle_t] -amdsmi_close_supported_func_iterator = _libraries['libamd_smi.so'].amdsmi_close_supported_func_iterator -amdsmi_close_supported_func_iterator.restype = amdsmi_status_t -amdsmi_close_supported_func_iterator.argtypes = [ctypes.POINTER(ctypes.POINTER(struct_amdsmi_func_id_iter_handle))] -amdsmi_get_func_iter_value = _libraries['libamd_smi.so'].amdsmi_get_func_iter_value -amdsmi_get_func_iter_value.restype = amdsmi_status_t -amdsmi_get_func_iter_value.argtypes = [amdsmi_func_id_iter_handle_t, ctypes.POINTER(union_c__UA_amdsmi_func_id_value_t)] amdsmi_init_gpu_event_notification = _libraries['libamd_smi.so'].amdsmi_init_gpu_event_notification amdsmi_init_gpu_event_notification.restype = amdsmi_status_t amdsmi_init_gpu_event_notification.argtypes = [amdsmi_processor_handle] @@ -1663,10 +1654,10 @@ amdsmi_get_gpu_process_list.restype = amdsmi_status_t amdsmi_get_gpu_process_list.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)] amdsmi_get_gpu_process_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_process_info amdsmi_get_gpu_process_info.restype = amdsmi_status_t -amdsmi_get_gpu_process_info.argtypes = [amdsmi_processor_handle, amdsmi_process_handle, ctypes.POINTER(struct_c__SA_amdsmi_proc_info_t)] -amdsmi_get_gpu_ecc_error_count = _libraries['libamd_smi.so'].amdsmi_get_gpu_ecc_error_count -amdsmi_get_gpu_ecc_error_count.restype = amdsmi_status_t -amdsmi_get_gpu_ecc_error_count.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_error_count_t)] +amdsmi_get_gpu_process_info.argtypes = [amdsmi_processor_handle, amdsmi_process_handle_t, ctypes.POINTER(struct_c__SA_amdsmi_proc_info_t)] +amdsmi_get_gpu_total_ecc_count = _libraries['libamd_smi.so'].amdsmi_get_gpu_total_ecc_count +amdsmi_get_gpu_total_ecc_count.restype = amdsmi_status_t +amdsmi_get_gpu_total_ecc_count.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_error_count_t)] __all__ = \ ['AMDSMI_CNTR_CMD_START', 'AMDSMI_CNTR_CMD_STOP', 'AMDSMI_COARSE_GRAIN_GFX_ACTIVITY', @@ -1705,7 +1696,7 @@ __all__ = \ 'AMDSMI_GPU_BLOCK_PCIE_BIF', 'AMDSMI_GPU_BLOCK_RESERVED', 'AMDSMI_GPU_BLOCK_SDMA', 'AMDSMI_GPU_BLOCK_SEM', 'AMDSMI_GPU_BLOCK_SMN', 'AMDSMI_GPU_BLOCK_UMC', - 'AMDSMI_GPU_BLOCK_XGMI_WAFL', 'AMDSMI_INIT_ALL_DEVICES', + 'AMDSMI_GPU_BLOCK_XGMI_WAFL', 'AMDSMI_INIT_ALL_PROCESSORS', 'AMDSMI_INIT_AMD_CPUS', 'AMDSMI_INIT_AMD_GPUS', 'AMDSMI_INIT_NON_AMD_CPUS', 'AMDSMI_INIT_NON_AMD_GPUS', 'AMDSMI_IOLINK_TYPE_NUMIOLINKTYPES', @@ -1745,15 +1736,13 @@ __all__ = \ 'AMDSMI_STATUS_REFCOUNT_OVERFLOW', 'AMDSMI_STATUS_RETRY', 'AMDSMI_STATUS_SUCCESS', 'AMDSMI_STATUS_TIMEOUT', 'AMDSMI_STATUS_UNEXPECTED_DATA', 'AMDSMI_STATUS_UNEXPECTED_SIZE', - 'AMDSMI_STATUS_UNKNOWN_ERROR', 'AMDSMI_SW_COMP_DRIVER', - 'AMDSMI_SW_COMP_FIRST', 'AMDSMI_SW_COMP_LAST', - 'AMDSMI_TEMP_CRITICAL', 'AMDSMI_TEMP_CRITICAL_HYST', - 'AMDSMI_TEMP_CRIT_MIN', 'AMDSMI_TEMP_CRIT_MIN_HYST', - 'AMDSMI_TEMP_CURRENT', 'AMDSMI_TEMP_EMERGENCY', - 'AMDSMI_TEMP_EMERGENCY_HYST', 'AMDSMI_TEMP_FIRST', - 'AMDSMI_TEMP_HIGHEST', 'AMDSMI_TEMP_LAST', 'AMDSMI_TEMP_LOWEST', - 'AMDSMI_TEMP_MAX', 'AMDSMI_TEMP_MAX_HYST', 'AMDSMI_TEMP_MIN', - 'AMDSMI_TEMP_MIN_HYST', 'AMDSMI_TEMP_OFFSET', + 'AMDSMI_STATUS_UNKNOWN_ERROR', 'AMDSMI_TEMP_CRITICAL', + 'AMDSMI_TEMP_CRITICAL_HYST', 'AMDSMI_TEMP_CRIT_MIN', + 'AMDSMI_TEMP_CRIT_MIN_HYST', 'AMDSMI_TEMP_CURRENT', + 'AMDSMI_TEMP_EMERGENCY', 'AMDSMI_TEMP_EMERGENCY_HYST', + 'AMDSMI_TEMP_FIRST', 'AMDSMI_TEMP_HIGHEST', 'AMDSMI_TEMP_LAST', + 'AMDSMI_TEMP_LOWEST', 'AMDSMI_TEMP_MAX', 'AMDSMI_TEMP_MAX_HYST', + 'AMDSMI_TEMP_MIN', 'AMDSMI_TEMP_MIN_HYST', 'AMDSMI_TEMP_OFFSET', 'AMDSMI_UTILIZATION_COUNTER_FIRST', 'AMDSMI_UTILIZATION_COUNTER_LAST', 'AMDSMI_UTILIZATION_COUNTER_TYPE', @@ -1772,17 +1761,29 @@ __all__ = \ 'CLK_TYPE_VCLK1', 'CLK_TYPE__MAX', 'CONTAINER_DOCKER', 'CONTAINER_LXC', 'FW_ID_ASD', 'FW_ID_CP_CE', 'FW_ID_CP_ME', 'FW_ID_CP_MEC1', 'FW_ID_CP_MEC2', 'FW_ID_CP_MEC_JT1', - 'FW_ID_CP_MEC_JT2', 'FW_ID_CP_PFP', 'FW_ID_CP_PM4', 'FW_ID_DFC', - 'FW_ID_DMCU', 'FW_ID_DMCU_ERAM', 'FW_ID_DMCU_ISR', - 'FW_ID_DRV_CAP', 'FW_ID_FIRST', 'FW_ID_ISP', 'FW_ID_MC', - 'FW_ID_MMSCH', 'FW_ID_PSP_BL', 'FW_ID_PSP_KEYDB', + 'FW_ID_CP_MEC_JT2', 'FW_ID_CP_MES', 'FW_ID_CP_PFP', + 'FW_ID_CP_PM4', 'FW_ID_DFC', 'FW_ID_DMCU', 'FW_ID_DMCU_ERAM', + 'FW_ID_DMCU_ISR', 'FW_ID_DRV_CAP', 'FW_ID_FIRST', + 'FW_ID_IMU_DRAM', 'FW_ID_IMU_IRAM', 'FW_ID_ISP', 'FW_ID_MC', + 'FW_ID_MES_STACK', 'FW_ID_MES_THREAD1', 'FW_ID_MES_THREAD1_STACK', + 'FW_ID_MMSCH', 'FW_ID_PPTABLE', 'FW_ID_PSP_BL', 'FW_ID_PSP_DBG', + 'FW_ID_PSP_INTF', 'FW_ID_PSP_KEYDB', 'FW_ID_PSP_SOC', 'FW_ID_PSP_SOSDRV', 'FW_ID_PSP_SPL', 'FW_ID_PSP_SYSDRV', - 'FW_ID_PSP_TOC', 'FW_ID_RLC', 'FW_ID_RLC_RESTORE_LIST_CNTL', + 'FW_ID_PSP_TOC', 'FW_ID_REG_ACCESS_WHITELIST', 'FW_ID_RLC', + 'FW_ID_RLCV_LX7', 'FW_ID_RLC_P', 'FW_ID_RLC_RESTORE_LIST_CNTL', 'FW_ID_RLC_RESTORE_LIST_GPM_MEM', - 'FW_ID_RLC_RESTORE_LIST_SRM_MEM', 'FW_ID_RLC_SRLG', - 'FW_ID_RLC_SRLS', 'FW_ID_RLC_V', 'FW_ID_SDMA0', 'FW_ID_SDMA1', + 'FW_ID_RLC_RESTORE_LIST_SRM_MEM', 'FW_ID_RLC_SAVE_RESTORE_LIST', + 'FW_ID_RLC_SRLG', 'FW_ID_RLC_SRLS', 'FW_ID_RLC_V', 'FW_ID_RLX6', + 'FW_ID_RLX6_CORE1', 'FW_ID_RLX6_DRAM_BOOT', + 'FW_ID_RLX6_DRAM_BOOT_CORE1', 'FW_ID_RS64_ME', 'FW_ID_RS64_MEC', + 'FW_ID_RS64_MEC_P0_DATA', 'FW_ID_RS64_MEC_P1_DATA', + 'FW_ID_RS64_MEC_P2_DATA', 'FW_ID_RS64_MEC_P3_DATA', + 'FW_ID_RS64_ME_P0_DATA', 'FW_ID_RS64_ME_P1_DATA', + 'FW_ID_RS64_PFP', 'FW_ID_RS64_PFP_P0_DATA', + 'FW_ID_RS64_PFP_P1_DATA', 'FW_ID_SDMA0', 'FW_ID_SDMA1', 'FW_ID_SDMA2', 'FW_ID_SDMA3', 'FW_ID_SDMA4', 'FW_ID_SDMA5', - 'FW_ID_SDMA6', 'FW_ID_SDMA7', 'FW_ID_SMC', 'FW_ID_SMU', + 'FW_ID_SDMA6', 'FW_ID_SDMA7', 'FW_ID_SDMA_TH0', 'FW_ID_SDMA_TH1', + 'FW_ID_SEC_POLICY_STAGE2', 'FW_ID_SMC', 'FW_ID_SMU', 'FW_ID_TA_RAS', 'FW_ID_UVD', 'FW_ID_VCE', 'FW_ID_VCN', 'FW_ID_XGMI', 'FW_ID__MAX', 'NON_AMD_CPU', 'NON_AMD_GPU', 'TEMPERATURE_TYPE_EDGE', 'TEMPERATURE_TYPE_FIRST', @@ -1790,12 +1791,12 @@ __all__ = \ 'TEMPERATURE_TYPE_HBM_2', 'TEMPERATURE_TYPE_HBM_3', 'TEMPERATURE_TYPE_JUNCTION', 'TEMPERATURE_TYPE_PLX', 'TEMPERATURE_TYPE_VRAM', 'TEMPERATURE_TYPE__MAX', 'UNKNOWN', + 'admsmi_get_gpu_bdf_id', + 'admsmi_get_minmax_bandwith_between_processors', 'amd_metrics_table_header_t', 'amdsmi_asic_info_t', 'amdsmi_bdf_t', 'amdsmi_bit_field_t', 'amdsmi_board_info_t', 'amdsmi_clk_info_t', 'amdsmi_clk_type_t', - 'amdsmi_clk_type_t__enumvalues', - 'amdsmi_close_supported_func_iterator', - 'amdsmi_container_types_t', + 'amdsmi_clk_type_t__enumvalues', 'amdsmi_container_types_t', 'amdsmi_container_types_t__enumvalues', 'amdsmi_counter_command_t', 'amdsmi_counter_command_t__enumvalues', 'amdsmi_counter_value_t', @@ -1809,11 +1810,9 @@ __all__ = \ 'amdsmi_evt_notification_type_t__enumvalues', 'amdsmi_freq_ind_t', 'amdsmi_freq_ind_t__enumvalues', 'amdsmi_freq_volt_region_t', 'amdsmi_frequencies_t', 'amdsmi_frequency_range_t', - 'amdsmi_func_id_iter_handle_t', 'amdsmi_func_id_value_t', 'amdsmi_fw_block_t', 'amdsmi_fw_block_t__enumvalues', - 'amdsmi_fw_info_t', 'amdsmi_get_busy_percent', - 'amdsmi_get_clk_freq', 'amdsmi_get_clock_info', - 'amdsmi_get_energy_count', 'amdsmi_get_func_iter_value', + 'amdsmi_fw_info_t', 'amdsmi_get_clk_freq', + 'amdsmi_get_clock_info', 'amdsmi_get_energy_count', 'amdsmi_get_fw_info', 'amdsmi_get_gpu_activity', 'amdsmi_get_gpu_asic_info', 'amdsmi_get_gpu_available_counters', 'amdsmi_get_gpu_bad_page_info', 'amdsmi_get_gpu_board_info', @@ -1821,19 +1820,16 @@ __all__ = \ 'amdsmi_get_gpu_compute_process_info', 'amdsmi_get_gpu_compute_process_info_by_pid', 'amdsmi_get_gpu_device_bdf', 'amdsmi_get_gpu_device_uuid', - 'amdsmi_get_gpu_driver_version', - 'amdsmi_get_gpu_drm_render_minor', 'amdsmi_get_gpu_ecc_count', - 'amdsmi_get_gpu_ecc_enabled', 'amdsmi_get_gpu_ecc_error_count', - 'amdsmi_get_gpu_ecc_status', 'amdsmi_get_gpu_event_notification', - 'amdsmi_get_gpu_fan_rpms', 'amdsmi_get_gpu_fan_speed', - 'amdsmi_get_gpu_fan_speed_max', 'amdsmi_get_gpu_id', - 'amdsmi_get_gpu_memory_busy_percent', - 'amdsmi_get_gpu_memory_reserved_pages', + 'amdsmi_get_gpu_driver_version', 'amdsmi_get_gpu_ecc_count', + 'amdsmi_get_gpu_ecc_enabled', 'amdsmi_get_gpu_ecc_status', + 'amdsmi_get_gpu_event_notification', 'amdsmi_get_gpu_fan_rpms', + 'amdsmi_get_gpu_fan_speed', 'amdsmi_get_gpu_fan_speed_max', + 'amdsmi_get_gpu_id', 'amdsmi_get_gpu_memory_reserved_pages', 'amdsmi_get_gpu_memory_total', 'amdsmi_get_gpu_memory_usage', 'amdsmi_get_gpu_metrics_info', 'amdsmi_get_gpu_od_volt_curve_regions', 'amdsmi_get_gpu_od_volt_info', 'amdsmi_get_gpu_overdrive_level', - 'amdsmi_get_gpu_pci_bandwidth', 'amdsmi_get_gpu_pci_id', + 'amdsmi_get_gpu_pci_bandwidth', 'amdsmi_get_gpu_pci_replay_counter', 'amdsmi_get_gpu_pci_throughput', 'amdsmi_get_gpu_perf_level', 'amdsmi_get_gpu_power_profile_presets', @@ -1841,16 +1837,16 @@ __all__ = \ 'amdsmi_get_gpu_ras_block_features_enabled', 'amdsmi_get_gpu_subsystem_id', 'amdsmi_get_gpu_subsystem_name', 'amdsmi_get_gpu_target_frequency_range', - 'amdsmi_get_gpu_topo_numa_affinity', 'amdsmi_get_gpu_vbios_info', + 'amdsmi_get_gpu_topo_numa_affinity', + 'amdsmi_get_gpu_total_ecc_count', 'amdsmi_get_gpu_vbios_info', 'amdsmi_get_gpu_vendor_name', 'amdsmi_get_gpu_volt_metric', 'amdsmi_get_gpu_vram_usage', 'amdsmi_get_gpu_vram_vendor', - 'amdsmi_get_minmax_bandwidth', 'amdsmi_get_pcie_link_caps', + 'amdsmi_get_lib_version', 'amdsmi_get_pcie_link_caps', 'amdsmi_get_pcie_link_status', 'amdsmi_get_power_cap_info', 'amdsmi_get_power_info', 'amdsmi_get_processor_handle_from_bdf', 'amdsmi_get_processor_handles', 'amdsmi_get_processor_type', 'amdsmi_get_socket_handles', 'amdsmi_get_socket_info', 'amdsmi_get_temp_metric', 'amdsmi_get_utilization_count', - 'amdsmi_get_version', 'amdsmi_get_version_str', 'amdsmi_get_xgmi_info', 'amdsmi_gpu_block_t', 'amdsmi_gpu_block_t__enumvalues', 'amdsmi_gpu_control_counter', 'amdsmi_gpu_counter_group_supported', 'amdsmi_gpu_create_counter', @@ -1862,17 +1858,14 @@ __all__ = \ 'amdsmi_memory_page_status_t', 'amdsmi_memory_page_status_t__enumvalues', 'amdsmi_memory_type_t', 'amdsmi_memory_type_t__enumvalues', 'amdsmi_mm_ip_t', - 'amdsmi_mm_ip_t__enumvalues', 'amdsmi_next_func_iter', - 'amdsmi_od_vddc_point_t', 'amdsmi_od_volt_curve_t', - 'amdsmi_od_volt_freq_data_t', - 'amdsmi_open_supported_func_iterator', - 'amdsmi_open_supported_variant_iterator', + 'amdsmi_mm_ip_t__enumvalues', 'amdsmi_od_vddc_point_t', + 'amdsmi_od_volt_curve_t', 'amdsmi_od_volt_freq_data_t', 'amdsmi_pcie_bandwidth_t', 'amdsmi_pcie_info_t', 'amdsmi_power_cap_info_t', 'amdsmi_power_info_t', 'amdsmi_power_profile_preset_masks_t', 'amdsmi_power_profile_preset_masks_t__enumvalues', 'amdsmi_power_profile_status_t', 'amdsmi_proc_info_t', - 'amdsmi_process_handle', 'amdsmi_process_info_t', + 'amdsmi_process_handle_t', 'amdsmi_process_info_t', 'amdsmi_processor_handle', 'amdsmi_range_t', 'amdsmi_ras_err_state_t', 'amdsmi_ras_err_state_t__enumvalues', 'amdsmi_reset_gpu', 'amdsmi_reset_gpu_fan', @@ -1881,16 +1874,13 @@ __all__ = \ 'amdsmi_set_gpu_event_notification_mask', 'amdsmi_set_gpu_fan_speed', 'amdsmi_set_gpu_od_clk_info', 'amdsmi_set_gpu_od_volt_info', 'amdsmi_set_gpu_overdrive_level', - 'amdsmi_set_gpu_overdrive_level_v1', 'amdsmi_set_gpu_pci_bandwidth', 'amdsmi_set_gpu_perf_determinism_mode', - 'amdsmi_set_gpu_perf_level', 'amdsmi_set_gpu_perf_level_v1', - 'amdsmi_set_gpu_power_profile', 'amdsmi_set_power_cap', - 'amdsmi_shut_down', 'amdsmi_socket_handle', - 'amdsmi_status_string', 'amdsmi_status_t', - 'amdsmi_status_t__enumvalues', - 'amdsmi_stop_gpu_event_notification', 'amdsmi_sw_component_t', - 'amdsmi_sw_component_t__enumvalues', + 'amdsmi_set_gpu_perf_level', 'amdsmi_set_gpu_power_profile', + 'amdsmi_set_power_cap', 'amdsmi_shut_down', + 'amdsmi_socket_handle', 'amdsmi_status_code_to_string', + 'amdsmi_status_t', 'amdsmi_status_t__enumvalues', + 'amdsmi_stop_gpu_event_notification', 'amdsmi_temperature_metric_t', 'amdsmi_temperature_metric_t__enumvalues', 'amdsmi_temperature_type_t', @@ -1913,13 +1903,11 @@ __all__ = \ 'c__EA_amdsmi_memory_type_t', 'c__EA_amdsmi_mm_ip_t', 'c__EA_amdsmi_power_profile_preset_masks_t', 'c__EA_amdsmi_ras_err_state_t', 'c__EA_amdsmi_status_t', - 'c__EA_amdsmi_sw_component_t', 'c__EA_amdsmi_temperature_metric_t', 'c__EA_amdsmi_temperature_type_t', 'c__EA_amdsmi_voltage_metric_t', 'c__EA_amdsmi_voltage_type_t', 'c__EA_amdsmi_xgmi_status_t', 'c__EA_processor_type_t', 'processor_type_t', 'processor_type_t__enumvalues', 'size_t', - 'struct_amdsmi_func_id_iter_handle', 'struct_c__SA_amd_metrics_table_header_t', 'struct_c__SA_amdsmi_asic_info_t', 'struct_c__SA_amdsmi_board_info_t', @@ -1953,6 +1941,4 @@ __all__ = \ 'struct_c__SA_amdsmi_version_t', 'struct_c__SA_amdsmi_vram_info_t', 'struct_c__SA_amdsmi_xgmi_info_t', 'struct_c__UA_amdsmi_bdf_t_0', - 'uint32_t', 'uint64_t', 'union_c__UA_amdsmi_bdf_t', - 'union_c__UA_amdsmi_func_id_value_t', - 'union_c__UA_amdsmi_func_id_value_t_0'] + 'uint32_t', 'uint64_t', 'union_c__UA_amdsmi_bdf_t'] diff --git a/src/amd_smi/amd_smi.cc b/src/amd_smi/amd_smi.cc index 282913d300..46b39ba5ff 100644 --- a/src/amd_smi/amd_smi.cc +++ b/src/amd_smi/amd_smi.cc @@ -196,7 +196,7 @@ amdsmi_status_t amdsmi_get_socket_handles(uint32_t *socket_count, amdsmi_status_t amdsmi_get_socket_info( amdsmi_socket_handle socket_handle, - char *name, size_t len) { + size_t len, char *name) { AMDSMI_CHECK_INIT(); if (socket_handle == nullptr || name == nullptr) { @@ -1330,7 +1330,7 @@ amdsmi_get_gpu_total_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_ } amdsmi_status_t -amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, amdsmi_process_handle *list, uint32_t *max_processes) { +amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, uint32_t *max_processes, amdsmi_process_handle_t *list) { AMDSMI_CHECK_INIT(); if (max_processes == nullptr) { @@ -1378,7 +1378,7 @@ amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, amdsmi_pro } amdsmi_status_t -amdsmi_get_gpu_process_info(amdsmi_processor_handle processor_handle, amdsmi_process_handle process, amdsmi_proc_info_t *info) { +amdsmi_get_gpu_process_info(amdsmi_processor_handle processor_handle, amdsmi_process_handle_t process, amdsmi_proc_info_t *info) { AMDSMI_CHECK_INIT(); if (info == nullptr) { diff --git a/src/amd_smi/amd_smi_system.cc b/src/amd_smi/amd_smi_system.cc index a872674acf..2347ef2c63 100644 --- a/src/amd_smi/amd_smi_system.cc +++ b/src/amd_smi/amd_smi_system.cc @@ -138,7 +138,7 @@ amdsmi_status_t AMDSmiSystem::cleanup() { } processors_.clear(); sockets_.clear(); - init_flag_ = AMDSMI_INIT_ALL_DEVICES; + init_flag_ = AMDSMI_INIT_ALL_PROCESSORS; rsmi_status_t ret = rsmi_shut_down(); if (ret != RSMI_STATUS_SUCCESS) { return amd::smi::rsmi_to_amdsmi_status(ret);