Clock, Power and Performance Queries

Clock, Power and Performance Queries#

ROCmSMI: Clock, Power and Performance Queries
Clock, Power and Performance Queries

Functions

rsmi_status_t rsmi_dev_busy_percent_get (uint32_t dv_ind, uint32_t *busy_percent)
 Get percentage of time device is busy doing any processing. More...
 
rsmi_status_t rsmi_utilization_count_get (uint32_t dv_ind, rsmi_utilization_counter_t utilization_counters[], uint32_t count, uint64_t *timestamp)
 Get coarse grain utilization counter of the specified device. More...
 
rsmi_status_t rsmi_dev_activity_metric_get (uint32_t dv_ind, rsmi_activity_metric_t activity_metric_type, rsmi_activity_metric_counter_t *activity_metric_counter)
 Get activity metric average utilization counter of the specified device. More...
 
rsmi_status_t rsmi_dev_activity_avg_mm_get (uint32_t dv_ind, uint16_t *avg_activity)
 Get activity metric bandwidth average utilization counter of the specified device. More...
 
rsmi_status_t rsmi_dev_perf_level_get (uint32_t dv_ind, rsmi_dev_perf_level_t *perf)
 Get the performance level of the device with provided device index. More...
 
rsmi_status_t rsmi_perf_determinism_mode_set (uint32_t dv_ind, uint64_t clkvalue)
 Enter performance determinism mode with provided device index. More...
 
rsmi_status_t rsmi_dev_overdrive_level_get (uint32_t dv_ind, uint32_t *od)
 Get the overdrive percent associated with the device with provided device index. More...
 
rsmi_status_t rsmi_dev_mem_overdrive_level_get (uint32_t dv_ind, uint32_t *od)
 Get the memory clock overdrive percent associated with the device with provided device index. More...
 
rsmi_status_t rsmi_dev_gpu_clk_freq_get (uint32_t dv_ind, rsmi_clk_type_t clk_type, rsmi_frequencies_t *f)
 Get the list of possible system clock speeds of device for a specified clock type. More...
 
rsmi_status_t rsmi_dev_gpu_reset (uint32_t dv_ind)
 Reset the gpu associated with the device with provided device index. More...
 
rsmi_status_t rsmi_dev_od_volt_info_get (uint32_t dv_ind, rsmi_od_volt_freq_data_t *odv)
 This function retrieves the voltage/frequency curve information. More...
 
rsmi_status_t rsmi_dev_gpu_metrics_info_get (uint32_t dv_ind, rsmi_gpu_metrics_t *pgpu_metrics)
 This function retrieves the gpu metrics information. More...
 
rsmi_status_t rsmi_dev_clk_range_set (uint32_t dv_ind, uint64_t minclkvalue, uint64_t maxclkvalue, rsmi_clk_type_t clkType)
 This function sets the clock range information. More...
 
rsmi_status_t rsmi_dev_clk_extremum_set (uint32_t dv_ind, rsmi_freq_ind_t level, uint64_t clkvalue, rsmi_clk_type_t clkType)
 This function sets the clock min/max level. More...
 
rsmi_status_t rsmi_dev_od_clk_info_set (uint32_t dv_ind, rsmi_freq_ind_t level, uint64_t clkvalue, rsmi_clk_type_t clkType)
 This function sets the clock frequency information. More...
 
rsmi_status_t rsmi_dev_od_volt_info_set (uint32_t dv_ind, uint32_t vpoint, uint64_t clkvalue, uint64_t voltvalue)
 This function sets 1 of the 3 voltage curve points. More...
 
rsmi_status_t rsmi_dev_od_volt_curve_regions_get (uint32_t dv_ind, uint32_t *num_regions, rsmi_freq_volt_region_t *buffer)
 This function will retrieve the current valid regions in the frequency/voltage space. More...
 
rsmi_status_t rsmi_dev_power_profile_presets_get (uint32_t dv_ind, uint32_t sensor_ind, rsmi_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

◆ rsmi_dev_busy_percent_get()

rsmi_status_t rsmi_dev_busy_percent_get ( uint32_t  dv_ind,
uint32_t *  busy_percent 
)

Get percentage of time device is busy doing any processing.

Given a device index dv_ind, 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]dv_inda device index
[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 RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_utilization_count_get()

rsmi_status_t rsmi_utilization_count_get ( uint32_t  dv_ind,
rsmi_utilization_counter_t  utilization_counters[],
uint32_t  count,
uint64_t *  timestamp 
)

Get coarse grain utilization counter of the specified device.

Given a device index dv_ind, 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]dv_inda device index
[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 RSMI_UTILIZATION_COUNTER_TYPE type for each element of the array. RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.

If the function reutrns RSMI_STATUS_SUCCESS, the counter will be set in the value field of the rsmi_utilization_counter_t.

Parameters
[in]countThe size of utilization_counters array.
[in,out]timestampThe timestamp when the counter is retreived. Resolution: 1 ns.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_activity_metric_get()

rsmi_status_t rsmi_dev_activity_metric_get ( uint32_t  dv_ind,
rsmi_activity_metric_t  activity_metric_type,
rsmi_activity_metric_counter_t activity_metric_counter 
)

Get activity metric average utilization counter of the specified device.

Given a device index dv_ind, the activity metric type, this function returns the requested utilization counters

Parameters
[in]dv_inda device index
[in]activity_metric_typea metric type
[in,out]activity_metric_counterMultiple utilization counters can be retrieved with a single call. The caller must allocate enough space to the rsmi_activity_metric_counter_t structure.

If the function returns RSMI_STATUS_SUCCESS, the requested type will be set in the corresponding field of the counter will be set in the value field of the activity_metric_counter_t.

Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_activity_avg_mm_get()

rsmi_status_t rsmi_dev_activity_avg_mm_get ( uint32_t  dv_ind,
uint16_t *  avg_activity 
)

Get activity metric bandwidth average utilization counter of the specified device.

Given a device index dv_ind, the activity metric type, this function returns the requested utilization counters

Parameters
[in]dv_inda device index
[in,out]avg_activityaverage bandwidth utilization counters can be retrieved

If the function returns RSMI_STATUS_SUCCESS, the requested type will be set in the corresponding field of the counter will be set in the value field of the activity_metric_counter_t.

Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_perf_level_get()

rsmi_status_t rsmi_dev_perf_level_get ( uint32_t  dv_ind,
rsmi_dev_perf_level_t perf 
)

Get the performance level of the device with provided device index.

Given a device index dv_ind and a pointer to a uint32_t perf, this function will write the rsmi_dev_perf_level_t to the uint32_t pointed to by perf

Parameters
[in]dv_inda device index
[in,out]perfa pointer to rsmi_dev_perf_level_t to which the performance level will be written If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_perf_determinism_mode_set()

rsmi_status_t rsmi_perf_determinism_mode_set ( uint32_t  dv_ind,
uint64_t  clkvalue 
)

Enter performance determinism mode with provided device index.

Given a device index dv_ind 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 rsmi_dev_perf_level_t of the device being RSMI_DEV_PERF_LEVEL_DETERMINISM.

Parameters
[in]dv_inda device index
[in]clkvalueSoftmax value for GFXCLK in MHz.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_overdrive_level_get()

rsmi_status_t rsmi_dev_overdrive_level_get ( uint32_t  dv_ind,
uint32_t *  od 
)

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

Given a device index dv_ind 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]dv_inda device index
[in,out]oda pointer to uint32_t to which the overdrive percentage will be written If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_mem_overdrive_level_get()

rsmi_status_t rsmi_dev_mem_overdrive_level_get ( uint32_t  dv_ind,
uint32_t *  od 
)

Get the memory clock overdrive percent associated with the device with provided device index.

Given a device index dv_ind and a pointer to a uint32_t od, this function will write the memory overdrive percentage to the uint32_t pointed to by od

Parameters
[in]dv_inda device index
[in,out]oda pointer to uint32_t to which the overdrive percentage will be written If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_gpu_clk_freq_get()

rsmi_status_t rsmi_dev_gpu_clk_freq_get ( uint32_t  dv_ind,
rsmi_clk_type_t  clk_type,
rsmi_frequencies_t f 
)

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

Given a device index dv_ind, a clock type clk_type, and a pointer to a to an rsmi_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]dv_inda device index
[in]clk_typethe type of clock for which the frequency is desired
[in,out]fa pointer to a caller provided rsmi_frequencies_t structure to which the frequency information will be written. Frequency values are in Hz. If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments. If multiple current frequencies are found, a warning is shown. If no current frequency is found, it is reflected as -1. If frequencies are not read from low to high a warning is shown as well.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid
RSMI_STATUS_UNEXPECTED_DATAData read or provided was not as expected

◆ rsmi_dev_gpu_reset()

rsmi_status_t rsmi_dev_gpu_reset ( uint32_t  dv_ind)

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

Given a device index dv_ind, this function will reset the GPU

Parameters
[in]dv_inda device index
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_od_volt_info_get()

rsmi_status_t rsmi_dev_od_volt_info_get ( uint32_t  dv_ind,
rsmi_od_volt_freq_data_t odv 
)

This function retrieves the voltage/frequency curve information.

Given a device index dv_ind and a pointer to a rsmi_od_volt_freq_data_t structure odv, this function will populate odv. See rsmi_od_volt_freq_data_t for more details.

Parameters
[in]dv_inda device index
[in,out]odva pointer to an rsmi_od_volt_freq_data_t structure If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_gpu_metrics_info_get()

rsmi_status_t rsmi_dev_gpu_metrics_info_get ( uint32_t  dv_ind,
rsmi_gpu_metrics_t pgpu_metrics 
)

This function retrieves the gpu metrics information.

Given a device index dv_ind and a pointer to a rsmi_gpu_metrics_t structure pgpu_metrics, this function will populate pgpu_metrics. See rsmi_gpu_metrics_t for more details.

Parameters
[in]dv_inda device index
[in,out]pgpu_metricsa pointer to an rsmi_gpu_metrics_t structure If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_clk_range_set()

rsmi_status_t rsmi_dev_clk_range_set ( uint32_t  dv_ind,
uint64_t  minclkvalue,
uint64_t  maxclkvalue,
rsmi_clk_type_t  clkType 
)

This function sets the clock range information.

Given a device index dv_ind, 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]dv_inda device index
[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]clkTypeRSMI_CLK_TYPE_SYS | RSMI_CLK_TYPE_MEM range type
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_clk_extremum_set()

rsmi_status_t rsmi_dev_clk_extremum_set ( uint32_t  dv_ind,
rsmi_freq_ind_t  level,
uint64_t  clkvalue,
rsmi_clk_type_t  clkType 
)

This function sets the clock min/max level.

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

Parameters
[in]dv_inda device index
[in]levelRSMI_FREQ_IND_MIN|RSMI_FREQ_IND_MAX
[in]clkvaluevalue to apply to the clock level. Frequency values are in MHz.
[in]clkTypeRSMI_CLK_TYPE_SYS | RSMI_CLK_TYPE_MEM level type
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_od_clk_info_set()

rsmi_status_t rsmi_dev_od_clk_info_set ( uint32_t  dv_ind,
rsmi_freq_ind_t  level,
uint64_t  clkvalue,
rsmi_clk_type_t  clkType 
)

This function sets the clock frequency information.

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

Parameters
[in]dv_inda device index
[in]levelRSMI_FREQ_IND_MIN|RSMI_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]clkTypeRSMI_CLK_TYPE_SYS | RSMI_CLK_TYPE_MEM range type
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_od_volt_info_set()

rsmi_status_t rsmi_dev_od_volt_info_set ( uint32_t  dv_ind,
uint32_t  vpoint,
uint64_t  clkvalue,
uint64_t  voltvalue 
)

This function sets 1 of the 3 voltage curve points.

Given a device index dv_ind, a voltage point vpoint and a voltage value voltvalue this function will set voltage curve point

Parameters
[in]dv_inda device index
[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.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_od_volt_curve_regions_get()

rsmi_status_t rsmi_dev_od_volt_curve_regions_get ( uint32_t  dv_ind,
uint32_t *  num_regions,
rsmi_freq_volt_region_t buffer 
)

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

Given a device index dv_ind, a pointer to an unsigned integer num_regions and a buffer of rsmi_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 rsmi_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 rsmi_dev_od_volt_info_get().

Parameters
[in]dv_inda device index
[in,out]num_regionsAs input, this is the number of rsmi_freq_volt_region_t structures that can be written to buffer. As output, this is the number of rsmi_freq_volt_region_t structures that were actually written. If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
[in,out]buffera caller provided buffer to which rsmi_freq_volt_region_t structures will be written If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid

◆ rsmi_dev_power_profile_presets_get()

rsmi_status_t rsmi_dev_power_profile_presets_get ( uint32_t  dv_ind,
uint32_t  sensor_ind,
rsmi_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 index dv_ind and a pointer to a rsmi_power_profile_status_t status, this function will set the bits of the rsmi_power_profile_status_t.available_profiles bit field of status to 1 if the profile corresponding to the respective rsmi_power_profile_preset_masks_t profiles are enabled. For example, if both the VIDEO and VR power profiles are available selections, then RSMI_PWR_PROF_PRST_VIDEO_MASK AND'ed with rsmi_power_profile_status_t.available_profiles will be non-zero as will RSMI_PWR_PROF_PRST_VR_MASK AND'ed with rsmi_power_profile_status_t.available_profiles. Additionally, rsmi_power_profile_status_t.current will be set to the rsmi_power_profile_preset_masks_t of the profile that is currently active.

Parameters
[in]dv_inda device index
[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 rsmi_power_profile_status_t that will be populated by a call to this function If this parameter is nullptr, this function will return RSMI_STATUS_INVALID_ARGS if the function is supported with the provided, arguments and RSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Return values
RSMI_STATUS_SUCCESScall was successful
RSMI_STATUS_NOT_SUPPORTEDinstalled software or hardware does not support this function with the given arguments
RSMI_STATUS_INVALID_ARGSthe provided arguments are not valid