GPU Power/Thermal Controls and Monitoring¶
HWMON Interfaces¶
The amdgpu driver exposes the following sensor interfaces:
GPU temperature (via the on-die sensor)
GPU voltage
Northbridge voltage (APUs only)
GPU power
GPU fan
GPU gfx/compute engine clock
GPU memory clock (dGPU only)
hwmon interfaces for GPU temperature:
temp[1-3]_input: the on die GPU temperature in millidegrees Celsius- temp2_input and temp3_input are supported on SOC15 dGPUs only
temp[1-3]_label: temperature channel label- temp2_label and temp3_label are supported on SOC15 dGPUs only
temp[1-3]_crit: temperature critical max value in millidegrees Celsius- temp2_crit and temp3_crit are supported on SOC15 dGPUs only
temp[1-3]_crit_hyst: temperature hysteresis for critical limit in millidegrees Celsius- temp2_crit_hyst and temp3_crit_hyst are supported on SOC15 dGPUs only
temp[1-3]_emergency: temperature emergency max value(asic shutdown) in millidegrees Celsius- these are supported on SOC15 dGPUs only
hwmon interfaces for GPU voltage:
in0_input: the voltage on the GPU in millivolts
in1_input: the voltage on the Northbridge in millivolts
hwmon interfaces for GPU power:
power1_average: average power used by the SoC in microWatts. On APUs this includes the CPU.
power1_input: instantaneous power used by the SoC in microWatts. On APUs this includes the CPU.
power1_cap_min: minimum cap supported in microWatts
power1_cap_max: maximum cap supported in microWatts
power1_cap: selected power cap in microWatts
hwmon interfaces for GPU fan:
pwm1: pulse width modulation fan level (0-255)
pwm1_enable: pulse width modulation fan control method (0: no fan speed control, 1: manual fan speed control using pwm interface, 2: automatic fan speed control)
pwm1_min: pulse width modulation fan control minimum level (0)
pwm1_max: pulse width modulation fan control maximum level (255)
fan1_min: a minimum value Unit: revolution/min (RPM)
fan1_max: a maximum value Unit: revolution/max (RPM)
fan1_input: fan speed in RPM
fan[1-*]_target: Desired fan speed Unit: revolution/min (RPM)
fan[1-*]_enable: Enable or disable the sensors.1: Enable 0: Disable
- NOTE: DO NOT set the fan speed via “pwm1” and “fan[1-*]_target” interfaces at the same time.
That will get the former one overridden.
hwmon interfaces for GPU clocks:
freq1_input: the gfx/compute clock in hertz
freq2_input: the memory clock in hertz
You can use hwmon tools like sensors to view this information on your system.
GPU sysfs Power State Interfaces¶
GPU power controls are exposed via sysfs files.
power_dpm_state¶
The power_dpm_state file is a legacy interface and is only provided forbackwards compatibility. The amdgpu driver provides a sysfs API for adjustingcertain power related parameters. The file power_dpm_state is used for this.It accepts the following arguments:
battery
balanced
performance
battery
On older GPUs, the vbios provided a special power state for batteryoperation. Selecting battery switched to this state. This is nolonger provided on newer GPUs so the option does nothing in that case.
balanced
On older GPUs, the vbios provided a special power state for balancedoperation. Selecting balanced switched to this state. This is nolonger provided on newer GPUs so the option does nothing in that case.
performance
On older GPUs, the vbios provided a special power state for performanceoperation. Selecting performance switched to this state. This is nolonger provided on newer GPUs so the option does nothing in that case.
power_dpm_force_performance_level¶
The amdgpu driver provides a sysfs API for adjusting certain powerrelated parameters. The file power_dpm_force_performance_level isused for this. It accepts the following arguments:
auto
low
high
manual
profile_standard
profile_min_sclk
profile_min_mclk
profile_peak
auto
When auto is selected, the driver will attempt to dynamically selectthe optimal power profile for current conditions in the driver.
low
When low is selected, the clocks are forced to the lowest power state.
high
When high is selected, the clocks are forced to the highest power state.
manual
When manual is selected, the user can manually adjust which power statesare enabled for each clock domain via the sysfs pp_dpm_mclk, pp_dpm_sclk,and pp_dpm_pcie files and adjust the power state transition heuristicsvia the pp_power_profile_mode sysfs file.
profile_standardprofile_min_sclkprofile_min_mclkprofile_peak
When the profiling modes are selected, clock and power gating aredisabled and the clocks are set for different profiling cases. Thismode is recommended for profiling specific work loads where you donot want clock or power gating for clock fluctuation to interferewith your results. profile_standard sets the clocks to a fixed clocklevel which varies from asic to asic. profile_min_sclk forces the sclkto the lowest level. profile_min_mclk forces the mclk to the lowest level.profile_peak sets all clocks (mclk, sclk, pcie) to the highest levels.
pp_table¶
The amdgpu driver provides a sysfs API for uploading new powerplaytables. The file pp_table is used for this. Reading the filewill dump the current power play table. Writing to the filewill attempt to upload a new powerplay table and re-initializepowerplay using that new table.
pp_od_clk_voltage¶
The amdgpu driver provides a sysfs API for adjusting the clocks and voltagesin each power level within a power state. The pp_od_clk_voltage is used forthis.
Note that the actual memory controller clock rate are exposed, notthe effective memory clock of the DRAMs. To translate it, use thefollowing formula:
Clock conversion (Mhz):
HBM: effective_memory_clock = memory_controller_clock * 1
G5: effective_memory_clock = memory_controller_clock * 1
G6: effective_memory_clock = memory_controller_clock * 2
DRAM data rate (MT/s):
HBM: effective_memory_clock * 2 = data_rate
G5: effective_memory_clock * 4 = data_rate
G6: effective_memory_clock * 8 = data_rate
Bandwidth (MB/s):
data_rate * vram_bit_width / 8 = memory_bandwidth
Some examples:
G5 on RX460:
memory_controller_clock = 1750 Mhz
effective_memory_clock = 1750 Mhz * 1 = 1750 Mhz
data rate = 1750 * 4 = 7000 MT/s
memory_bandwidth = 7000 * 128 bits / 8 = 112000 MB/s
G6 on RX5700:
memory_controller_clock = 875 Mhz
effective_memory_clock = 875 Mhz * 2 = 1750 Mhz
data rate = 1750 * 8 = 14000 MT/s
memory_bandwidth = 14000 * 256 bits / 8 = 448000 MB/s
< For Vega10 and previous ASICs >
Reading the file will display:
a list of engine clock levels and voltages labeled OD_SCLK
a list of memory clock levels and voltages labeled OD_MCLK
a list of valid ranges for sclk, mclk, and voltage labeled OD_RANGE
To manually adjust these settings, first select manual usingpower_dpm_force_performance_level. Enter a new value for eachlevel by writing a string that contains “s/m level clock voltage” tothe file. E.g., “s 1 500 820” will update sclk level 1 to be 500 MHzat 820 mV; “m 0 350 810” will update mclk level 0 to be 350 MHz at810 mV. When you have edited all of the states as needed, write“c” (commit) to the file to commit your changes. If you want to reset to thedefault power levels, write “r” (reset) to the file to reset them.
< For Vega20 and newer ASICs >
Reading the file will display:
minimum and maximum engine clock labeled OD_SCLK
minimum(not available for Vega20 and Navi1x) and maximum memoryclock labeled OD_MCLK
three <frequency, voltage> points labeled OD_VDDC_CURVE.They can be used to calibrate the sclk voltage curve. This isavailable for Vega20 and NV1X.
voltage offset(in mV) applied on target voltage calculation.This is available for Sienna Cichlid, Navy Flounder, DimgreyCavefish and some later SMU13 ASICs. For these ASICs, the targetvoltage calculation can be illustrated by “voltage = voltagecalculated from v/f curve + overdrive vddgfx offset”
a list of valid ranges for sclk, mclk, voltage curve pointsor voltage offset labeled OD_RANGE
< For APUs >
Reading the file will display:
minimum and maximum engine clock labeled OD_SCLK
a list of valid ranges for sclk labeled OD_RANGE
< For VanGogh >
Reading the file will display:
minimum and maximum engine clock labeled OD_SCLK
minimum and maximum core clocks labeled OD_CCLK
a list of valid ranges for sclk and cclk labeled OD_RANGE
To manually adjust these settings:
First select manual using power_dpm_force_performance_level
For clock frequency setting, enter a new value by writing astring that contains “s/m index clock” to the file. The indexshould be 0 if to set minimum clock. And 1 if to set maximumclock. E.g., “s 0 500” will update minimum sclk to be 500 MHz.“m 1 800” will update maximum mclk to be 800Mhz. For coreclocks on VanGogh, the string contains “p core index clock”.E.g., “p 2 0 800” would set the minimum core clock on core2 to 800Mhz.
For sclk voltage curve supported by Vega20 and NV1X, enter the newvalues by writing a string that contains “vc point clock voltage”to the file. The points are indexed by 0, 1 and 2. E.g., “vc 0 300600” will update point1 with clock set as 300Mhz and voltage as 600mV.“vc 2 1000 1000” will update point3 with clock set as 1000Mhz andvoltage 1000mV.
For voltage offset supported by Sienna Cichlid, Navy Flounder, DimgreyCavefish and some later SMU13 ASICs, enter the new value by writing astring that contains “vo offset”. E.g., “vo -10” will update the extravoltage offset applied to the whole v/f curve line as -10mv.
When you have edited all of the states as needed, write “c” (commit)to the file to commit your changes
If you want to reset to the default power levels, write “r” (reset)to the file to reset them
pp_dpm_*¶
The amdgpu driver provides a sysfs API for adjusting what power levelsare enabled for a given power state. The files pp_dpm_sclk, pp_dpm_mclk,pp_dpm_socclk, pp_dpm_fclk, pp_dpm_dcefclk and pp_dpm_pcie are used forthis.
pp_dpm_socclk and pp_dpm_dcefclk interfaces are only available forVega10 and later ASICs.pp_dpm_fclk interface is only available for Vega20 and later ASICs.
Reading back the files will show you the available power levels withinthe power state and the clock information for those levels. If deep sleep isapplied to a clock, the level will be denoted by a special level ‘S:’E.g.,
S: 19Mhz *0: 615Mhz1: 800Mhz2: 888Mhz3: 1000Mhz
To manually adjust these states, first select manual usingpower_dpm_force_performance_level.Secondly, enter a new value for each level by inputing a string thatcontains “ echo xx xx xx > pp_dpm_sclk/mclk/pcie”E.g.,
echo"4 5 6">pp_dpm_sclk
will enable sclk levels 4, 5, and 6.
NOTE: change to the dcefclk max dpm level is not supported now
pp_power_profile_mode¶
The amdgpu driver provides a sysfs API for adjusting the heuristicsrelated to switching between power levels in a power state. The filepp_power_profile_mode is used for this.
Reading this file outputs a list of all of the predefined power profilesand the relevant heuristics settings for that profile.
To select a profile or create a custom profile, first select manual usingpower_dpm_force_performance_level. Writing the number of a predefinedprofile to pp_power_profile_mode will enable those heuristics. Tocreate a custom set of heuristics, write a string of numbers to the filestarting with the number of the custom profile along with a settingfor each heuristic parameter. Due to differences across asic familiesthe heuristic parameters vary from family to family. Additionally,you can apply the custom heuristics to different clock domains. Eachclock domain is considered a distinct operation so if you modify thegfxclk heuristics and then the memclk heuristics, the all of thecustom heuristics will be retained until you switch to another profile.
pm_policy¶
Certain SOCs can support different power policies to optimize applicationperformance. However, this policy is provided only at SOC level and not at aper-process level. This is useful especially when entire SOC is utilized fordedicated workload.
The amdgpu driver provides a sysfs API for selecting the policy. Presently,only two types of policies are supported through this interface.
Pstate Policy Selection - This is to select different Pstate profiles whichdecides clock/throttling preferences.
XGMI PLPD Policy Selection - When multiple devices are connected over XGMI,this helps to select policy to be applied for per link power down.
The list of available policies and policy levels vary between SOCs. They canbe viewed under pm_policy node directory. If SOC doesn’t support any policy,this node won’t be available. The different policies supported will beavailable as separate nodes under pm_policy.
cat /sys/bus/pci/devices/.../pm_policy/<policy_type>
Reading the policy file shows the different levels supported. The level whichis applied presently is denoted by * (asterisk). E.g.,
cat /sys/bus/pci/devices/.../pm_policy/soc_pstate0 : soc_pstate_default1 : soc_pstate_02 : soc_pstate_1*3 : soc_pstate_2cat /sys/bus/pci/devices/.../pm_policy/xgmi_plpd0 : plpd_disallow1 : plpd_default2 : plpd_optimized*
To apply a specific policy
“echo <level> > /sys/bus/pci/devices/.../pm_policy/<policy_type>”
For the levels listed in the example above, to select “plpd_optimized” forXGMI and “soc_pstate_2” for soc pstate policy -
echo "2" > /sys/bus/pci/devices/.../pm_policy/xgmi_plpdecho "3" > /sys/bus/pci/devices/.../pm_policy/soc_pstate
*_busy_percent¶
The amdgpu driver provides a sysfs API for reading how busy the GPUis as a percentage. The file gpu_busy_percent is used for this.The SMU firmware computes a percentage of load based on theaggregate activity level in the IP cores.
The amdgpu driver provides a sysfs API for reading how busy the VRAMis as a percentage. The file mem_busy_percent is used for this.The SMU firmware computes a percentage of load based on theaggregate activity level in the IP cores.
gpu_metrics¶
The amdgpu driver provides a sysfs API for retrieving current gpumetrics data. The file gpu_metrics is used for this. Reading thefile will dump all the current gpu metrics data.
These data include temperature, frequency, engines utilization,power consume, throttler status, fan speed and cpu core statistics(available for APU only). That’s it will give a snapshot of all sensorsat the same time.
fan_curve¶
The amdgpu driver provides a sysfs API for checking and adjusting the fancontrol curve line.
Reading back the file shows you the current settings(temperature in Celsiusdegree and fan speed in pwm) applied to every anchor point of the curve lineand their permitted ranges if changable.
Writing a desired string(with the format like “anchor_point_index temperaturefan_speed_in_pwm”) to the file, change the settings for the specific anchorpoint accordingly.
When you have finished the editing, write “c” (commit) to the file to commityour changes.
If you want to reset to the default value, write “r” (reset) to the file toreset them
There are two fan control modes supported: auto and manual. With auto mode,PMFW handles the fan speed control(how fan speed reacts to ASIC temperature).While with manual mode, users can set their own fan curve line as whatdescribed here. Normally the ASIC is booted up with auto mode. Anysettings via this interface will switch the fan control to manual modeimplicitly.
acoustic_limit_rpm_threshold¶
The amdgpu driver provides a sysfs API for checking and adjusting theacoustic limit in RPM for fan control.
Reading back the file shows you the current setting and the permittedranges if changable.
Writing an integer to the file, change the setting accordingly.
When you have finished the editing, write “c” (commit) to the file to commityour changes.
If you want to reset to the default value, write “r” (reset) to the file toreset them
This setting works under auto fan control mode only. It adjusts the PMFW’sbehavior about the maximum speed in RPM the fan can spin. Setting via thisinterface will switch the fan control to auto mode implicitly.
acoustic_target_rpm_threshold¶
The amdgpu driver provides a sysfs API for checking and adjusting theacoustic target in RPM for fan control.
Reading back the file shows you the current setting and the permittedranges if changable.
Writing an integer to the file, change the setting accordingly.
When you have finished the editing, write “c” (commit) to the file to commityour changes.
If you want to reset to the default value, write “r” (reset) to the file toreset them
This setting works under auto fan control mode only. It can co-exist withother settings which can work also under auto mode. It adjusts the PMFW’sbehavior about the maximum speed in RPM the fan can spin when ASICtemperature is not greater than target temperature. Setting via thisinterface will switch the fan control to auto mode implicitly.
fan_target_temperature¶
The amdgpu driver provides a sysfs API for checking and adjusting thetarget tempeature in Celsius degree for fan control.
Reading back the file shows you the current setting and the permittedranges if changable.
Writing an integer to the file, change the setting accordingly.
When you have finished the editing, write “c” (commit) to the file to commityour changes.
If you want to reset to the default value, write “r” (reset) to the file toreset them
This setting works under auto fan control mode only. It can co-exist withother settings which can work also under auto mode. Paring with theacoustic_target_rpm_threshold setting, they define the maximum speed inRPM the fan can spin when ASIC temperature is not greater than targettemperature. Setting via this interface will switch the fan control toauto mode implicitly.
fan_minimum_pwm¶
The amdgpu driver provides a sysfs API for checking and adjusting theminimum fan speed in PWM.
Reading back the file shows you the current setting and the permittedranges if changable.
Writing an integer to the file, change the setting accordingly.
When you have finished the editing, write “c” (commit) to the file to commityour changes.
If you want to reset to the default value, write “r” (reset) to the file toreset them
This setting works under auto fan control mode only. It can co-exist withother settings which can work also under auto mode. It adjusts the PMFW’sbehavior about the minimum fan speed in PWM the fan should spin. Settingvia this interface will switch the fan control to auto mode implicitly.
fan_zero_rpm_enable¶
The amdgpu driver provides a sysfs API for checking and adjusting thezero RPM feature.
Reading back the file shows you the current setting and the permittedranges if changable.
Writing an integer to the file, change the setting accordingly.
When you have finished the editing, write “c” (commit) to the file to commityour changes.
If you want to reset to the default value, write “r” (reset) to the file toreset them.
fan_zero_rpm_stop_temperature¶
The amdgpu driver provides a sysfs API for checking and adjusting thezero RPM stop temperature feature.
Reading back the file shows you the current setting and the permittedranges if changable.
Writing an integer to the file, change the setting accordingly.
When you have finished the editing, write “c” (commit) to the file to commityour changes.
If you want to reset to the default value, write “r” (reset) to the file toreset them.
This setting works only if the Zero RPM setting is enabled. It adjusts thetemperature below which the fan can stop.
GFXOFF¶
GFXOFF is a feature found in most recent GPUs that saves power at runtime. Thecard’s RLC (RunList Controller) firmware powers off the gfx enginedynamically when there is no workload on gfx or compute pipes. GFXOFF is on bydefault on supported GPUs.
Userspace can interact with GFXOFF through a debugfs interface (all values inuint32_t, unless otherwise noted):
amdgpu_gfxoff¶
Use it to enable/disable GFXOFF, and to check if it’s current enabled/disabled:
$ xxd -l1 -p /sys/kernel/debug/dri/0/amdgpu_gfxoff01
Write 0 to disable it, and 1 to enable it.
Read 0 means it’s disabled, 1 it’s enabled.
If it’s enabled, that means that the GPU is free to enter into GFXOFF mode asneeded. Disabled means that it will never enter GFXOFF mode.
amdgpu_gfxoff_status¶
Read it to check current GFXOFF’s status of a GPU:
$ xxd -l1 -p /sys/kernel/debug/dri/0/amdgpu_gfxoff_status02
0: GPU is in GFXOFF state, the gfx engine is powered down.
1: Transition out of GFXOFF state
2: Not in GFXOFF state
3: Transition into GFXOFF state
If GFXOFF is enabled, the value will be transitioning around [0, 3], alwaysgetting into 0 when possible. When it’s disabled, it’s always at 2. Returns-EINVAL if it’s not supported.
amdgpu_gfxoff_count¶
Read it to get the total GFXOFF entry count at the time of query since systempower-up. The value is anuint64_t type, however, due to firmware limitations,it can currently overflow as anuint32_t.Only supported in vangogh
amdgpu_gfxoff_residency¶
Write 1 to amdgpu_gfxoff_residency to start logging, and 0 to stop. Read it toget average GFXOFF residency % multiplied by 100 during the last logginginterval. E.g. a value of 7854 means 78.54% of the time in the last logginginterval the GPU was in GFXOFF mode.Only supported in vangogh