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_get_utilization_count (amdsmi_processor_handle processor_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_processor_handle processor_handle, amdsmi_pcie_info_t *info)
 Get current PCIE info of the device with provided processor handle. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_get_pcie_link_caps (amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info)
 Get max PCIe capabilities of the device with provided processor handle. More...
 
amdsmi_status_t amdsmi_get_gpu_perf_level (amdsmi_processor_handle processor_handle, amdsmi_dev_perf_level_t *perf)
 Get the performance level of the device. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_set_gpu_perf_determinism_mode (amdsmi_processor_handle processor_handle, uint64_t clkvalue)
 Enter performance determinism mode with provided processor handle. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_get_gpu_overdrive_level (amdsmi_processor_handle processor_handle, uint32_t *od)
 Get the overdrive percent associated with the device with provided processor handle. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_get_clk_freq (amdsmi_processor_handle processor_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. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_reset_gpu (amdsmi_processor_handle processor_handle)
 Reset the gpu associated with the device with provided processor handle. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_get_gpu_od_volt_info (amdsmi_processor_handle processor_handle, amdsmi_od_volt_freq_data_t *odv)
 This function retrieves the voltage/frequency curve information. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_get_gpu_metrics_info (amdsmi_processor_handle processor_handle, amdsmi_gpu_metrics_t *pgpu_metrics)
 This function retrieves the gpu metrics information. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_set_gpu_clk_range (amdsmi_processor_handle processor_handle, uint64_t minclkvalue, uint64_t maxclkvalue, amdsmi_clk_type_t clkType)
 This function sets the clock range information. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_set_gpu_od_clk_info (amdsmi_processor_handle processor_handle, amdsmi_freq_ind_t level, uint64_t clkvalue, amdsmi_clk_type_t clkType)
 This function sets the clock frequency information. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_set_gpu_od_volt_info (amdsmi_processor_handle processor_handle, uint32_t vpoint, uint64_t clkvalue, uint64_t voltvalue)
 This function sets 1 of the 3 voltage curve points. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_get_gpu_od_volt_curve_regions (amdsmi_processor_handle processor_handle, uint32_t *num_regions, amdsmi_freq_volt_region_t *buffer)
 This function will retrieve the current valid regions in the frequency/voltage space. It is not supported on virtual machine guest. More...
 
amdsmi_status_t amdsmi_get_gpu_power_profile_presets (amdsmi_processor_handle processor_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. It is not supported on virtual machine guest. More...
 

Detailed Description

These functions provide information about clock frequencies and performance.

Function Documentation

◆ amdsmi_get_utilization_count()

amdsmi_status_t amdsmi_get_utilization_count ( amdsmi_processor_handle  processor_handle,
amdsmi_utilization_counter_t  utilization_counters[],
uint32_t  count,
uint64_t *  timestamp 
)

Get coarse grain utilization counter of the specified device.

Given a processor handle processor_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]processor_handlea processor 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_processor_handle  processor_handle,
amdsmi_pcie_info_t info 
)

Get current PCIE info of the device with provided processor handle. It is not supported on virtual machine guest.

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

Parameters
[in]processor_handlea processor 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_processor_handle  processor_handle,
amdsmi_pcie_info_t info 
)

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

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

Parameters
[in]processor_handlea processor 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_get_gpu_perf_level()

amdsmi_status_t amdsmi_get_gpu_perf_level ( amdsmi_processor_handle  processor_handle,
amdsmi_dev_perf_level_t perf 
)

Get the performance level of the device. It is not supported on virtual machine guest.

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

Parameters
[in]processor_handlea processor 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_gpu_perf_determinism_mode()

amdsmi_status_t amdsmi_set_gpu_perf_determinism_mode ( amdsmi_processor_handle  processor_handle,
uint64_t  clkvalue 
)

Enter performance determinism mode with provided processor handle. It is not supported on virtual machine guest.

Given a processor handle processor_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]processor_handlea processor handle
[in]clkvalueSoftmax value for GFXCLK in MHz.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_get_gpu_overdrive_level()

amdsmi_status_t amdsmi_get_gpu_overdrive_level ( amdsmi_processor_handle  processor_handle,
uint32_t *  od 
)

Get the overdrive percent associated with the device with provided processor handle. It is not supported on virtual machine guest.

Given a processor handle processor_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]processor_handlea processor 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_get_clk_freq()

amdsmi_status_t amdsmi_get_clk_freq ( amdsmi_processor_handle  processor_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. It is not supported on virtual machine guest.

Given a processor handle processor_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]processor_handlea processor 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_reset_gpu()

amdsmi_status_t amdsmi_reset_gpu ( amdsmi_processor_handle  processor_handle)

Reset the gpu associated with the device with provided processor handle. It is not supported on virtual machine guest.

Given a processor handle processor_handle, this function will reset the GPU

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

◆ amdsmi_get_gpu_od_volt_info()

amdsmi_status_t amdsmi_get_gpu_od_volt_info ( amdsmi_processor_handle  processor_handle,
amdsmi_od_volt_freq_data_t odv 
)

This function retrieves the voltage/frequency curve information. It is not supported on virtual machine guest.

Given a processor handle processor_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]processor_handlea processor 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_get_gpu_metrics_info()

amdsmi_status_t amdsmi_get_gpu_metrics_info ( amdsmi_processor_handle  processor_handle,
amdsmi_gpu_metrics_t pgpu_metrics 
)

This function retrieves the gpu metrics information. It is not supported on virtual machine guest.

Given a processor handle processor_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]processor_handlea processor 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_set_gpu_clk_range()

amdsmi_status_t amdsmi_set_gpu_clk_range ( amdsmi_processor_handle  processor_handle,
uint64_t  minclkvalue,
uint64_t  maxclkvalue,
amdsmi_clk_type_t  clkType 
)

This function sets the clock range information. It is not supported on virtual machine guest.

Given a processor handle processor_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]processor_handlea processor 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_set_gpu_od_clk_info()

amdsmi_status_t amdsmi_set_gpu_od_clk_info ( amdsmi_processor_handle  processor_handle,
amdsmi_freq_ind_t  level,
uint64_t  clkvalue,
amdsmi_clk_type_t  clkType 
)

This function sets the clock frequency information. It is not supported on virtual machine guest.

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

Parameters
[in]processor_handlea processor 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_set_gpu_od_volt_info()

amdsmi_status_t amdsmi_set_gpu_od_volt_info ( amdsmi_processor_handle  processor_handle,
uint32_t  vpoint,
uint64_t  clkvalue,
uint64_t  voltvalue 
)

This function sets 1 of the 3 voltage curve points. It is not supported on virtual machine guest.

Given a processor handle processor_handle, a voltage point vpoint and a voltage value voltvalue this function will set voltage curve point

Parameters
[in]processor_handlea processor 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_get_gpu_od_volt_curve_regions()

amdsmi_status_t amdsmi_get_gpu_od_volt_curve_regions ( amdsmi_processor_handle  processor_handle,
uint32_t *  num_regions,
amdsmi_freq_volt_region_t buffer 
)

This function will retrieve the current valid regions in the frequency/voltage space. It is not supported on virtual machine guest.

Given a processor handle processor_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_get_gpu_od_volt_info().

Parameters
[in]processor_handlea processor 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_get_gpu_power_profile_presets()

amdsmi_status_t amdsmi_get_gpu_power_profile_presets ( amdsmi_processor_handle  processor_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. It is not supported on virtual machine guest.

Given a processor handle processor_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]processor_handlea processor 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