make default power limit configurable, add comment for power limit

This commit is contained in:
Josh Lay 2022-06-07 19:12:52 -05:00
parent c2367b2dc7
commit 5bb751c510
Signed by: jlay
GPG key ID: B265E45CACAD108A
2 changed files with 20 additions and 11 deletions

View file

@ -2,14 +2,20 @@
- hosts: localhost
become: yes
vars:
power_max_multi: 1.0 # should not exceed 1.0, must be a float. note: driver seems to do its own rounding
# the multipliers against power capability to determine power limits for the non-OC (default)/OC (custom) profiles
# 0.5 = 50%
# 1.0 = 100% (of card power capability, not stock limits)
# should not exceed 1.0, must be a float. driver will do some rounding/stepping
power_max_custom_multi: 1.0
power_max_default_multi: 0.75
power_max: "{{ power_max_b64['content'] | b64decode }}"
power_cap_float: "{{ power_max |float * power_max_multi }}"
power_cap_half_float: "{{ power_max |float * 0.5 }}"
power_cap: "{{ power_cap_float |int }}"
power_cap_half: "{{ power_cap_half_float |int }}" # used to limit GPU power to 50% on 'low' perf modes
gpu_clock_min: "2300" # minimum GPU clock (in 3D) - defaults 500Mhz
gpu_clock_max: "2600" # maximum GPU clock (also 3D) - range allows up to 3000Mhz. default 2529
power_max_float: "{{ power_max_b64['content'] | b64decode |float }}"
power_cap_custom_float: "{{ power_max |float * power_max_custom_multi }}"
power_cap_default_float: "{{ power_max |float * power_max_default_multi }}"
power_cap_custom: "{{ power_cap_custom_float |int }}"
power_cap_default: "{{ power_cap_default_float |int }}" # used to limit GPU power to some lower percentage on 'low' perf modes
gpu_clock_min: "2200" # minimum GPU clock (in 3D) - defaults 500Mhz
gpu_clock_max: "2575" # maximum GPU clock (also 3D) - range allows up to 3000Mhz. default 2529
gpumem_clock_max: "1075" # maximum GPU memory clock - default 1000Mhz, range allows 1075Mhz
# note: (all clocks based on my non-reference 6900XT)
# consult '/sys/class/drm/{{ card }}/device/pp_od_clk_voltage'

View file

@ -25,16 +25,19 @@ script=${i:PROFILE_DIR}/amdgpu-clock-reset.sh
# ref: https://docs.kernel.org/gpu/amdgpu/thermal.html
/sys/class/drm/{{ card }}/device/pp_power_profile_mode = {{ item.0.value }}
/sys/class/drm/{{ card }}/device/power_dpm_force_performance_level = auto
# give default profile {{ power_max_multi * 50.0 |int }}% (max) power capability
/sys/class/drm/{{ card }}/device/hwmon/hwmon9/power1_cap = {{ power_cap_half }}
{# # give default profile {{ power_max_default_multi * 100.0 |int }}% of the max power capability -- {{ power_max_float * power_max_default_multi / 1000000.0 |int }} Watts of {{ power_max / 1000000 |int }} total #}
# give default profile {{ power_max_default_multi * 100.0 |int }}% of the max power capability
# {{ power_cap_default|int/1000000 }} Watts of {{ power_max|int/1000000 }} total
/sys/class/drm/{{ card }}/device/hwmon/hwmon9/power1_cap = {{ power_cap_default }}
{% endif %}
{% if 'custom' in item.0.name %}
[sysfs]
# configure GPU power/clock characteristics
# ref: https://docs.kernel.org/gpu/amdgpu/thermal.html
/sys/class/drm/{{ card }}/device/pp_power_profile_mode = {{ item.0.value }}
# give this custom oriented profile {{ power_max_multi * 100.0 |int }}% of the power capability
/sys/class/drm/{{ card }}/device/hwmon/hwmon9/power1_cap = {{ power_cap }}
# give this custom oriented profile {{ power_max_custom_multi * 100.0 |int }}% of the max power capability
# {{ power_cap_custom|int/1000000 }} Watts of {{ power_max|int/1000000 }} total
/sys/class/drm/{{ card }}/device/hwmon/hwmon9/power1_cap = {{ power_cap_custom }}
# reference/execute AMDGPU clock control script
[gpuclockscript]