From 743e98caa7da1a8b8f3ee90c7fabd84c59c554a5 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 3 Mar 2024 17:56:42 -0600 Subject: [PATCH 1/5] play: clock var updates, -retry files in ansible.cfg --- ansible.cfg | 4 +++- playbook.yml | 18 +++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ansible.cfg b/ansible.cfg index 56bf283..fd63fbd 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,2 +1,4 @@ [defaults] -nocows=True +nocows = True +stdout_callback = yaml +retry_files_enabled = False diff --git a/playbook.yml b/playbook.yml index eec99dd..47db37e 100644 --- a/playbook.yml +++ b/playbook.yml @@ -11,17 +11,21 @@ # the connected AMD GPU is automatically discovered - assumes one # on swap to other AMD cards to avoid instability: # 'rm -rfv /etc/tuned/*amdgpu*' - gpu_clock_min: "750" # default 500, for best performance: near maximum. applies with 'overclock' tuned profile - gpu_clock_max: "2675" # default somewhere around 2529 to 2660 + gpu_clock_min: "500" # default 500, for best performance: near maximum. applies with 'overclock' tuned profile + # gpu_clock_max: "2675" # default somewhere around 2529 to 2660. + gpu_clock_max: "2725" + # note: 6900XT seems to OC best with a slight underclock. 300W and -15mV gpumem_clock_static: "1075" gpu_power_multi: default: 0.869969040247678 # 281W - real default - overclock: 0.928792569659443 # 300W - slight boost -# overclock: 1.0 # 323W - full board capability + # overclock: 0.928792569659443 # 300W - slight boost + overclock: 1.0 # 323W - full board capability # optional, applies offset (+/-) to GPU voltage by provided mV - # gpu_mv_offset: "-25" - # gpu_mv_offset: "+50" # add 50mV or 0.05V - gpu_mv_offset: "+25" # add 25mV or 0.025V + # only counts for peak and overlock profiles + # gpu_mv_offset: "-20" + gpu_mv_offset: "+125" # add 125mV or 0.125V +# gpu_mv_offset: "+50" # add 50mV or 0.05V +# gpu_mv_offset: "+75" # add 75mV or 0.075V # '-50' undervolts GPU core voltage 50mV or 0.05V # mostly untested, there be dragons/instability # From 70b9ae64699e52fb9bbf188ffef7495dff08709f Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 3 Mar 2024 17:59:34 -0600 Subject: [PATCH 2/5] play: trim comments --- playbook.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/playbook.yml b/playbook.yml index 47db37e..4f6bd99 100644 --- a/playbook.yml +++ b/playbook.yml @@ -14,7 +14,6 @@ gpu_clock_min: "500" # default 500, for best performance: near maximum. applies with 'overclock' tuned profile # gpu_clock_max: "2675" # default somewhere around 2529 to 2660. gpu_clock_max: "2725" - # note: 6900XT seems to OC best with a slight underclock. 300W and -15mV gpumem_clock_static: "1075" gpu_power_multi: default: 0.869969040247678 # 281W - real default @@ -24,10 +23,9 @@ # only counts for peak and overlock profiles # gpu_mv_offset: "-20" gpu_mv_offset: "+125" # add 125mV or 0.125V -# gpu_mv_offset: "+50" # add 50mV or 0.05V -# gpu_mv_offset: "+75" # add 75mV or 0.075V - # '-50' undervolts GPU core voltage 50mV or 0.05V - # mostly untested, there be dragons/instability + # gpu_mv_offset: "+50" # add 50mV or 0.05V + # gpu_mv_offset: "+75" # add 75mV or 0.075V + # '-50' undervolts GPU core voltage 50mV or 0.05V; untested - here be dragons/instability # # list of source tuned profiles available on Fedora (TODO: should dynamically discover) base_profiles: From aa64363d2969a9560e85d4c3097f751948e30c30 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 24 Mar 2024 18:28:38 -0500 Subject: [PATCH 3/5] vars: move to host_vars --- host_vars/localhost.yml | 28 ++++++++++++++++++++++++++++ playbook.yml | 22 ---------------------- 2 files changed, 28 insertions(+), 22 deletions(-) create mode 100644 host_vars/localhost.yml diff --git a/host_vars/localhost.yml b/host_vars/localhost.yml new file mode 100644 index 0000000..bcaa294 --- /dev/null +++ b/host_vars/localhost.yml @@ -0,0 +1,28 @@ +--- +# note: 'gpu_*' vars only apply with the 'custom' suffixed profiles created by this tooling +# profiles based on the 'default' amdgpu power profile mode use default clocks +# +# the connected AMD GPU is automatically discovered - assumes one +# on swap to other AMD cards to avoid instability: +# 'rm -rfv /etc/tuned/*amdgpu*' +# +# default 500, for best performance: near maximum. applies with 'overclock' tuned profile +gpu_clock_min: "500" + +# gpu_clock_max: "2675" # default somewhere around 2529 to 2660. +gpu_clock_max: "2750" + +gpumem_clock_static: "1075" + +gpu_power_multi: + default: 0.869969040247678 # 281W - real default + # overclock: 0.928792569659443 # 300W - slight boost + overclock: 1.0 # 323W - full board capability +# optional, applies offset (+/-) to GPU voltage by provided mV +# only counts for peak and overlock profiles +# gpu_mv_offset: "-20" + +gpu_mv_offset: "+125" # add 125mV or 0.125V +# gpu_mv_offset: "+50" # add 50mV or 0.05V +# gpu_mv_offset: "+75" # add 75mV or 0.075V +# '-50' undervolts GPU core voltage 50mV or 0.05V; untested - here be dragons/instability diff --git a/playbook.yml b/playbook.yml index 4f6bd99..ca760bd 100644 --- a/playbook.yml +++ b/playbook.yml @@ -5,28 +5,6 @@ # role prepares/modifies 'tuned' with AMD GPU power/clock parameters # creates a new tuned profile made for each permutation of (base) 'tuned' profile + AMD powerplay profile - role: tuned_amdgpu - # note: 'gpu_*' vars only apply with the 'custom' suffixed profiles created by this tooling - # profiles based on the 'default' amdgpu power profile mode use default clocks - # - # the connected AMD GPU is automatically discovered - assumes one - # on swap to other AMD cards to avoid instability: - # 'rm -rfv /etc/tuned/*amdgpu*' - gpu_clock_min: "500" # default 500, for best performance: near maximum. applies with 'overclock' tuned profile - # gpu_clock_max: "2675" # default somewhere around 2529 to 2660. - gpu_clock_max: "2725" - gpumem_clock_static: "1075" - gpu_power_multi: - default: 0.869969040247678 # 281W - real default - # overclock: 0.928792569659443 # 300W - slight boost - overclock: 1.0 # 323W - full board capability - # optional, applies offset (+/-) to GPU voltage by provided mV - # only counts for peak and overlock profiles - # gpu_mv_offset: "-20" - gpu_mv_offset: "+125" # add 125mV or 0.125V - # gpu_mv_offset: "+50" # add 50mV or 0.05V - # gpu_mv_offset: "+75" # add 75mV or 0.075V - # '-50' undervolts GPU core voltage 50mV or 0.05V; untested - here be dragons/instability - # # list of source tuned profiles available on Fedora (TODO: should dynamically discover) base_profiles: - balanced From 1a72de4828909d6e39f62c3117b52b5ab473b30f Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 24 Mar 2024 18:30:15 -0500 Subject: [PATCH 4/5] inv: localhost/workstation (map host_vars) --- inventories/localhost.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inventories/localhost.yml b/inventories/localhost.yml index 16c7496..bf2a06e 100644 --- a/inventories/localhost.yml +++ b/inventories/localhost.yml @@ -1,5 +1,5 @@ --- lab: hosts: - localhost: + workstation: ansible_connection: local From 3d2a88c12b52cd4f344d4a65f25a3fde3e6a2040 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 24 Mar 2024 18:55:50 -0500 Subject: [PATCH 5/5] handle sysctl tunable dict --- host_vars/localhost.yml | 13 ++++++++++ roles/tuned_amdgpu/templates/tuned.conf.j2 | 29 ++++------------------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/host_vars/localhost.yml b/host_vars/localhost.yml index bcaa294..578ca52 100644 --- a/host_vars/localhost.yml +++ b/host_vars/localhost.yml @@ -26,3 +26,16 @@ gpu_mv_offset: "+125" # add 125mV or 0.125V # gpu_mv_offset: "+50" # add 50mV or 0.05V # gpu_mv_offset: "+75" # add 75mV or 0.075V # '-50' undervolts GPU core voltage 50mV or 0.05V; untested - here be dragons/instability + +# optional kernel parameters to set as well +sysctl: # quote ints/cast to string to avoid surprises + kernel.dmesg_restrict: '0' # allow regular users to see the kernel ring buffer + net.core.default_qdisc: fq # congestion control + net.ipv4.tcp_congestion_control: bbr2 # cong. control part 2 + net.core.rmem_max: '33554432' + net.core.wmem_max: '33554432' + dev.raid.speed_limit_min: '2000000' + dev.raid.speed_limit_max: '6000000' + vm.compaction_proactiveness: '30' # improve THP allocation latency, compact in background + vm.page_lock_unfairness: '1' # make page lock theft slightly more fair + vm.max_map_count: '1048576' # allow some games to run (eg: DayZ) diff --git a/roles/tuned_amdgpu/templates/tuned.conf.j2 b/roles/tuned_amdgpu/templates/tuned.conf.j2 index 729e025..a10ec3e 100644 --- a/roles/tuned_amdgpu/templates/tuned.conf.j2 +++ b/roles/tuned_amdgpu/templates/tuned.conf.j2 @@ -2,35 +2,16 @@ include={{ item.1 }} summary={{ item.1 }} + TCP/RAID tweaks + AMDGPU {{ item.0 }} +{% if sysctl is defined %} [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' -net.ipv4.tcp_congestion_control=bbr2 -net.core.rmem_max=33554432 -net.core.wmem_max=33554432 -dev.raid.speed_limit_min=1000000 -dev.raid.speed_limit_max=6000000 -# improve THP allocation latency, compact in background -vm.compaction_proactiveness=30 -# make page lock theft slightly more fair -vm.page_lock_unfairness=1 -# allow some games to run (eg: DayZ) -vm.max_map_count=1048576 +{% for _sysctl, value in sysctl.items() %} +{{ _sysctl }}={{ value }} +{% endfor %} +{% endif %} # reference/execute AMDGPU control script # used because some sysfs interfaces are transactional # cannot be set by a single param in 'tuned'/[sysfs] [gpuclockscript] type=script script=${i:PROFILE_DIR}/amdgpu-clock.sh - -# for SSDs with no RPM, set no IO scheduler -[ssdnosched] -type=disk -devices_udev_regex=(ID_ATA_ROTATION_RATE_RPM=0) -# elevator=none -elevator=kyber -# elevator=mq-deadline