diff --git a/include/rocm_smi/rocm_smi.h b/include/rocm_smi/rocm_smi.h index bd506f9ef2..120669d7cf 100755 --- a/include/rocm_smi/rocm_smi.h +++ b/include/rocm_smi/rocm_smi.h @@ -1134,7 +1134,7 @@ typedef struct { uint32_t cu_occupancy; //!< Compute Unit usage in percent } rsmi_process_info_t; -//! CU occupancy invalidation value for the GFX revisions not providing cu_occupancy debugfs method +//! CU occupancy invalidation value for the GFX revisions not providing cu_occupancy debugfs method #define CU_OCCUPANCY_INVALID 0xFFFFFFFF /** @@ -1637,7 +1637,7 @@ rsmi_status_t rsmi_dev_xgmi_physical_id_get(uint32_t dv_ind, uint16_t *id); * @param[inout] gpu_id a pointer to uint64_t to which the KFD gpu id will be * written. If the @p guid parameter is nullptr, this function will return * ::RSMI_STATUS_INVALID_ARGS. If the GPU ID is not supported with - * the device index queried, gpu_id will return MAX UINT64 value an + * the device index queried, gpu_id will return MAX UINT64 value an * arguments and ::RSMI_STATUS_NOT_SUPPORTED as a response. * * @retval ::RSMI_STATUS_SUCCESS call was successful @@ -1872,7 +1872,7 @@ rsmi_status_t rsmi_dev_pci_bandwidth_set(uint32_t dv_ind, uint64_t bw_bitmask); * backwards compatibility, which looks at both average and current power * values. Whereas ::rsmi_dev_power_ave_get only looks for average power * consumption. Newer ASICs will support current power only. - * + * * @param[in] dv_ind a device index * * @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0. @@ -4489,1054 +4489,6 @@ rsmi_status_t rsmi_event_notification_stop(uint32_t dv_ind); * @{ */ -/** - * Metric multi-valued counter types - */ -typedef uint16_t GPUMetricTempHbm_t[RSMI_NUM_HBM_INSTANCES]; -typedef uint16_t GPUMetricVcnActivity_t[RSMI_MAX_NUM_VCNS]; -typedef uint16_t GPUMetricJpegActivity_t[RSMI_MAX_NUM_JPEG_ENGS]; -typedef uint64_t GPUMetricXgmiReadDataAcc_t[RSMI_MAX_NUM_XGMI_LINKS]; -typedef uint64_t GPUMetricXgmiWriteDataAcc_t[RSMI_MAX_NUM_XGMI_LINKS]; -typedef uint16_t GPUMetricCurrGfxClk_t[RSMI_MAX_NUM_GFX_CLKS]; -typedef uint16_t GPUMetricCurrSocClk_t[RSMI_MAX_NUM_CLKS]; -typedef uint16_t GPUMetricCurrVClk0_t[RSMI_MAX_NUM_CLKS]; -typedef uint16_t GPUMetricCurrDClk0_t[RSMI_MAX_NUM_CLKS]; - - -/****** - * Metric single-valued counter types - */ - -/** - * @brief Get the 'temp_hotspot' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'temp_hotspot' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] hotspot_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_temp_hotspot_get(uint32_t dv_ind, uint16_t* hotspot_value); - -/** - * @brief Get the 'temp_mem' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'temp_mem' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] mem_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_temp_mem_get(uint32_t dv_ind, uint16_t* mem_value); - -/** - * @brief Get the 'temp_vrsoc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'temp_vrsoc' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] vrsoc_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_temp_vrsoc_get(uint32_t dv_ind, uint16_t* vrsoc_value); - -/** - * @brief Get the 'curr_socket_power' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'socket_power' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] socket_power_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_curr_socket_power_get(uint32_t dv_ind, uint16_t* socket_power_value); - -/** - * @brief Get the 'avg_gfx_activity' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'gfx_activity' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] gfx_activity_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_gfx_activity_get(uint32_t dv_ind, uint16_t* gfx_activity_value); - -/** - * @brief Get the 'avg_umc_activity' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'umc_activity' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] umc_activity_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_umc_activity_get(uint32_t dv_ind, uint16_t* umc_activity_value); - -/** - * @brief Get the 'energy_acc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'energy_acc' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] energy_acc_value a pointer to uint64_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_energy_acc_get(uint32_t dv_ind, uint64_t* energy_acc_value); - -/** - * @brief Get the 'system_clock_counter' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'system_clock_counter' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] system_clock_counter_value a pointer to uint64_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_system_clock_counter_get(uint32_t dv_ind, uint64_t* system_clock_counter_value); - -/** - * @brief Get the 'firmware_timestamp' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'firmware_timestamp' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] firmware_timestamp_value a pointer to uint64_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_firmware_timestamp_get(uint32_t dv_ind, uint64_t* firmware_timestamp_value); - -/** - * @brief Get the 'throttle_status' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint32_t in which - * the 'throttle_status' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] throttle_status_value a pointer to uint32_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_throttle_status_get(uint32_t dv_ind, uint32_t* throttle_status_value); - -/** - * @brief Get the 'pcie_link_width' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'pcie_link_width' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] pcie_link_width_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_pcie_link_width_get(uint32_t dv_ind, uint16_t* pcie_link_width_value); - -/** - * @brief Get the 'pcie_link_speed' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'pcie_link_speed' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] pcie_link_speed_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_pcie_link_speed_get(uint32_t dv_ind, uint16_t* pcie_link_speed_value); - -/** - * @brief Get the 'xgmi_link_width' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'xgmi_link_width' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] xgmi_link_width_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_xgmi_link_width_get(uint32_t dv_ind, uint16_t* xgmi_link_width_value); - -/** - * @brief Get the 'xgmi_link_speed' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'xgmi_link_speed' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] xgmi_link_speed_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_xgmi_link_speed_get(uint32_t dv_ind, uint16_t* xgmi_link_speed_value); - -/** - * @brief Get the 'gfxclk_lock_status' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint32_t in which - * the 'gfxclk_lock_status' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] gfxclk_lock_status_value a pointer to uint32_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_gfxclk_lock_status_get(uint32_t dv_ind, uint32_t* gfxclk_lock_status_value); - -/** - * @brief Get the 'gfx_activity_acc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint32_t in which - * the 'gfx_activity_acc' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] gfx_activity_acc_value a pointer to uint32_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_gfx_activity_acc_get(uint32_t dv_ind, uint32_t* gfx_activity_acc_value); - -/** - * @brief Get the 'mem_activity_acc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint32_t in which - * the 'mem_activity_acc' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] mem_activity_acc_value a pointer to uint32_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_mem_activity_acc_get(uint32_t dv_ind, uint32_t* mem_activity_acc_value); - -/** - * @brief Get the 'pcie_bandwidth_acc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'pcie_bandwidth_acc' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] pcie_bandwidth_acc_value a pointer to uint64_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_pcie_bandwidth_acc_get(uint32_t dv_ind, uint64_t* pcie_bandwidth_acc_value); - -/** - * @brief Get the 'pcie_bandwidth_inst' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'pcie_bandwidth_inst' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] pcie_bandwidth_inst_value a pointer to uint64_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_pcie_bandwidth_inst_get(uint32_t dv_ind, 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 device index @p dv_ind and a pointer to a uint64_t in which - * the 'pcie_l0_recov_count_acc' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] pcie_count_acc_value a pointer to uint64_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_pcie_l0_recov_count_acc_get(uint32_t dv_ind, uint64_t* pcie_count_acc_value); - -/** - * @brief Get the 'pcie_replay_count_acc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'pcie_replay_count_acc' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] pcie_count_acc_value a pointer to uint64_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_pcie_replay_count_acc_get(uint32_t dv_ind, uint64_t* pcie_count_acc_value); - -/** - * @brief Get the 'pcie_replay_rover_count_acc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'pcie_replay_rover_count_acc' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] pcie_count_acc_value a pointer to uint64_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_pcie_replay_rover_count_acc_get(uint32_t dv_ind, uint64_t* pcie_count_acc_value); - -/** - * @brief Get the 'pcie_nak_sent_count_acc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint32_t in which - * the 'mem_max_bandwidth_usage' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] pcie_nak_sent_count_acc_value a pointer to uint32_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_pcie_nak_sent_count_acc_get(uint32_t dv_ind, uint32_t* pcie_nak_sent_count_acc_value); - -/** - * @brief Get the 'pcie_nak_rcvd_count_acc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint32_t in which - * the 'mem_max_bandwidth_usage' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] pcie_nak_rcvd_count_acc_value a pointer to uint32_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_pcie_nak_rcvd_count_acc_get(uint32_t dv_ind, uint32_t* pcie_nak_rcvd_count_acc_value); - -/** - * @brief Get the 'curr_uclk' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'curr_uclk' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] uclk_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_curr_uclk_get(uint32_t dv_ind, 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 device index @p dv_ind and a pointer to a uint16_t in which - * the 'temp_hbm' will stored - * - * @param[in] dv_ind a device index - * - * @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 (RSMI_NUM_HBM_INSTANCES) - * element array (GPUMetricTempHbm_t) - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_temp_hbm_get(uint32_t dv_ind, GPUMetricTempHbm_t* temp_hbm_value); - -/** - * @brief Get the 'vcn_activity' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'vcn_activity' will stored - * - * @param[in] dv_ind a device index - * - * @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 (RSMI_MAX_NUM_VCNS) - * element array (GPUMetricVcnActivity_t) - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_vcn_activity_get(uint32_t dv_ind, GPUMetricVcnActivity_t* vcn_activity_value); - -/** - * @brief Get the 'jpeg_activity' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'vcn_activity' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] jpeg_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 32 (RSMI_MAX_NUM_JPEG_ENGS) - * element array (GPUMetricJpegActivity_t) - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_jpeg_activity_get(uint32_t dv_ind, GPUMetricJpegActivity_t* jpeg_activity_value); - -/** - * @brief Get the 'xgmi_read_data' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'xgmi_read_data' will stored - * - * @param[in] dv_ind a device index - * - * @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 (RSMI_MAX_NUM_XGMI_LINKS) - * element array (GPUMetricXgmiReadDataAcc_t) - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_xgmi_read_data_get(uint32_t dv_ind, GPUMetricXgmiReadDataAcc_t* xgmi_read_data_acc_value); - -/** - * @brief Get the 'xgmi_write_data' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'xgmi_write_data' will stored - * - * @param[in] dv_ind a device index - * - * @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 (RSMI_MAX_NUM_XGMI_LINKS) - * element array (GPUMetricXgmiWriteDataAcc_t) - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_xgmi_write_data_get(uint32_t dv_ind, GPUMetricXgmiWriteDataAcc_t* xgmi_write_data_acc_value); - -/** - * @brief Get the 'curr_gfxclk' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'curr_gfxclk' will stored - * - * @param[in] dv_ind a device index - * - * @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 (RSMI_MAX_NUM_GFX_CLKS) - * element array (GPUMetricCurrGfxClk_t) - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_curr_gfxclk_get(uint32_t dv_ind, GPUMetricCurrGfxClk_t* current_gfxclk_value); - -/** - * @brief Get the 'curr_socclk' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'curr_socclk' will stored - * - * @param[in] dv_ind a device index - * - * @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 (RSMI_MAX_NUM_CLKS) - * element array (GPUMetricCurrSocClk_t) - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_curr_socclk_get(uint32_t dv_ind, GPUMetricCurrSocClk_t* current_socclk_value); - -/** - * @brief Get the 'curr_vclk0' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'curr_vclk0' will stored - * - * @param[in] dv_ind a device index - * - * @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 (RSMI_MAX_NUM_CLKS) - * element array (GPUMetricCurrVClk0_t) - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_curr_vclk0_get(uint32_t dv_ind, GPUMetricCurrVClk0_t* current_vclk_value); - -/** - * @brief Get the 'curr_dclk0' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'curr_dclk0' will stored - * - * @param[in] dv_ind a device index - * - * @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 (RSMI_MAX_NUM_CLKS) - * element array (GPUMetricCurrDClk0_t) - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_curr_dclk0_get(uint32_t dv_ind, GPUMetricCurrDClk0_t* current_dclk_value); - -/** - * @brief Get the 'temp_edge' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'temp_edge' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] edge_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_temp_edge_get(uint32_t dv_ind, uint16_t* edge_value); - -/** - * @brief Get the 'temp_vrgfx' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'temp_vrgfx' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] vrgfx_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_temp_vrgfx_get(uint32_t dv_ind, uint16_t* vrgfx_value); - -/** - * @brief Get the 'temp_vrmem' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'temp_vrmem' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] vrmem_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_temp_vrmem_get(uint32_t dv_ind, uint16_t* vrmem_value); - -/** - * @brief Get the 'avg_mm_activity' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'avg_mm_activity' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] mm_activity_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_mm_activity_get(uint32_t dv_ind, uint16_t* mm_activity_value); - -/** - * @brief Get the 'curr_vclk1' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'curr_vclk1' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] current_vclk_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_curr_vclk1_get(uint32_t dv_ind, uint16_t* current_vclk_value); - -/** - * @brief Get the 'curr_dclk1' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'curr_dclk1' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] current_dclk_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_curr_dclk1_get(uint32_t dv_ind, uint16_t* current_dclk_value); - -/** - * @brief Get the 'indep_throttle_status' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint64_t in which - * the 'indep_throttle_status' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] throttle_status_value a pointer to uint64_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_indep_throttle_status_get(uint32_t dv_ind, uint64_t* throttle_status_value); - -/** - * @brief Get the 'avg_socket_power' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'avg_socket_power' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] socket_power_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_socket_power_get(uint32_t dv_ind, uint16_t* socket_power_value); - -/** - * @brief Get the 'curr_fan_speed' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'curr_fan_speed' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] fan_speed_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_curr_fan_speed_get(uint32_t dv_ind, uint16_t* fan_speed_value); - -/** - * @brief Get the 'avg_gfx_clock_frequency' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'avg_gfx_clock_frequency' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_gfx_clock_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value); - -/** - * @brief Get the 'avg_soc_clock_frequency' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'avg_soc_clock_frequency' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_soc_clock_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value); - -/** - * @brief Get the 'avg_uclock_frequency' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'avg_uclock_frequency' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_uclock_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value); - -/** - * @brief Get the 'avg_vclock0_frequency' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'avg_vclock0_frequency' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_vclock0_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value); - -/** - * @brief Get the 'avg_dclock0_frequency' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'avg_dclock0_frequency' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_dclock0_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value); - -/** - * @brief Get the 'avg_vclock1_frequency' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'avg_vclock1_frequency' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_vclock1_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value); - -/** - * @brief Get the 'avg_dclock1_frequency' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'avg_dclock1_frequency' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] clock_frequency_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_avg_dclock1_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value); - -/** - * @brief Get the 'volt_soc' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'volt_soc' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] voltage_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_volt_soc_get(uint32_t dv_ind, uint16_t* voltage_value); - -/** - * @brief Get the 'volt_gfx' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'volt_gfx' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] voltage_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_volt_gfx_get(uint32_t dv_ind, uint16_t* voltage_value); - -/** - * @brief Get the 'volt_mem' from the GPU metrics associated with the device - * - * @details Given a device index @p dv_ind and a pointer to a uint16_t in which - * the 'volt_mem' will stored - * - * @param[in] dv_ind a device index - * - * @param[inout] voltage_value a pointer to uint16_t to which the device gpu - * metric unit will be stored - * - * @retval ::RSMI_STATUS_SUCCESS is returned upon successful call. - * ::RSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit - * does not exist for the given device - * - */ -rsmi_status_t -rsmi_dev_metrics_volt_mem_get(uint32_t dv_ind, uint16_t* voltage_value); - /** * @brief Get the 'metrics_header_info' from the GPU metrics associated with the device * diff --git a/rocm_smi/example/rocm_smi_example.cc b/rocm_smi/example/rocm_smi_example.cc index 1925520903..5ea30bf5bf 100755 --- a/rocm_smi/example/rocm_smi_example.cc +++ b/rocm_smi/example/rocm_smi_example.cc @@ -1002,18 +1002,10 @@ int main() { } std::cout << " ** Note: Values MAX'ed out (UINTX MAX are unsupported for the version in question) ** " << "\n"; + std::cout << "\n\n"; print_test_header("GPU METRICS: Using direct APIs (newer)", i); metrics_table_header_t header_values; - GPUMetricTempHbm_t hbm_values; - GPUMetricVcnActivity_t vcn_values; - GPUMetricJpegActivity_t jpeg_values; - GPUMetricXgmiReadDataAcc_t xgmi_read_values; - GPUMetricXgmiWriteDataAcc_t xgmi_write_values; - GPUMetricCurrGfxClk_t curr_gfxclk_values; - GPUMetricCurrSocClk_t curr_socclk_values; - GPUMetricCurrVClk0_t curr_vclk0_values; - GPUMetricCurrDClk0_t curr_dclk0_values; ret = rsmi_dev_metrics_header_info_get(i, &header_values); std::cout << "\t[Metrics Header]" << "\n"; @@ -1021,152 +1013,12 @@ int main() { std::cout << "\t -> content_revision : " << print_unsigned_int(header_values.content_revision) << "\n"; std::cout << "\t--------------------" << "\n"; - std::cout << "\n"; - std::cout << "\t[Temperature]" << "\n"; - ret = rsmi_dev_metrics_temp_edge_get(i, &val_ui16); - std::cout << "\t -> temp_edge(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_temp_hotspot_get(i, &val_ui16); - std::cout << "\t -> temp_hotspot(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_temp_mem_get(i, &val_ui16); - std::cout << "\t -> temp_mem(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_temp_vrgfx_get(i, &val_ui16); - std::cout << "\t -> temp_vrgfx(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_temp_vrsoc_get(i, &val_ui16); - std::cout << "\t -> temp_vrsoc(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_temp_vrmem_get(i, &val_ui16); - std::cout << "\t -> temp_vrmem(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_temp_hbm_get(i, &hbm_values); - std::cout << "\t -> temp_hbm(): " << print_error_or_value(ret, hbm_values) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Power/Energy]" << "\n"; - ret = rsmi_dev_metrics_curr_socket_power_get(i, &val_ui16); - std::cout << "\t -> current_socket_power(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_energy_acc_get(i, &val_ui64); - std::cout << "\t -> energy_accum(): " << print_error_or_value(ret, val_ui64) << "\n"; - ret = rsmi_dev_metrics_avg_socket_power_get(i, &val_ui16); - std::cout << "\t -> average_socket_power(): " << print_error_or_value(ret, val_ui16) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Utilization]" << "\n"; - ret = rsmi_dev_metrics_avg_gfx_activity_get(i, &val_ui16); - std::cout << "\t -> average_gfx_activity(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_avg_umc_activity_get(i, &val_ui16); - std::cout << "\t -> average_umc_activity(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_avg_mm_activity_get(i, &val_ui16); - std::cout << "\t -> average_mm_activity(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_vcn_activity_get(i, &vcn_values); - std::cout << "\t -> vcn_activity(): " << print_error_or_value(ret, vcn_values) << "\n"; - ret = rsmi_dev_metrics_jpeg_activity_get(i, &jpeg_values); - std::cout << "\t -> jpeg_activity(): " << print_error_or_value(ret, jpeg_values) << "\n"; - ret = rsmi_dev_metrics_mem_activity_acc_get(i, &val_ui32); - std::cout << "\t -> mem_activity_accum(): " << print_error_or_value(ret, val_ui32) << "\n"; - ret = rsmi_dev_metrics_gfx_activity_acc_get(i, &val_ui32); - std::cout << "\t -> gfx_activity_accum(): " << print_error_or_value(ret, val_ui32) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Average Clock]" << "\n"; - ret = rsmi_dev_metrics_avg_gfx_clock_frequency_get(i, &val_ui16); - std::cout << "\t -> average_gfx_clock_frequency(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_avg_soc_clock_frequency_get(i, &val_ui16); - std::cout << "\t -> average_soc_clock_frequency(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_avg_uclock_frequency_get(i, &val_ui16); - std::cout << "\t -> average_uclock_frequency(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_avg_vclock0_frequency_get(i, &val_ui16); - std::cout << "\t -> average_vclock0_frequency(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_avg_dclock0_frequency_get(i, &val_ui16); - std::cout << "\t -> average_dclock0_frequency(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_avg_vclock1_frequency_get(i, &val_ui16); - std::cout << "\t -> average_vclock1_frequency(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_avg_dclock1_frequency_get(i, &val_ui16); - std::cout << "\t -> average_dclock1_frequency(): " << print_error_or_value(ret, val_ui16) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Current Clock]" << "\n"; - ret = rsmi_dev_metrics_curr_vclk1_get(i, &val_ui16); - std::cout << "\t -> current_vclock1(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_curr_dclk1_get(i, &val_ui16); - std::cout << "\t -> current_dclock1(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_curr_uclk_get(i, &val_ui16); - std::cout << "\t -> current_uclock(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_curr_dclk0_get(i, &curr_dclk0_values); - std::cout << "\t -> current_dclk0(): " << print_error_or_value(ret, curr_dclk0_values) << "\n"; - ret = rsmi_dev_metrics_curr_gfxclk_get(i, &curr_gfxclk_values); - std::cout << "\t -> current_gfxclk(): " << print_error_or_value(ret, curr_gfxclk_values) << "\n"; - ret = rsmi_dev_metrics_curr_socclk_get(i, &curr_socclk_values); - std::cout << "\t -> current_soc_clock(): " << print_error_or_value(ret, curr_socclk_values) << "\n"; - ret = rsmi_dev_metrics_curr_vclk0_get(i, &curr_vclk0_values); - std::cout << "\t -> current_vclk0(): " << print_error_or_value(ret, curr_vclk0_values) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Throttle]" << "\n"; - ret = rsmi_dev_metrics_indep_throttle_status_get(i, &val_ui64); - std::cout << "\t -> indep_throttle_status(): " << print_error_or_value(ret, val_ui64) << "\n"; - ret = rsmi_dev_metrics_throttle_status_get(i, &val_ui32); - std::cout << "\t -> throttle_status(): " << print_error_or_value(ret, val_ui32) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Gfx Clock Lock]" << "\n"; - ret = rsmi_dev_metrics_gfxclk_lock_status_get(i, &val_ui32); - std::cout << "\t -> gfxclk_lock_status(): " << print_error_or_value(ret, val_ui32) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Current Fan Speed]" << "\n"; - ret = rsmi_dev_metrics_curr_fan_speed_get(i, &val_ui16); - std::cout << "\t -> current_fan_speed(): " << print_error_or_value(ret, val_ui16) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Link/Bandwidth/Speed]" << "\n"; - ret = rsmi_dev_metrics_pcie_link_width_get(i, &val_ui16); - std::cout << "\t -> pcie_link_width(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_pcie_link_speed_get(i, &val_ui16); - std::cout << "\t -> pcie_link_speed(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_pcie_bandwidth_acc_get(i, &val_ui64); - std::cout << "\t -> pcie_bandwidth_accum(): " << print_error_or_value(ret, val_ui64) << "\n"; - ret = rsmi_dev_metrics_pcie_bandwidth_inst_get(i, &val_ui64); - std::cout << "\t -> pcie_bandwidth_inst(): " << print_error_or_value(ret, val_ui64) << "\n"; - ret = rsmi_dev_metrics_pcie_l0_recov_count_acc_get(i, &val_ui64); - std::cout << "\t -> pcie_l0_recov_count_accum(): " << print_error_or_value(ret, val_ui64) << "\n"; - ret = rsmi_dev_metrics_pcie_replay_count_acc_get(i, &val_ui64); - std::cout << "\t -> pcie_replay_count_accum(): " << print_error_or_value(ret, val_ui64) << "\n"; - ret = rsmi_dev_metrics_pcie_replay_rover_count_acc_get(i, &val_ui64); - std::cout << "\t -> pcie_replay_rollover_count_accum(): " << print_error_or_value(ret, val_ui64) << "\n"; - ret = rsmi_dev_metrics_xgmi_link_width_get(i, &val_ui16); - std::cout << "\t -> xgmi_link_width(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_xgmi_link_speed_get(i, &val_ui16); - std::cout << "\t -> xgmi_link_speed(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_xgmi_read_data_get(i, &xgmi_read_values); - std::cout << "\t -> xgmi_read_data(): " << print_error_or_value(ret, xgmi_read_values) << "\n"; - ret = rsmi_dev_metrics_xgmi_write_data_get(i, &xgmi_write_values); - std::cout << "\t -> xgmi_write_data(): " << print_error_or_value(ret, xgmi_write_values) << "\n"; - ret = rsmi_dev_metrics_pcie_nak_sent_count_acc_get(i, &val_ui32); - std::cout << "\t -> pcie_nak_sent_count_accum(): " << print_error_or_value(ret, val_ui32) << "\n"; - ret = rsmi_dev_metrics_pcie_nak_rcvd_count_acc_get(i, &val_ui32); - std::cout << "\t -> pcie_nak_rcvd_count_accum(): " << print_error_or_value(ret, val_ui32) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Voltage]" << "\n"; - ret = rsmi_dev_metrics_volt_soc_get(i, &val_ui16); - std::cout << "\t -> voltage_soc(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_volt_gfx_get(i, &val_ui16); - std::cout << "\t -> voltage_gfx(): " << print_error_or_value(ret, val_ui16) << "\n"; - ret = rsmi_dev_metrics_volt_mem_get(i, &val_ui16); - std::cout << "\t -> voltage_mem(): " << print_error_or_value(ret, val_ui16) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Timestamp]" << "\n"; - ret = rsmi_dev_metrics_system_clock_counter_get(i, &val_ui64); - std::cout << "\t -> system_clock_counter(): " << print_error_or_value(ret, val_ui64) << "\n"; - ret = rsmi_dev_metrics_firmware_timestamp_get(i, &val_ui64); - std::cout << "\t -> firmware_timestamp(): " << print_error_or_value(ret, val_ui64) << "\n"; - std::cout << "\n"; std::cout << "\t[XCD CounterVoltage]" << "\n"; ret = rsmi_dev_metrics_xcd_counter_get(i, &val_ui16); std::cout << "\t -> xcd_counter(): " << print_error_or_value(ret, val_ui16) << "\n"; std::cout << "\n\n"; - ret = rsmi_dev_perf_level_get(i, &pfl); CHK_AND_PRINT_RSMI_ERR_RET(ret) std::cout << "\t**Performance Level:" << diff --git a/src/rocm_smi.cc b/src/rocm_smi.cc index 3a48511679..f6f0ff64b4 100755 --- a/src/rocm_smi.cc +++ b/src/rocm_smi.cc @@ -5695,1548 +5695,6 @@ rsmi_status_t rsmi_event_notification_stop(uint32_t dv_ind) { CATCH } -// -// NOTE: APIs related to new 'GPU Metrics' related work are added here -// so they can be used/tested. -// -rsmi_status_t -rsmi_dev_metrics_temp_edge_get(uint32_t dv_ind, uint16_t* edge_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(edge_value != nullptr); - if (edge_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricTempEdge); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *edge_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_temp_hotspot_get(uint32_t dv_ind, uint16_t* hotspot_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(hotspot_value != nullptr); - if (hotspot_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricTempHotspot); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *hotspot_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_temp_mem_get(uint32_t dv_ind, uint16_t* mem_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(mem_value != nullptr); - if (mem_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricTempMem); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *mem_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_temp_vrgfx_get(uint32_t dv_ind, uint16_t* vrgfx_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(vrgfx_value != nullptr); - if (vrgfx_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricTempVrGfx); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *vrgfx_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_temp_vrsoc_get(uint32_t dv_ind, uint16_t* vrsoc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(vrsoc_value != nullptr); - if (vrsoc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricTempVrSoc); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *vrsoc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_temp_vrmem_get(uint32_t dv_ind, uint16_t* vrmem_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(vrmem_value != nullptr); - if (vrmem_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricTempVrMem); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *vrmem_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_curr_socket_power_get(uint32_t dv_ind, uint16_t* socket_power_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(socket_power_value != nullptr); - if (socket_power_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrSocketPower); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *socket_power_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_socket_power_get(uint32_t dv_ind, uint16_t* socket_power_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(socket_power_value != nullptr); - if (socket_power_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgSocketPower); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *socket_power_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_gfx_activity_get(uint32_t dv_ind, uint16_t* gfx_activity_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(gfx_activity_value != nullptr); - if (gfx_activity_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgGfxActivity); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *gfx_activity_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_umc_activity_get(uint32_t dv_ind, uint16_t* umc_activity_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(umc_activity_value != nullptr); - if (umc_activity_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgUmcActivity); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *umc_activity_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_mm_activity_get(uint32_t dv_ind, uint16_t* mm_activity_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(mm_activity_value != nullptr); - if (mm_activity_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgMmActivity); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *mm_activity_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_energy_acc_get(uint32_t dv_ind, uint64_t* energy_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(energy_acc_value != nullptr); - if (energy_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricEnergyAccumulator); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *energy_acc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_system_clock_counter_get(uint32_t dv_ind, uint64_t* system_clock_counter_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(system_clock_counter_value != nullptr); - if (system_clock_counter_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricTSClockCounter); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *system_clock_counter_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_firmware_timestamp_get(uint32_t dv_ind, uint64_t* firmware_timestamp_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(firmware_timestamp_value != nullptr); - if (firmware_timestamp_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricTSFirmware); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *firmware_timestamp_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_indep_throttle_status_get(uint32_t dv_ind, uint64_t* throttle_status_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(throttle_status_value != nullptr); - if (throttle_status_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricIndepThrottleStatus); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *throttle_status_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_throttle_status_get(uint32_t dv_ind, uint32_t* throttle_status_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(throttle_status_value != nullptr); - if (throttle_status_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricThrottleStatus); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *throttle_status_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_curr_fan_speed_get(uint32_t dv_ind, uint16_t* fan_speed_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(fan_speed_value != nullptr); - if (fan_speed_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrFanSpeed); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *fan_speed_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_pcie_link_width_get(uint32_t dv_ind, uint16_t* pcie_link_width_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(pcie_link_width_value != nullptr); - if (pcie_link_width_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricPcieLinkWidth); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *pcie_link_width_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_pcie_link_speed_get(uint32_t dv_ind, uint16_t* pcie_link_speed_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(pcie_link_speed_value != nullptr); - if (pcie_link_speed_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricPcieLinkSpeed); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *pcie_link_speed_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_xgmi_link_width_get(uint32_t dv_ind, uint16_t* xgmi_link_width_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(xgmi_link_width_value != nullptr); - if (xgmi_link_width_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricXgmiLinkWidth); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *xgmi_link_width_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_xgmi_link_speed_get(uint32_t dv_ind, uint16_t* xgmi_link_speed_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(xgmi_link_speed_value != nullptr); - if (xgmi_link_speed_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricXgmiLinkSpeed); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *xgmi_link_speed_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_gfxclk_lock_status_get(uint32_t dv_ind, uint32_t* gfxclk_lock_status_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(gfxclk_lock_status_value != nullptr); - if (gfxclk_lock_status_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricGfxClkLockStatus); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *gfxclk_lock_status_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_gfx_activity_acc_get(uint32_t dv_ind, uint32_t* gfx_activity_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(gfx_activity_acc_value != nullptr); - if (gfx_activity_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricGfxActivityAccumulator); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *gfx_activity_acc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_mem_activity_acc_get(uint32_t dv_ind, uint32_t* mem_activity_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(mem_activity_acc_value != nullptr); - if (mem_activity_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricMemActivityAccumulator); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *mem_activity_acc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_pcie_bandwidth_acc_get(uint32_t dv_ind, uint64_t* pcie_bandwidth_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(pcie_bandwidth_acc_value != nullptr); - if (pcie_bandwidth_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricPcieBandwidthAccumulator); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *pcie_bandwidth_acc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_pcie_bandwidth_inst_get(uint32_t dv_ind, uint64_t* pcie_bandwidth_inst_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(pcie_bandwidth_inst_value != nullptr); - if (pcie_bandwidth_inst_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricPcieBandwidthInst); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *pcie_bandwidth_inst_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_pcie_l0_recov_count_acc_get(uint32_t dv_ind, uint64_t* pcie_count_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(pcie_count_acc_value != nullptr); - if (pcie_count_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricPcieL0RecovCountAccumulator); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *pcie_count_acc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_pcie_replay_count_acc_get(uint32_t dv_ind, uint64_t* pcie_count_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(pcie_count_acc_value != nullptr); - if (pcie_count_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricPcieReplayCountAccumulator); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *pcie_count_acc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_pcie_replay_rover_count_acc_get(uint32_t dv_ind, uint64_t* pcie_count_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(pcie_count_acc_value != nullptr); - if (pcie_count_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricPcieReplayRollOverCountAccumulator); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *pcie_count_acc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_pcie_nak_sent_count_acc_get(uint32_t dv_ind, uint32_t* pcie_nak_sent_count_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(pcie_nak_sent_count_acc_value != nullptr); - if (pcie_nak_sent_count_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricPcieNakSentCountAccumulator); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *pcie_nak_sent_count_acc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_pcie_nak_rcvd_count_acc_get(uint32_t dv_ind, uint32_t* pcie_nak_rcvd_count_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(pcie_nak_rcvd_count_acc_value != nullptr); - if (pcie_nak_rcvd_count_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricPcieNakReceivedCountAccumulator); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *pcie_nak_rcvd_count_acc_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_curr_uclk_get(uint32_t dv_ind, uint16_t* uclk_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(uclk_value != nullptr); - if (uclk_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrUClock); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *uclk_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_temp_hbm_get(uint32_t dv_ind, GPUMetricTempHbm_t* temp_hbm_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(temp_hbm_value != nullptr); - if (temp_hbm_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricTempHbm); - amd::smi::GPUMetricTempHbmTbl_t tmp_hbl_tbl{}; - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_hbl_tbl); - const auto max_num_elems = - static_cast(std::end(*temp_hbm_value) - std::begin(*temp_hbm_value)); - const auto copy_size = - static_cast((max_num_elems < tmp_hbl_tbl.size()) ? max_num_elems : tmp_hbl_tbl.size()); - ostrstream << __PRETTY_FUNCTION__ - << "\n | ======= end ======= " - << "\n | End Result " - << "\n | Device #: " << dv_ind - << "\n | Metric Type: " << static_cast(gpu_metric_unit) - << "\n | Metric Size: " << tmp_hbl_tbl.size() - << "\n | Max num of elements: " << max_num_elems - << "\n | Copy size: " << copy_size - << "\n | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - std::memset(temp_hbm_value, 0, sizeof(*temp_hbm_value)); - std::copy_n(std::begin(tmp_hbl_tbl), copy_size, *temp_hbm_value); - } - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_vcn_activity_get(uint32_t dv_ind, GPUMetricVcnActivity_t* vcn_activity_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(vcn_activity_value != nullptr); - if (vcn_activity_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVcnActivity); - amd::smi::GPUMetricVcnActivityTbl_t tmp_vcn_tbl{}; - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_vcn_tbl); - const auto max_num_elems = - static_cast(std::end(*vcn_activity_value) - std::begin(*vcn_activity_value)); - const auto copy_size = - static_cast((max_num_elems < tmp_vcn_tbl.size()) ? max_num_elems : tmp_vcn_tbl.size()); - ostrstream << __PRETTY_FUNCTION__ - << "\n | ======= end ======= " - << "\n | End Result " - << "\n | Device #: " << dv_ind - << "\n | Metric Type: " << static_cast(gpu_metric_unit) - << "\n | Metric Size: " << tmp_vcn_tbl.size() - << "\n | Max num of elements: " << max_num_elems - << "\n | Copy size: " << copy_size - << "\n | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - std::memset(vcn_activity_value, 0, sizeof(*vcn_activity_value)); - std::copy_n(std::begin(tmp_vcn_tbl), copy_size, *vcn_activity_value); - } - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_jpeg_activity_get(uint32_t dv_ind, GPUMetricJpegActivity_t* jpeg_activity_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(jpeg_activity_value != nullptr); - if (jpeg_activity_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVcnActivity); - amd::smi::GPUMetricJpegActivityTbl_t tmp_jpeg_tbl{}; - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_jpeg_tbl); - const auto max_num_elems = - static_cast(std::end(*jpeg_activity_value) - std::begin(*jpeg_activity_value)); - const auto copy_size = - static_cast((max_num_elems < tmp_jpeg_tbl.size()) ? max_num_elems : tmp_jpeg_tbl.size()); - ostrstream << __PRETTY_FUNCTION__ - << "\n | ======= end ======= " - << "\n | End Result " - << "\n | Device #: " << dv_ind - << "\n | Metric Type: " << static_cast(gpu_metric_unit) - << "\n | Metric Size: " << tmp_jpeg_tbl.size() - << "\n | Max num of elements: " << max_num_elems - << "\n | Copy size: " << copy_size - << "\n | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - std::memset(jpeg_activity_value, 0, sizeof(*jpeg_activity_value)); - std::copy_n(std::begin(tmp_jpeg_tbl), copy_size, *jpeg_activity_value); - } - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_xgmi_read_data_get(uint32_t dv_ind, GPUMetricXgmiReadDataAcc_t* xgmi_read_data_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(xgmi_read_data_acc_value != nullptr); - if (xgmi_read_data_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricXgmiReadDataAccumulator); - amd::smi::GPUMetricXgmiAccTbl_t tmp_xgmi_acc_tbl{}; - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_xgmi_acc_tbl); - const auto max_num_elems = - static_cast(std::end(*xgmi_read_data_acc_value) - std::begin(*xgmi_read_data_acc_value)); - const auto copy_size = - static_cast((max_num_elems < tmp_xgmi_acc_tbl.size()) ? max_num_elems : tmp_xgmi_acc_tbl.size()); - ostrstream << __PRETTY_FUNCTION__ - << "\n | ======= end ======= " - << "\n | End Result " - << "\n | Device #: " << dv_ind - << "\n | Metric Type: " << static_cast(gpu_metric_unit) - << "\n | Metric Size: " << tmp_xgmi_acc_tbl.size() - << "\n | Max num of elements: " << max_num_elems - << "\n | Copy size: " << copy_size - << "\n | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - std::memset(xgmi_read_data_acc_value, 0, sizeof(*xgmi_read_data_acc_value)); - std::copy_n(std::begin(tmp_xgmi_acc_tbl), copy_size, *xgmi_read_data_acc_value); - } - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_xgmi_write_data_get(uint32_t dv_ind, GPUMetricXgmiWriteDataAcc_t* xgmi_write_data_acc_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(xgmi_write_data_acc_value != nullptr); - if (xgmi_write_data_acc_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricXgmiWriteDataAccumulator); - amd::smi::GPUMetricXgmiAccTbl_t tmp_xgmi_acc_tbl{}; - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_xgmi_acc_tbl); - const auto max_num_elems = - static_cast(std::end(*xgmi_write_data_acc_value) - std::begin(*xgmi_write_data_acc_value)); - const auto copy_size = - static_cast((max_num_elems < tmp_xgmi_acc_tbl.size()) ? max_num_elems : tmp_xgmi_acc_tbl.size()); - ostrstream << __PRETTY_FUNCTION__ - << "\n | ======= end ======= " - << "\n | End Result " - << "\n | Device #: " << dv_ind - << "\n | Metric Type: " << static_cast(gpu_metric_unit) - << "\n | Metric Size: " << tmp_xgmi_acc_tbl.size() - << "\n | Max num of elements: " << max_num_elems - << "\n | Copy size: " << copy_size - << "\n | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - std::memset(xgmi_write_data_acc_value, 0, sizeof(*xgmi_write_data_acc_value)); - std::copy_n(std::begin(tmp_xgmi_acc_tbl), copy_size, *xgmi_write_data_acc_value); - } - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_curr_gfxclk_get(uint32_t dv_ind, GPUMetricCurrGfxClk_t* current_gfxclk_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(current_gfxclk_value != nullptr); - if (current_gfxclk_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrGfxClock); - amd::smi::GPUMetricCurrGfxClkTbl_t tmp_curr_gfxclk_tbl{}; - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_curr_gfxclk_tbl); - const auto max_num_elems = - static_cast(std::end(*current_gfxclk_value) - std::begin(*current_gfxclk_value)); - const auto copy_size = - static_cast((max_num_elems < tmp_curr_gfxclk_tbl.size()) ? max_num_elems : tmp_curr_gfxclk_tbl.size()); - ostrstream << __PRETTY_FUNCTION__ - << "\n | ======= end ======= " - << "\n | End Result " - << "\n | Device #: " << dv_ind - << "\n | Metric Type: " << static_cast(gpu_metric_unit) - << "\n | Metric Size: " << tmp_curr_gfxclk_tbl.size() - << "\n | Max num of elements: " << max_num_elems - << "\n | Copy size: " << copy_size - << "\n | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - std::memset(current_gfxclk_value, 0, sizeof(*current_gfxclk_value)); - std::copy_n(std::begin(tmp_curr_gfxclk_tbl), copy_size, *current_gfxclk_value); - } - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_curr_socclk_get(uint32_t dv_ind, GPUMetricCurrSocClk_t* current_socclk_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(current_socclk_value != nullptr); - if (current_socclk_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrSocClock); - amd::smi::GPUMetricCurrSocClkTbl_t tmp_curr_socclk_tbl{}; - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_curr_socclk_tbl); - const auto max_num_elems = - static_cast(std::end(*current_socclk_value) - std::begin(*current_socclk_value)); - const auto copy_size = - static_cast((max_num_elems < tmp_curr_socclk_tbl.size()) ? max_num_elems : tmp_curr_socclk_tbl.size()); - ostrstream << __PRETTY_FUNCTION__ - << "\n | ======= end ======= " - << "\n | End Result " - << "\n | Device #: " << dv_ind - << "\n | Metric Type: " << static_cast(gpu_metric_unit) - << "\n | Metric Size: " << tmp_curr_socclk_tbl.size() - << "\n | Max num of elements: " << max_num_elems - << "\n | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - std::memset(current_socclk_value, 0, sizeof(*current_socclk_value)); - std::copy_n(std::begin(tmp_curr_socclk_tbl), copy_size, *current_socclk_value); - } - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_curr_vclk0_get(uint32_t dv_ind, GPUMetricCurrVClk0_t* current_vclk_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(current_vclk_value != nullptr); - if (current_vclk_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrVClock0); - amd::smi::GPUMetricCurrVClkTbl_t tmp_curr_vclk0_tbl{}; - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_curr_vclk0_tbl); - const auto max_num_elems = - static_cast(std::end(*current_vclk_value) - std::begin(*current_vclk_value)); - const auto copy_size = - static_cast((max_num_elems < tmp_curr_vclk0_tbl.size()) ? max_num_elems : tmp_curr_vclk0_tbl.size()); - ostrstream << __PRETTY_FUNCTION__ - << "\n | ======= end ======= " - << "\n | End Result " - << "\n | Device #: " << dv_ind - << "\n | Metric Type: " << static_cast(gpu_metric_unit) - << "\n | Metric Size: " << tmp_curr_vclk0_tbl.size() - << "\n | Max num of elements: " << max_num_elems - << "\n | Copy size: " << copy_size - << "\n | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - std::memset(current_vclk_value, 0, sizeof(*current_vclk_value)); - std::copy_n(std::begin(tmp_curr_vclk0_tbl), copy_size, *current_vclk_value); - } - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_curr_vclk1_get(uint32_t dv_ind, uint16_t* current_vclk_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(current_vclk_value != nullptr); - if (current_vclk_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrVClock1); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *current_vclk_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_curr_dclk0_get(uint32_t dv_ind, GPUMetricCurrDClk0_t* current_dclk_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(current_dclk_value != nullptr); - if (current_dclk_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrDClock0); - amd::smi::GPUMetricCurrDClkTbl_t tmp_curr_dclk0_tbl; - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, tmp_curr_dclk0_tbl); - const auto max_num_elems = - static_cast(std::end(*current_dclk_value) - std::begin(*current_dclk_value)); - const auto copy_size = - static_cast((max_num_elems < tmp_curr_dclk0_tbl.size()) ? max_num_elems : tmp_curr_dclk0_tbl.size()); - ostrstream << __PRETTY_FUNCTION__ - << "\n | ======= end ======= " - << "\n | End Result " - << "\n | Device #: " << dv_ind - << "\n | Metric Type: " << static_cast(gpu_metric_unit) - << "\n | Metric Size: " << tmp_curr_dclk0_tbl.size() - << "\n | Max num of elements: " << max_num_elems - << "\n | Copy size: " << copy_size - << "\n | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - std::memset(current_dclk_value, 0, sizeof(*current_dclk_value)); - std::copy_n(std::begin(tmp_curr_dclk0_tbl), copy_size, *current_dclk_value); - } - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_curr_dclk1_get(uint32_t dv_ind, uint16_t* current_dclk_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(current_dclk_value != nullptr); - if (current_dclk_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricCurrDClock1); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *current_dclk_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_gfx_clock_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(clock_frequency_value != nullptr); - if (clock_frequency_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgGfxClockFrequency); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *clock_frequency_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_soc_clock_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(clock_frequency_value != nullptr); - if (clock_frequency_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgSocClockFrequency); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *clock_frequency_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_uclock_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(clock_frequency_value != nullptr); - if (clock_frequency_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgUClockFrequency); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *clock_frequency_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_vclock0_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(clock_frequency_value != nullptr); - if (clock_frequency_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgVClock0Frequency); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *clock_frequency_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_dclock0_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(clock_frequency_value != nullptr); - if (clock_frequency_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgDClock0Frequency); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *clock_frequency_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_vclock1_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(clock_frequency_value != nullptr); - if (clock_frequency_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgVClock1Frequency); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *clock_frequency_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_avg_dclock1_frequency_get(uint32_t dv_ind, uint16_t* clock_frequency_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(clock_frequency_value != nullptr); - if (clock_frequency_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricAvgDClock1Frequency); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *clock_frequency_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_volt_soc_get(uint32_t dv_ind, uint16_t* voltage_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(voltage_value != nullptr); - if (voltage_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVoltageSoc); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *voltage_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_volt_gfx_get(uint32_t dv_ind, uint16_t* voltage_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(voltage_value != nullptr); - if (voltage_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVoltageGfx); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *voltage_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - -rsmi_status_t -rsmi_dev_metrics_volt_mem_get(uint32_t dv_ind, uint16_t* voltage_value) -{ - TRY - std::ostringstream ostrstream; - ostrstream << __PRETTY_FUNCTION__ << "| ======= start ======="; - LOG_TRACE(ostrstream); - - assert(voltage_value != nullptr); - if (voltage_value == nullptr) { - return rsmi_status_t::RSMI_STATUS_INVALID_ARGS; - } - - const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVoltageMem); - auto status_code = rsmi_dev_gpu_metrics_info_query(dv_ind, gpu_metric_unit, *voltage_value); - ostrstream << __PRETTY_FUNCTION__ - << " | ======= end ======= " - << " | End Result " - << " | Device #: " << dv_ind - << " | Metric Type: " << static_cast(gpu_metric_unit) - << " | Returning = " << status_code << " " << getRSMIStatusString(status_code) << " |"; - LOG_INFO(ostrstream); - - return status_code; - CATCH -} - rsmi_status_t rsmi_dev_metrics_header_info_get(uint32_t dv_ind, metrics_table_header_t* header_value) { @@ -7280,10 +5738,10 @@ rsmi_dev_metrics_xcd_counter_get(uint32_t dv_ind, uint16_t* xcd_counter_value) } auto xcd_counter = uint16_t(0); - GPUMetricCurrGfxClk_t curr_gfxclk_table{}; - auto status_code = rsmi_dev_metrics_curr_gfxclk_get(dv_ind, &curr_gfxclk_table); + rsmi_gpu_metrics_t gpu_metrics; + auto status_code = rsmi_dev_gpu_metrics_info_get(dv_ind, &gpu_metrics); if (status_code == rsmi_status_t::RSMI_STATUS_SUCCESS) { - for (const auto& gfxclk : curr_gfxclk_table) { + for (const auto& gfxclk : gpu_metrics.current_gfxclks) { if ((gfxclk != 0) && (gfxclk != UINT16_MAX)) { xcd_counter++; } @@ -7325,10 +5783,6 @@ rsmi_dev_metrics_log_get(uint32_t dv_ind) CATCH } -// -// End of: new GPU Metrics related work. -// - // UNDOCUMENTED FUNCTIONS // This functions are not declared in rocm_smi.h. They are either not fully diff --git a/src/rocm_smi_gpu_metrics.cc b/src/rocm_smi_gpu_metrics.cc index 44b9a88052..2f1a40837a 100755 --- a/src/rocm_smi_gpu_metrics.cc +++ b/src/rocm_smi_gpu_metrics.cc @@ -2680,7 +2680,6 @@ rsmi_status_t Device::dev_read_gpu_metrics_header_data() LOG_TRACE(ostrstream); // Check if/when metrics table needs to be refreshed. - auto now_ts = actual_timestamp_in_secs(); if ((!m_gpu_metrics_header.m_structure_size) || (!m_gpu_metrics_header.m_format_revision) || (!m_gpu_metrics_header.m_content_revision)) { diff --git a/tests/rocm_smi_test/functional/gpu_metrics_read.cc b/tests/rocm_smi_test/functional/gpu_metrics_read.cc index a3fa8af4b0..2d7bde7c67 100644 --- a/tests/rocm_smi_test/functional/gpu_metrics_read.cc +++ b/tests/rocm_smi_test/functional/gpu_metrics_read.cc @@ -47,6 +47,7 @@ #include #include +#include #include #include @@ -119,6 +120,13 @@ auto print_error_or_value(std::string title, std::string func_name, const T& met } }; +template +std::string print_unsigned_int(T value) { + std::stringstream ss; + ss << static_cast(value | 0); + + return ss.str(); +} void TestGpuMetricsRead::Run(void) { rsmi_status_t err; @@ -133,8 +141,19 @@ void TestGpuMetricsRead::Run(void) { PrintDeviceHeader(i); IF_VERB(STANDARD) { + std::cout << "\n\n"; std::cout << "\t**GPU METRICS: Using static struct (Backwards Compatibility):\n"; + + metrics_table_header_t header_values; + auto ret = rsmi_dev_metrics_header_info_get(i, &header_values); + if (ret == rsmi_status_t::RSMI_STATUS_SUCCESS) { + std::cout << "\t[Metrics Header]" << "\n"; + std::cout << "\t -> format_revision : " << print_unsigned_int(header_values.format_revision) << "\n"; + std::cout << "\t -> content_revision : " << print_unsigned_int(header_values.content_revision) << "\n"; + std::cout << "\t--------------------" << "\n"; + } } + rsmi_gpu_metrics_t smu; err = rsmi_dev_gpu_metrics_info_get(i, &smu); if (err != RSMI_STATUS_SUCCESS) { @@ -243,491 +262,11 @@ void TestGpuMetricsRead::Run(void) { // Verify api support checking functionality is working err = rsmi_dev_gpu_metrics_info_get(i, nullptr); ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS); - } - - // - auto val_ui16 = uint16_t(0); - auto val_ui32 = uint32_t(0); - auto val_ui64 = uint64_t(0); - auto status_code(rsmi_status_t::RSMI_STATUS_SUCCESS); - - std::cout << "\n\t**GPU METRICS: Using direct APIs (newer):\n"; - for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(i); - - auto temp_edge_value = val_ui16; - status_code = rsmi_dev_metrics_temp_edge_get(i, &temp_edge_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_temp_edge_get", status_code); - - auto temp_hotspot_value = val_ui16; - status_code = rsmi_dev_metrics_temp_hotspot_get(i, &temp_hotspot_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_temp_hotspot_get", status_code); - - auto temp_mem_value = val_ui16; - status_code = rsmi_dev_metrics_temp_mem_get(i, &temp_mem_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_temp_mem_get", status_code); - - auto temp_vrgfx_value = val_ui16; - status_code = rsmi_dev_metrics_temp_vrgfx_get(i, &temp_vrgfx_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_temp_vrgfx_get", status_code); - - auto temp_vrsoc_value = val_ui16; - status_code = rsmi_dev_metrics_temp_vrsoc_get(i, &temp_vrsoc_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_temp_vrsoc_get", status_code); - - auto temp_vrmem_value = val_ui16; - status_code = rsmi_dev_metrics_temp_vrmem_get(i, &temp_vrmem_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_temp_vrmem_get", status_code); - - GPUMetricTempHbm_t temp_hbm_values{}; - status_code = rsmi_dev_metrics_temp_hbm_get(i, &temp_hbm_values); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_temp_hbm_get", status_code); - - auto temp_curr_socket_power_value = val_ui16; - status_code = rsmi_dev_metrics_curr_socket_power_get(i, &temp_curr_socket_power_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_curr_socket_power_get", status_code); - - auto temp_energy_accum_value = val_ui64; - status_code = rsmi_dev_metrics_energy_acc_get(i, &temp_energy_accum_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_energy_acc_get", status_code); - - auto temp_avg_socket_power_value = val_ui16; - status_code = rsmi_dev_metrics_avg_socket_power_get(i, &temp_avg_socket_power_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_socket_power_get", status_code); - - auto temp_avg_gfx_activity_value = val_ui16; - status_code = rsmi_dev_metrics_avg_gfx_activity_get(i, &temp_avg_gfx_activity_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_gfx_activity_get", status_code); - - auto temp_avg_umc_activity_value = val_ui16; - status_code = rsmi_dev_metrics_avg_umc_activity_get(i, &temp_avg_umc_activity_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_umc_activity_get", status_code); - - auto temp_avg_mm_activity_value = val_ui16; - status_code = rsmi_dev_metrics_avg_mm_activity_get(i, &temp_avg_mm_activity_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_mm_activity_get", status_code); - - GPUMetricVcnActivity_t temp_vcn_values{}; - status_code = rsmi_dev_metrics_vcn_activity_get(i, &temp_vcn_values); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_vcn_activity_get", status_code); - - GPUMetricJpegActivity_t temp_jpeg_values{}; - status_code = rsmi_dev_metrics_jpeg_activity_get(i, &temp_jpeg_values); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_jpeg_activity_get", status_code); - - auto temp_mem_activity_accum_value = val_ui32; - status_code = rsmi_dev_metrics_mem_activity_acc_get(i, &temp_mem_activity_accum_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_mem_activity_acc_get", status_code); - - auto temp_gfx_activity_accum_value = val_ui32; - status_code = rsmi_dev_metrics_gfx_activity_acc_get(i, &temp_gfx_activity_accum_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_gfx_activity_acc_get", status_code); - - auto temp_avg_gfx_clock_freq_value = val_ui16; - status_code = rsmi_dev_metrics_avg_gfx_clock_frequency_get(i, &temp_avg_gfx_clock_freq_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_gfx_clock_frequency_get", status_code); - - auto temp_avg_soc_clock_freq_value = val_ui16; - status_code = rsmi_dev_metrics_avg_soc_clock_frequency_get(i, &temp_avg_soc_clock_freq_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_soc_clock_frequency_get", status_code); - - auto temp_avg_uclock_freq_value = val_ui16; - status_code = rsmi_dev_metrics_avg_uclock_frequency_get(i, &temp_avg_uclock_freq_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_uclock_frequency_get", status_code); - - auto temp_avg_vclock0_freq_value = val_ui16; - status_code = rsmi_dev_metrics_avg_vclock0_frequency_get(i, &temp_avg_vclock0_freq_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_vclock0_frequency_get", status_code); - - auto temp_avg_dclock0_freq_value = val_ui16; - status_code = rsmi_dev_metrics_avg_dclock0_frequency_get(i, &temp_avg_dclock0_freq_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_dclock0_frequency_get", status_code); - - auto temp_avg_vclock1_freq_value = val_ui16; - status_code = rsmi_dev_metrics_avg_vclock1_frequency_get(i, &temp_avg_vclock1_freq_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_vclock1_frequency_get", status_code); - - auto temp_avg_dclock1_freq_value = val_ui16; - status_code = rsmi_dev_metrics_avg_dclock1_frequency_get(i, &temp_avg_dclock1_freq_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_avg_dclock1_frequency_get", status_code); - - auto temp_curr_vclk1_value = val_ui16; - status_code = rsmi_dev_metrics_curr_vclk1_get(i, &temp_curr_vclk1_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_curr_vclk1_get", status_code); - - auto temp_curr_dclk1_value = val_ui16; - status_code = rsmi_dev_metrics_curr_dclk1_get(i, &temp_curr_dclk1_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_curr_dclk1_get", status_code); - - auto temp_curr_uclk_value = val_ui16; - status_code = rsmi_dev_metrics_curr_uclk_get(i, &temp_curr_uclk_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_curr_uclk_get", status_code); - - GPUMetricCurrDClk0_t temp_curr_dclk0_values{}; - status_code = rsmi_dev_metrics_curr_dclk0_get(i, &temp_curr_dclk0_values); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_curr_dclk0_get", status_code); - - GPUMetricCurrGfxClk_t temp_curr_gfxclk_values{}; - status_code = rsmi_dev_metrics_curr_gfxclk_get(i, &temp_curr_gfxclk_values); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_curr_gfxclk_get", status_code); - - GPUMetricCurrSocClk_t temp_curr_socclk_values{}; - status_code = rsmi_dev_metrics_curr_socclk_get(i, &temp_curr_socclk_values); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_curr_socclk_get", status_code); - - GPUMetricCurrVClk0_t temp_curr_vclk0_values{}; - status_code = rsmi_dev_metrics_curr_vclk0_get(i, &temp_curr_vclk0_values); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_curr_vclk0_get", status_code); - - auto temp_indep_throttle_status_value = val_ui64; - status_code = rsmi_dev_metrics_indep_throttle_status_get(i, &temp_indep_throttle_status_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_indep_throttle_status_get", status_code); - - auto temp_throttle_status_value = val_ui32; - status_code = rsmi_dev_metrics_throttle_status_get(i, &temp_throttle_status_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_throttle_status_get", status_code); - - auto temp_gfxclk_lock_status_value = val_ui32; - status_code = rsmi_dev_metrics_gfxclk_lock_status_get(i, &temp_gfxclk_lock_status_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_gfxclk_lock_status_get", status_code); - - auto temp_curr_fan_speed_value = val_ui16; - status_code = rsmi_dev_metrics_curr_fan_speed_get(i, &temp_curr_fan_speed_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_curr_fan_speed_get", status_code); - - auto temp_pcie_link_width_value = val_ui16; - status_code = rsmi_dev_metrics_pcie_link_width_get(i, &temp_pcie_link_width_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_pcie_link_width_get", status_code); - - auto temp_pcie_link_speed_value = val_ui16; - status_code = rsmi_dev_metrics_pcie_link_speed_get(i, &temp_pcie_link_speed_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_pcie_link_speed_get", status_code); - - auto temp_pcie_bandwidth_accum_value = val_ui64; - status_code = rsmi_dev_metrics_pcie_bandwidth_acc_get(i, &temp_pcie_bandwidth_accum_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_pcie_bandwidth_acc_get", status_code); - - auto temp_pcie_bandwidth_inst_value = val_ui64; - status_code = rsmi_dev_metrics_pcie_bandwidth_inst_get(i, &temp_pcie_bandwidth_inst_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_pcie_bandwidth_inst_get", status_code); - - auto temp_pcie_l0_recov_count_accum_value = val_ui64; - status_code = rsmi_dev_metrics_pcie_l0_recov_count_acc_get(i, &temp_pcie_l0_recov_count_accum_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_pcie_l0_recov_count_acc_get", status_code); - - auto temp_pcie_replay_count_accum_value = val_ui64; - status_code = rsmi_dev_metrics_pcie_replay_count_acc_get(i, &temp_pcie_replay_count_accum_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_pcie_replay_count_acc_get", status_code); - - auto temp_pcie_replay_rover_count_accum_value = val_ui64; - status_code = rsmi_dev_metrics_pcie_replay_rover_count_acc_get(i, &temp_pcie_replay_rover_count_accum_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_pcie_replay_rover_count_acc_get", status_code); - - auto temp_pcie_nak_sent_count_accum_value = val_ui32; - status_code = rsmi_dev_metrics_pcie_nak_sent_count_acc_get(i, &temp_pcie_nak_sent_count_accum_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_pcie_nak_sent_count_acc_get", status_code); - - auto temp_pcie_nak_rcvd_count_accum_value = val_ui32; - status_code = rsmi_dev_metrics_pcie_nak_rcvd_count_acc_get(i, &temp_pcie_nak_rcvd_count_accum_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_pcie_nak_rcvd_count_acc_get", status_code); - - auto temp_xgmi_link_width_value = val_ui16; - status_code = rsmi_dev_metrics_xgmi_link_width_get(i, &temp_xgmi_link_width_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_xgmi_link_width_get", status_code); - - auto temp_xgmi_link_speed_value = val_ui16; - status_code = rsmi_dev_metrics_xgmi_link_speed_get(i, &temp_xgmi_link_speed_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_xgmi_link_speed_get", status_code); - - GPUMetricXgmiReadDataAcc_t temp_xgmi_read_values{}; - status_code = rsmi_dev_metrics_xgmi_read_data_get(i, &temp_xgmi_read_values); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_xgmi_read_data_get", status_code); - - GPUMetricXgmiWriteDataAcc_t temp_xgmi_write_values{}; - status_code = rsmi_dev_metrics_xgmi_write_data_get(i, &temp_xgmi_write_values); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_xgmi_write_data_get", status_code); - - auto temp_voltage_soc_value = val_ui16; - status_code = rsmi_dev_metrics_volt_soc_get(i, &temp_voltage_soc_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_volt_soc_get", status_code); - - auto temp_voltage_gfx_value = val_ui16; - status_code = rsmi_dev_metrics_volt_gfx_get(i, &temp_voltage_gfx_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_volt_gfx_get", status_code); - - auto temp_voltage_mem_value = val_ui16; - status_code = rsmi_dev_metrics_volt_mem_get(i, &temp_voltage_mem_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_volt_mem_get", status_code); - - auto temp_system_clock_counter_value = val_ui64; - status_code = rsmi_dev_metrics_system_clock_counter_get(i, &temp_system_clock_counter_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_system_clock_counter_get", status_code); - - auto temp_firmware_timestamp_value = val_ui64; - status_code = rsmi_dev_metrics_firmware_timestamp_get(i, &temp_firmware_timestamp_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_firmware_timestamp_get", status_code); - - auto temp_xcd_counter_value = val_ui16; - status_code = rsmi_dev_metrics_xcd_counter_get(i, &temp_xcd_counter_value); - if (status_code != RSMI_STATUS_NOT_SUPPORTED) { - CHK_ERR_ASRT(status_code); - } - MetricResults.emplace("rsmi_dev_metrics_xcd_counter_get", status_code); - - IF_VERB(STANDARD) { - std::cout << "\n"; - std::cout << "\t[Temperature]" << "\n"; - std::cout << print_error_or_value("\t -> temp_edge(): ", "rsmi_dev_metrics_temp_edge_get", temp_edge_value) << "\n"; - std::cout << print_error_or_value("\t -> temp_hotspot(): ", "rsmi_dev_metrics_temp_hotspot_get", temp_hotspot_value) << "\n"; - std::cout << print_error_or_value("\t -> temp_mem(): ", "rsmi_dev_metrics_temp_mem_get", temp_mem_value) << "\n"; - std::cout << print_error_or_value("\t -> temp_vrgfx(): ", "rsmi_dev_metrics_temp_vrgfx_get", temp_vrgfx_value) << "\n"; - std::cout << print_error_or_value("\t -> temp_vrsoc(): ", "rsmi_dev_metrics_temp_vrsoc_get", temp_vrsoc_value) << "\n"; - std::cout << print_error_or_value("\t -> temp_vrmem(): ", "rsmi_dev_metrics_temp_vrmem_get", temp_vrmem_value) << "\n"; - std::cout << print_error_or_value("\t -> temp_hbm[]: ", "rsmi_dev_metrics_temp_hbm_get", temp_hbm_values) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Power/Energy]" << "\n"; - std::cout << print_error_or_value("\t -> current_socket_power(): ", "rsmi_dev_metrics_curr_socket_power_get", temp_curr_socket_power_value) << "\n"; - std::cout << print_error_or_value("\t -> energy_accum(): ", "rsmi_dev_metrics_energy_acc_get", temp_energy_accum_value) << "\n"; - std::cout << print_error_or_value("\t -> average_socket_power(): ", "rsmi_dev_metrics_avg_socket_power_get", temp_avg_socket_power_value) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Utilization]" << "\n"; - std::cout << print_error_or_value("\t -> average_gfx_activity(): ", "rsmi_dev_metrics_avg_gfx_activity_get", temp_avg_gfx_activity_value) << "\n"; - std::cout << print_error_or_value("\t -> average_umc_activity(): ", "rsmi_dev_metrics_avg_umc_activity_get", temp_avg_umc_activity_value) << "\n"; - std::cout << print_error_or_value("\t -> average_mm_activity(): ", "rsmi_dev_metrics_avg_mm_activity_get", temp_avg_mm_activity_value) << "\n"; - std::cout << print_error_or_value("\t -> vcn_activity[]: ", "rsmi_dev_metrics_vcn_activity_get", temp_vcn_values) << "\n"; - std::cout << print_error_or_value("\t -> jpeg_activity[]: ", "rsmi_dev_metrics_jpeg_activity_get", temp_jpeg_values) << "\n"; - - std::cout << "\n"; - std::cout << print_error_or_value("\t -> mem_activity_accum(): ", "rsmi_dev_metrics_mem_activity_acc_get", temp_mem_activity_accum_value) << "\n"; - std::cout << print_error_or_value("\t -> gfx_activity_accum(): ", "rsmi_dev_metrics_gfx_activity_acc_get", temp_gfx_activity_accum_value) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Average Clock]" << "\n"; - std::cout << print_error_or_value("\t -> average_gfx_clock_frequency(): ", "rsmi_dev_metrics_avg_gfx_clock_frequency_get", temp_avg_gfx_clock_freq_value) << "\n"; - std::cout << print_error_or_value("\t -> average_soc_clock_frequency(): ", "rsmi_dev_metrics_avg_soc_clock_frequency_get", temp_avg_soc_clock_freq_value) << "\n"; - std::cout << print_error_or_value("\t -> average_uclock_frequency(): ", "rsmi_dev_metrics_avg_uclock_frequency_get", temp_avg_uclock_freq_value) << "\n"; - std::cout << print_error_or_value("\t -> average_vclock0_frequency(): ", "rsmi_dev_metrics_avg_vclock0_frequency_get", temp_avg_vclock0_freq_value) << "\n"; - std::cout << print_error_or_value("\t -> average_dclock0_frequency(): ", "rsmi_dev_metrics_avg_dclock0_frequency_get", temp_avg_dclock0_freq_value) << "\n"; - std::cout << print_error_or_value("\t -> average_vclock1_frequency(): ", "rsmi_dev_metrics_avg_vclock1_frequency_get", temp_avg_vclock1_freq_value) << "\n"; - std::cout << print_error_or_value("\t -> average_dclock1_frequency(): ", "rsmi_dev_metrics_avg_dclock1_frequency_get", temp_avg_dclock1_freq_value) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Current Clock]" << "\n"; - std::cout << print_error_or_value("\t -> current_vclock1(): ", "rsmi_dev_metrics_curr_vclk1_get", temp_curr_vclk1_value) << "\n"; - std::cout << print_error_or_value("\t -> current_dclock1(): ", "rsmi_dev_metrics_curr_dclk1_get", temp_curr_dclk1_value) << "\n"; - std::cout << print_error_or_value("\t -> current_uclock(): ", "rsmi_dev_metrics_curr_uclk_get", temp_curr_uclk_value) << "\n"; - std::cout << print_error_or_value("\t -> current_dclk0[]: ", "rsmi_dev_metrics_curr_dclk0_get", temp_curr_dclk0_values) << "\n"; - std::cout << print_error_or_value("\t -> current_gfxclk[]: ", "rsmi_dev_metrics_curr_gfxclk_get", temp_curr_gfxclk_values) << "\n"; - std::cout << print_error_or_value("\t -> current_soc_clock[]: ", "rsmi_dev_metrics_curr_socclk_get", temp_curr_socclk_values) << "\n"; - std::cout << print_error_or_value("\t -> current_vclk0[]: ", "rsmi_dev_metrics_curr_vclk0_get", temp_curr_vclk0_values) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Throttle]" << "\n"; - std::cout << print_error_or_value("\t -> indep_throttle_status(): ", "rsmi_dev_metrics_indep_throttle_status_get", temp_indep_throttle_status_value) << "\n"; - std::cout << print_error_or_value("\t -> throttle_status(): ", "rsmi_dev_metrics_throttle_status_get", temp_throttle_status_value) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Gfx Clock Lock]" << "\n"; - std::cout << print_error_or_value("\t -> gfxclk_lock_status(): ", "rsmi_dev_metrics_gfxclk_lock_status_get", temp_gfxclk_lock_status_value) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Current Fan Speed]" << "\n"; - std::cout << print_error_or_value("\t -> current_fan_speed(): ", "rsmi_dev_metrics_curr_fan_speed_get", temp_curr_fan_speed_value) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Link/Bandwidth/Speed]" << "\n"; - std::cout << print_error_or_value("\t -> pcie_link_width(): ", "rsmi_dev_metrics_pcie_link_width_get", temp_pcie_link_width_value) << "\n"; - std::cout << print_error_or_value("\t -> pcie_link_speed(): ", "rsmi_dev_metrics_pcie_link_speed_get", temp_pcie_link_speed_value) << "\n"; - std::cout << print_error_or_value("\t -> pcie_bandwidth_accum(): ", "rsmi_dev_metrics_pcie_bandwidth_acc_get", temp_pcie_bandwidth_accum_value) << "\n"; - std::cout << print_error_or_value("\t -> pcie_bandwidth_inst(): ", "rsmi_dev_metrics_pcie_bandwidth_inst_get", temp_pcie_bandwidth_inst_value) << "\n"; - std::cout << print_error_or_value("\t -> pcie_l0_recov_count_accum(): ", "rsmi_dev_metrics_pcie_l0_recov_count_acc_get", temp_pcie_l0_recov_count_accum_value) << "\n"; - std::cout << print_error_or_value("\t -> pcie_replay_count_accum(): ", "rsmi_dev_metrics_pcie_replay_count_acc_get", temp_pcie_replay_count_accum_value) << "\n"; - std::cout << print_error_or_value("\t -> pcie_replay_rollover_count_accum(): ", "rsmi_dev_metrics_pcie_replay_rover_count_acc_get", temp_pcie_replay_rover_count_accum_value) << "\n"; - std::cout << print_error_or_value("\t -> pcie_nak_sent_count_accum(): ", "rsmi_dev_metrics_pcie_nak_sent_count_acc_get", temp_pcie_nak_sent_count_accum_value) << "\n"; - std::cout << print_error_or_value("\t -> pcie_nak_rcvd_count_accum(): ", "rsmi_dev_metrics_pcie_nak_rcvd_count_acc_get", temp_pcie_nak_rcvd_count_accum_value) << "\n"; - std::cout << print_error_or_value("\t -> xgmi_link_width(): ", "rsmi_dev_metrics_xgmi_link_width_get", temp_xgmi_link_width_value) << "\n"; - std::cout << print_error_or_value("\t -> xgmi_link_speed(): ", "rsmi_dev_metrics_xgmi_link_speed_get", temp_xgmi_link_speed_value) << "\n"; - std::cout << print_error_or_value("\t -> xgmi_read_data[]: ", "rsmi_dev_metrics_xgmi_read_data_get", temp_xgmi_read_values) << "\n"; - std::cout << print_error_or_value("\t -> xgmi_write_data[]: ", "rsmi_dev_metrics_xgmi_write_data_get", temp_xgmi_write_values) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Voltage]" << "\n"; - std::cout << print_error_or_value("\t -> voltage_soc(): ", "rsmi_dev_metrics_volt_soc_get", temp_voltage_soc_value) << "\n"; - std::cout << print_error_or_value("\t -> voltage_gfx(): ", "rsmi_dev_metrics_volt_gfx_get", temp_voltage_gfx_value) << "\n"; - std::cout << print_error_or_value("\t -> voltage_mem(): ", "rsmi_dev_metrics_volt_mem_get", temp_voltage_mem_value) << "\n"; - - std::cout << "\n"; - std::cout << "\t[Timestamp]" << "\n"; - std::cout << print_error_or_value("\t -> system_clock_counter(): ", "rsmi_dev_metrics_system_clock_counter_get", temp_system_clock_counter_value) << "\n"; - std::cout << print_error_or_value("\t -> firmware_timestamp(): ", "rsmi_dev_metrics_firmware_timestamp_get", temp_firmware_timestamp_value) << "\n"; - - std::cout << "\n"; - std::cout << "\t[XCD CounterVoltage]" << "\n"; - std::cout << print_error_or_value("\t -> xcd_counter(): ", "rsmi_dev_metrics_xcd_counter_get", temp_xcd_counter_value) << "\n"; - std::cout << "\n\n"; + auto temp_xcd_counter_value = uint16_t(0); + err = rsmi_dev_metrics_xcd_counter_get(i, &temp_xcd_counter_value); + if (err != RSMI_STATUS_NOT_SUPPORTED) { + CHK_ERR_ASRT(err); } } - } diff --git a/tests/rocm_smi_test/functional/measure_api_execution_time.cc b/tests/rocm_smi_test/functional/measure_api_execution_time.cc index e8bc54b044..4cbbec7553 100644 --- a/tests/rocm_smi_test/functional/measure_api_execution_time.cc +++ b/tests/rocm_smi_test/functional/measure_api_execution_time.cc @@ -167,930 +167,14 @@ void TestMeasureApiExecutionTime::Run(void) { skip = false; std::cout << "----------------------------------------------------------------------------" << std::endl; - //Test execution time for each individual gpu metric auto val_ui16 = uint16_t(0); - auto val_ui32 = uint32_t(0); - auto val_ui64 = uint64_t(0); - GPUMetricTempHbm_t temp_hbm_values; - GPUMetricVcnActivity_t temp_vcn_values; - GPUMetricJpegActivity_t temp_jpeg_values; - GPUMetricCurrDClk0_t temp_curr_dclk0_values; - GPUMetricCurrGfxClk_t temp_curr_gfxclk_values; - GPUMetricCurrSocClk_t temp_curr_socclk_values; - GPUMetricCurrVClk0_t temp_curr_vclk0_values; - GPUMetricXgmiReadDataAcc_t temp_xgmi_read_values; - GPUMetricXgmiWriteDataAcc_t temp_xgmi_write_values; auto status_code(rsmi_status_t::RSMI_STATUS_SUCCESS); - - start = std::chrono::high_resolution_clock::now(); auto start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_temp_edge_get(dv_ind, &val_ui16); - } - auto stop_api = std::chrono::high_resolution_clock::now(); - auto duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_temp_edge_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_temp_hotspot_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_temp_hotspot_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_temp_mem_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_temp_mem_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_temp_vrgfx_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_temp_vrgfx_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_temp_vrsoc_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_temp_vrsoc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_temp_vrmem_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_temp_vrmem_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_temp_hbm_get(dv_ind, &temp_hbm_values); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_temp_hbm_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_curr_socket_power_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_curr_socket_power_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_energy_acc_get(dv_ind, &val_ui64); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_energy_acc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_socket_power_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_socket_power_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_gfx_activity_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_gfx_activity_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_umc_activity_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_umc_activity_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_mm_activity_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_mm_activity_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_vcn_activity_get(dv_ind, &temp_vcn_values); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_vcn_activity_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_jpeg_activity_get(dv_ind, &temp_jpeg_values); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_jpeg_activity_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_mem_activity_acc_get(dv_ind, &val_ui32); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_mem_activity_acc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_gfx_activity_acc_get(dv_ind, &val_ui32); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_gfx_activity_acc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_gfx_clock_frequency_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_gfx_clock_frequency_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_soc_clock_frequency_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_soc_clock_frequency_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_uclock_frequency_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_uclock_frequency_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_vclock0_frequency_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_vclock0_frequency_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_dclock0_frequency_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_dclock0_frequency_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_vclock1_frequency_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_vclock1_frequency_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_avg_dclock1_frequency_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_avg_dclock1_frequency_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_curr_vclk1_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_curr_vclk1_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_curr_dclk1_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_curr_dclk1_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_curr_uclk_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_curr_uclk_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_curr_dclk0_get(dv_ind, &temp_curr_dclk0_values); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_curr_dclk0_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_curr_gfxclk_get(dv_ind, &temp_curr_gfxclk_values); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_curr_gfxclk_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_curr_socclk_get(dv_ind, &temp_curr_socclk_values); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_curr_socclk_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_curr_vclk0_get(dv_ind, &temp_curr_vclk0_values); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_curr_vclk0_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_indep_throttle_status_get(dv_ind, &val_ui64); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_indep_throttle_status_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_throttle_status_get(dv_ind, &val_ui32); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_throttle_status_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_gfxclk_lock_status_get(dv_ind, &val_ui32); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_gfxclk_lock_status_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_curr_fan_speed_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_curr_fan_speed_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_pcie_link_width_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_pcie_link_width_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_pcie_link_speed_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_pcie_link_speed_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_pcie_bandwidth_acc_get(dv_ind, &val_ui64); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_pcie_bandwidth_acc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_pcie_bandwidth_inst_get(dv_ind, &val_ui64); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_pcie_bandwidth_inst_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_pcie_l0_recov_count_acc_get(dv_ind, &val_ui64); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_pcie_l0_recov_count_acc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_pcie_replay_count_acc_get(dv_ind, &val_ui64); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_pcie_replay_count_acc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_pcie_replay_rover_count_acc_get(dv_ind, &val_ui64); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_pcie_replay_rover_count_acc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_pcie_nak_sent_count_acc_get(dv_ind, &val_ui32); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_pcie_nak_sent_count_acc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_pcie_nak_rcvd_count_acc_get(dv_ind, &val_ui32); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_pcie_nak_rcvd_count_acc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_xgmi_link_width_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_xgmi_link_width_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_xgmi_link_speed_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_xgmi_link_speed_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_xgmi_read_data_get(dv_ind, &temp_xgmi_read_values); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_xgmi_read_data_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_xgmi_write_data_get(dv_ind, &temp_xgmi_write_values); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_xgmi_write_data_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_volt_soc_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_volt_soc_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_volt_gfx_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_volt_gfx_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_volt_mem_get(dv_ind, &val_ui16); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_volt_mem_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_system_clock_counter_get(dv_ind, &val_ui64); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_system_clock_counter_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); - for (int i=0; i < repeat; ++i) { - status_code = rsmi_dev_metrics_firmware_timestamp_get(dv_ind, &val_ui64); - } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); - if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ - skip = true; - } - if (!skip) { - std::cout << "\rsmi_dev_metrics_firmware_timestamp_get() execution time: " - << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * repeat); - } - skip = false; - std::cout << "----------------------------------------------------------------------------" << std::endl; - - start_api = std::chrono::high_resolution_clock::now(); for (int i=0; i < repeat; ++i) { status_code = rsmi_dev_metrics_xcd_counter_get(dv_ind, &val_ui16); } - stop_api = std::chrono::high_resolution_clock::now(); - duration_api = std::chrono::duration_cast(stop_api - start_api); + auto stop_api = std::chrono::high_resolution_clock::now(); + auto duration_api = std::chrono::duration_cast(stop_api - start_api); if (status_code != rsmi_status_t::RSMI_STATUS_SUCCESS){ skip = true; } @@ -1105,10 +189,9 @@ void TestMeasureApiExecutionTime::Run(void) { stop = std::chrono::high_resolution_clock::now(); duration = std::chrono::duration_cast(stop - start); if (!skip) { - const auto kTOTAL_GPU_METRICS_APIS = uint16_t(57); std::cout << "\rTotal execution time (All APIs): " << (float(duration_api.count()) / repeat) << " microseconds" << std::endl; - EXPECT_LT(duration_api.count(), 500 * (repeat * kTOTAL_GPU_METRICS_APIS)); + EXPECT_LT(duration_api.count(), (500 * repeat)); } skip = false; std::cout << "============================================================================" << std::endl;