modernize/simplify: OC assumes "high" perf profile
This commit is contained in:
parent
f2e4923658
commit
bb03fc2cc2
6 changed files with 71 additions and 57 deletions
|
@ -8,8 +8,20 @@ board_watts: "{{ power_max | int / 1000000 }}"
|
|||
|
||||
# internals for profile power calculations
|
||||
# item in the context of the with_nested loops in the play
|
||||
profile_name: "{{ item.0.key }}"
|
||||
profile_percentage: "{{ (item.0.value.pwr_cap_multi * 100.0) | round(2) }}"
|
||||
profile_multi: "{{ item.0.value.pwr_cap_multi }}"
|
||||
profile_microwatts: "{{ power_max | float * profile_multi | float }}"
|
||||
profile_watts: "{{ profile_microwatts | int / 1000000 }}"
|
||||
profile_name: "{{ item.0 }}"
|
||||
|
||||
# determine percentage for human-friendly comments
|
||||
power_default_pct: "{{ (gpu_power_multi.default * 100.0) | round(2) }}"
|
||||
power_oc_pct: "{{ (gpu_power_multi.overclock * 100.0) | round(2) }}"
|
||||
|
||||
# in microWatts, actually written to sysfs
|
||||
power_default_mw: "{{ (power_max | float) * (gpu_power_multi.default | float) }}"
|
||||
power_oc_mw: "{{ (power_max | float) * (gpu_power_multi.overclock | float) }}"
|
||||
|
||||
# wattages - more human-friendly comments
|
||||
power_default_watts: "{{ (power_default_mw | int) / 1000000 }}"
|
||||
power_oc_watts: "{{ (power_oc_mw | int) / 1000000 }}"
|
||||
|
||||
amdgpu_profiles:
|
||||
- default
|
||||
- overclock
|
||||
|
|
|
@ -63,22 +63,22 @@
|
|||
- name: Create custom profile directories
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
path: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}
|
||||
path: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0 }}
|
||||
mode: "0755"
|
||||
with_nested:
|
||||
- "{{ lookup('dict', amdgpu_profiles) }}"
|
||||
- "{{ amdgpu_profiles }}"
|
||||
- "{{ base_profiles }}"
|
||||
become: true
|
||||
|
||||
- name: Template AMDGPU control/reset scripts
|
||||
ansible.builtin.template:
|
||||
src: templates/amdgpu-clock.sh.j2
|
||||
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}/amdgpu-clock.sh
|
||||
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0 }}/amdgpu-clock.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
with_nested:
|
||||
- "{{ lookup('dict', amdgpu_profiles) }}"
|
||||
- "{{ amdgpu_profiles }}"
|
||||
- "{{ base_profiles }}"
|
||||
notify: Restart tuned
|
||||
become: true
|
||||
|
@ -86,12 +86,12 @@
|
|||
- name: Template custom tuned profiles
|
||||
ansible.builtin.template:
|
||||
src: templates/tuned.conf.j2
|
||||
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}/tuned.conf
|
||||
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0 }}/tuned.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
with_nested:
|
||||
- "{{ lookup('dict', amdgpu_profiles) }}"
|
||||
- "{{ amdgpu_profiles }}"
|
||||
- "{{ base_profiles }}"
|
||||
notify: Restart tuned
|
||||
become: true
|
||||
|
|
|
@ -20,9 +20,6 @@ CARD=$(/usr/bin/grep -ls ^connected /sys/class/drm/*/status | /usr/bin/grep -o '
|
|||
|
||||
{# begin the templated script for 'default' profiles to reset state #}
|
||||
{% if 'default' in profile_name %}
|
||||
# set power state transition heuristics to default
|
||||
echo '{{ item.0.value.pwrmode }}' | tee /sys/class/drm/"${CARD}"/device/pp_power_profile_mode
|
||||
|
||||
# set control mode back to auto
|
||||
# attempts to dynamically set optimal power profile for (load) conditions
|
||||
echo 'auto' | tee /sys/class/drm/"${CARD}"/device/power_dpm_force_performance_level
|
||||
|
@ -30,23 +27,20 @@ echo 'auto' | tee /sys/class/drm/"${CARD}"/device/power_dpm_force_performance_le
|
|||
# reset any existing profile clock changes
|
||||
echo 'r' | tee /sys/class/drm/"${CARD}"/device/pp_od_clk_voltage
|
||||
|
||||
# give '{{ profile_name }}' profile ~{{ profile_percentage }}% (rounded) of the max power capability
|
||||
# {{ profile_watts }} Watts of {{ board_watts }} total
|
||||
echo '{{ profile_microwatts | int }}' | tee '{{ powercap_set.files.0.path }}'
|
||||
# give '{{ profile_name }}' profile ~{{ power_default_pct }}% (rounded) of the max power capability
|
||||
# {{ power_default_watts }} Watts of {{ board_watts }} total
|
||||
echo '{{ power_default_mw | int }}' | tee '{{ powercap_set.files.0.path }}'
|
||||
{% else %}
|
||||
{# begin the templated script for non-default AMD GPU profiles, eg: 'VR' or '3D_FULL_SCREEN' #}
|
||||
# set manual control mode
|
||||
# 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 '{{ profile_name }}' profile
|
||||
echo '{{ item.0.value.pwrmode }}' | tee /sys/class/drm/"${CARD}"/device/pp_power_profile_mode
|
||||
|
||||
# give '{{ profile_name }}' profile ~{{ profile_percentage }}% (rounded) of the max power capability
|
||||
# {{ profile_watts }} Watts of {{ board_watts }} total
|
||||
echo '{{ profile_microwatts | int }}' | tee '{{ powercap_set.files.0.path }}'
|
||||
# give '{{ profile_name }}' profile ~{{ power_oc_pct }}% (rounded) of the max power capability
|
||||
# {{ power_oc_watts }} Watts of {{ board_watts }} total
|
||||
echo '{{ power_oc_mw | int }}' | tee '{{ powercap_set.files.0.path }}'
|
||||
|
||||
# set the minimum GPU clock
|
||||
echo 's 0 {{ gpu_clock_min }}' | tee /sys/class/drm/"${CARD}"/device/pp_od_clk_voltage
|
||||
|
@ -54,7 +48,8 @@ echo 's 0 {{ gpu_clock_min }}' | tee /sys/class/drm/"${CARD}"/device/pp_od_clk_v
|
|||
# set the maximum GPU clock
|
||||
echo 's 1 {{ gpu_clock_max }}' | tee /sys/class/drm/"${CARD}"/device/pp_od_clk_voltage
|
||||
|
||||
# set the maximum GPU *memory* clock
|
||||
# set the minimum / maximum GPU *memory* clock - force it high
|
||||
echo 'm 0 {{ gpumem_clock_static }}' | tee /sys/class/drm/"${CARD}"/device/pp_od_clk_voltage
|
||||
echo 'm 1 {{ gpumem_clock_static }}' | tee /sys/class/drm/"${CARD}"/device/pp_od_clk_voltage
|
||||
{% if gpu_mv_offset is defined %}
|
||||
|
||||
|
@ -68,5 +63,9 @@ echo 'c' | tee /sys/class/drm/"${CARD}"/device/pp_od_clk_voltage
|
|||
# force GPU memory into highest clock (fix flickering)
|
||||
# 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
|
||||
echo '3' | tee /sys/class/drm/"${CARD}"/device/pp_dpm_mclk
|
||||
# echo '3' | tee /sys/class/drm/"${CARD}"/device/pp_dpm_mclk
|
||||
|
||||
# note 4/8/2023: instead of 'manual'... deal with broken power management, force clocks to high
|
||||
# ref: https://gitlab.freedesktop.org/drm/amd/-/issues/1500
|
||||
echo 'high' | tee /sys/class/drm/"${CARD}"/device/power_dpm_force_performance_level
|
||||
{% endif %}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
[main]
|
||||
include={{ item.1 }}
|
||||
summary={{ item.1 }} + TCP/RAID tweaks + AMDGPU pp_power_profile_mode = {{ item.0.value.pwrmode }} ({{ item.0.key }})
|
||||
summary={{ item.1 }} + TCP/RAID tweaks + AMDGPU {{ item.0 }}
|
||||
|
||||
[sysctl]
|
||||
# allow regular users to see the kernel ring buffer
|
||||
kernel.dmesg_restrict=0
|
||||
net.core.default_qdisc=fq
|
||||
# 'bbr2' requires a [modified] supporting kernel - stock Fedora kernels do *not* support it (currently)
|
||||
# eg: 'kernel-xanmode-edge' from COPR 'rmnscnce/kernel-xanmod'
|
||||
|
@ -25,4 +27,6 @@ script=${i:PROFILE_DIR}/amdgpu-clock.sh
|
|||
[ssdnosched]
|
||||
type=disk
|
||||
devices_udev_regex=(ID_ATA_ROTATION_RATE_RPM=0)
|
||||
elevator=none
|
||||
# elevator=none
|
||||
elevator=kyber
|
||||
# elevator=mq-deadline
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue