fix clock profile choice consistency when moving profiles
This commit is contained in:
parent
6214034e59
commit
ca723c732b
3 changed files with 57 additions and 37 deletions
53
playbook.yml
53
playbook.yml
|
@ -6,35 +6,48 @@
|
||||||
# 0.5 = 50%
|
# 0.5 = 50%
|
||||||
# 1.0 = 100% (of card power capability, not stock limits)
|
# 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
|
# should not exceed 1.0, must be a float. driver will do some rounding/stepping
|
||||||
power_max_custom_multi: 1.0 # used to control the effective power limit in the 'custom' AMDGPU tuned profile
|
# default is ~87% (281/323) on my 6900XT. check '/sys/class/drm/card*/device/hwmon/hwmon*/power1_cap_default'
|
||||||
power_max_default_multi: 0.75 # used to limit GPU power to some lower percentage on default perf mode
|
power_max_custom_multi: 0.928793 # calculated to ~300W. used to control the effective power limit in the non-default AMDGPU tuned profiles
|
||||||
# minimum/maximum GPU clocks using 'powerplay'.
|
power_max_default_multi: 0.82 # (typically) used to limit GPU power to some lower percentage on default perf mode/profile
|
||||||
|
#
|
||||||
|
# minimum/maximum GPU clocks using 'powerplay'
|
||||||
|
# these do not apply to the resulting 'amdgpu-default' tuned profile
|
||||||
|
# only the others (eg: 'VR'/'custom') under amdgpu_profiles (below)
|
||||||
# effective clocks are dynamically adjusted by the driver in this range - based on utilization
|
# effective clocks are dynamically adjusted by the driver in this range - based on utilization
|
||||||
# can find baseline values in the '/sys/class/drm/{{ card }}/device/pp_od_clk_voltage' file
|
# can find baseline values in the '/sys/class/drm/{{ card }}/device/pp_od_clk_voltage' file
|
||||||
# OD_RANGE indicates acceptable value ranges for SCLK (core) and MCLK (memory)
|
# OD_RANGE indicates acceptable value ranges for SCLK (core) and MCLK (memory)
|
||||||
# Under 'OD_SCLK' and 'OD_MCLK' you will see 0/1. These are the minimum/maximum values for the respective component.
|
# Under 'OD_SCLK' and 'OD_MCLK' you will see 0/1. These are the minimum/maximum values for the respective component.
|
||||||
gpu_clock_min: "2300"
|
gpu_clock_min: "2000"
|
||||||
gpu_clock_max: "2600"
|
gpu_clock_max: "2615"
|
||||||
|
#
|
||||||
# memory clocks are static, we only set a 'max' - high-refresh rate display quirk
|
# memory clocks are static, we only set a 'max' - high-refresh rate display quirk
|
||||||
# this allows the memory clock to be adjusted
|
# this allows the memory clock to be adjusted
|
||||||
gpumem_clock_max: "1075"
|
gpumem_clock_max: "1075"
|
||||||
|
#
|
||||||
# optional, applies offset to GPU voltage, eg: '+100' = to boost GPU core voltage 100mV or 0.1V. for the 'custom' GPU profile.
|
# optional, applies offset to GPU voltage, eg: '+100' = to boost GPU core voltage 100mV or 0.1V. for the 'custom' GPU profile.
|
||||||
gpu_mv_offset: "+50"
|
gpu_mv_offset: "-25"
|
||||||
|
#
|
||||||
# the card for 'tuned' to control
|
# the card for 'tuned' to control
|
||||||
# this is *usually* 'card0', but may differ.
|
# this is *usually* 'card0', but may differ.
|
||||||
# check '/dev/dri/card*'
|
# check '/dev/dri/card*'
|
||||||
card: 'card0' # default to card0
|
card: 'card0' # default to card0
|
||||||
base_profiles: # list of source tuned profiles available on Fedora (TODO: should dynamically discover?)
|
# list of source tuned profiles available on Fedora (TODO: should dynamically discover)
|
||||||
- balanced # these are further modified with secondary (templated) profiles, see 'templates/tuned.conf.j2'
|
# further modified with AMD GPU power/clock parameters, creating new profiles. eg: 'balanced-amdgpu-VR'
|
||||||
|
base_profiles:
|
||||||
|
- balanced
|
||||||
- desktop
|
- desktop
|
||||||
- latency-performance
|
- latency-performance
|
||||||
- network-latency
|
- network-latency
|
||||||
- network-throughput
|
- network-throughput
|
||||||
- powersave
|
- powersave
|
||||||
- virtual-host
|
- virtual-host
|
||||||
amdgpu_profiles: # statically defined mapping of the contents in /sys/class/drm/{{ card }}/device/pp_power_profile_mode
|
amdgpu_profiles: # statically defined mapping of the contents in /sys/class/drm/card*/device/pp_power_profile_mode
|
||||||
- { name: 'default', value: 0 }
|
default: # more may be added, but do not remove default/custom. new profiles require a script template, see 'templates'
|
||||||
- { name: 'custom', value: 6 }
|
pwrmode: 0
|
||||||
|
VR:
|
||||||
|
pwrmode: 4
|
||||||
|
custom:
|
||||||
|
pwrmode: 6
|
||||||
handlers:
|
handlers:
|
||||||
- name: restart tuned
|
- name: restart tuned
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
|
@ -85,30 +98,34 @@
|
||||||
- name: create custom profile directories
|
- name: create custom profile directories
|
||||||
file:
|
file:
|
||||||
state: directory
|
state: directory
|
||||||
path: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.name }}
|
path: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{ amdgpu_profiles }}"
|
- "{{ lookup('dict', amdgpu_profiles) }}"
|
||||||
- "{{ base_profiles }}"
|
- "{{ base_profiles }}"
|
||||||
- name: template AMDGPU clock control scripts (default/GPU profile dependency)
|
- name: template AMDGPU control/reset scripts
|
||||||
template:
|
template:
|
||||||
src: templates/amdgpu-clock.sh.j2
|
src: templates/amdgpu-clock.sh.j2
|
||||||
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.name }}/amdgpu-clock.sh
|
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}/amdgpu-clock.sh
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{ amdgpu_profiles }}"
|
- "{{ lookup('dict', amdgpu_profiles) }}"
|
||||||
- "{{ base_profiles }}"
|
- "{{ base_profiles }}"
|
||||||
notify: restart tuned
|
notify: restart tuned
|
||||||
- name: template custom tuned profiles
|
- name: template custom tuned profiles
|
||||||
template:
|
template:
|
||||||
src: templates/tuned.conf.j2
|
src: templates/tuned.conf.j2
|
||||||
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.name }}/tuned.conf
|
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}/tuned.conf
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{ amdgpu_profiles }}"
|
- "{{ lookup('dict', amdgpu_profiles) }}"
|
||||||
- "{{ base_profiles }}"
|
- "{{ base_profiles }}"
|
||||||
notify: restart tuned
|
notify: restart tuned
|
||||||
|
- name: ensure tuned is enabled
|
||||||
|
service:
|
||||||
|
name: tuned
|
||||||
|
enabled: yes
|
||||||
|
|
|
@ -3,42 +3,46 @@
|
||||||
# configures GPU power/clock characteristics
|
# configures GPU power/clock characteristics
|
||||||
# clocks/power in 3D are dynamic based on need/usage
|
# clocks/power in 3D are dynamic based on need/usage
|
||||||
#
|
#
|
||||||
|
# for 'amdgpu-default' tuned profiles, this will reset the characteristics to default
|
||||||
|
# for others this will apply overclocking settings -- leaving clock choices to the associated power profile (eg: VR)
|
||||||
|
#
|
||||||
# rendered by Ansible with environment-appropriate values:
|
# rendered by Ansible with environment-appropriate values:
|
||||||
# card #, eg: card0
|
# card #, eg: card0
|
||||||
# path to discovered sysfs device files (power/clock/voltage control)
|
# path to discovered sysfs device files (power/clock/voltage control)
|
||||||
#
|
#
|
||||||
# this sets the minimums / maximums for a specific generation of GPU
|
|
||||||
# settings may need adjusted
|
|
||||||
#
|
|
||||||
# AMDGPU driver/sysfs references:
|
# AMDGPU driver/sysfs references:
|
||||||
# https://01.org/linuxgraphics/gfx-docs/drm/gpu/amdgpu.html
|
# https://01.org/linuxgraphics/gfx-docs/drm/gpu/amdgpu.html
|
||||||
# https://docs.kernel.org/gpu/amdgpu/thermal.html
|
# https://docs.kernel.org/gpu/amdgpu/thermal.html
|
||||||
|
{# begin the templated script for 'default' profiles to reset state #}
|
||||||
|
{% if 'default' in item.0.key %}
|
||||||
|
|
||||||
{% if 'default' in item.0.name %}
|
|
||||||
# set power state transition heuristics to default
|
# set power state transition heuristics to default
|
||||||
echo '{{ item.0.value }}' | tee /sys/class/drm/{{ card }}/device/pp_power_profile_mode
|
echo '{{ item.0.value.pwrmode }}' | tee /sys/class/drm/{{ card }}/device/pp_power_profile_mode
|
||||||
|
|
||||||
# set control mode back to auto
|
# set control mode back to auto
|
||||||
# attempts to dynamically set optimal power profile for conditions
|
# attempts to dynamically set optimal power profile for (load) conditions
|
||||||
echo 'auto' | tee /sys/class/drm/{{ card }}/device/power_dpm_force_performance_level
|
echo 'auto' | tee /sys/class/drm/{{ card }}/device/power_dpm_force_performance_level
|
||||||
|
|
||||||
# reset any existing profile clock changes
|
# reset any existing profile clock changes
|
||||||
echo 'r' | tee /sys/class/drm/{{ card }}/device/pp_od_clk_voltage
|
echo 'r' | tee /sys/class/drm/{{ card }}/device/pp_od_clk_voltage
|
||||||
|
|
||||||
# give default profile {{ power_max_default_multi * 100.0 |int }}% of the max power capability
|
# 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
|
# {{ power_cap_default|int/1000000 }} Watts of {{ power_max|int/1000000 }} total
|
||||||
echo '{{ power_cap_default }}' | tee {{ powercap_set.files.0.path }}
|
echo '{{ power_cap_default }}' | tee {{ powercap_set.files.0.path }}
|
||||||
{% elif 'custom' in item.0.name %}
|
{% else %}
|
||||||
|
|
||||||
|
{# begin the templated script for non-default AMD GPU profiles, eg: 'VR' or '3D_FULL_SCREEN' #}
|
||||||
# set manual control mode
|
# set manual control mode
|
||||||
# allow control via 'pp_dpm_mclk', 'pp_dpm_sclk', 'pp_dpm_pcie', and 'pp_power_profile_mode' files
|
# allows control via 'pp_dpm_mclk', 'pp_dpm_sclk', 'pp_dpm_pcie', 'pp_dpm_fclk', and 'pp_power_profile_mode' files
|
||||||
|
# only interested in 'pp_power_profile_mode' for power and 'pp_dpm_mclk' for memory clock (flickering).
|
||||||
|
# GPU clocks are dynamic based on (load) condition
|
||||||
echo 'manual' | tee /sys/class/drm/{{ card }}/device/power_dpm_force_performance_level
|
echo 'manual' | tee /sys/class/drm/{{ card }}/device/power_dpm_force_performance_level
|
||||||
|
|
||||||
# set power state transition heuristics to custom/manual
|
# set power state transition heuristics to '{{ item.0.key }}' profile
|
||||||
# looked up from amdgpu_profiles variable using 'with_nested' loop in task
|
echo '{{ item.0.value.pwrmode }}' | tee /sys/class/drm/{{ card }}/device/pp_power_profile_mode
|
||||||
echo '{{ item.0.value }}' | tee /sys/class/drm/{{ card }}/device/pp_power_profile_mode
|
|
||||||
|
|
||||||
# give this profile {{ power_max_custom_multi * 100.0 |int }}% of the max power capability
|
# give this 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
|
# {{ power_cap_custom|int/1000000 }} Watts of {{ power_max|int/1000000 }} total
|
||||||
echo '{{ power_cap_custom }}' | tee {{ powercap_set.files.0.path }}
|
echo '{{ power_cap_custom }}' | tee {{ powercap_set.files.0.path }}
|
||||||
|
|
||||||
# set the minimum GPU clock
|
# set the minimum GPU clock
|
||||||
|
@ -58,9 +62,8 @@ echo 'vo {{ gpu_mv_offset }}' | tee /sys/class/drm/{{ card }}/device/pp_od_clk_v
|
||||||
# commit the changes
|
# commit the changes
|
||||||
echo 'c' | tee /sys/class/drm/{{ card }}/device/pp_od_clk_voltage
|
echo 'c' | tee /sys/class/drm/{{ card }}/device/pp_od_clk_voltage
|
||||||
|
|
||||||
# force GPU core/shader into the highest profile: {{ gpu_clock_max }}Mhz
|
# force GPU memory into highest clock (fix flickering)
|
||||||
echo '1' | tee /sys/class/drm/{{ card }}/device/pp_dpm_sclk
|
# pp_dpm_*clk settings are unintuitive, giving profiles that may be used
|
||||||
|
# opt not to set the others (eg: sclk/fclk) - those should remain for benefits from the curve
|
||||||
# force GPU memory into highest profile
|
|
||||||
echo '3' | tee /sys/class/drm/{{ card }}/device/pp_dpm_mclk
|
echo '3' | tee /sys/class/drm/{{ card }}/device/pp_dpm_mclk
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[main]
|
[main]
|
||||||
include={{ item.1 }}
|
include={{ item.1 }}
|
||||||
summary={{ item.1 }} + TCP/RAID tweaks + AMDGPU pp_power_profile_mode = {{ item.0.value }} ({{ item.0.name }})
|
summary={{ item.1 }} + TCP/RAID tweaks + AMDGPU pp_power_profile_mode = {{ item.0.value.pwrmode }} ({{ item.0.key }})
|
||||||
|
|
||||||
[sysctl]
|
[sysctl]
|
||||||
net.core.default_qdisc=fq
|
net.core.default_qdisc=fq
|
||||||
|
|
Loading…
Reference in a new issue