From 5bb751c5105173b8a43321ba3877f9adb4f3aaff Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Tue, 7 Jun 2022 19:12:52 -0500 Subject: [PATCH] make default power limit configurable, add comment for power limit --- playbook.yml | 20 +++++++++++++------- templates/tuned.conf.j2 | 11 +++++++---- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/playbook.yml b/playbook.yml index c6ba71e..3e6186f 100644 --- a/playbook.yml +++ b/playbook.yml @@ -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' diff --git a/templates/tuned.conf.j2 b/templates/tuned.conf.j2 index 90ff588..6ebe1c2 100644 --- a/templates/tuned.conf.j2 +++ b/templates/tuned.conf.j2 @@ -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]