2021-10-13 02:02:22 +00:00
|
|
|
---
|
|
|
|
- hosts: localhost
|
|
|
|
become: yes
|
|
|
|
vars:
|
2022-06-08 00:12:52 +00:00
|
|
|
# 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
|
2022-06-08 00:22:48 +00:00
|
|
|
power_max_custom_multi: 1.0 # used to boost GPU power to board capability for some overclocking
|
|
|
|
power_max_default_multi: 0.75 # used to limit GPU power to some lower percentage on default perf mode
|
2022-06-08 00:12:52 +00:00
|
|
|
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
|
2022-06-04 16:38:40 +00:00
|
|
|
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'
|
2021-10-13 02:02:22 +00:00
|
|
|
card: card0 # default to card0
|
2022-06-04 16:38:40 +00:00
|
|
|
base_profiles: # 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'
|
2021-10-13 02:02:22 +00:00
|
|
|
- desktop
|
2022-01-30 05:02:26 +00:00
|
|
|
- latency-performance
|
2021-10-13 02:02:22 +00:00
|
|
|
- network-latency
|
2022-01-30 05:02:26 +00:00
|
|
|
- network-throughput
|
2021-10-13 02:02:22 +00:00
|
|
|
- powersave
|
2022-01-30 05:02:26 +00:00
|
|
|
- virtual-host
|
2021-10-13 02:09:15 +00:00
|
|
|
amdgpu_profiles: # statically defined mapping of the contents in /sys/class/drm/{{ card }}/device/pp_power_profile_mode
|
2022-06-04 16:38:40 +00:00
|
|
|
- { name: 'default', value: 0 }
|
2022-05-30 06:50:56 +00:00
|
|
|
- { name: 'custom', value: 6 }
|
2022-01-30 05:02:26 +00:00
|
|
|
handlers:
|
|
|
|
- name: restart tuned
|
|
|
|
ansible.builtin.service:
|
|
|
|
name: tuned
|
|
|
|
state: restarted
|
2021-10-13 02:02:22 +00:00
|
|
|
tasks:
|
2022-02-01 01:18:10 +00:00
|
|
|
- name: find hwmon/max power capability file for {{ card }}
|
|
|
|
find:
|
|
|
|
paths: /sys/class/drm/{{ card }}/device/hwmon
|
|
|
|
file_type: file
|
|
|
|
recurse: yes
|
|
|
|
use_regex: yes
|
|
|
|
patterns:
|
|
|
|
- '^power1_cap_max$'
|
|
|
|
register: hwmon
|
|
|
|
- name: get max power capability for {{ card }}
|
|
|
|
slurp:
|
|
|
|
src: "{{ hwmon.files.0.path }}"
|
2022-05-06 02:48:35 +00:00
|
|
|
register: power_max_b64
|
2021-10-13 02:02:22 +00:00
|
|
|
- name: ensure tuned is installed
|
|
|
|
package:
|
|
|
|
name: tuned
|
|
|
|
state: present
|
|
|
|
- name: create custom profile directories
|
|
|
|
file:
|
|
|
|
state: directory
|
2022-01-30 05:02:26 +00:00
|
|
|
path: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.name }}
|
2021-10-13 02:02:22 +00:00
|
|
|
mode: "0755"
|
|
|
|
with_nested:
|
|
|
|
- "{{ amdgpu_profiles }}"
|
|
|
|
- "{{ base_profiles }}"
|
2022-06-04 16:38:40 +00:00
|
|
|
- name: template AMDGPU clock control scripts (tuned profile dependency)
|
|
|
|
template:
|
|
|
|
src: templates/amdgpu-clock.sh.j2
|
|
|
|
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0 }}/amdgpu-clock.sh
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0755"
|
|
|
|
with_nested:
|
|
|
|
- 'custom'
|
|
|
|
- "{{ base_profiles }}"
|
|
|
|
notify: restart tuned
|
|
|
|
- name: template AMDGPU clock control *reset* script (tuned profile dependency)
|
|
|
|
template:
|
|
|
|
src: templates/amdgpu-clock-reset.sh.j2
|
|
|
|
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0 }}/amdgpu-clock-reset.sh
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0755"
|
|
|
|
with_nested:
|
|
|
|
- 'default'
|
|
|
|
- "{{ base_profiles }}"
|
|
|
|
notify: restart tuned
|
2021-10-13 02:02:22 +00:00
|
|
|
- name: template custom tuned profiles
|
|
|
|
template:
|
|
|
|
src: templates/tuned.conf.j2
|
2022-01-30 05:02:26 +00:00
|
|
|
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.name }}/tuned.conf
|
2021-10-13 02:02:22 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0644"
|
|
|
|
with_nested:
|
|
|
|
- "{{ amdgpu_profiles }}"
|
2022-01-30 05:02:26 +00:00
|
|
|
- "{{ base_profiles }}"
|
|
|
|
notify: restart tuned
|