diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index 35e1bcde23..8fc3d6e7d8 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -524,13 +524,13 @@ class AMDSMICommands(): if 'partition' in current_platform_args: if args.partition: try: - compute_partition = amdsmi_interface.amdsmi_dev_compute_partition_get(args.gpu) + compute_partition = amdsmi_interface.amdsmi_get_gpu_compute_partition(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: compute_partition = "N/A" logging.debug("Failed to get compute partition info for gpu %s | %s", gpu_id, e.get_error_info()) try: - memory_partition = amdsmi_interface.amdsmi_dev_memory_partition_get(args.gpu) + memory_partition = amdsmi_interface.amdsmi_get_gpu_memory_partition(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: memory_partition = "N/A" logging.debug("Failed to get memory partition info for gpu %s | %s", gpu_id, e.get_error_info()) @@ -1943,7 +1943,7 @@ class AMDSMICommands(): if args.compute_partition: compute_partition = amdsmi_interface.AmdSmiComputePartitionType[args.compute_partition] try: - amdsmi_interface.amdsmi_dev_compute_partition_set(args.gpu, compute_partition) + amdsmi_interface.amdsmi_set_gpu_compute_partition(args.gpu, compute_partition) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1952,7 +1952,7 @@ class AMDSMICommands(): if args.memory_partition: memory_partition = amdsmi_interface.AmdSmiMemoryPartitionType[args.memory_partition] try: - amdsmi_interface.amdsmi_dev_memory_partition_set(args.gpu, memory_partition) + amdsmi_interface.amdsmi_set_gpu_memory_partition(args.gpu, memory_partition) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -2165,7 +2165,7 @@ class AMDSMICommands(): self.logger.store_output(args.gpu, 'reset_perf_determinism', result) if args.compute_partition: try: - amdsmi_interface.amdsmi_dev_compute_partition_reset(args.gpu) + amdsmi_interface.amdsmi_reset_gpu_compute_partition(args.gpu) result = 'Successfully reset compute partition' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM: @@ -2175,7 +2175,7 @@ class AMDSMICommands(): self.logger.store_output(args.gpu, 'reset_compute_partition', result) if args.memory_partition: try: - amdsmi_interface.amdsmi_dev_memory_partition_reset(args.gpu) + amdsmi_interface.amdsmi_reset_gpu_memory_partition(args.gpu) result = 'Successfully reset memory partition' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM: diff --git a/include/amd_smi/amdsmi.h b/include/amd_smi/amdsmi.h index 1aaf34d729..fb27f80da2 100644 --- a/include/amd_smi/amdsmi.h +++ b/include/amd_smi/amdsmi.h @@ -196,6 +196,9 @@ typedef enum { AMDSMI_NO_DRV = 51, //!< No Energy and HSMP driver present AMDSMI_FILE_NOT_FOUND = 52, //!< file or directory not found AMDSMI_ARG_PTR_NULL = 53, //!< Parsed argument is invalid + AMDSMI_STATUS_AMDGPU_RESTART_ERR = 54, //!< AMDGPU restart failed + AMDSMI_STATUS_SETTING_UNAVAILABLE = 55, //!< Setting is not available + // General errors AMDSMI_STATUS_MAP_ERROR = 0xFFFFFFFE, //!< The internal library error did not map to a status code AMDSMI_STATUS_UNKNOWN_ERROR = 0xFFFFFFFF, //!< An unknown error occurred @@ -1123,94 +1126,185 @@ typedef struct { */ typedef struct { // TODO(amd) Doxygen documents - /// @cond Ignore in docs. + // Note: This should match: AMDGpuMetricsHeader_v1_t + /// \cond Ignore in docs. uint16_t structure_size; uint8_t format_revision; uint8_t content_revision; - /// @endcond + /// \endcond } amd_metrics_table_header_t; /** * @brief The following structure holds the gpu metrics values for a device. */ -// Below is the assumed version of gpu_metric data on the device. If the device -// is using this version, we can read data directly into amdsmi_gpu_metrics_t. -// If the device is using an older format, a conversion of formats will be -// required. -// DGPU targets have a format version of 1. APU targets have a format version of -// 2. Currently, only version 1 (DGPU) gpu_metrics is supported. -#define AMDSMI_GPU_METRICS_API_FORMAT_VER 1 -// The content version increments when gpu_metrics is extended with new and/or -// existing field sizes are changed. -#define AMDSMI_GPU_METRICS_API_CONTENT_VER_1 1 -#define AMDSMI_GPU_METRICS_API_CONTENT_VER_2 2 -#define AMDSMI_GPU_METRICS_API_CONTENT_VER_3 3 -// This should match NUM_HBM_INSTANCES -#define AMDSMI_NUM_HBM_INSTANCES 4 - -// Unit conversion factor for HBM temperatures +/** + * @brief Unit conversion factor for HBM temperatures + */ #define CENTRIGRADE_TO_MILLI_CENTIGRADE 1000 +/** + * @brief This should match NUM_HBM_INSTANCES + */ +#define AMDSMI_NUM_HBM_INSTANCES 4 + +/** + * @brief This should match MAX_NUM_VCN + */ +#define AMDSMI_MAX_NUM_VCN 4 + +/** + * @brief This should match MAX_NUM_CLKS + */ +#define AMDSMI_MAX_NUM_CLKS 4 + +/** + * @brief This should match MAX_NUM_XGMI_LINKS + */ +#define AMDSMI_MAX_NUM_XGMI_LINKS 8 + +/** + * @brief This should match MAX_NUM_GFX_CLKS + */ +#define AMDSMI_MAX_NUM_GFX_CLKS 8 + + typedef struct { -// TODO(amd) Doxygen documents - /// @cond Ignore in docs. + // TODO(amd) Doxygen documents + // Note: This structure is extended to fit the needs of different GPU metric + // versions when exposing data through the structure. + // Depending on the version, some data members will hold data, and + // some will not. A good example is the set of 'current clocks': + // - current_gfxclk, current_socclk, current_vclk0, current_dclk0 + // These are single-valued data members, up to version 1.3. + // For version 1.4 and up these are multi-valued data members (arrays) + // and their counterparts; + // - current_gfxclks[], current_socclks[], current_vclk0s[], + // current_dclk0s[] + // will hold the data + /// \cond Ignore in docs. amd_metrics_table_header_t common_header; -/* Temperature */ - uint16_t temperature_edge; - uint16_t temperature_hotspot; - uint16_t temperature_mem; - uint16_t temperature_vrgfx; - uint16_t temperature_vrsoc; - uint16_t temperature_vrmem; + /* + * v1.0 Base + */ + // Temperature + uint16_t temperature_edge; + uint16_t temperature_hotspot; + uint16_t temperature_mem; + uint16_t temperature_vrgfx; + uint16_t temperature_vrsoc; + uint16_t temperature_vrmem; -/* Utilization */ - uint16_t average_gfx_activity; - uint16_t average_umc_activity; // memory controller - uint16_t average_mm_activity; // UVD or VCN + // Utilization + uint16_t average_gfx_activity; + uint16_t average_umc_activity; // memory controller + uint16_t average_mm_activity; // UVD or VCN -/* Power/Energy */ - uint16_t average_socket_power; - uint64_t energy_accumulator; // v1 mod. (32->64) + // Power/Energy + uint16_t average_socket_power; + uint64_t energy_accumulator; // v1 mod. (32->64) -/* Driver attached timestamp (in ns) */ - uint64_t system_clock_counter; // v1 mod. (moved from top of struct) + // Driver attached timestamp (in ns) + uint64_t system_clock_counter; // v1 mod. (moved from top of struct) -/* Average clocks */ - uint16_t average_gfxclk_frequency; - uint16_t average_socclk_frequency; - uint16_t average_uclk_frequency; - uint16_t average_vclk0_frequency; - uint16_t average_dclk0_frequency; - uint16_t average_vclk1_frequency; - uint16_t average_dclk1_frequency; + // Average clocks + uint16_t average_gfxclk_frequency; + uint16_t average_socclk_frequency; + uint16_t average_uclk_frequency; + uint16_t average_vclk0_frequency; + uint16_t average_dclk0_frequency; + uint16_t average_vclk1_frequency; + uint16_t average_dclk1_frequency; -/* Current clocks */ - uint16_t current_gfxclk; - uint16_t current_socclk; - uint16_t current_uclk; - uint16_t current_vclk0; - uint16_t current_dclk0; - uint16_t current_vclk1; - uint16_t current_dclk1; + // Current clocks + uint16_t current_gfxclk; + uint16_t current_socclk; + uint16_t current_uclk; + uint16_t current_vclk0; + uint16_t current_dclk0; + uint16_t current_vclk1; + uint16_t current_dclk1; -/* Throttle status */ - uint32_t throttle_status; + // Throttle status + uint32_t throttle_status; -/* Fans */ - uint16_t current_fan_speed; + // Fans + uint16_t current_fan_speed; -/* Link width/speed */ - uint16_t pcie_link_width; // v1 mod.(8->16) - uint16_t pcie_link_speed; // in 0.1 GT/s; v1 mod. (8->16) + // Link width/speed + uint16_t pcie_link_width; // v1 mod.(8->16) + uint16_t pcie_link_speed; // in 0.1 GT/s; v1 mod. (8->16) - uint16_t padding; // new in v1 - uint32_t gfx_activity_acc; // new in v1 - uint32_t mem_activity_acc; // new in v1 - uint16_t temperature_hbm[AMDSMI_NUM_HBM_INSTANCES]; // new in v1 - /// @endcond + /* + * v1.1 additions + */ + uint32_t gfx_activity_acc; // new in v1 + uint32_t mem_activity_acc; // new in v1 + uint16_t temperature_hbm[AMDSMI_NUM_HBM_INSTANCES]; // new in v1 + + + /* + * v1.2 additions + */ + // PMFW attached timestamp (10ns resolution) + uint64_t firmware_timestamp; + + + /* + * v1.3 additions + */ + // Voltage (mV) + uint16_t voltage_soc; + uint16_t voltage_gfx; + uint16_t voltage_mem; + + // Throttle status + uint64_t indep_throttle_status; + + + /* + * v1.4 additions + */ + // Power (Watts) + uint16_t current_socket_power; + + // Utilization (%) + uint16_t vcn_activity[AMDSMI_MAX_NUM_VCN]; // VCN instances activity percent (encode/decode) + + // Clock Lock Status. Each bit corresponds to clock instance + uint32_t gfxclk_lock_status; + + // XGMI bus width and bitrate (in Gbps) + uint16_t xgmi_link_width; + uint16_t xgmi_link_speed; + + // PCIE accumulated bandwidth (GB/sec) + uint64_t pcie_bandwidth_acc; + + // PCIE instantaneous bandwidth (GB/sec) + uint64_t pcie_bandwidth_inst; + + // PCIE L0 to recovery state transition accumulated count + uint64_t pcie_l0_to_recov_count_acc; + + // PCIE replay accumulated count + uint64_t pcie_replay_count_acc; + + // PCIE replay rollover accumulated count + uint64_t pcie_replay_rover_count_acc; + + // XGMI accumulated data transfer size(KiloBytes) + uint64_t xgmi_read_data_acc[AMDSMI_MAX_NUM_XGMI_LINKS]; + uint64_t xgmi_write_data_acc[AMDSMI_MAX_NUM_XGMI_LINKS]; + + // Current clock frequencies + uint16_t current_gfxclks[AMDSMI_MAX_NUM_GFX_CLKS]; + uint16_t current_socclks[AMDSMI_MAX_NUM_CLKS]; + uint16_t current_vclk0s[AMDSMI_MAX_NUM_CLKS]; + uint16_t current_dclk0s[AMDSMI_MAX_NUM_CLKS]; + /// \endcond } amdsmi_gpu_metrics_t; @@ -3557,13 +3651,13 @@ amdsmi_is_P2P_accessible(amdsmi_processor_handle processor_handle_src, * @brief Retrieves the current compute partitioning for a desired device * * @details - * Given a device index @p dv_ind and a string @p compute_partition , + * Given a processor handle @p processor_handle and a string @p compute_partition , * and uint32 @p len , this function will attempt to obtain the device's * current compute partition setting string. Upon successful retreival, * the obtained device's compute partition settings string shall be stored in * the passed @p compute_partition char string variable. * - * @param[in] dv_ind a device index + * @param[in] processor_handle Device which to query * * @param[inout] compute_partition a pointer to a char string variable, * which the device's current compute partition will be written to. @@ -3582,17 +3676,17 @@ amdsmi_is_P2P_accessible(amdsmi_processor_handle processor_handle_src, * */ amdsmi_status_t -amdsmi_dev_compute_partition_get(amdsmi_processor_handle processor_handle, +amdsmi_get_gpu_compute_partition(amdsmi_processor_handle processor_handle, char *compute_partition, uint32_t len); /** * @brief Modifies a selected device's compute partition setting. * - * @details Given a device index @p dv_ind, a type of compute partition + * @details Given a processor handle @p processor_handle, a type of compute partition * @p compute_partition, this function will attempt to update the selected * device's compute partition setting. * - * @param[in] dv_ind a device index + * @param[in] processor_handle Device which to query * * @param[in] compute_partition using enum ::amdsmi_compute_partition_type_t, * define what the selected device's compute partition setting should be @@ -3608,17 +3702,17 @@ amdsmi_dev_compute_partition_get(amdsmi_processor_handle processor_handle, * */ amdsmi_status_t -amdsmi_dev_compute_partition_set(amdsmi_processor_handle processor_handle, +amdsmi_set_gpu_compute_partition(amdsmi_processor_handle processor_handle, amdsmi_compute_partition_type_t compute_partition); /** * @brief Reverts a selected device's compute partition setting back to its * boot state. * - * @details Given a device index @p dv_ind , this function will attempt to + * @details Given a processor handle @p processor_handle, this function will attempt to * revert its compute partition setting back to its boot state. * - * @param[in] dv_ind a device index + * @param[in] processor_handle Device which to query * * @retval ::AMDSMI_STATUS_SUCCESS call was successful * @retval ::AMDSMI_STATUS_PERMISSION function requires root access @@ -3626,7 +3720,7 @@ amdsmi_dev_compute_partition_set(amdsmi_processor_handle processor_handle, * support this function * */ -amdsmi_status_t amdsmi_dev_compute_partition_reset(amdsmi_processor_handle processor_handle); +amdsmi_status_t amdsmi_reset_gpu_compute_partition(amdsmi_processor_handle processor_handle); /** @} */ // end of compute_partition @@ -3641,13 +3735,13 @@ amdsmi_status_t amdsmi_dev_compute_partition_reset(amdsmi_processor_handle proce * @brief Retrieves the current memory partition for a desired device * * @details - * Given a device index @p dv_ind and a string @p memory_partition , + * Given a processor handle @p processor_handle and a string @p memory_partition , * and uint32 @p len , this function will attempt to obtain the device's * memory partition string. Upon successful retreival, the obtained device's * memory partition string shall be stored in the passed @p memory_partition * char string variable. * - * @param[in] dv_ind a device index + * @param[in] processor_handle Device which to query * * @param[inout] memory_partition a pointer to a char string variable, * which the device's memory partition will be written to. @@ -3666,17 +3760,17 @@ amdsmi_status_t amdsmi_dev_compute_partition_reset(amdsmi_processor_handle proce * */ amdsmi_status_t -amdsmi_dev_memory_partition_get(amdsmi_processor_handle processor_handle, +amdsmi_get_gpu_memory_partition(amdsmi_processor_handle processor_handle, char *memory_partition, uint32_t len); /** * @brief Modifies a selected device's current memory partition setting. * - * @details Given a device index @p dv_ind and a type of memory partition + * @details Given a processor handle @p processor_handle and a type of memory partition * @p memory_partition, this function will attempt to update the selected * device's memory partition setting. * - * @param[in] dv_ind a device index + * @param[in] processor_handle Device which to query * * @param[in] memory_partition using enum ::amdsmi_memory_partition_type_t, * define what the selected device's current mode setting should be updated to. @@ -3691,17 +3785,17 @@ amdsmi_dev_memory_partition_get(amdsmi_processor_handle processor_handle, * */ amdsmi_status_t -amdsmi_dev_memory_partition_set(amdsmi_processor_handle processor_handle, +amdsmi_set_gpu_memory_partition(amdsmi_processor_handle processor_handle, amdsmi_memory_partition_type_t memory_partition); /** * @brief Reverts a selected device's memory partition setting back to its * boot state. * - * @details Given a device index @p dv_ind , this function will attempt to + * @details Given a processor handle @p processor_handle, this function will attempt to * revert its current memory partition setting back to its boot state. * - * @param[in] dv_ind a device index + * @param[in] processor_handle Device which to query * * @retval ::AMDSMI_STATUS_SUCCESS call was successful * @retval ::AMDSMI_STATUS_PERMISSION function requires root access @@ -3711,7 +3805,7 @@ amdsmi_dev_memory_partition_set(amdsmi_processor_handle processor_handle, * the amdgpu driver * */ -amdsmi_status_t amdsmi_dev_memory_partition_reset(amdsmi_processor_handle processor_handle); +amdsmi_status_t amdsmi_reset_gpu_memory_partition(amdsmi_processor_handle processor_handle); /** @} */ // end of memory_partition @@ -4144,6 +4238,1057 @@ amdsmi_get_gpu_total_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_ /** @} End eccinfo */ + +/*****************************************************************************/ +/** @defgroup metricfunctions GPU Metric Functions + * These functions are used to get granular information about all counters + * available in GPU Metrics. + * @{ + */ + +/** + * Metric multi-valued counter types + */ +typedef uint16_t gpu_metric_temp_hbm_t[AMDSMI_NUM_HBM_INSTANCES]; +typedef uint16_t gpu_metric_vcn_activity_t[AMDSMI_MAX_NUM_VCN]; +typedef uint64_t gpu_metric_xgmi_read_data_acc_t[AMDSMI_MAX_NUM_XGMI_LINKS]; +typedef uint64_t gpu_metric_xgmi_write_data_acc_t[AMDSMI_MAX_NUM_XGMI_LINKS]; +typedef uint16_t gpu_metric_curr_gfxclk_t[AMDSMI_MAX_NUM_GFX_CLKS]; +typedef uint16_t gpu_metric_curr_socclk_t[AMDSMI_MAX_NUM_CLKS]; +typedef uint16_t gpu_metric_curr_vclk0_t[AMDSMI_MAX_NUM_CLKS]; +typedef uint16_t gpu_metric_curr_dclk0_t[AMDSMI_MAX_NUM_CLKS]; + + +/****** + * Metric single-valued counter types + */ + +/** + * @brief Get the 'temp_hotspot' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'temp_hotspot' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] hotspot_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_hotspot(amdsmi_processor_handle processor_handle, uint16_t* hotspot_value); + +/** + * @brief Get the 'temp_mem' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'temp_mem' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] mem_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_mem(amdsmi_processor_handle processor_handle, uint16_t* mem_value); + +/** + * @brief Get the 'temp_vrsoc' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'temp_vrsoc' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] vrsoc_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_vrsoc(amdsmi_processor_handle processor_handle, uint16_t* vrsoc_value); + +/** + * @brief Get the 'curr_socket_power' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'socket_power' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] socket_power_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_socket_power(amdsmi_processor_handle processor_handle, uint16_t* socket_power_value); + +/** + * @brief Get the 'avg_gfx_activity' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'gfx_activity' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] gfx_activity_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_gfx_activity(amdsmi_processor_handle processor_handle, uint16_t* gfx_activity_value); + +/** + * @brief Get the 'avg_umc_activity' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'umc_activity' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] umc_activity_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_umc_activity(amdsmi_processor_handle processor_handle, uint16_t* umc_activity_value); + +/** + * @brief Get the 'energy_acc' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'energy_acc' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] energy_acc_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_energy_acc(amdsmi_processor_handle processor_handle, uint64_t* energy_acc_value); + +/** + * @brief Get the 'system_clock_counter' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'system_clock_counter' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] system_clock_counter_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_system_clock_counter(amdsmi_processor_handle processor_handle, uint64_t* system_clock_counter_value); + +/** + * @brief Get the 'firmware_timestamp' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'firmware_timestamp' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] firmware_timestamp_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_firmware_timestamp(amdsmi_processor_handle processor_handle, uint64_t* firmware_timestamp_value); + +/** + * @brief Get the 'throttle_status' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t in which + * the 'throttle_status' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] throttle_status_value a pointer to uint32_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_throttle_status(amdsmi_processor_handle processor_handle, uint32_t* throttle_status_value); + +/** + * @brief Get the 'pcie_link_width' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'pcie_link_width' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] pcie_link_width_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_link_width(amdsmi_processor_handle processor_handle, uint16_t* pcie_link_width_value); + +/** + * @brief Get the 'pcie_link_speed' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'pcie_link_speed' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] pcie_link_speed_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_link_speed(amdsmi_processor_handle processor_handle, uint16_t* pcie_link_speed_value); + +/** + * @brief Get the 'xgmi_link_width' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'xgmi_link_width' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] xgmi_link_width_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_link_width(amdsmi_processor_handle processor_handle, uint16_t* xgmi_link_width_value); + +/** + * @brief Get the 'xgmi_link_speed' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'xgmi_link_speed' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] xgmi_link_speed_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_link_speed(amdsmi_processor_handle processor_handle, uint16_t* xgmi_link_speed_value); + +/** + * @brief Get the 'gfxclk_lock_status' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t in which + * the 'gfxclk_lock_status' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] gfxclk_lock_status_value a pointer to uint32_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_gfxclk_lock_status(amdsmi_processor_handle processor_handle, uint32_t* gfxclk_lock_status_value); + +/** + * @brief Get the 'gfx_activity_acc' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t in which + * the 'gfx_activity_acc' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] gfx_activity_acc_value a pointer to uint32_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_gfx_activity_acc(amdsmi_processor_handle processor_handle, uint32_t* gfx_activity_acc_value); + +/** + * @brief Get the 'mem_activity_acc' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t in which + * the 'mem_activity_acc' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] mem_activity_acc_value a pointer to uint32_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_mem_activity_acc(amdsmi_processor_handle processor_handle, uint32_t* mem_activity_acc_value); + +/** + * @brief Get the 'pcie_bandwidth_acc' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'pcie_bandwidth_acc' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] pcie_bandwidth_acc_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_bandwidth_acc(amdsmi_processor_handle processor_handle, uint64_t* pcie_bandwidth_acc_value); + +/** + * @brief Get the 'pcie_bandwidth_inst' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'pcie_bandwidth_inst' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] pcie_bandwidth_inst_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_bandwidth_inst(amdsmi_processor_handle processor_handle, uint64_t* pcie_bandwidth_inst_value); + +/** + * @brief Get the 'pcie_l0_recov_count_acc' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'pcie_l0_recov_count_acc' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] pcie_count_acc_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc(amdsmi_processor_handle processor_handle, uint64_t* pcie_count_acc_value); + +/** + * @brief Get the 'pcie_replay_count_acc' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'pcie_replay_count_acc' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] pcie_count_acc_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_replay_count_acc(amdsmi_processor_handle processor_handle, uint64_t* pcie_count_acc_value); + +/** + * @brief Get the 'pcie_replay_rover_count_acc' (Rollover count) from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'pcie_replay_rover_count_acc' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] pcie_count_acc_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc(amdsmi_processor_handle processor_handle, uint64_t* pcie_count_acc_value); + +/** + * @brief Get the 'curr_uclk' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'curr_uclk' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] uclk_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_uclk(amdsmi_processor_handle processor_handle, uint16_t* uclk_value); + + +/****** + * Metric multi-valued counter types + */ + +/** + * @brief Get the 'temp_hbm' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'temp_hbm' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] temp_hbm_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * - This is a multi-valued counter holding a 4 (AMDSMI_NUM_HBM_INSTANCES) + * element array (gpu_metric_temp_hbm_t) + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_hbm(amdsmi_processor_handle processor_handle, gpu_metric_temp_hbm_t* temp_hbm_value); + +/** + * @brief Get the 'vcn_activity' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'vcn_activity' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] vcn_activity_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * - This is a multi-valued counter holding a 4 (AMDSMI_MAX_NUM_VCN) + * element array (gpu_metric_vcn_activity_t) + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_vcn_activity(amdsmi_processor_handle processor_handle, gpu_metric_vcn_activity_t* vcn_activity_value); + +/** + * @brief Get the 'xgmi_read_data' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'xgmi_read_data' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] xgmi_read_data_acc_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * - This is a multi-valued counter holding an 8 (AMDSMI_MAX_NUM_XGMI_LINKS) + * element array (gpu_metric_xgmi_read_data_acc_t) + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_read_data(amdsmi_processor_handle processor_handle, gpu_metric_xgmi_read_data_acc_t* xgmi_read_data_acc_value); + +/** + * @brief Get the 'xgmi_write_data' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'xgmi_write_data' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] xgmi_write_data_acc_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * - This is a multi-valued counter holding an 8 (AMDSMI_MAX_NUM_XGMI_LINKS) + * element array (gpu_metric_xgmi_write_data_acc_t) + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_write_data(amdsmi_processor_handle processor_handle, gpu_metric_xgmi_write_data_acc_t* xgmi_write_data_acc_value); + +/** + * @brief Get the 'curr_gfxclk' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'curr_gfxclk' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] current_gfxclk_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * - This is a multi-valued counter holding an 8 (AMDSMI_MAX_NUM_GFX_CLKS) + * element array (gpu_metric_curr_gfxclk_t) + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_gfxclk(amdsmi_processor_handle processor_handle, gpu_metric_curr_gfxclk_t* current_gfxclk_value); + +/** + * @brief Get the 'curr_socclk' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'curr_socclk' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] current_socclk_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * - This is a multi-valued counter holding a 4 (AMDSMI_MAX_NUM_CLKS) + * element array (gpu_metric_curr_socclk_t) + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_socclk(amdsmi_processor_handle processor_handle, gpu_metric_curr_socclk_t* current_socclk_value); + +/** + * @brief Get the 'curr_vclk0' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'curr_vclk0' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] current_vclk_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * - This is a multi-valued counter holding a 4 (AMDSMI_MAX_NUM_CLKS) + * element array (gpu_metric_curr_vclk0_t) + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_vclk0(amdsmi_processor_handle processor_handle, gpu_metric_curr_vclk0_t* current_vclk_value); + +/** + * @brief Get the 'curr_dclk0' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'curr_dclk0' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] current_dclk_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * - This is a multi-valued counter holding a 4 (AMDSMI_MAX_NUM_CLKS) + * element array (gpu_metric_curr_dclk0_t) + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_dclk0(amdsmi_processor_handle processor_handle, gpu_metric_curr_dclk0_t* current_dclk_value); + +/** + * @brief Get the 'temp_edge' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'temp_edge' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] edge_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_edge(amdsmi_processor_handle processor_handle, uint16_t* edge_value); + +/** + * @brief Get the 'temp_vrgfx' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'temp_vrgfx' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] vrgfx_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_vrgfx(amdsmi_processor_handle processor_handle, uint16_t* vrgfx_value); + +/** + * @brief Get the 'temp_vrmem' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'temp_vrmem' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] vrmem_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_vrmem(amdsmi_processor_handle processor_handle, uint16_t* vrmem_value); + +/** + * @brief Get the 'avg_mm_activity' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'avg_mm_activity' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] mm_activity_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_mm_activity(amdsmi_processor_handle processor_handle, uint16_t* mm_activity_value); + +/** + * @brief Get the 'curr_vclk1' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'curr_vclk1' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] current_vclk_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_vclk1(amdsmi_processor_handle processor_handle, uint16_t* current_vclk_value); + +/** + * @brief Get the 'curr_dclk1' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'curr_dclk1' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] current_dclk_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_dclk1(amdsmi_processor_handle processor_handle, uint16_t* current_dclk_value); + +/** + * @brief Get the 'indep_throttle_status' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t in which + * the 'indep_throttle_status' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] throttle_status_value a pointer to uint64_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_indep_throttle_status(amdsmi_processor_handle processor_handle, uint64_t* throttle_status_value); + +/** + * @brief Get the 'avg_socket_power' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'avg_socket_power' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] socket_power_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_socket_power(amdsmi_processor_handle processor_handle, uint16_t* socket_power_value); + +/** + * @brief Get the 'curr_fan_speed' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'curr_fan_speed' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] fan_speed_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_fan_speed(amdsmi_processor_handle processor_handle, uint16_t* fan_speed_value); + +/** + * @brief Get the 'avg_gfx_clock_frequency' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'avg_gfx_clock_frequency' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_gfx_clock_frequency(amdsmi_processor_handle processor_handle, uint16_t* clock_frequency_value); + +/** + * @brief Get the 'avg_soc_clock_frequency' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'avg_soc_clock_frequency' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_soc_clock_frequency(amdsmi_processor_handle processor_handle, uint16_t* clock_frequency_value); + +/** + * @brief Get the 'avg_uclock_frequency' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'avg_uclock_frequency' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_uclock_frequency(amdsmi_processor_handle processor_handle, uint16_t* clock_frequency_value); + +/** + * @brief Get the 'avg_vclock0_frequency' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'avg_vclock0_frequency' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_vclock0_frequency(amdsmi_processor_handle processor_handle, uint16_t* clock_frequency_value); + +/** + * @brief Get the 'avg_dclock0_frequency' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'avg_dclock0_frequency' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_dclock0_frequency(amdsmi_processor_handle processor_handle, uint16_t* clock_frequency_value); + +/** + * @brief Get the 'avg_vclock1_frequency' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'avg_vclock1_frequency' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_vclock1_frequency(amdsmi_processor_handle processor_handle, uint16_t* clock_frequency_value); + +/** + * @brief Get the 'avg_dclock1_frequency' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'avg_dclock1_frequency' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_dclock1_frequency(amdsmi_processor_handle processor_handle, uint16_t* clock_frequency_value); + +/** + * @brief Get the 'volt_soc' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'volt_soc' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] voltage_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_volt_soc(amdsmi_processor_handle processor_handle, uint16_t* voltage_value); + +/** + * @brief Get the 'volt_gfx' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'volt_gfx' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] voltage_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_volt_gfx(amdsmi_processor_handle processor_handle, uint16_t* voltage_value); + +/** + * @brief Get the 'volt_mem' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'volt_mem' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] voltage_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_volt_mem(amdsmi_processor_handle processor_handle, uint16_t* voltage_value); + +/** + * @brief Get the 'metrics_header_info' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a amd_metrics_table_header_t in which + * the 'metrics_header_info' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] header_value a pointer to amd_metrics_table_header_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_header_info(amdsmi_processor_handle processor_handle, amd_metrics_table_header_t* header_value); + +/** + * @brief Get the 'xcd_counter' from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle and a pointer to a uint16_t in which + * the 'xcd_counter' will stored + * + * @param[in] processor_handle Device which to query + * + * @param[inout] xcd_counter_value a pointer to uint16_t to which the device gpu + * metric unit will be stored + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit + * does not exist for the given device + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_xcd_counter(amdsmi_processor_handle processor_handle, uint16_t* xcd_counter_value); + +/** + * @brief Get the log from the GPU metrics associated with the device + * + * @details Given a processor handle @p processor_handle it will log all the gpu metric info + * related to the device. The 'logging' feature must be on. + * + * @param[in] processor_handle Device which to query + * + * @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call. + * + */ +amdsmi_status_t +amdsmi_get_gpu_metrics_log(amdsmi_processor_handle processor_handle); + +/** @} End metricfunctions */ + + #ifdef ENABLE_ESMI_LIB /*---------------------------------------------------------------------------*/ /** @defgroup energyinfo Energy information (RAPL MSR) */ diff --git a/include/amd_smi/impl/amd_smi_common.h b/include/amd_smi/impl/amd_smi_common.h index 3a93823f7d..16362a157a 100644 --- a/include/amd_smi/impl/amd_smi_common.h +++ b/include/amd_smi/impl/amd_smi_common.h @@ -56,6 +56,7 @@ const std::map rsmi_status_map = { {RSMI_STATUS_SUCCESS, AMDSMI_STATUS_SUCCESS}, {RSMI_STATUS_INVALID_ARGS, AMDSMI_STATUS_INVAL}, {RSMI_STATUS_NOT_SUPPORTED, AMDSMI_STATUS_NOT_SUPPORTED}, + {RSMI_STATUS_FILE_ERROR, AMDSMI_STATUS_FILE_ERROR}, {RSMI_STATUS_PERMISSION, AMDSMI_STATUS_NO_PERM}, {RSMI_STATUS_OUT_OF_RESOURCES, AMDSMI_STATUS_OUT_OF_RESOURCES}, {RSMI_STATUS_INTERNAL_EXCEPTION, AMDSMI_STATUS_INTERNAL_EXCEPTION}, @@ -71,6 +72,8 @@ const std::map rsmi_status_map = { {RSMI_STATUS_UNEXPECTED_DATA, AMDSMI_STATUS_UNEXPECTED_DATA}, {RSMI_STATUS_BUSY, AMDSMI_STATUS_BUSY}, {RSMI_STATUS_REFCOUNT_OVERFLOW, AMDSMI_STATUS_REFCOUNT_OVERFLOW}, + {RSMI_STATUS_SETTING_UNAVAILABLE, AMDSMI_STATUS_SETTING_UNAVAILABLE}, + {RSMI_STATUS_AMDGPU_RESTART_ERR, AMDSMI_STATUS_AMDGPU_RESTART_ERR}, {RSMI_STATUS_UNKNOWN_ERROR, AMDSMI_STATUS_UNKNOWN_ERROR}, }; diff --git a/py-interface/README.md b/py-interface/README.md index 01a23e4bb8..dbe0e9fa0b 100644 --- a/py-interface/README.md +++ b/py-interface/README.md @@ -1783,7 +1783,7 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_is_gpu_power_management_enabled +### amdsmi_is_gpu_power_management_enabled Description: Returns is power management enabled @@ -2152,7 +2152,28 @@ Field | Description `padding` | padding `gfx_activity_acc` | gfx activity acc `mem_activity_acc` | mem activity acc -`temperature_hbm` | hbm temperature +`temperature_hbm` | list of hbm temperatures +`firmware_timestamp` | timestamp from PMFW +`voltage_soc` | soc voltage +`voltage_gfx` | gfx voltage +`voltage_mem` | mem voltage +`indep_throttle_status` | asic independent throttle status +`current_socket_power` | current socket power +`vcn_activity` | list of encoding and decoding engine utilizations +`gfxclk_lock_status` | gfx clock lock status +`xgmi_link_width` | XGMI bus width +`xgmi_link_speed` | XGMI bitrate (in Gbps) +`pcie_bandwidth_acc` | PCIE accumulated bandwidth (GB/sec) +`pcie_bandwidth_inst` | PCIE instantaneous bandwidth (GB/sec) +`pcie_l0_to_recov_count_acc` | PCIE L0 to recovery state transition accumulated count +`pcie_replay_count_acc` | PCIE replay accumulated count +`pcie_replay_rover_count_acc` | PCIE replay rollover accumulated count +`xgmi_read_data_acc` | XGMI accumulated read data transfer size(KiloBytes) +`xgmi_write_data_acc` | XGMI accumulated write data transfer size(KiloBytes) +`current_gfxclks` | list of current gfx clock frequencies +`current_socclks` | list of current soc clock frequencies +`current_vclk0s` | list of current v0 clock frequencies +`current_dclk0s` | list of current d0 clock frequencies Exceptions that can be thrown by `amdsmi_get_gpu_metrics_info` function: @@ -3285,7 +3306,7 @@ except AmdSmiException as e: print(e) ``` -### amdsmi_dev_compute_partition_get +### amdsmi_get_gpu_compute_partition Description: Get the compute partition from the given GPU @@ -3295,7 +3316,7 @@ Input parameters: Output: String of the partition type -Exceptions that can be thrown by `amdsmi_dev_compute_partition_get` function: +Exceptions that can be thrown by `amdsmi_get_gpu_compute_partition` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` @@ -3310,13 +3331,13 @@ try: print("No GPUs on machine") else: for device in devices: - compute_partition_type = amdsmi_dev_compute_partition_get(device) + compute_partition_type = amdsmi_get_gpu_compute_partition(device) print(compute_partition_type) except AmdSmiException as e: print(e) ``` -### amdsmi_dev_compute_partition_set +### amdsmi_set_gpu_compute_partition Description: Set the compute partition to the given GPU @@ -3327,7 +3348,7 @@ Input parameters: Output: String of the partition type -Exceptions that can be thrown by `amdsmi_dev_compute_partition_set` function: +Exceptions that can be thrown by `amdsmi_set_gpu_compute_partition` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` @@ -3343,12 +3364,12 @@ try: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_compute_partition_set(device, compute_partition) + amdsmi_set_gpu_compute_partition(device, compute_partition) except AmdSmiException as e: print(e) ``` -### amdsmi_dev_compute_partition_reset +### amdsmi_reset_gpu_compute_partition Description: Reset the compute partitioning on the given GPU @@ -3358,7 +3379,7 @@ Input parameters: Output: String of the partition type -Exceptions that can be thrown by `amdsmi_dev_compute_partition_reset` function: +Exceptions that can be thrown by `amdsmi_reset_gpu_compute_partition` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` @@ -3373,12 +3394,12 @@ try: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_compute_partition_reset(device) + amdsmi_reset_gpu_compute_partition(device) except AmdSmiException as e: print(e) ``` -### amdsmi_dev_memory_partition_get +### amdsmi_get_gpu_memory_partition Description: Get the memory partition from the given GPU @@ -3388,7 +3409,7 @@ Input parameters: Output: String of the partition type -Exceptions that can be thrown by `amdsmi_dev_memory_partition_get` function: +Exceptions that can be thrown by `amdsmi_get_gpu_memory_partition` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` @@ -3403,13 +3424,13 @@ try: print("No GPUs on machine") else: for device in devices: - memory_partition_type = amdsmi_dev_memory_partition_get(device) + memory_partition_type = amdsmi_get_gpu_memory_partition(device) print(memory_partition_type) except AmdSmiException as e: print(e) ``` -### amdsmi_dev_memory_partition_set +### amdsmi_set_gpu_memory_partition Description: Set the memory partition to the given GPU @@ -3420,7 +3441,7 @@ Input parameters: Output: String of the partition type -Exceptions that can be thrown by `amdsmi_dev_memory_partition_set` function: +Exceptions that can be thrown by `amdsmi_set_gpu_memory_partition` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` @@ -3436,12 +3457,12 @@ try: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_memory_partition_set(device, memory_partition) + amdsmi_set_gpu_memory_partition(device, memory_partition) except AmdSmiException as e: print(e) ``` -### amdsmi_dev_memory_partition_reset +### amdsmi_reset_gpu_memory_partition Description: Reset the memory partitioning on the given GPU @@ -3451,7 +3472,7 @@ Input parameters: Output: String of the partition type -Exceptions that can be thrown by `amdsmi_dev_memory_partition_reset` function: +Exceptions that can be thrown by `amdsmi_reset_gpu_memory_partition` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` @@ -3466,7 +3487,7 @@ try: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_memory_partition_reset(device) + amdsmi_reset_gpu_memory_partition(device) except AmdSmiException as e: print(e) ``` @@ -3512,6 +3533,1592 @@ except AmdSmiException as e: print(e) ``` +## GPU Metrics APIs + +### amdsmi_get_gpu_metrics_temp_hotspot + +Description: Get the hotspot temperature in degrees Celsius + +Input parameters: + +* `processor_handle` device which to query + +Output: hotspot temperature in degrees Celsius + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_hotspot` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + hotspot_temp = amdsmi_get_gpu_metrics_temp_hotspot(device) + print(hotspot_temp) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_temp_mem + +Description: Get the memory temperature in degrees Celsius + +Input parameters: + +* `processor_handle` device which to query + +Output: memory temperature in degrees Celsius + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_mem` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + mem_temp = amdsmi_get_gpu_metrics_temp_mem(device) + print(mem_temp) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_temp_vrsoc + +Description: Get the VRSOC temperature in degrees Celsius + +Input parameters: + +* `processor_handle` device which to query + +Output: VRSOC temperature in degrees Celsius + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_vrsoc` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + vrsoc_temp = amdsmi_get_gpu_metrics_temp_vrsoc(device) + print(vrsoc_temp) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_curr_socket_power + +Description: Get the current socket power in Watts + +Input parameters: + +* `processor_handle` device which to query + +Output: current socket power in Watts + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_socket_power` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + curr_socket_power = amdsmi_get_gpu_metrics_curr_socket_power(device) + print(curr_socket_power) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_gfx_activity + +Description: Get the average GFX activity in percent + +Input parameters: + +* `processor_handle` device which to query + +Output: average GFX activity in percent + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_gfx_activity` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_gfx_activity = amdsmi_get_gpu_metrics_avg_gfx_activity(device) + print(avg_gfx_activity) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_umc_activity + +Description: Get the average UMC activity in percent + +Input parameters: + +* `processor_handle` device which to query + +Output: average UMC activity in percent + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_umc_activity` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_umc_activity = amdsmi_get_gpu_metrics_avg_umc_activity(device) + print(avg_umc_activity) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_energy_acc + +Description: Get the average energy accumulator in millijoules (check unit) + +Input parameters: + +* `processor_handle` device which to query + +Output: average energy accumulator in millijoules (check unit) + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_energy_acc` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_energy_acc = amdsmi_get_gpu_metrics_avg_energy_acc(device) + print(avg_energy_acc) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_system_clock_counter + +Description: Get the system clock counter + +Input parameters: + +* `processor_handle` device which to query + +Output: system clock counter + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_system_clock_counter` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + system_clock_counter = amdsmi_get_gpu_metrics_system_clock_counter(device) + print(system_clock_counter) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_firmware_timestamp + +Description: Get the firmware timestamp + +Input parameters: + +* `processor_handle` device which to query + +Output: firmware timestamp + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_firmware_timestamp` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + + firmware_timestamp = amdsmi_get_gpu_metrics_firmware_timestamp(device) + print(firmware_timestamp) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_throttle_status + +Description: Get the throttle status + +Input parameters: + +* `processor_handle` device which to query + +Output: True if throttled, False if it's not throttled + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_throttle_status` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + throttle_status = amdsmi_get_gpu_metrics_throttle_status(device) + print(throttle_status) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_pcie_link_width + +Description: Get the pcie link width + +Input parameters: + +* `processor_handle` device which to query + +Output: pcie link width + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_link_width` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + pcie_link_width = amdsmi_get_gpu_metrics_pcie_link_width(device) + print(pcie_link_width) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_pcie_link_speed + +Description: Get the pcie link speed + +Input parameters: + +* `processor_handle` device which to query + +Output: pcie link speed + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_link_speed` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + pcie_link_speed = amdsmi_get_gpu_metrics_pcie_link_speed(device) + print(pcie_link_speed) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_xgmi_link_width + +Description: Get the xgmi link width + +Input parameters: + +* `processor_handle` device which to query + +Output: xgmi link width + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_xgmi_link_width` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + xgmi_link_width = amdsmi_get_gpu_metrics_xgmi_link_width(device) + print(xgmi_link_width) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_xgmi_link_speed + +Description: Get the xgmi link speed + +Input parameters: + +* `processor_handle` device which to query + +Output: xgmi link speed + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_xgmi_link_speed` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + xgmi_link_speed = amdsmi_get_gpu_metrics_xgmi_link_speed(device) + print(xgmi_link_speed) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_gfxclk_lock_status + +Description: Get the lock status of the gfx clock + +Input parameters: + +* `processor_handle` device which to query + +Output: True if gfx clock is locked, False if it's not locked, raise if not supported + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_gfxclk_lock_status` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + lock_status = amdsmi_get_gpu_metrics_gfxclk_lock_status(device) + print(lock_status) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_gfx_activity_acc + +Description: Get accumulated gfx activity + +Input parameters: + +* `processor_handle` device which to query + +Output: accumulated gfx activity + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_gfx_activity_acc` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + gfx_activity_acc = amdsmi_get_gpu_metrics_gfx_activity_acc(device) + print(gfx_activity_acc) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_mem_activity_acc + +Description: Get accumulated memory activity + +Input parameters: + +* `processor_handle` device which to query + +Output: accumulated mem activity + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_mem_activity_acc` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + mem_activity_acc = amdsmi_get_gpu_metrics_mem_activity_acc(device) + print(mem_activity_acc) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_pcie_bandwidth_acc + +Description: Get accumulated pcie bandwidth activity + +Input parameters: + +* `processor_handle` device which to query + +Output: accumulated pcie bandwidth activity + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_bandwidth_acc` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + pcie_bandwidth_acc = amdsmi_get_gpu_metrics_pcie_bandwidth_acc(device) + print(pcie_bandwidth_acc) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_pcie_bandwidth_inst + +Description: Get instantaneous pcie bandwidth activity + +Input parameters: + +* `processor_handle` device which to query + +Output: instantaneous pcie bandwidth activity + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_bandwidth_inst` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + pcie_bandwidth_inst = amdsmi_get_gpu_metrics_pcie_bandwidth_inst(device) + print(pcie_bandwidth_inst) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_pcie_l0_recov_count + +Description: Get count of pcie l0 recovery count errors + +Input parameters: + +* `processor_handle` device which to query + +Output: number of l0 recovery count errors + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_l0_recov_count` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + pcie_l0_recov_count = amdsmi_get_gpu_metrics_pcie_l0_recov_count(device) + print(pcie_l0_recov_count) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_pcie_replay_count_acc + +Description: Get accumulated pcie replay counts + +Input parameters: + +* `processor_handle` device which to query + +Output: accumulated pcie replay counts + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_replay_count_acc` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + pcie_replay_count_acc = amdsmi_get_gpu_metrics_pcie_replay_count_acc(device) + print(pcie_replay_count_acc) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc + +Description: Get accumulated pcie replay rollover counts + +Input parameters: + +* `processor_handle` device which to query + +Output: accumulated pcie replay rollover counts + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + pcie_replay_rover_count_acc = amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc(device) + print(pcie_replay_rover_count_acc) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_curr_uclk + +Description: Get the current u clock frequency + +Input parameters: + +* `processor_handle` device which to query + +Output: Current u clock frequency + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_uclk` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + curr_uclk = amdsmi_get_gpu_metrics_curr_uclk(device) + print(curr_uclk) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_temp_hbm + +Description: Get the HBM temperatures in degrees Celsius + +Input parameters: + +* `processor_handle` device which to query + +Output: list of HBM temperatures in degrees Celsius + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_hbm` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + hbm_temp = amdsmi_get_gpu_metrics_temp_hbm(device) + print(hbm_temp) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_vcn_activity + +Description: Get the activity for each vcn encoding engine + +Input parameters: + +* `processor_handle` device which to query + +Output: list of vcn activities + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_vcn_activity` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + vcn_activity = amdsmi_get_gpu_metrics_vcn_activity(device) + print(vcn_activity) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_xgmi_read_data + +Description: Get the accumulated read xgmi data for each xgmi link + +Input parameters: + +* `processor_handle` device which to query + +Output: list of accumulated read xgmi data + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_xgmi_read_data` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + xgmi_read_data = amdsmi_get_gpu_metrics_xgmi_read_data(device) + print(xgmi_read_data) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_xgmi_write_data + +Description: Get the accumulated written xgmi data for each xgmi link + +Input parameters: + +* `processor_handle` device which to query + +Output: list of accumulated written xgmi data + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_xgmi_write_data` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + xgmi_write_data = amdsmi_get_gpu_metrics_xgmi_write_data(device) + print(xgmi_write_data) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_curr_gfxclk + +Description: Get the current gfx clock frequency + +Input parameters: + +* `processor_handle` device which to query + +Output: Current gfx clock frequency + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_gfxclk` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + curr_gfxclk = amdsmi_get_gpu_metrics_curr_gfxclk(device) + print(curr_gfxclk) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_curr_socclk + +Description: Get the current soc clock frequency + +Input parameters: + +* `processor_handle` device which to query + +Output: Current soc clock frequency + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_socclk` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + curr_socclk = amdsmi_get_gpu_metrics_curr_socclk(device) + print(curr_socclk) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_curr_vclk0 + +Description: Get the current v0 clock frequency + +Input parameters: + +* `processor_handle` device which to query + +Output: Current v0 clock frequency + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_vclk0` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + curr_vclk0 = amdsmi_get_gpu_metrics_curr_vclk0(device) + print(curr_vclk0) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_curr_dclk0 + +Description: Get the current d0 clock frequency + +Input parameters: + +* `processor_handle` device which to query + +Output: Current d0 clock frequency + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_dclk0` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + curr_dclk0 = amdsmi_get_gpu_metrics_curr_dclk0(device) + print(curr_dclk0) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_temp_edge + +Description: Get the edge temperature in degrees Celsius + +Input parameters: + +* `processor_handle` device which to query + +Output: edge temperature in degrees Celsius + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_edge` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + edge_temp = amdsmi_get_gpu_metrics_temp_edge(device) + print(edge_temp) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_temp_vr_gfx + +Description: Get the VR GFX temperature in degrees Celsius + +Input parameters: + +* `processor_handle` device which to query + +Output: VR GFX temperature in degrees Celsius + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_vr_gfx` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + vr_gfx_temp = amdsmi_get_gpu_metrics_temp_vr_gfx(device) + print(vr_gfx_temp) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_temp_vr_mem + +Description: Get the VR MEM temperature in degrees Celsius + +Input parameters: + +* `processor_handle` device which to query + +Output: VR MEM temperature in degrees Celsius + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_temp_vr_mem` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + vr_mem_temp = amdsmi_get_gpu_metrics_temp_vr_mem(device) + print(vr_mem_temp) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_mm_activity + +Description: Get the average MM activity in percent + +Input parameters: + +* `processor_handle` device which to query + +Output: average MM activity in percent + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_mm_activity` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_mm_activity = amdsmi_get_gpu_metrics_avg_mm_activity(device) + print(avg_mm_activity) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_curr_vclk1 + +Description: Get the current v1 clock frequency + +Input parameters: + +* `processor_handle` device which to query + +Output: Current v1 clock frequency + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_vclk1` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + curr_vclk1 = amdsmi_get_gpu_metrics_curr_vclk1(device) + print(curr_vclk1) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_curr_dclk1 + +Description: Get the current d1 clock frequency + +Input parameters: + +* `processor_handle` device which to query + +Output: Current d1 clock frequency + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_dclk1` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + curr_dclk1 = amdsmi_get_gpu_metrics_curr_dclk1(device) + print(curr_dclk1) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_indep_throttle_status + +Description: Get the independent throttle status + +Input parameters: + +* `processor_handle` device which to query + +Output: True if throttled, False if it's not throttled + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_indep_throttle_status` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + throttle_status = amdsmi_get_gpu_metrics_indep_throttle_status(device) + print(throttle_status) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_socket_power + +Description: Get the average socket power in Watts + +Input parameters: + +* `processor_handle` device which to query + +Output: average socket power in Watts + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_socket_power` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_socket_power = amdsmi_get_gpu_metrics_avg_socket_power(device) + print(avg_socket_power) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_curr_fan_speed + +Description: Get the current fan speed in percent + +Input parameters: + +* `processor_handle` device which to query + +Output: current fan speed in percent + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_curr_fan_speed` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + curr_fan_speed = amdsmi_get_gpu_metrics_curr_fan_speed(device) + print(curr_fan_speed) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_gfx_clock_frequency + +Description: Get the average gfx clock frequency in MHz + +Input parameters: + +* `processor_handle` device which to query + +Output: average gfx clock frequency in MHz + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_gfx_clock_frequency` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_gfx_clock_frequency = amdsmi_get_gpu_metrics_avg_gfx_clock_frequency(device) + print(avg_gfx_clock_frequency) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_soc_clock_frequency + +Description: Get the average soc clock frequency in MHz + +Input parameters: + +* `processor_handle` device which to query + +Output: average soc clock frequency in MHz + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_soc_clock_frequency` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_soc_clock_frequency = amdsmi_get_gpu_metrics_avg_soc_clock_frequency(device) + print(avg_soc_clock_frequency) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_uclock_frequency + +Description: Get the average u clock frequency in MHz + +Input parameters: + +* `processor_handle` device which to query + +Output: average u clock frequency in MHz + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_uclock_frequency` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_uclock_frequency = amdsmi_get_gpu_metrics_avg_uclock_frequency(device) + print(avg_uclock_frequency) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_vclock0_frequency + +Description: Get the average v0 clock frequency in MHz + +Input parameters: + +* `processor_handle` device which to query + +Output: average v0 clock frequency in MHz + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_vclock0_frequency` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_vclock0_frequency = amdsmi_get_gpu_metrics_avg_vclock0_frequency(device) + print(avg_vclock0_frequency) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_dclock0_frequency + +Description: Get the average d0 clock frequency in MHz + +Input parameters: + +* `processor_handle` device which to query + +Output: average d0 clock frequency in MHz + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_dclock0_frequency` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_dclock0_frequency = amdsmi_get_gpu_metrics_avg_dclock0_frequency(device) + print(avg_dclock0_frequency) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_vclock1_frequency + +Description: Get the average v1 clock frequency in MHz + +Input parameters: + +* `processor_handle` device which to query + +Output: average v1 clock frequency in MHz + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_vclock1_frequency` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_vclock1_frequency = amdsmi_get_gpu_metrics_avg_vclock1_frequency(device) + print(avg_vclock1_frequency) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_avg_dclock1_frequency + +Description: Get the average d1 clock frequency in MHz + +Input parameters: + +* `processor_handle` device which to query + +Output: average d1 clock frequency in MHz + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_avg_dclock1_frequency` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + avg_dclock1_frequency = amdsmi_get_gpu_metrics_avg_dclock1_frequency(device) + print(avg_dclock1_frequency) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_volt_soc + +Description: Get the soc voltage in millivolts + +Input parameters: + +* `processor_handle` device which to query + +Output: soc voltage in millivolts + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_volt_soc` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + volt_soc = amdsmi_get_gpu_metrics_volt_soc(device) + print(volt_soc) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_volt_gfx + +Description: Get the gfx voltage in millivolts + +Input parameters: + +* `processor_handle` device which to query + +Output: gfx voltage in millivolts + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_volt_gfx` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + volt_gfx = amdsmi_get_gpu_metrics_volt_gfx(device) + print(volt_gfx) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_volt_mem + +Description: Get the mem voltage in millivolts + +Input parameters: + +* `processor_handle` device which to query + +Output: mem voltage in millivolts + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_volt_mem` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + volt_mem = amdsmi_get_gpu_metrics_volt_mem(device) + print(volt_mem) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_gpu_metrics_header_info + +Description: Get the gpu metrics structure header info + +Input parameters: + +* `processor_handle` device which to query + +Output: dictionary of gpu metrics header information + +Exceptions that can be thrown by `amdsmi_get_gpu_metrics_header_info` function: + +* `AmdSmiLibraryException` +* `AmdSmiRetryException` +* `AmdSmiParameterException` + +Example: + +```python +try: + devices = amdsmi_get_processor_handles() + if len(devices) == 0: + print("No GPUs on the machine") + else: + for device in devices: + header_info = amdsmi_get_gpu_metrics_header_info(device) + print(header_info) +except AmdSmiException as e: + print(e) +``` + +## CPU APIs + ### amdsmi_get_cpusocket_handles **Note: CURRENTLY HARDCODED TO RETURN DUMMY DATA** diff --git a/py-interface/__init__.py b/py-interface/__init__.py index ba2b0c6e38..4d98d7fddd 100644 --- a/py-interface/__init__.py +++ b/py-interface/__init__.py @@ -130,7 +130,6 @@ from .amdsmi_interface import amdsmi_get_gpu_volt_metric # # Clock, Power and Performance Query 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 from .amdsmi_interface import amdsmi_get_gpu_overdrive_level from .amdsmi_interface import amdsmi_get_clk_freq from .amdsmi_interface import amdsmi_get_gpu_od_volt_info @@ -195,6 +194,59 @@ 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 +# # Individual GPU Metrics Functions +from .amdsmi_interface import amdsmi_get_gpu_metrics_temp_hotspot +from .amdsmi_interface import amdsmi_get_gpu_metrics_temp_mem +from .amdsmi_interface import amdsmi_get_gpu_metrics_temp_vrsoc +from .amdsmi_interface import amdsmi_get_gpu_metrics_curr_socket_power +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_gfx_activity +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_umc_activity +from .amdsmi_interface import amdsmi_get_gpu_metrics_energy_acc +from .amdsmi_interface import amdsmi_get_gpu_metrics_system_clock_counter +from .amdsmi_interface import amdsmi_get_gpu_metrics_firmware_timestamp +from .amdsmi_interface import amdsmi_get_gpu_metrics_throttle_status +from .amdsmi_interface import amdsmi_get_gpu_metrics_pcie_link_width +from .amdsmi_interface import amdsmi_get_gpu_metrics_pcie_link_speed +from .amdsmi_interface import amdsmi_get_gpu_metrics_xgmi_link_width +from .amdsmi_interface import amdsmi_get_gpu_metrics_xgmi_link_speed +from .amdsmi_interface import amdsmi_get_gpu_metrics_gfxclk_lock_status +from .amdsmi_interface import amdsmi_get_gpu_metrics_gfx_activity_acc +from .amdsmi_interface import amdsmi_get_gpu_metrics_mem_activity_acc +from .amdsmi_interface import amdsmi_get_gpu_metrics_pcie_bandwidth_acc +from .amdsmi_interface import amdsmi_get_gpu_metrics_pcie_bandwidth_inst +from .amdsmi_interface import amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc +from .amdsmi_interface import amdsmi_get_gpu_metrics_pcie_replay_count_acc +from .amdsmi_interface import amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc +from .amdsmi_interface import amdsmi_get_gpu_metrics_curr_uclk +from .amdsmi_interface import amdsmi_get_gpu_metrics_temp_hbm +from .amdsmi_interface import amdsmi_get_gpu_metrics_vcn_activity +from .amdsmi_interface import amdsmi_get_gpu_metrics_xgmi_read_data +from .amdsmi_interface import amdsmi_get_gpu_metrics_xgmi_write_data +from .amdsmi_interface import amdsmi_get_gpu_metrics_curr_gfxclk +from .amdsmi_interface import amdsmi_get_gpu_metrics_curr_socclk +from .amdsmi_interface import amdsmi_get_gpu_metrics_curr_vclk0 +from .amdsmi_interface import amdsmi_get_gpu_metrics_curr_dclk0 +from .amdsmi_interface import amdsmi_get_gpu_metrics_temp_edge +from .amdsmi_interface import amdsmi_get_gpu_metrics_temp_vrgfx +from .amdsmi_interface import amdsmi_get_gpu_metrics_temp_vrmem +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_mm_activity +from .amdsmi_interface import amdsmi_get_gpu_metrics_curr_vclk1 +from .amdsmi_interface import amdsmi_get_gpu_metrics_curr_dclk1 +from .amdsmi_interface import amdsmi_get_gpu_metrics_indep_throttle_status +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_socket_power +from .amdsmi_interface import amdsmi_get_gpu_metrics_curr_fan_speed +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_gfx_clock_frequency +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_soc_clock_frequency +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_uclock_frequency +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_vclock0_frequency +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_dclock0_frequency +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_vclock1_frequency +from .amdsmi_interface import amdsmi_get_gpu_metrics_avg_dclock1_frequency +from .amdsmi_interface import amdsmi_get_gpu_metrics_volt_soc +from .amdsmi_interface import amdsmi_get_gpu_metrics_volt_gfx +from .amdsmi_interface import amdsmi_get_gpu_metrics_volt_mem +from .amdsmi_interface import amdsmi_get_gpu_metrics_header_info + # # Enums from .amdsmi_interface import AmdSmiInitFlags from .amdsmi_interface import AmdSmiContainerTypes diff --git a/py-interface/amdsmi_interface.py b/py-interface/amdsmi_interface.py index 71ae0ffd71..b61f68ac44 100644 --- a/py-interface/amdsmi_interface.py +++ b/py-interface/amdsmi_interface.py @@ -30,6 +30,14 @@ from .amdsmi_exception import * MAX_NUM_PROCESSES = 1024 +# gpu metrics macros defined in amdsmi.h +AMDSMI_NUM_HBM_INSTANCES = 4 +AMDSMI_MAX_NUM_VCN = 4 +AMDSMI_MAX_NUM_CLKS = 4 +AMDSMI_MAX_NUM_XGMI_LINKS = 8 +AMDSMI_MAX_NUM_GFX_CLKS = 8 + + class AmdSmiInitFlags(IntEnum): INIT_ALL_PROCESSORS = amdsmi_wrapper.AMDSMI_INIT_ALL_PROCESSORS INIT_AMD_CPUS = amdsmi_wrapper.AMDSMI_INIT_AMD_CPUS @@ -338,6 +346,7 @@ 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 @@ -1997,7 +2006,7 @@ def amdsmi_is_P2P_accessible( return accessible.value -def amdsmi_dev_compute_partition_get(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): +def amdsmi_get_gpu_compute_partition(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 @@ -2009,7 +2018,7 @@ def amdsmi_dev_compute_partition_get(processor_handle: amdsmi_wrapper.amdsmi_pro compute_partition = ctypes.create_string_buffer(_AMDSMI_STRING_LENGTH) _check_res( - amdsmi_wrapper.amdsmi_dev_compute_partition_get( + amdsmi_wrapper.amdsmi_get_gpu_compute_partition( processor_handle, compute_partition, length ) ) @@ -2017,7 +2026,7 @@ def amdsmi_dev_compute_partition_get(processor_handle: amdsmi_wrapper.amdsmi_pro return compute_partition.value.decode("utf-8") -def amdsmi_dev_compute_partition_set(processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +def amdsmi_set_gpu_compute_partition(processor_handle: amdsmi_wrapper.amdsmi_processor_handle, compute_partition: AmdSmiComputePartitionType): if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( @@ -2028,22 +2037,22 @@ def amdsmi_dev_compute_partition_set(processor_handle: amdsmi_wrapper.amdsmi_pro raise AmdSmiParameterException(compute_partition, AmdSmiComputePartitionType) _check_res( - amdsmi_wrapper.amdsmi_dev_compute_partition_set( + amdsmi_wrapper.amdsmi_set_gpu_compute_partition( processor_handle, compute_partition ) ) -def amdsmi_dev_compute_partition_reset(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): +def amdsmi_reset_gpu_compute_partition(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 ) - _check_res(amdsmi_wrapper.amdsmi_dev_compute_partition_reset(processor_handle)) + _check_res(amdsmi_wrapper.amdsmi_reset_gpu_compute_partition(processor_handle)) -def amdsmi_dev_memory_partition_get(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): +def amdsmi_get_gpu_memory_partition(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 @@ -2055,7 +2064,7 @@ def amdsmi_dev_memory_partition_get(processor_handle: amdsmi_wrapper.amdsmi_proc memory_partition = ctypes.create_string_buffer(_AMDSMI_STRING_LENGTH) _check_res( - amdsmi_wrapper.amdsmi_dev_memory_partition_get( + amdsmi_wrapper.amdsmi_get_gpu_memory_partition( processor_handle, memory_partition, length ) ) @@ -2063,7 +2072,7 @@ def amdsmi_dev_memory_partition_get(processor_handle: amdsmi_wrapper.amdsmi_proc return memory_partition.value.decode("utf-8") -def amdsmi_dev_memory_partition_set(processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +def amdsmi_set_gpu_memory_partition(processor_handle: amdsmi_wrapper.amdsmi_processor_handle, memory_partition: AmdSmiMemoryPartitionType): if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( @@ -2074,19 +2083,19 @@ def amdsmi_dev_memory_partition_set(processor_handle: amdsmi_wrapper.amdsmi_proc raise AmdSmiParameterException(memory_partition, AmdSmiMemoryPartitionType) _check_res( - amdsmi_wrapper.amdsmi_dev_memory_partition_set( + amdsmi_wrapper.amdsmi_set_gpu_memory_partition( processor_handle, memory_partition ) ) -def amdsmi_dev_memory_partition_reset(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): +def amdsmi_reset_gpu_memory_partition(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 ) - _check_res(amdsmi_wrapper.amdsmi_dev_memory_partition_reset(processor_handle)) + _check_res(amdsmi_wrapper.amdsmi_reset_gpu_memory_partition(processor_handle)) def amdsmi_get_xgmi_info(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): @@ -2937,10 +2946,30 @@ def amdsmi_get_gpu_metrics_info( "current_fan_speed": gpu_metrics.current_fan_speed, "pcie_link_width": gpu_metrics.pcie_link_width, "pcie_link_speed": gpu_metrics.pcie_link_speed, - "padding": gpu_metrics.padding, "gfx_activity_acc": gpu_metrics.gfx_activity_acc, "mem_activity_acc": gpu_metrics.mem_activity_acc, "temperature_hbm": list(gpu_metrics.temperature_hbm), + "firmware_timestamp": gpu_metrics.firmware_timestamp, + "voltage_soc": gpu_metrics.voltage_soc, + "voltage_gfx": gpu_metrics.voltage_gfx, + "voltage_mem": gpu_metrics.voltage_mem, + "indep_throttle_status": gpu_metrics.indep_throttle_status, + "current_socket_power": gpu_metrics.current_socket_power, + "vcn_activity": list(gpu_metrics.vcn_activity), + "gfxclk_lock_status": gpu_metrics.gfxclk_lock_status, + "xgmi_link_width": gpu_metrics.xgmi_link_width, + "xgmi_link_speed": gpu_metrics.xgmi_link_speed, + "pcie_bandwidth_acc": gpu_metrics.pcie_bandwidth_acc, + "pcie_bandwidth_inst": gpu_metrics.pcie_bandwidth_inst, + "pcie_l0_to_recov_count_acc": gpu_metrics.pcie_l0_to_recov_count_acc, + "pcie_replay_count_acc": gpu_metrics.pcie_replay_count_acc, + "pcie_replay_rover_count_acc": gpu_metrics.pcie_replay_rover_count_acc, + "xgmi_read_data_acc": list(gpu_metrics.xgmi_read_data_acc), + "xgmi_write_data_acc": list(gpu_metrics.xgmi_write_data_acc), + "current_gfxclks": list(gpu_metrics.current_gfxclks), + "current_socclks": list(gpu_metrics.current_socclks), + "current_vclk0s": list(gpu_metrics.current_vclk0s), + "current_dclk0s": list(gpu_metrics.current_dclk0s), } @@ -3200,3 +3229,1076 @@ def amdsmi_get_gpu_memory_reserved_pages( table_records = _format_bad_page_info(retired_page_record, num_pages) return table_records + + +### Individual GPU Metrics Functions +def amdsmi_get_gpu_metrics_temp_hotspot( + 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 + ) + + hotspot_value = ctypes.c_int16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_temp_hotspot( + processor_handle, ctypes.byref(hotspot_value) + ) + ) + + if hotspot_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return hotspot_value.value + + +def amdsmi_get_gpu_metrics_temp_mem( + 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 + ) + + mem_value = ctypes.c_int16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_temp_mem( + processor_handle, ctypes.byref(mem_value) + ) + ) + + if mem_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return mem_value.value + + +def amdsmi_get_gpu_metrics_temp_vrsoc( + 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 + ) + + vrsoc_value = ctypes.c_int16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_temp_vrsoc( + processor_handle, ctypes.byref(vrsoc_value) + ) + ) + + if vrsoc_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return vrsoc_value.value + + +def amdsmi_get_gpu_metrics_curr_socket_power( + 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 + ) + + socket_power_value = ctypes.c_uint16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_curr_socket_power( + processor_handle, ctypes.byref(socket_power_value) + ) + ) + + if socket_power_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return socket_power_value.value + + +def amdsmi_get_gpu_metrics_avg_gfx_activity( + 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 + ) + + gfx_activity_value = ctypes.c_uint16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_gfx_activity( + processor_handle, ctypes.byref(gfx_activity_value) + ) + ) + + if gfx_activity_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return gfx_activity_value.value + + +def amdsmi_get_gpu_metrics_avg_umc_activity( + 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 + ) + + umc_activity_value = ctypes.c_uint16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_umc_activity( + processor_handle, ctypes.byref(umc_activity_value) + ) + ) + + if umc_activity_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return umc_activity_value.value + + +def amdsmi_get_gpu_metrics_energy_acc( + 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 + ) + + energy_acc_value = ctypes.c_uint64() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_energy_acc( + processor_handle, ctypes.byref(energy_acc_value) + ) + ) + + if energy_acc_value.value == 0xFFFFFFFFFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return energy_acc_value.value + + +def amdsmi_get_gpu_metrics_system_clock_counter( + 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 + ) + + system_clock_counter_value = ctypes.c_uint64() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_system_clock_counter( + processor_handle, ctypes.byref(system_clock_counter_value) + ) + ) + + if system_clock_counter_value.value == 0xFFFFFFFFFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return system_clock_counter_value.value + + +def amdsmi_get_gpu_metrics_firmware_timestamp( + 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 + ) + + firmware_timestamp_value = ctypes.c_uint64() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_firmware_timestamp( + processor_handle, ctypes.byref(firmware_timestamp_value) + ) + ) + + if firmware_timestamp_value.value == 0xFFFFFFFFFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return firmware_timestamp_value.value + + +def amdsmi_get_gpu_metrics_throttle_status( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> bool: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + throttle_status_value = ctypes.c_uint32() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_throttle_status( + processor_handle, ctypes.byref(throttle_status_value) + ) + ) + + if throttle_status_value.value == 0xFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return bool(throttle_status_value.value) + + +def amdsmi_get_gpu_metrics_pcie_link_width( + 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 + ) + + pcie_link_width_value = ctypes.c_uint16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_pcie_link_width( + processor_handle, ctypes.byref(pcie_link_width_value) + ) + ) + + if pcie_link_width_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return pcie_link_width_value.value + + +def amdsmi_get_gpu_metrics_pcie_link_speed( + 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 + ) + + pcie_link_speed_value = ctypes.c_uint16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_pcie_link_speed( + processor_handle, ctypes.byref(pcie_link_speed_value) + ) + ) + + if pcie_link_speed_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return pcie_link_speed_value.value + + +def amdsmi_get_gpu_metrics_xgmi_link_width( + 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 + ) + + xgmi_link_width_value = ctypes.c_uint16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_xgmi_link_width( + processor_handle, ctypes.byref(xgmi_link_width_value) + ) + ) + + if xgmi_link_width_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return xgmi_link_width_value.value + + +def amdsmi_get_gpu_metrics_xgmi_link_speed( + 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 + ) + + xgmi_link_speed_value = ctypes.c_uint16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_xgmi_link_speed( + processor_handle, ctypes.byref(xgmi_link_speed_value) + ) + ) + + if xgmi_link_speed_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return xgmi_link_speed_value.value + + +def amdsmi_get_gpu_metrics_gfxclk_lock_status( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> bool: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + gfxclk_lock_status_value = ctypes.c_uint32() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_gfxclk_lock_status( + processor_handle, ctypes.byref(gfxclk_lock_status_value) + ) + ) + + if gfxclk_lock_status_value.value == 0xFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return bool(gfxclk_lock_status_value.value) + + +def amdsmi_get_gpu_metrics_gfx_activity_acc( + 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 + ) + + gfx_activity_acc_value = ctypes.c_uint32() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_gfx_activity_acc( + processor_handle, ctypes.byref(gfx_activity_acc_value) + ) + ) + + if gfx_activity_acc_value.value == 0xFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return gfx_activity_acc_value.value + + +def amdsmi_get_gpu_metrics_mem_activity_acc( + 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 + ) + + mem_activity_acc_value = ctypes.c_uint32() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_mem_activity_acc( + processor_handle, ctypes.byref(mem_activity_acc_value) + ) + ) + + if mem_activity_acc_value.value == 0xFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return mem_activity_acc_value.value + + +def amdsmi_get_gpu_metrics_pcie_bandwidth_acc( + 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 + ) + + pcie_bandwidth_acc_value = ctypes.c_uint64() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_pcie_bandwidth_acc( + processor_handle, ctypes.byref(pcie_bandwidth_acc_value) + ) + ) + + if pcie_bandwidth_acc_value.value == 0xFFFFFFFFFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return pcie_bandwidth_acc_value.value + + +def amdsmi_get_gpu_metrics_pcie_bandwidth_inst( + 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 + ) + + pcie_bandwidth_inst_value = ctypes.c_uint64() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_pcie_bandwidth_inst( + processor_handle, ctypes.byref(pcie_bandwidth_inst_value) + ) + ) + + if pcie_bandwidth_inst_value.value == 0xFFFFFFFFFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return pcie_bandwidth_inst_value.value + + +def amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc( + 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 + ) + + pcie_count_acc_value = ctypes.c_uint64() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc( + processor_handle, ctypes.byref(pcie_count_acc_value) + ) + ) + + if pcie_count_acc_value.value == 0xFFFFFFFFFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return pcie_count_acc_value.value + + +def amdsmi_get_gpu_metrics_pcie_replay_count_acc( + 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 + ) + + pcie_count_acc_value = ctypes.c_uint64() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_pcie_replay_count_acc( + processor_handle, ctypes.byref(pcie_count_acc_value) + ) + ) + + if pcie_count_acc_value.value == 0xFFFFFFFFFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return pcie_count_acc_value.value + + +def amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc( + 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 + ) + + pcie_count_acc_value = ctypes.c_uint64() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc( + processor_handle, ctypes.byref(pcie_count_acc_value) + ) + ) + + if pcie_count_acc_value.value == 0xFFFFFFFFFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return pcie_count_acc_value.value + + +def amdsmi_get_gpu_metrics_curr_uclk( + 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 + ) + + uclk_value = ctypes.c_uint16() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_curr_uclk( + processor_handle, ctypes.byref(uclk_value) + ) + ) + + if uclk_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return uclk_value.value + + +def amdsmi_get_gpu_metrics_temp_hbm( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> List[int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + temp_hbm_value = (ctypes.c_uint16 * AMDSMI_NUM_HBM_INSTANCES)() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_temp_hbm( + processor_handle, temp_hbm_value + ) + ) + + return [temp_hbm.value for temp_hbm in temp_hbm_value] + + +def amdsmi_get_gpu_metrics_vcn_activity( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> List[int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + vcn_activity_value = (ctypes.c_uint16 * AMDSMI_MAX_NUM_VCN)() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_vcn_activity( + processor_handle, vcn_activity_value + ) + ) + + return [vcn_activity.value for vcn_activity in vcn_activity_value] + + +def amdsmi_get_gpu_metrics_xgmi_read_data( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> List[int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + xgmi_write_data_acc_value = (ctypes.c_uint64 * AMDSMI_MAX_NUM_XGMI_LINKS)() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_xgmi_read_data( + processor_handle, xgmi_write_data_acc_value + ) + ) + + return [xgmi_read_data_acc.value for xgmi_read_data_acc in xgmi_write_data_acc_value] + + +def amdsmi_get_gpu_metrics_xgmi_write_data( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> List[int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + xgmi_write_data_acc_value = (ctypes.c_uint64 * AMDSMI_MAX_NUM_XGMI_LINKS)() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_xgmi_write_data( + processor_handle, xgmi_write_data_acc_value + ) + ) + + return [xgmi_write_data_acc.value for xgmi_write_data_acc in xgmi_write_data_acc_value] + + +def amdsmi_get_gpu_metrics_curr_gfxclk( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> List[int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + current_gfxclk_value = (ctypes.c_uint16 * AMDSMI_MAX_NUM_GFX_CLKS)() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_curr_gfxclk( + processor_handle, current_gfxclk_value + ) + ) + + return [curr_gfxclk.value for curr_gfxclk in current_gfxclk_value] + + +def amdsmi_get_gpu_metrics_curr_socclk( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> List[int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + current_socclk_value = (ctypes.c_uint16 * AMDSMI_MAX_NUM_CLKS)() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_curr_socclk( + processor_handle, current_socclk_value + ) + ) + + return [curr_socclk.value for curr_socclk in current_socclk_value] + + +def amdsmi_get_gpu_metrics_curr_vclk0( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> List[int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + current_vclk_value = (ctypes.c_uint16 * AMDSMI_MAX_NUM_CLKS)() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_curr_vclk0( + processor_handle, current_vclk_value + ) + ) + + return [curr_vclk0.value for curr_vclk0 in current_vclk_value] + + +def amdsmi_get_gpu_metrics_curr_dclk0( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> List[int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + current_dclk_value = (ctypes.c_uint16 * AMDSMI_MAX_NUM_CLKS)() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_curr_dclk0( + processor_handle, current_dclk_value + ) + ) + + return [curr_dclk0.value for curr_dclk0 in current_dclk_value] + + +def amdsmi_get_gpu_metrics_temp_edge( + 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 + ) + + edge_value = ctypes.c_int16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_temp_edge( + processor_handle, ctypes.byref(edge_value) + ) + ) + + if edge_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return edge_value.value + + +def amdsmi_get_gpu_metrics_temp_vrgfx( + 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 + ) + + vrgfx_value = ctypes.c_int16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_temp_vrgfx( + processor_handle, ctypes.byref(vrgfx_value) + ) + ) + + if vrgfx_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return vrgfx_value.value + + +def amdsmi_get_gpu_metrics_temp_vrmem( + 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 + ) + + vrmem_value = ctypes.c_int16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_temp_vrmem( + processor_handle, ctypes.byref(vrmem_value) + ) + ) + + if vrmem_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return vrmem_value.value + + +def amdsmi_get_gpu_metrics_avg_mm_activity( + 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 + ) + + mm_activity_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_mm_activity( + processor_handle, ctypes.byref(mm_activity_value) + ) + ) + + if mm_activity_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return mm_activity_value.value + + +def amdsmi_get_gpu_metrics_curr_vclk1( + 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 + ) + + current_vclk_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_curr_vclk1( + processor_handle, ctypes.byref(current_vclk_value) + ) + ) + + if current_vclk_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return current_vclk_value.value + + +def amdsmi_get_gpu_metrics_curr_dclk1( + 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 + ) + + current_dclk_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_curr_dclk1( + processor_handle, ctypes.byref(current_dclk_value) + ) + ) + + if current_dclk_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return current_dclk_value.value + + +def amdsmi_get_gpu_metrics_indep_throttle_status( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> bool: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + throttle_status_value = ctypes.c_uint64() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_indep_throttle_status( + processor_handle, ctypes.byref(throttle_status_value) + ) + ) + + if throttle_status_value.value == 0xFFFFFFFFFFFFFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return bool(throttle_status_value.value) + + +def amdsmi_get_gpu_metrics_avg_socket_power( + 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 + ) + + socket_power_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_socket_power( + processor_handle, ctypes.byref(socket_power_value) + ) + ) + + if socket_power_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return socket_power_value.value + + +def amdsmi_get_gpu_metrics_curr_fan_speed( + 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 + ) + + fan_speed_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_curr_fan_speed( + processor_handle, ctypes.byref(fan_speed_value) + ) + ) + + if fan_speed_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return fan_speed_value.value + + +def amdsmi_get_gpu_metrics_avg_gfx_clock_frequency( + 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 + ) + + clock_frequency_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_gfx_clock_frequency( + processor_handle, ctypes.byref(clock_frequency_value) + ) + ) + + if clock_frequency_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return clock_frequency_value.value + + +def amdsmi_get_gpu_metrics_avg_soc_clock_frequency( + 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 + ) + + clock_frequency_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_soc_clock_frequency( + processor_handle, ctypes.byref(clock_frequency_value) + ) + ) + + if clock_frequency_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return clock_frequency_value.value + + +def amdsmi_get_gpu_metrics_avg_uclock_frequency( + 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 + ) + + clock_frequency_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_uclock_frequency( + processor_handle, ctypes.byref(clock_frequency_value) + ) + ) + + if clock_frequency_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return clock_frequency_value.value + + +def amdsmi_get_gpu_metrics_avg_vclock0_frequency( + 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 + ) + + clock_frequency_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_vclock0_frequency( + processor_handle, ctypes.byref(clock_frequency_value) + ) + ) + + if clock_frequency_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return clock_frequency_value.value + + +def amdsmi_get_gpu_metrics_avg_dclock0_frequency( + 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 + ) + + clock_frequency_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_dclock0_frequency( + processor_handle, ctypes.byref(clock_frequency_value) + ) + ) + + if clock_frequency_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return clock_frequency_value.value + + +def amdsmi_get_gpu_metrics_avg_vclock1_frequency( + 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 + ) + + clock_frequency_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_vclock1_frequency( + processor_handle, ctypes.byref(clock_frequency_value) + ) + ) + + if clock_frequency_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return clock_frequency_value.value + + +def amdsmi_get_gpu_metrics_avg_dclock1_frequency( + 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 + ) + + clock_frequency_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_avg_dclock1_frequency( + processor_handle, ctypes.byref(clock_frequency_value) + ) + ) + + if clock_frequency_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return clock_frequency_value.value + + +def amdsmi_get_gpu_metrics_volt_soc( + 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 + ) + + voltage_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_volt_soc( + processor_handle, ctypes.byref(voltage_value) + ) + ) + + if voltage_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return voltage_value.value + + +def amdsmi_get_gpu_metrics_volt_gfx( + 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 + ) + + voltage_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_volt_gfx( + processor_handle, ctypes.byref(voltage_value) + ) + ) + + return [volt_gfx.value for volt_gfx in voltage_value] + + +def amdsmi_get_gpu_metrics_volt_mem( + 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 + ) + + voltage_value = ctypes.c_uint16() + + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_volt_mem( + processor_handle, ctypes.byref(voltage_value) + ) + ) + + if voltage_value.value == 0xFFFF: + raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NOT_SUPPORTED) + + return voltage_value.value + + +def amdsmi_get_gpu_metrics_header_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> Dict[str, int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + + header_info = amdsmi_wrapper.amd_metrics_table_header_t() + _check_res( + amdsmi_wrapper.amdsmi_get_gpu_metrics_header_info( + ctypes.byref(header_info) + ) + ) + + return { + "structure_size": header_info.structure_size.value, + "format_revision": header_info.format_revision.value, + "content_revision": header_info.content_revision.value + } diff --git a/py-interface/amdsmi_wrapper.py b/py-interface/amdsmi_wrapper.py index c19a492943..a36dd0f43c 100644 --- a/py-interface/amdsmi_wrapper.py +++ b/py-interface/amdsmi_wrapper.py @@ -284,6 +284,8 @@ amdsmi_status_t__enumvalues = { 51: 'AMDSMI_NO_DRV', 52: 'AMDSMI_FILE_NOT_FOUND', 53: 'AMDSMI_ARG_PTR_NULL', + 54: 'AMDSMI_STATUS_AMDGPU_RESTART_ERR', + 55: 'AMDSMI_STATUS_SETTING_UNAVAILABLE', 4294967294: 'AMDSMI_STATUS_MAP_ERROR', 4294967295: 'AMDSMI_STATUS_UNKNOWN_ERROR', } @@ -326,6 +328,8 @@ AMDSMI_HSMP_TIMEOUT = 50 AMDSMI_NO_DRV = 51 AMDSMI_FILE_NOT_FOUND = 52 AMDSMI_ARG_PTR_NULL = 53 +AMDSMI_STATUS_AMDGPU_RESTART_ERR = 54 +AMDSMI_STATUS_SETTING_UNAVAILABLE = 55 AMDSMI_STATUS_MAP_ERROR = 4294967294 AMDSMI_STATUS_UNKNOWN_ERROR = 4294967295 amdsmi_status_t = ctypes.c_uint32 # enum @@ -1479,10 +1483,34 @@ struct_amdsmi_gpu_metrics_t._fields_ = [ ('current_fan_speed', ctypes.c_uint16), ('pcie_link_width', ctypes.c_uint16), ('pcie_link_speed', ctypes.c_uint16), - ('padding', ctypes.c_uint16), + ('PADDING_0', ctypes.c_ubyte * 2), ('gfx_activity_acc', ctypes.c_uint32), ('mem_activity_acc', ctypes.c_uint32), ('temperature_hbm', ctypes.c_uint16 * 4), + ('firmware_timestamp', ctypes.c_uint64), + ('voltage_soc', ctypes.c_uint16), + ('voltage_gfx', ctypes.c_uint16), + ('voltage_mem', ctypes.c_uint16), + ('PADDING_1', ctypes.c_ubyte * 2), + ('indep_throttle_status', ctypes.c_uint64), + ('current_socket_power', ctypes.c_uint16), + ('vcn_activity', ctypes.c_uint16 * 4), + ('PADDING_2', ctypes.c_ubyte * 2), + ('gfxclk_lock_status', ctypes.c_uint32), + ('xgmi_link_width', ctypes.c_uint16), + ('xgmi_link_speed', ctypes.c_uint16), + ('PADDING_3', ctypes.c_ubyte * 4), + ('pcie_bandwidth_acc', ctypes.c_uint64), + ('pcie_bandwidth_inst', ctypes.c_uint64), + ('pcie_l0_to_recov_count_acc', ctypes.c_uint64), + ('pcie_replay_count_acc', ctypes.c_uint64), + ('pcie_replay_rover_count_acc', ctypes.c_uint64), + ('xgmi_read_data_acc', ctypes.c_uint64 * 8), + ('xgmi_write_data_acc', ctypes.c_uint64 * 8), + ('current_gfxclks', ctypes.c_uint16 * 8), + ('current_socclks', ctypes.c_uint16 * 4), + ('current_vclk0s', ctypes.c_uint16 * 4), + ('current_dclk0s', ctypes.c_uint16 * 4), ] amdsmi_gpu_metrics_t = struct_amdsmi_gpu_metrics_t @@ -1883,24 +1911,24 @@ amdsmi_topo_get_link_type.argtypes = [amdsmi_processor_handle, amdsmi_processor_ 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_dev_compute_partition_get = _libraries['libamd_smi.so'].amdsmi_dev_compute_partition_get -amdsmi_dev_compute_partition_get.restype = amdsmi_status_t -amdsmi_dev_compute_partition_get.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), uint32_t] -amdsmi_dev_compute_partition_set = _libraries['libamd_smi.so'].amdsmi_dev_compute_partition_set -amdsmi_dev_compute_partition_set.restype = amdsmi_status_t -amdsmi_dev_compute_partition_set.argtypes = [amdsmi_processor_handle, amdsmi_compute_partition_type_t] -amdsmi_dev_compute_partition_reset = _libraries['libamd_smi.so'].amdsmi_dev_compute_partition_reset -amdsmi_dev_compute_partition_reset.restype = amdsmi_status_t -amdsmi_dev_compute_partition_reset.argtypes = [amdsmi_processor_handle] -amdsmi_dev_memory_partition_get = _libraries['libamd_smi.so'].amdsmi_dev_memory_partition_get -amdsmi_dev_memory_partition_get.restype = amdsmi_status_t -amdsmi_dev_memory_partition_get.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), uint32_t] -amdsmi_dev_memory_partition_set = _libraries['libamd_smi.so'].amdsmi_dev_memory_partition_set -amdsmi_dev_memory_partition_set.restype = amdsmi_status_t -amdsmi_dev_memory_partition_set.argtypes = [amdsmi_processor_handle, amdsmi_memory_partition_type_t] -amdsmi_dev_memory_partition_reset = _libraries['libamd_smi.so'].amdsmi_dev_memory_partition_reset -amdsmi_dev_memory_partition_reset.restype = amdsmi_status_t -amdsmi_dev_memory_partition_reset.argtypes = [amdsmi_processor_handle] +amdsmi_get_gpu_compute_partition = _libraries['libamd_smi.so'].amdsmi_get_gpu_compute_partition +amdsmi_get_gpu_compute_partition.restype = amdsmi_status_t +amdsmi_get_gpu_compute_partition.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), uint32_t] +amdsmi_set_gpu_compute_partition = _libraries['libamd_smi.so'].amdsmi_set_gpu_compute_partition +amdsmi_set_gpu_compute_partition.restype = amdsmi_status_t +amdsmi_set_gpu_compute_partition.argtypes = [amdsmi_processor_handle, amdsmi_compute_partition_type_t] +amdsmi_reset_gpu_compute_partition = _libraries['libamd_smi.so'].amdsmi_reset_gpu_compute_partition +amdsmi_reset_gpu_compute_partition.restype = amdsmi_status_t +amdsmi_reset_gpu_compute_partition.argtypes = [amdsmi_processor_handle] +amdsmi_get_gpu_memory_partition = _libraries['libamd_smi.so'].amdsmi_get_gpu_memory_partition +amdsmi_get_gpu_memory_partition.restype = amdsmi_status_t +amdsmi_get_gpu_memory_partition.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), uint32_t] +amdsmi_set_gpu_memory_partition = _libraries['libamd_smi.so'].amdsmi_set_gpu_memory_partition +amdsmi_set_gpu_memory_partition.restype = amdsmi_status_t +amdsmi_set_gpu_memory_partition.argtypes = [amdsmi_processor_handle, amdsmi_memory_partition_type_t] +amdsmi_reset_gpu_memory_partition = _libraries['libamd_smi.so'].amdsmi_reset_gpu_memory_partition +amdsmi_reset_gpu_memory_partition.restype = amdsmi_status_t +amdsmi_reset_gpu_memory_partition.argtypes = [amdsmi_processor_handle] 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] @@ -1967,6 +1995,173 @@ amdsmi_get_gpu_process_info.argtypes = [amdsmi_processor_handle, amdsmi_process_ 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_amdsmi_error_count_t)] +gpu_metric_temp_hbm_t = ctypes.c_uint16 * 4 +gpu_metric_vcn_activity_t = ctypes.c_uint16 * 4 +gpu_metric_xgmi_read_data_acc_t = ctypes.c_uint64 * 8 +gpu_metric_xgmi_write_data_acc_t = ctypes.c_uint64 * 8 +gpu_metric_curr_gfxclk_t = ctypes.c_uint16 * 8 +gpu_metric_curr_socclk_t = ctypes.c_uint16 * 4 +gpu_metric_curr_vclk0_t = ctypes.c_uint16 * 4 +gpu_metric_curr_dclk0_t = ctypes.c_uint16 * 4 +amdsmi_get_gpu_metrics_temp_hotspot = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_temp_hotspot +amdsmi_get_gpu_metrics_temp_hotspot.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_temp_hotspot.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_temp_mem = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_temp_mem +amdsmi_get_gpu_metrics_temp_mem.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_temp_mem.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_temp_vrsoc = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_temp_vrsoc +amdsmi_get_gpu_metrics_temp_vrsoc.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_temp_vrsoc.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_curr_socket_power = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_curr_socket_power +amdsmi_get_gpu_metrics_curr_socket_power.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_curr_socket_power.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_gfx_activity = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_gfx_activity +amdsmi_get_gpu_metrics_avg_gfx_activity.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_gfx_activity.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_umc_activity = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_umc_activity +amdsmi_get_gpu_metrics_avg_umc_activity.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_umc_activity.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_energy_acc = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_energy_acc +amdsmi_get_gpu_metrics_energy_acc.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_energy_acc.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_metrics_system_clock_counter = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_system_clock_counter +amdsmi_get_gpu_metrics_system_clock_counter.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_system_clock_counter.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_metrics_firmware_timestamp = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_firmware_timestamp +amdsmi_get_gpu_metrics_firmware_timestamp.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_firmware_timestamp.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_metrics_throttle_status = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_throttle_status +amdsmi_get_gpu_metrics_throttle_status.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_throttle_status.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_metrics_pcie_link_width = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_pcie_link_width +amdsmi_get_gpu_metrics_pcie_link_width.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_link_width.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_pcie_link_speed = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_pcie_link_speed +amdsmi_get_gpu_metrics_pcie_link_speed.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_link_speed.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_xgmi_link_width = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_xgmi_link_width +amdsmi_get_gpu_metrics_xgmi_link_width.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_link_width.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_xgmi_link_speed = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_xgmi_link_speed +amdsmi_get_gpu_metrics_xgmi_link_speed.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_link_speed.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_gfxclk_lock_status = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_gfxclk_lock_status +amdsmi_get_gpu_metrics_gfxclk_lock_status.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_gfxclk_lock_status.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_metrics_gfx_activity_acc = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_gfx_activity_acc +amdsmi_get_gpu_metrics_gfx_activity_acc.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_gfx_activity_acc.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_metrics_mem_activity_acc = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_mem_activity_acc +amdsmi_get_gpu_metrics_mem_activity_acc.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_mem_activity_acc.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_metrics_pcie_bandwidth_acc = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_pcie_bandwidth_acc +amdsmi_get_gpu_metrics_pcie_bandwidth_acc.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_bandwidth_acc.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_metrics_pcie_bandwidth_inst = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_pcie_bandwidth_inst +amdsmi_get_gpu_metrics_pcie_bandwidth_inst.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_bandwidth_inst.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc +amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_metrics_pcie_replay_count_acc = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_pcie_replay_count_acc +amdsmi_get_gpu_metrics_pcie_replay_count_acc.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_replay_count_acc.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc +amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_metrics_curr_uclk = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_curr_uclk +amdsmi_get_gpu_metrics_curr_uclk.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_curr_uclk.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_temp_hbm = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_temp_hbm +amdsmi_get_gpu_metrics_temp_hbm.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_temp_hbm.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16 * 4)] +amdsmi_get_gpu_metrics_vcn_activity = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_vcn_activity +amdsmi_get_gpu_metrics_vcn_activity.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_vcn_activity.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16 * 4)] +amdsmi_get_gpu_metrics_xgmi_read_data = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_xgmi_read_data +amdsmi_get_gpu_metrics_xgmi_read_data.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_read_data.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64 * 8)] +amdsmi_get_gpu_metrics_xgmi_write_data = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_xgmi_write_data +amdsmi_get_gpu_metrics_xgmi_write_data.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_write_data.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64 * 8)] +amdsmi_get_gpu_metrics_curr_gfxclk = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_curr_gfxclk +amdsmi_get_gpu_metrics_curr_gfxclk.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_curr_gfxclk.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16 * 8)] +amdsmi_get_gpu_metrics_curr_socclk = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_curr_socclk +amdsmi_get_gpu_metrics_curr_socclk.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_curr_socclk.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16 * 4)] +amdsmi_get_gpu_metrics_curr_vclk0 = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_curr_vclk0 +amdsmi_get_gpu_metrics_curr_vclk0.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_curr_vclk0.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16 * 4)] +amdsmi_get_gpu_metrics_curr_dclk0 = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_curr_dclk0 +amdsmi_get_gpu_metrics_curr_dclk0.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_curr_dclk0.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16 * 4)] +amdsmi_get_gpu_metrics_temp_edge = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_temp_edge +amdsmi_get_gpu_metrics_temp_edge.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_temp_edge.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_temp_vrgfx = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_temp_vrgfx +amdsmi_get_gpu_metrics_temp_vrgfx.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_temp_vrgfx.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_temp_vrmem = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_temp_vrmem +amdsmi_get_gpu_metrics_temp_vrmem.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_temp_vrmem.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_mm_activity = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_mm_activity +amdsmi_get_gpu_metrics_avg_mm_activity.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_mm_activity.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_curr_vclk1 = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_curr_vclk1 +amdsmi_get_gpu_metrics_curr_vclk1.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_curr_vclk1.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_curr_dclk1 = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_curr_dclk1 +amdsmi_get_gpu_metrics_curr_dclk1.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_curr_dclk1.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_indep_throttle_status = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_indep_throttle_status +amdsmi_get_gpu_metrics_indep_throttle_status.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_indep_throttle_status.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_metrics_avg_socket_power = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_socket_power +amdsmi_get_gpu_metrics_avg_socket_power.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_socket_power.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_curr_fan_speed = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_curr_fan_speed +amdsmi_get_gpu_metrics_curr_fan_speed.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_curr_fan_speed.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_gfx_clock_frequency = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_gfx_clock_frequency +amdsmi_get_gpu_metrics_avg_gfx_clock_frequency.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_gfx_clock_frequency.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_soc_clock_frequency = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_soc_clock_frequency +amdsmi_get_gpu_metrics_avg_soc_clock_frequency.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_soc_clock_frequency.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_uclock_frequency = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_uclock_frequency +amdsmi_get_gpu_metrics_avg_uclock_frequency.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_uclock_frequency.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_vclock0_frequency = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_vclock0_frequency +amdsmi_get_gpu_metrics_avg_vclock0_frequency.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_vclock0_frequency.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_dclock0_frequency = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_dclock0_frequency +amdsmi_get_gpu_metrics_avg_dclock0_frequency.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_dclock0_frequency.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_vclock1_frequency = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_vclock1_frequency +amdsmi_get_gpu_metrics_avg_vclock1_frequency.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_vclock1_frequency.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_avg_dclock1_frequency = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_avg_dclock1_frequency +amdsmi_get_gpu_metrics_avg_dclock1_frequency.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_avg_dclock1_frequency.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_volt_soc = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_volt_soc +amdsmi_get_gpu_metrics_volt_soc.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_volt_soc.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_volt_gfx = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_volt_gfx +amdsmi_get_gpu_metrics_volt_gfx.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_volt_gfx.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_volt_mem = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_volt_mem +amdsmi_get_gpu_metrics_volt_mem.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_volt_mem.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_header_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_header_info +amdsmi_get_gpu_metrics_header_info.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_header_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amd_metrics_table_header_t)] +amdsmi_get_gpu_metrics_xcd_counter = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_xcd_counter +amdsmi_get_gpu_metrics_xcd_counter.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_xcd_counter.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_metrics_log = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_log +amdsmi_get_gpu_metrics_log.restype = amdsmi_status_t +amdsmi_get_gpu_metrics_log.argtypes = [amdsmi_processor_handle] amdsmi_get_cpu_core_energy = _libraries['libamd_smi.so'].amdsmi_get_cpu_core_energy amdsmi_get_cpu_core_energy.restype = amdsmi_status_t amdsmi_get_cpu_core_energy.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(ctypes.c_uint64)] @@ -2157,9 +2352,9 @@ __all__ = \ 'AMDSMI_RAS_ERR_STATE_SING_C', 'AMDSMI_SLOT_TYPE__CEM', 'AMDSMI_SLOT_TYPE__OAM', 'AMDSMI_SLOT_TYPE__PCIE', 'AMDSMI_SLOT_TYPE__RESERVED', 'AMDSMI_STATUS_ADDRESS_FAULT', - 'AMDSMI_STATUS_API_FAILED', 'AMDSMI_STATUS_BUSY', - 'AMDSMI_STATUS_DRIVER_NOT_LOADED', 'AMDSMI_STATUS_DRM_ERROR', - 'AMDSMI_STATUS_FAIL_LOAD_MODULE', + 'AMDSMI_STATUS_AMDGPU_RESTART_ERR', 'AMDSMI_STATUS_API_FAILED', + 'AMDSMI_STATUS_BUSY', 'AMDSMI_STATUS_DRIVER_NOT_LOADED', + 'AMDSMI_STATUS_DRM_ERROR', 'AMDSMI_STATUS_FAIL_LOAD_MODULE', 'AMDSMI_STATUS_FAIL_LOAD_SYMBOL', 'AMDSMI_STATUS_FILE_ERROR', 'AMDSMI_STATUS_INIT_ERROR', 'AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS', 'AMDSMI_STATUS_INSUFFICIENT_SIZE', @@ -2172,15 +2367,16 @@ __all__ = \ 'AMDSMI_STATUS_NO_PERM', 'AMDSMI_STATUS_NO_SLOT', 'AMDSMI_STATUS_OUT_OF_RESOURCES', '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_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_SETTING_UNAVAILABLE', 'AMDSMI_STATUS_SUCCESS', + 'AMDSMI_STATUS_TIMEOUT', 'AMDSMI_STATUS_UNEXPECTED_DATA', + 'AMDSMI_STATUS_UNEXPECTED_SIZE', '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_VOLT_AVERAGE', 'AMDSMI_VOLT_CURRENT', 'AMDSMI_VOLT_FIRST', 'AMDSMI_VOLT_HIGHEST', @@ -2257,12 +2453,7 @@ __all__ = \ 'amdsmi_container_types_t', 'amdsmi_counter_command_t', 'amdsmi_counter_value_t', 'amdsmi_cpu_apb_disable', 'amdsmi_cpu_apb_enable', 'amdsmi_cpusocket_handle', - 'amdsmi_ddr_bw_metrics_t', 'amdsmi_dev_compute_partition_get', - 'amdsmi_dev_compute_partition_reset', - 'amdsmi_dev_compute_partition_set', - 'amdsmi_dev_memory_partition_get', - 'amdsmi_dev_memory_partition_reset', - 'amdsmi_dev_memory_partition_set', 'amdsmi_dev_perf_level_t', + 'amdsmi_ddr_bw_metrics_t', 'amdsmi_dev_perf_level_t', 'amdsmi_dimm_power_t', 'amdsmi_dimm_thermal_t', 'amdsmi_dpm_level_t', 'amdsmi_driver_info_t', 'amdsmi_engine_usage_t', 'amdsmi_error_count_t', @@ -2300,6 +2491,7 @@ __all__ = \ 'amdsmi_get_gpu_available_counters', 'amdsmi_get_gpu_bad_page_info', 'amdsmi_get_gpu_bdf_id', 'amdsmi_get_gpu_board_info', 'amdsmi_get_gpu_cache_info', + 'amdsmi_get_gpu_compute_partition', 'amdsmi_get_gpu_compute_process_gpus', 'amdsmi_get_gpu_compute_process_info', 'amdsmi_get_gpu_compute_process_info_by_pid', @@ -2308,9 +2500,62 @@ __all__ = \ '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_id', 'amdsmi_get_gpu_memory_partition', + 'amdsmi_get_gpu_memory_reserved_pages', 'amdsmi_get_gpu_memory_total', 'amdsmi_get_gpu_memory_usage', - 'amdsmi_get_gpu_metrics_info', + 'amdsmi_get_gpu_metrics_avg_dclock0_frequency', + 'amdsmi_get_gpu_metrics_avg_dclock1_frequency', + 'amdsmi_get_gpu_metrics_avg_gfx_activity', + 'amdsmi_get_gpu_metrics_avg_gfx_clock_frequency', + 'amdsmi_get_gpu_metrics_avg_mm_activity', + 'amdsmi_get_gpu_metrics_avg_soc_clock_frequency', + 'amdsmi_get_gpu_metrics_avg_socket_power', + 'amdsmi_get_gpu_metrics_avg_uclock_frequency', + 'amdsmi_get_gpu_metrics_avg_umc_activity', + 'amdsmi_get_gpu_metrics_avg_vclock0_frequency', + 'amdsmi_get_gpu_metrics_avg_vclock1_frequency', + 'amdsmi_get_gpu_metrics_curr_dclk0', + 'amdsmi_get_gpu_metrics_curr_dclk1', + 'amdsmi_get_gpu_metrics_curr_fan_speed', + 'amdsmi_get_gpu_metrics_curr_gfxclk', + 'amdsmi_get_gpu_metrics_curr_socclk', + 'amdsmi_get_gpu_metrics_curr_socket_power', + 'amdsmi_get_gpu_metrics_curr_uclk', + 'amdsmi_get_gpu_metrics_curr_vclk0', + 'amdsmi_get_gpu_metrics_curr_vclk1', + 'amdsmi_get_gpu_metrics_energy_acc', + 'amdsmi_get_gpu_metrics_firmware_timestamp', + 'amdsmi_get_gpu_metrics_gfx_activity_acc', + 'amdsmi_get_gpu_metrics_gfxclk_lock_status', + 'amdsmi_get_gpu_metrics_header_info', + 'amdsmi_get_gpu_metrics_indep_throttle_status', + 'amdsmi_get_gpu_metrics_info', 'amdsmi_get_gpu_metrics_log', + 'amdsmi_get_gpu_metrics_mem_activity_acc', + 'amdsmi_get_gpu_metrics_pcie_bandwidth_acc', + 'amdsmi_get_gpu_metrics_pcie_bandwidth_inst', + 'amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc', + 'amdsmi_get_gpu_metrics_pcie_link_speed', + 'amdsmi_get_gpu_metrics_pcie_link_width', + 'amdsmi_get_gpu_metrics_pcie_replay_count_acc', + 'amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc', + 'amdsmi_get_gpu_metrics_system_clock_counter', + 'amdsmi_get_gpu_metrics_temp_edge', + 'amdsmi_get_gpu_metrics_temp_hbm', + 'amdsmi_get_gpu_metrics_temp_hotspot', + 'amdsmi_get_gpu_metrics_temp_mem', + 'amdsmi_get_gpu_metrics_temp_vrgfx', + 'amdsmi_get_gpu_metrics_temp_vrmem', + 'amdsmi_get_gpu_metrics_temp_vrsoc', + 'amdsmi_get_gpu_metrics_throttle_status', + 'amdsmi_get_gpu_metrics_vcn_activity', + 'amdsmi_get_gpu_metrics_volt_gfx', + 'amdsmi_get_gpu_metrics_volt_mem', + 'amdsmi_get_gpu_metrics_volt_soc', + 'amdsmi_get_gpu_metrics_xcd_counter', + 'amdsmi_get_gpu_metrics_xgmi_link_speed', + 'amdsmi_get_gpu_metrics_xgmi_link_width', + 'amdsmi_get_gpu_metrics_xgmi_read_data', + 'amdsmi_get_gpu_metrics_xgmi_write_data', 'amdsmi_get_gpu_od_volt_curve_regions', 'amdsmi_get_gpu_od_volt_info', 'amdsmi_get_gpu_overdrive_level', 'amdsmi_get_gpu_pci_bandwidth', @@ -2355,9 +2600,10 @@ __all__ = \ 'amdsmi_process_info_t', 'amdsmi_processor_handle', 'amdsmi_range_t', 'amdsmi_ras_err_state_t', 'amdsmi_ras_feature_t', 'amdsmi_reset_gpu', - 'amdsmi_reset_gpu_fan', 'amdsmi_reset_gpu_xgmi_error', - 'amdsmi_retired_page_record_t', 'amdsmi_set_clk_freq', - 'amdsmi_set_cpu_core_boostlimit', + 'amdsmi_reset_gpu_compute_partition', 'amdsmi_reset_gpu_fan', + 'amdsmi_reset_gpu_memory_partition', + 'amdsmi_reset_gpu_xgmi_error', 'amdsmi_retired_page_record_t', + 'amdsmi_set_clk_freq', 'amdsmi_set_cpu_core_boostlimit', 'amdsmi_set_cpu_df_pstate_range', 'amdsmi_set_cpu_gmi3_link_width_range', 'amdsmi_set_cpu_pcie_link_rate', @@ -2365,11 +2611,11 @@ __all__ = \ 'amdsmi_set_cpu_socket_boostlimit', 'amdsmi_set_cpu_socket_lclk_dpm_level', 'amdsmi_set_cpu_socket_power_cap', 'amdsmi_set_cpu_xgmi_width', - 'amdsmi_set_gpu_clk_range', + 'amdsmi_set_gpu_clk_range', 'amdsmi_set_gpu_compute_partition', '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_pci_bandwidth', + 'amdsmi_set_gpu_fan_speed', 'amdsmi_set_gpu_memory_partition', + 'amdsmi_set_gpu_od_clk_info', 'amdsmi_set_gpu_od_volt_info', + 'amdsmi_set_gpu_overdrive_level', 'amdsmi_set_gpu_pci_bandwidth', 'amdsmi_set_gpu_perf_determinism_mode', 'amdsmi_set_gpu_perf_level', 'amdsmi_set_gpu_power_profile', 'amdsmi_set_power_cap', 'amdsmi_shut_down', @@ -2385,7 +2631,11 @@ __all__ = \ 'amdsmi_voltage_type_t', 'amdsmi_vram_info_t', 'amdsmi_vram_type_t', 'amdsmi_vram_usage_t', 'amdsmi_vram_vendor_type_t', 'amdsmi_xgmi_info_t', - 'amdsmi_xgmi_status_t', 'processor_type_t', 'size_t', + 'amdsmi_xgmi_status_t', 'gpu_metric_curr_dclk0_t', + 'gpu_metric_curr_gfxclk_t', 'gpu_metric_curr_socclk_t', + 'gpu_metric_curr_vclk0_t', 'gpu_metric_temp_hbm_t', + 'gpu_metric_vcn_activity_t', 'gpu_metric_xgmi_read_data_acc_t', + 'gpu_metric_xgmi_write_data_acc_t', 'processor_type_t', 'size_t', 'struct_amd_metrics_table_header_t', 'struct_amdsmi_asic_info_t', 'struct_amdsmi_board_info_t', 'struct_amdsmi_clk_info_t', 'struct_amdsmi_counter_value_t', 'struct_amdsmi_ddr_bw_metrics_t', diff --git a/src/amd_smi/amd_smi.cc b/src/amd_smi/amd_smi.cc index 4415783f93..c69bc63f85 100644 --- a/src/amd_smi/amd_smi.cc +++ b/src/amd_smi/amd_smi.cc @@ -1019,7 +1019,7 @@ amdsmi_is_P2P_accessible(amdsmi_processor_handle processor_handle_src, // Compute Partition functions amdsmi_status_t -amdsmi_dev_compute_partition_get(amdsmi_processor_handle processor_handle, +amdsmi_get_gpu_compute_partition(amdsmi_processor_handle processor_handle, char *compute_partition, uint32_t len) { AMDSMI_CHECK_INIT(); return rsmi_wrapper(rsmi_dev_compute_partition_get, processor_handle, @@ -1027,7 +1027,7 @@ amdsmi_dev_compute_partition_get(amdsmi_processor_handle processor_handle, } amdsmi_status_t -amdsmi_dev_compute_partition_set(amdsmi_processor_handle processor_handle, +amdsmi_set_gpu_compute_partition(amdsmi_processor_handle processor_handle, amdsmi_compute_partition_type_t compute_partition) { AMDSMI_CHECK_INIT(); return rsmi_wrapper(rsmi_dev_compute_partition_set, processor_handle, @@ -1035,14 +1035,14 @@ amdsmi_dev_compute_partition_set(amdsmi_processor_handle processor_handle, } amdsmi_status_t -amdsmi_dev_compute_partition_reset(amdsmi_processor_handle processor_handle) { +amdsmi_reset_gpu_compute_partition(amdsmi_processor_handle processor_handle) { AMDSMI_CHECK_INIT(); return rsmi_wrapper(rsmi_dev_compute_partition_reset, processor_handle); } // Memory Partition functions amdsmi_status_t -amdsmi_dev_memory_partition_get(amdsmi_processor_handle processor_handle, +amdsmi_get_gpu_memory_partition(amdsmi_processor_handle processor_handle, char *memory_partition, uint32_t len) { AMDSMI_CHECK_INIT(); return rsmi_wrapper(rsmi_dev_memory_partition_get, processor_handle, @@ -1050,7 +1050,7 @@ amdsmi_dev_memory_partition_get(amdsmi_processor_handle processor_handle, } amdsmi_status_t -amdsmi_dev_memory_partition_set(amdsmi_processor_handle processor_handle, +amdsmi_set_gpu_memory_partition(amdsmi_processor_handle processor_handle, amdsmi_memory_partition_type_t memory_partition) { AMDSMI_CHECK_INIT(); return rsmi_wrapper(rsmi_dev_memory_partition_set, processor_handle, @@ -1058,7 +1058,7 @@ amdsmi_dev_memory_partition_set(amdsmi_processor_handle processor_handle, } amdsmi_status_t -amdsmi_dev_memory_partition_reset(amdsmi_processor_handle processor_handle) { +amdsmi_reset_gpu_memory_partition(amdsmi_processor_handle processor_handle) { AMDSMI_CHECK_INIT(); return rsmi_wrapper(rsmi_dev_memory_partition_reset, processor_handle); } @@ -2155,6 +2155,589 @@ amdsmi_status_t amdsmi_get_processor_handle_from_bdf(amdsmi_bdf_t bdf, return AMDSMI_STATUS_API_FAILED; } +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_hotspot(amdsmi_processor_handle processor_handle, + uint16_t *hotspot_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_temp_hotspot_get, processor_handle, + hotspot_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_mem(amdsmi_processor_handle processor_handle, + uint16_t *mem_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_temp_mem_get, processor_handle, + mem_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_vrsoc(amdsmi_processor_handle processor_handle, + uint16_t *vrsoc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_temp_vrsoc_get, processor_handle, + vrsoc_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_socket_power(amdsmi_processor_handle processor_handle, + uint16_t *socket_power_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_curr_socket_power_get, processor_handle, + socket_power_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_gfx_activity(amdsmi_processor_handle processor_handle, + uint16_t *gfx_activity_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_gfx_activity_get, processor_handle, + gfx_activity_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_umc_activity(amdsmi_processor_handle processor_handle, + uint16_t *umc_activity_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_umc_activity_get, processor_handle, + umc_activity_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_energy_acc(amdsmi_processor_handle processor_handle, + uint64_t *energy_acc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_energy_acc_get, processor_handle, + energy_acc_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_system_clock_counter(amdsmi_processor_handle processor_handle, + uint64_t *system_clock_counter_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_system_clock_counter_get, processor_handle, + system_clock_counter_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_firmware_timestamp(amdsmi_processor_handle processor_handle, + uint64_t *firmware_timestamp_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_firmware_timestamp_get, processor_handle, + firmware_timestamp_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_throttle_status(amdsmi_processor_handle processor_handle, + uint32_t *throttle_status_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_throttle_status_get, processor_handle, + throttle_status_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_link_width(amdsmi_processor_handle processor_handle, + uint16_t *pcie_link_width_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_pcie_link_width_get, processor_handle, + pcie_link_width_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_link_speed(amdsmi_processor_handle processor_handle, + uint16_t *pcie_link_speed_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_pcie_link_speed_get, processor_handle, + pcie_link_speed_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_link_width(amdsmi_processor_handle processor_handle, + uint16_t *xgmi_link_width_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_xgmi_link_width_get, processor_handle, + xgmi_link_width_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_link_speed(amdsmi_processor_handle processor_handle, + uint16_t *xgmi_link_speed_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_xgmi_link_speed_get, processor_handle, + xgmi_link_speed_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_gfxclk_lock_status(amdsmi_processor_handle processor_handle, + uint32_t *gfxclk_lock_status_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_gfxclk_lock_status_get, processor_handle, + gfxclk_lock_status_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_gfx_activity_acc(amdsmi_processor_handle processor_handle, + uint32_t *gfx_activity_acc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_gfx_activity_acc_get, processor_handle, + gfx_activity_acc_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_mem_activity_acc(amdsmi_processor_handle processor_handle, + uint32_t *mem_activity_acc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_mem_activity_acc_get, processor_handle, + mem_activity_acc_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_bandwidth_acc(amdsmi_processor_handle processor_handle, + uint64_t *pcie_bandwidth_acc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_pcie_bandwidth_acc_get, processor_handle, + pcie_bandwidth_acc_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_bandwidth_inst(amdsmi_processor_handle processor_handle, + uint64_t *pcie_bandwidth_inst_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_pcie_bandwidth_inst_get, processor_handle, + pcie_bandwidth_inst_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc(amdsmi_processor_handle processor_handle, + uint64_t *pcie_count_acc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_pcie_l0_recov_count_acc_get, processor_handle, + pcie_count_acc_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_replay_count_acc(amdsmi_processor_handle processor_handle, + uint64_t *pcie_count_acc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_pcie_replay_count_acc_get, processor_handle, + pcie_count_acc_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc(amdsmi_processor_handle processor_handle, + uint64_t *pcie_count_acc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_pcie_replay_rover_count_acc_get, processor_handle, + pcie_count_acc_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_uclk(amdsmi_processor_handle processor_handle, + uint16_t *uclk_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_curr_uclk_get, processor_handle, + uclk_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_hbm(amdsmi_processor_handle processor_handle, + gpu_metric_temp_hbm_t *temp_hbm_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_temp_hbm_get, processor_handle, + reinterpret_cast(temp_hbm_value)); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_vcn_activity(amdsmi_processor_handle processor_handle, + gpu_metric_vcn_activity_t *vcn_activity_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_vcn_activity_get, processor_handle, + reinterpret_cast(vcn_activity_value)); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_read_data(amdsmi_processor_handle processor_handle, + gpu_metric_xgmi_read_data_acc_t *xgmi_read_data_acc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_xgmi_read_data_get, processor_handle, + reinterpret_cast(xgmi_read_data_acc_value)); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_xgmi_write_data(amdsmi_processor_handle processor_handle, + gpu_metric_xgmi_write_data_acc_t *xgmi_write_data_acc_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_xgmi_write_data_get, processor_handle, + reinterpret_cast(xgmi_write_data_acc_value)); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_gfxclk(amdsmi_processor_handle processor_handle, + gpu_metric_curr_gfxclk_t *curr_gfxclk_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_curr_gfxclk_get, processor_handle, + reinterpret_cast(curr_gfxclk_value)); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_socclk(amdsmi_processor_handle processor_handle, + gpu_metric_curr_socclk_t *current_socclk_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_curr_socclk_get, processor_handle, + reinterpret_cast(current_socclk_value)); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_vclk0(amdsmi_processor_handle processor_handle, + gpu_metric_curr_vclk0_t *current_vclk_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_curr_vclk0_get, processor_handle, + reinterpret_cast(current_vclk_value)); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_dclk0(amdsmi_processor_handle processor_handle, + gpu_metric_curr_dclk0_t *current_dclk_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_curr_dclk0_get, processor_handle, + reinterpret_cast(current_dclk_value)); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_edge(amdsmi_processor_handle processor_handle, + uint16_t *edge_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_temp_edge_get, processor_handle, + edge_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_vrgfx(amdsmi_processor_handle processor_handle, + uint16_t *vrgfx_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_temp_vrgfx_get, processor_handle, + vrgfx_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_temp_vrmem(amdsmi_processor_handle processor_handle, + uint16_t *vrmem_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_temp_vrmem_get, processor_handle, + vrmem_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_mm_activity(amdsmi_processor_handle processor_handle, + uint16_t *mm_activity_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_mm_activity_get, processor_handle, + mm_activity_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_vclk1(amdsmi_processor_handle processor_handle, + uint16_t *current_vclk_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_curr_vclk1_get, processor_handle, + current_vclk_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_dclk1(amdsmi_processor_handle processor_handle, + uint16_t *current_dclk_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_curr_dclk1_get, processor_handle, + current_dclk_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_indep_throttle_status(amdsmi_processor_handle processor_handle, + uint64_t *throttle_status_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_indep_throttle_status_get, processor_handle, + throttle_status_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_socket_power(amdsmi_processor_handle processor_handle, + uint16_t *socket_power_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_socket_power_get, processor_handle, + socket_power_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_curr_fan_speed(amdsmi_processor_handle processor_handle, + uint16_t *fan_speed_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_curr_fan_speed_get, processor_handle, + fan_speed_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_gfx_clock_frequency(amdsmi_processor_handle processor_handle, + uint16_t *clock_frequency_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_gfx_clock_frequency_get, processor_handle, + clock_frequency_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_soc_clock_frequency(amdsmi_processor_handle processor_handle, + uint16_t *clock_frequency_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_soc_clock_frequency_get, processor_handle, + clock_frequency_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_uclock_frequency(amdsmi_processor_handle processor_handle, + uint16_t *clock_frequency_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_uclock_frequency_get, processor_handle, + clock_frequency_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_vclock0_frequency(amdsmi_processor_handle processor_handle, + uint16_t *clock_frequency_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_vclock0_frequency_get, processor_handle, + clock_frequency_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_dclock0_frequency(amdsmi_processor_handle processor_handle, + uint16_t *clock_frequency_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_dclock0_frequency_get, processor_handle, + clock_frequency_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_vclock1_frequency(amdsmi_processor_handle processor_handle, + uint16_t *clock_frequency_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_vclock1_frequency_get, processor_handle, + clock_frequency_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_avg_dclock1_frequency(amdsmi_processor_handle processor_handle, + uint16_t *clock_frequency_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_avg_dclock1_frequency_get, processor_handle, + clock_frequency_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_volt_soc(amdsmi_processor_handle processor_handle, + uint16_t *voltage_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_volt_soc_get, processor_handle, + voltage_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_volt_gfx(amdsmi_processor_handle processor_handle, + uint16_t *voltage_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_volt_gfx_get, processor_handle, + voltage_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_volt_mem(amdsmi_processor_handle processor_handle, + uint16_t *voltage_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_volt_mem_get, processor_handle, + voltage_value); +} + + +amdsmi_status_t +amdsmi_get_gpu_metrics_header_info(amdsmi_processor_handle processor_handle, + amd_metrics_table_header_t *header_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_header_info_get, processor_handle, + reinterpret_cast(header_value)); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_xcd_counter(amdsmi_processor_handle processor_handle, + uint16_t *xcd_counter_value) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_xcd_counter_get, processor_handle, + xcd_counter_value); +} + +amdsmi_status_t +amdsmi_get_gpu_metrics_log(amdsmi_processor_handle processor_handle) +{ + AMDSMI_CHECK_INIT(); + // nullptr api supported + + return rsmi_wrapper(rsmi_dev_metrics_log_get, processor_handle); +} + + #ifdef ENABLE_ESMI_LIB amdsmi_status_t amdsmi_get_cpu_hsmp_proto_ver(amdsmi_cpusocket_handle socket_handle, uint32_t *proto_ver) diff --git a/tests/amd_smi_test/functional/gpu_metrics_read.cc b/tests/amd_smi_test/functional/gpu_metrics_read.cc index a5e69fdedd..571bb30585 100644 --- a/tests/amd_smi_test/functional/gpu_metrics_read.cc +++ b/tests/amd_smi_test/functional/gpu_metrics_read.cc @@ -100,7 +100,7 @@ void TestGpuMetricsRead::Run(void) { PrintDeviceHeader(processor_handles_[i]); IF_VERB(STANDARD) { - std::cout << "\t**GPU METRICS:\n"; + std::cout << "\t**GPU METRICS: Using static struct (Backwards Compatibility):\n"; } amdsmi_gpu_metrics_t smu; err = amdsmi_get_gpu_metrics_info(processor_handles_[i], &smu); @@ -191,4 +191,381 @@ void TestGpuMetricsRead::Run(void) { err = amdsmi_get_gpu_metrics_info(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } + + + // + auto val_ui16 = uint16_t(0); + auto val_ui32 = uint32_t(0); + auto val_ui64 = uint64_t(0); + auto status_code(amdsmi_status_t::AMDSMI_STATUS_SUCCESS); + for (uint32_t i = 0; i < num_monitor_devs(); ++i) { + PrintDeviceHeader(processor_handles_[i]); + + auto temp_edge_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_temp_edge(processor_handles_[i], &temp_edge_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_hotspot_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_temp_hotspot(processor_handles_[i], &temp_hotspot_value); + CHK_ERR_ASRT(status_code); + + auto temp_mem_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_temp_mem(processor_handles_[i], &temp_mem_value); + CHK_ERR_ASRT(status_code); + + auto temp_vrgfx_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_temp_vrgfx(processor_handles_[i], &temp_vrgfx_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_vrsoc_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_temp_vrsoc(processor_handles_[i], &temp_vrsoc_value); + CHK_ERR_ASRT(status_code); + + auto temp_vrmem_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_temp_vrmem(processor_handles_[i], &temp_vrmem_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + gpu_metric_temp_hbm_t temp_hbm_values; + status_code = amdsmi_get_gpu_metrics_temp_hbm(processor_handles_[i], &temp_hbm_values); + CHK_ERR_ASRT(status_code); + + auto temp_curr_socket_power_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_curr_socket_power(processor_handles_[i], &temp_curr_socket_power_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_energy_accum_value = val_ui64; + status_code = amdsmi_get_gpu_metrics_energy_acc(processor_handles_[i], &temp_energy_accum_value); + CHK_ERR_ASRT(status_code); + + auto temp_avg_socket_power_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_socket_power(processor_handles_[i], &temp_avg_socket_power_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_avg_gfx_activity_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_gfx_activity(processor_handles_[i], &temp_avg_gfx_activity_value); + CHK_ERR_ASRT(status_code); + + auto temp_avg_umc_activity_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_umc_activity(processor_handles_[i], &temp_avg_umc_activity_value); + CHK_ERR_ASRT(status_code); + + auto temp_avg_mm_activity_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_mm_activity(processor_handles_[i], &temp_avg_mm_activity_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + gpu_metric_vcn_activity_t temp_vcn_values; + status_code = amdsmi_get_gpu_metrics_vcn_activity(processor_handles_[i], &temp_vcn_values); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_mem_activity_accum_value = val_ui32; + status_code = amdsmi_get_gpu_metrics_mem_activity_acc(processor_handles_[i], &temp_mem_activity_accum_value); + CHK_ERR_ASRT(status_code); + + auto temp_gfx_activity_accum_value = val_ui32; + status_code = amdsmi_get_gpu_metrics_gfx_activity_acc(processor_handles_[i], &temp_gfx_activity_accum_value); + CHK_ERR_ASRT(status_code); + + auto temp_avg_gfx_clock_freq_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_gfx_clock_frequency(processor_handles_[i], &temp_avg_gfx_clock_freq_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_avg_soc_clock_freq_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_soc_clock_frequency(processor_handles_[i], &temp_avg_soc_clock_freq_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_avg_uclock_freq_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_uclock_frequency(processor_handles_[i], &temp_avg_uclock_freq_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_avg_vclock0_freq_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_vclock0_frequency(processor_handles_[i], &temp_avg_vclock0_freq_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_avg_dclock0_freq_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_dclock0_frequency(processor_handles_[i], &temp_avg_dclock0_freq_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_avg_vclock1_freq_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_vclock1_frequency(processor_handles_[i], &temp_avg_vclock1_freq_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_avg_dclock1_freq_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_avg_dclock1_frequency(processor_handles_[i], &temp_avg_dclock1_freq_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_curr_vclk1_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_curr_vclk1(processor_handles_[i], &temp_curr_vclk1_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_curr_dclk1_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_curr_dclk1(processor_handles_[i], &temp_curr_dclk1_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_curr_uclk_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_curr_uclk(processor_handles_[i], &temp_curr_uclk_value); + CHK_ERR_ASRT(status_code); + + gpu_metric_curr_dclk0_t temp_curr_dclk0_values; + status_code = amdsmi_get_gpu_metrics_curr_dclk0(processor_handles_[i], &temp_curr_dclk0_values); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + gpu_metric_curr_gfxclk_t temp_curr_gfxclk_values; + status_code = amdsmi_get_gpu_metrics_curr_gfxclk(processor_handles_[i], &temp_curr_gfxclk_values); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + gpu_metric_curr_socclk_t temp_curr_socclk_values; + status_code = amdsmi_get_gpu_metrics_curr_socclk(processor_handles_[i], &temp_curr_socclk_values); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + gpu_metric_curr_vclk0_t temp_curr_vclk0_values; + status_code = amdsmi_get_gpu_metrics_curr_vclk0(processor_handles_[i], &temp_curr_vclk0_values); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_indep_throttle_status_value = val_ui64; + status_code = amdsmi_get_gpu_metrics_indep_throttle_status(processor_handles_[i], &temp_indep_throttle_status_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_throttle_status_value = val_ui32; + status_code = amdsmi_get_gpu_metrics_throttle_status(processor_handles_[i], &temp_throttle_status_value); + CHK_ERR_ASRT(status_code); + + auto temp_gfxclk_lock_status_value = val_ui32; + status_code = amdsmi_get_gpu_metrics_gfxclk_lock_status(processor_handles_[i], &temp_gfxclk_lock_status_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_curr_fan_speed_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_curr_fan_speed(processor_handles_[i], &temp_curr_fan_speed_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_pcie_link_width_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_pcie_link_width(processor_handles_[i], &temp_pcie_link_width_value); + CHK_ERR_ASRT(status_code); + + auto temp_pcie_link_speed_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_pcie_link_speed(processor_handles_[i], &temp_pcie_link_speed_value); + CHK_ERR_ASRT(status_code); + + auto temp_pcie_bandwidth_accum_value = val_ui64; + status_code = amdsmi_get_gpu_metrics_pcie_bandwidth_acc(processor_handles_[i], &temp_pcie_bandwidth_accum_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_pcie_bandwidth_inst_value = val_ui64; + status_code = amdsmi_get_gpu_metrics_pcie_bandwidth_inst(processor_handles_[i], &temp_pcie_bandwidth_inst_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_pcie_l0_recov_count_accum_value = val_ui64; + status_code = amdsmi_get_gpu_metrics_pcie_l0_recov_count_acc(processor_handles_[i], &temp_pcie_l0_recov_count_accum_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_pcie_replay_count_accum_value = val_ui64; + status_code = amdsmi_get_gpu_metrics_pcie_replay_count_acc(processor_handles_[i], &temp_pcie_replay_count_accum_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_pcie_replay_rover_count_accum_value = val_ui64; + status_code = amdsmi_get_gpu_metrics_pcie_replay_rover_count_acc(processor_handles_[i], &temp_pcie_replay_rover_count_accum_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_xgmi_link_width_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_xgmi_link_width(processor_handles_[i], &temp_xgmi_link_width_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_xgmi_link_speed_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_xgmi_link_speed(processor_handles_[i], &temp_xgmi_link_speed_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + gpu_metric_xgmi_read_data_acc_t temp_xgmi_read_values; + status_code = amdsmi_get_gpu_metrics_xgmi_read_data(processor_handles_[i], &temp_xgmi_read_values); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + gpu_metric_xgmi_write_data_acc_t temp_xgmi_write_values; + status_code = amdsmi_get_gpu_metrics_xgmi_write_data(processor_handles_[i], &temp_xgmi_write_values); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_voltage_soc_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_volt_soc(processor_handles_[i], &temp_voltage_soc_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_voltage_gfx_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_volt_gfx(processor_handles_[i], &temp_voltage_gfx_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_voltage_mem_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_volt_mem(processor_handles_[i], &temp_voltage_mem_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + auto temp_system_clock_counter_value = val_ui64; + status_code = amdsmi_get_gpu_metrics_system_clock_counter(processor_handles_[i], &temp_system_clock_counter_value); + CHK_ERR_ASRT(status_code); + + auto temp_firmware_timestamp_value = val_ui64; + status_code = amdsmi_get_gpu_metrics_firmware_timestamp(processor_handles_[i], &temp_firmware_timestamp_value); + CHK_ERR_ASRT(status_code); + + auto temp_xcd_counter_value = val_ui16; + status_code = amdsmi_get_gpu_metrics_xcd_counter(processor_handles_[i], &temp_xcd_counter_value); + if (status_code != AMDSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(status_code); + } + + IF_VERB(STANDARD) { + std::cout << "\n"; + std::cout << "\t[Temperature]" << "\n"; + std::cout << "\t -> temp_edge(): " << temp_edge_value << "\n"; + std::cout << "\t -> temp_hotspot(): " << temp_hotspot_value << "\n"; + std::cout << "\t -> temp_mem(): " << temp_mem_value << "\n"; + std::cout << "\t -> temp_vrgfx(): " << temp_vrgfx_value << "\n"; + std::cout << "\t -> temp_vrsoc(): " << temp_vrsoc_value << "\n"; + std::cout << "\t -> temp_vrmem(): " << temp_vrmem_value << "\n"; + std::cout << "\t -> temp_hbm(): " << temp_hbm_values << "\n"; + + std::cout << "\n"; + std::cout << "\t[Power/Energy]" << "\n"; + std::cout << "\t -> current_socket_power(): " << temp_curr_socket_power_value << "\n"; + std::cout << "\t -> energy_accum(): " << temp_energy_accum_value << "\n"; + std::cout << "\t -> average_socket_power(): " << temp_avg_socket_power_value << "\n"; + + std::cout << "\n"; + std::cout << "\t[Utilization]" << "\n"; + std::cout << "\t -> average_gfx_activity(): " << temp_avg_gfx_activity_value << "\n"; + std::cout << "\t -> average_umc_activity(): " << temp_avg_umc_activity_value << "\n"; + std::cout << "\t -> average_mm_activity(): " << temp_avg_mm_activity_value << "\n"; + std::cout << "\t -> vcn_activity(): " << temp_vcn_values << "\n"; + std::cout << "\t -> mem_activity_accum(): " << temp_mem_activity_accum_value << "\n"; + std::cout << "\t -> gfx_activity_accum(): " << temp_gfx_activity_accum_value << "\n"; + + std::cout << "\n"; + std::cout << "\t[Average Clock]" << "\n"; + std::cout << "\t -> average_gfx_clock_frequency(): " << temp_avg_gfx_clock_freq_value << "\n"; + std::cout << "\t -> average_soc_clock_frequency(): " << temp_avg_soc_clock_freq_value << "\n"; + std::cout << "\t -> average_uclock_frequency(): " << temp_avg_uclock_freq_value << "\n"; + std::cout << "\t -> average_vclock0_frequency(): " << temp_avg_vclock0_freq_value << "\n"; + std::cout << "\t -> average_dclock0_frequency(): " << temp_avg_dclock0_freq_value << "\n"; + std::cout << "\t -> average_vclock1_frequency(): " << temp_avg_vclock1_freq_value << "\n"; + std::cout << "\t -> average_dclock1_frequency(): " << temp_avg_dclock1_freq_value << "\n"; + + std::cout << "\n"; + std::cout << "\t[Current Clock]" << "\n"; + std::cout << "\t -> current_vclock1(): " << temp_curr_vclk1_value << "\n"; + std::cout << "\t -> current_dclock1(): " << temp_curr_dclk1_value << "\n"; + std::cout << "\t -> current_uclock(): " << temp_curr_uclk_value << "\n"; + std::cout << "\t -> current_dclk0(): " << temp_curr_dclk0_values << "\n"; + std::cout << "\t -> current_gfxclk(): " << temp_curr_gfxclk_values << "\n"; + std::cout << "\t -> current_soc_clock(): " << temp_curr_socclk_values << "\n"; + std::cout << "\t -> current_vclk0(): " << temp_curr_vclk0_values << "\n"; + + std::cout << "\n"; + std::cout << "\t[Throttle]" << "\n"; + std::cout << "\t -> indep_throttle_status(): " << temp_indep_throttle_status_value << "\n"; + std::cout << "\t -> throttle_status(): " << temp_throttle_status_value << "\n"; + + std::cout << "\n"; + std::cout << "\t[Gfx Clock Lock]" << "\n"; + std::cout << "\t -> gfxclk_lock_status(): " << temp_gfxclk_lock_status_value << "\n"; + + std::cout << "\n"; + std::cout << "\t[Current Fan Speed]" << "\n"; + std::cout << "\t -> current_fan_speed(): " << temp_curr_fan_speed_value << "\n"; + + std::cout << "\n"; + std::cout << "\t[Link/Bandwidth/Speed]" << "\n"; + std::cout << "\t -> pcie_link_width(): " << temp_pcie_link_width_value << "\n"; + std::cout << "\t -> pcie_link_speed(): " << temp_pcie_link_speed_value << "\n"; + std::cout << "\t -> pcie_bandwidth_accum(): " << temp_pcie_bandwidth_accum_value << "\n"; + std::cout << "\t -> pcie_bandwidth_inst(): " << temp_pcie_bandwidth_inst_value << "\n"; + std::cout << "\t -> pcie_l0_recov_count_accum(): " << temp_pcie_l0_recov_count_accum_value << "\n"; + std::cout << "\t -> pcie_replay_count_accum(): " << temp_pcie_replay_count_accum_value << "\n"; + std::cout << "\t -> pcie_replay_rollover_count_accum(): " << temp_pcie_replay_rover_count_accum_value << "\n"; + std::cout << "\t -> xgmi_link_width(): " << temp_xgmi_link_width_value << "\n"; + std::cout << "\t -> xgmi_link_speed(): " << temp_xgmi_link_speed_value << "\n"; + std::cout << "\t -> xgmi_read_data(): " << temp_xgmi_read_values << "\n"; + std::cout << "\t -> xgmi_write_data(): " << temp_xgmi_write_values << "\n"; + + std::cout << "\n"; + std::cout << "\t[Voltage]" << "\n"; + std::cout << "\t -> voltage_soc(): " << temp_voltage_soc_value << "\n"; + std::cout << "\t -> voltage_gfx(): " << temp_voltage_gfx_value << "\n"; + std::cout << "\t -> voltage_mem(): " << temp_voltage_mem_value << "\n"; + + std::cout << "\n"; + std::cout << "\t[Timestamp]" << "\n"; + std::cout << "\t -> system_clock_counter(): " << temp_system_clock_counter_value << "\n"; + std::cout << "\t -> firmware_timestamp(): " << temp_firmware_timestamp_value << "\n"; + + std::cout << "\n"; + std::cout << "\t[XCD CounterVoltage]" << "\n"; + std::cout << "\t -> xcd_counter(): " << temp_xcd_counter_value << "\n"; + std::cout << "\n\n"; + } + } + } diff --git a/tests/amd_smi_test/functional/temp_read.cc b/tests/amd_smi_test/functional/temp_read.cc index ded598910a..fea3b4e5d0 100755 --- a/tests/amd_smi_test/functional/temp_read.cc +++ b/tests/amd_smi_test/functional/temp_read.cc @@ -108,7 +108,7 @@ void TestTempRead::Run(void) { return; } - uint32_t type; + uint32_t type(0); for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { PrintDeviceHeader(processor_handles_[i]);