Clock, Power and Performance Queries

Clock, Power and Performance Queries#

AMD SMI: Clock, Power and Performance Queries
Clock, Power and Performance Queries

Functions

amdsmi_status_t amdsmi_dev_get_busy_percent (amdsmi_device_handle device_handle, uint32_t *busy_percent)
 Get percentage of time device is busy doing any processing. More...
 
amdsmi_status_t amdsmi_get_utilization_count (amdsmi_device_handle device_handle, amdsmi_utilization_counter_t utilization_counters[], uint32_t count, uint64_t *timestamp)
 Get coarse grain utilization counter of the specified device. More...
 
amdsmi_status_t amdsmi_get_pcie_link_status (amdsmi_device_handle device_handle, amdsmi_pcie_info_t *info)
 Get current PCIE info of the device with provided device handle. More...
 
amdsmi_status_t amdsmi_get_pcie_link_caps (amdsmi_device_handle device_handle, amdsmi_pcie_info_t *info)
 Get max PCIe capabilities of the device with provided device handle. More...
 
amdsmi_status_t amdsmi_dev_get_perf_level (amdsmi_device_handle device_handle, amdsmi_dev_perf_level_t *perf)
 Get the performance level of the device. More...
 
amdsmi_status_t amdsmi_set_perf_determinism_mode (amdsmi_device_handle device_handle, uint64_t clkvalue)
 Enter performance determinism mode with provided device handle. More...
 
amdsmi_status_t amdsmi_dev_get_overdrive_level (amdsmi_device_handle device_handle, uint32_t *od)
 Get the overdrive percent associated with the device with provided device handle. More...
 
amdsmi_status_t amdsmi_dev_get_gpu_clk_freq (amdsmi_device_handle device_handle, amdsmi_clk_type_t clk_type, amdsmi_frequencies_t *f)
 Get the list of possible system clock speeds of device for a specified clock type. More...
 
amdsmi_status_t amdsmi_dev_reset_gpu (amdsmi_device_handle device_handle)
 Reset the gpu associated with the device with provided device handle. More...
 
amdsmi_status_t amdsmi_dev_get_od_volt_info (amdsmi_device_handle device_handle, amdsmi_od_volt_freq_data_t *odv)
 This function retrieves the voltage/frequency curve information. More...
 
amdsmi_status_t amdsmi_dev_get_gpu_metrics_info (amdsmi_device_handle device_handle, amdsmi_gpu_metrics_t *pgpu_metrics)
 This function retrieves the gpu metrics information. More...
 
amdsmi_status_t amdsmi_dev_set_clk_range (amdsmi_device_handle device_handle, uint64_t minclkvalue, uint64_t maxclkvalue, amdsmi_clk_type_t clkType)
 This function sets the clock range information. More...
 
amdsmi_status_t amdsmi_dev_set_od_clk_info (amdsmi_device_handle device_handle, amdsmi_freq_ind_t level, uint64_t clkvalue, amdsmi_clk_type_t clkType)
 This function sets the clock frequency information. More...
 
amdsmi_status_t amdsmi_dev_set_od_volt_info (amdsmi_device_handle device_handle, uint32_t vpoint, uint64_t clkvalue, uint64_t voltvalue)
 This function sets 1 of the 3 voltage curve points. More...
 
amdsmi_status_t amdsmi_dev_get_od_volt_curve_regions (amdsmi_device_handle device_handle, uint32_t *num_regions, amdsmi_freq_volt_region_t *buffer)
 This function will retrieve the current valid regions in the frequency/voltage space. More...
 
amdsmi_status_t amdsmi_dev_get_power_profile_presets (amdsmi_device_handle device_handle, uint32_t sensor_ind, amdsmi_power_profile_status_t *status)
 Get the list of available preset power profiles and an indication of which profile is currently active. More...
 

Detailed Description

These functions provide information about clock frequencies and performance.

Function Documentation

◆ amdsmi_dev_get_busy_percent()

amdsmi_status_t amdsmi_dev_get_busy_percent ( amdsmi_device_handle  device_handle,
uint32_t *  busy_percent 
)

Get percentage of time device is busy doing any processing.

Given a device handle device_handle, this function returns the percentage of time that the specified device is busy. The device is considered busy if any one or more of its sub-blocks are working, and idle if none of the sub-blocks are working.

Parameters
[in]device_handlea device handle
[in,out]busy_percenta pointer to the uint32_t to which the busy percent will be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_get_utilization_count()

amdsmi_status_t amdsmi_get_utilization_count ( amdsmi_device_handle  device_handle,
amdsmi_utilization_counter_t  utilization_counters[],
uint32_t  count,
uint64_t *  timestamp 
)

Get coarse grain utilization counter of the specified device.

Given a device handle device_handle, the array of the utilization counters, the size of the array, this function returns the coarse grain utilization counters and timestamp. The counter is the accumulated percentages. Every milliseconds the firmware calculates % busy count and then accumulates that value in the counter. This provides minimally invasive coarse grain GPU usage information.

Parameters
[in]device_handlea device handle
[in,out]utilization_countersMultiple utilization counters can be retreived with a single call. The caller must allocate enough space to the utilization_counters array. The caller also needs to set valid AMDSMI_UTILIZATION_COUNTER_TYPE type for each element of the array. AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.

If the function reutrns AMDSMI_STATUS_SUCCESS, the counter will be set in the value field of the amdsmi_utilization_counter_t.

Parameters
[in]countThe size of utilization_counters array.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_get_pcie_link_status()

amdsmi_status_t amdsmi_get_pcie_link_status ( amdsmi_device_handle  device_handle,
amdsmi_pcie_info_t info 
)

Get current PCIE info of the device with provided device handle.

Given a device handle device_handle, this function returns PCIE info of the given device.

Parameters
[in]device_handlea device handle
[out]infoamdsmi_pcie_info_t struct which will hold all the extracted PCIE info data.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_get_pcie_link_caps()

amdsmi_status_t amdsmi_get_pcie_link_caps ( amdsmi_device_handle  device_handle,
amdsmi_pcie_info_t info 
)

Get max PCIe capabilities of the device with provided device handle.

Given a device handle device_handle, this function returns PCIe caps info of the given device.

Parameters
[in]device_handlea device handle
[out]infoamdsmi_pcie_info_t struct which will hold all the extracted PCIe caps data.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_perf_level()

amdsmi_status_t amdsmi_dev_get_perf_level ( amdsmi_device_handle  device_handle,
amdsmi_dev_perf_level_t perf 
)

Get the performance level of the device.

This function will write the amdsmi_dev_perf_level_t to the uint32_t pointed to by perf, for a given device handle device_handle and a pointer to a uint32_t perf.

Parameters
[in]device_handlea device handle
[in,out]perfa pointer to amdsmi_dev_perf_level_t to which the performance level will be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_set_perf_determinism_mode()

amdsmi_status_t amdsmi_set_perf_determinism_mode ( amdsmi_device_handle  device_handle,
uint64_t  clkvalue 
)

Enter performance determinism mode with provided device handle.

Given a device handle device_handle and clkvalue this function will enable performance determinism mode, which enforces a GFXCLK frequency SoftMax limit per GPU set by the user. This prevents the GFXCLK PLL from stretching when running the same workload on different GPUS, making performance variation minimal. This call will result in the performance level amdsmi_dev_perf_level_t of the device being AMDSMI_DEV_PERF_LEVEL_DETERMINISM.

Parameters
[in]device_handlea device handle
[in]clkvalueSoftmax value for GFXCLK in MHz.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_overdrive_level()

amdsmi_status_t amdsmi_dev_get_overdrive_level ( amdsmi_device_handle  device_handle,
uint32_t *  od 
)

Get the overdrive percent associated with the device with provided device handle.

Given a device handle device_handle and a pointer to a uint32_t od, this function will write the overdrive percentage to the uint32_t pointed to by od

Parameters
[in]device_handlea device handle
[in,out]oda pointer to uint32_t to which the overdrive percentage will be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_gpu_clk_freq()

amdsmi_status_t amdsmi_dev_get_gpu_clk_freq ( amdsmi_device_handle  device_handle,
amdsmi_clk_type_t  clk_type,
amdsmi_frequencies_t f 
)

Get the list of possible system clock speeds of device for a specified clock type.

Given a device handle device_handle, a clock type clk_type, and a pointer to a to an amdsmi_frequencies_t structure f, this function will fill in f with the possible clock speeds, and indication of the current clock speed selection.

Parameters
[in]device_handlea device handle
[in]clk_typethe type of clock for which the frequency is desired
[in,out]fa pointer to a caller provided amdsmi_frequencies_t structure to which the frequency information will be written. Frequency values are in Hz.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_reset_gpu()

amdsmi_status_t amdsmi_dev_reset_gpu ( amdsmi_device_handle  device_handle)

Reset the gpu associated with the device with provided device handle.

Given a device handle device_handle, this function will reset the GPU

Parameters
[in]device_handlea device handle
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_od_volt_info()

amdsmi_status_t amdsmi_dev_get_od_volt_info ( amdsmi_device_handle  device_handle,
amdsmi_od_volt_freq_data_t odv 
)

This function retrieves the voltage/frequency curve information.

Given a device handle device_handle and a pointer to a amdsmi_od_volt_freq_data_t structure odv, this function will populate odv. See amdsmi_od_volt_freq_data_t for more details.

Parameters
[in]device_handlea device handle
[in,out]odva pointer to an amdsmi_od_volt_freq_data_t structure If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_gpu_metrics_info()

amdsmi_status_t amdsmi_dev_get_gpu_metrics_info ( amdsmi_device_handle  device_handle,
amdsmi_gpu_metrics_t pgpu_metrics 
)

This function retrieves the gpu metrics information.

Given a device handle device_handle and a pointer to a amdsmi_gpu_metrics_t structure pgpu_metrics, this function will populate pgpu_metrics. See amdsmi_gpu_metrics_t for more details.

Parameters
[in]device_handlea device handle
[in,out]pgpu_metricsa pointer to an amdsmi_gpu_metrics_t structure If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_set_clk_range()

amdsmi_status_t amdsmi_dev_set_clk_range ( amdsmi_device_handle  device_handle,
uint64_t  minclkvalue,
uint64_t  maxclkvalue,
amdsmi_clk_type_t  clkType 
)

This function sets the clock range information.

Given a device handle device_handle, a minimum clock value minclkvalue, a maximum clock value maxclkvalue and a clock type clkType this function will set the sclk|mclk range

Parameters
[in]device_handlea device handle
[in]minclkvaluevalue to apply to the clock range. Frequency values are in MHz.
[in]maxclkvaluevalue to apply to the clock range. Frequency values are in MHz.
[in]clkTypeAMDSMI_CLK_TYPE_SYS | AMDSMI_CLK_TYPE_MEM range type
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_set_od_clk_info()

amdsmi_status_t amdsmi_dev_set_od_clk_info ( amdsmi_device_handle  device_handle,
amdsmi_freq_ind_t  level,
uint64_t  clkvalue,
amdsmi_clk_type_t  clkType 
)

This function sets the clock frequency information.

Given a device handle device_handle, a frequency level level, a clock value clkvalue and a clock type clkType this function will set the sclk|mclk range

Parameters
[in]device_handlea device handle
[in]levelAMDSMI_FREQ_IND_MIN|AMDSMI_FREQ_IND_MAX to set the minimum (0) or maximum (1) speed.
[in]clkvaluevalue to apply to the clock range. Frequency values are in MHz.
[in]clkTypeAMDSMI_CLK_TYPE_SYS | AMDSMI_CLK_TYPE_MEM range type
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_set_od_volt_info()

amdsmi_status_t amdsmi_dev_set_od_volt_info ( amdsmi_device_handle  device_handle,
uint32_t  vpoint,
uint64_t  clkvalue,
uint64_t  voltvalue 
)

This function sets 1 of the 3 voltage curve points.

Given a device handle device_handle, a voltage point vpoint and a voltage value voltvalue this function will set voltage curve point

Parameters
[in]device_handlea device handle
[in]vpointvoltage point [0|1|2] on the voltage curve
[in]clkvalueclock value component of voltage curve point. Frequency values are in MHz.
[in]voltvaluevoltage value component of voltage curve point. Voltage is in mV.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_od_volt_curve_regions()

amdsmi_status_t amdsmi_dev_get_od_volt_curve_regions ( amdsmi_device_handle  device_handle,
uint32_t *  num_regions,
amdsmi_freq_volt_region_t buffer 
)

This function will retrieve the current valid regions in the frequency/voltage space.

Given a device handle device_handle, a pointer to an unsigned integer num_regions and a buffer of amdsmi_freq_volt_region_t structures, buffer, this function will populate buffer with the current frequency-volt space regions. The caller should assign buffer to memory that can be written to by this function. The caller should also indicate the number of amdsmi_freq_volt_region_t structures that can safely be written to buffer in num_regions.

The number of regions to expect this function provide (num_regions) can be obtained by calling :: amdsmi_dev_get_od_volt_info().

Parameters
[in]device_handlea device handle
[in,out]num_regionsAs input, this is the number of amdsmi_freq_volt_region_t structures that can be written to buffer. As output, this is the number of amdsmi_freq_volt_region_t structures that were actually written. If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
[in,out]buffera caller provided buffer to which amdsmi_freq_volt_region_t structures will be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_power_profile_presets()

amdsmi_status_t amdsmi_dev_get_power_profile_presets ( amdsmi_device_handle  device_handle,
uint32_t  sensor_ind,
amdsmi_power_profile_status_t status 
)

Get the list of available preset power profiles and an indication of which profile is currently active.

Given a device handle device_handle and a pointer to a amdsmi_power_profile_status_t status, this function will set the bits of the amdsmi_power_profile_status_t.available_profiles bit field of status to 1 if the profile corresponding to the respective amdsmi_power_profile_preset_masks_t profiles are enabled. For example, if both the VIDEO and VR power profiles are available selections, then AMDSMI_PWR_PROF_PRST_VIDEO_MASK AND'ed with amdsmi_power_profile_status_t.available_profiles will be non-zero as will AMDSMI_PWR_PROF_PRST_VR_MASK AND'ed with amdsmi_power_profile_status_t.available_profiles. Additionally, amdsmi_power_profile_status_t.current will be set to the amdsmi_power_profile_preset_masks_t of the profile that is currently active.

Parameters
[in]device_handlea device handle
[in]sensor_inda 0-based sensor index. Normally, this will be 0. If a device has more than one sensor, it could be greater than 0.
[in,out]statusa pointer to amdsmi_power_profile_status_t that will be populated by a call to this function If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail