Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

add support for amd cpu,apu and gpu. #18

Open
ghost opened this issue Apr 24, 2019 · 11 comments
Open

add support for amd cpu,apu and gpu. #18

ghost opened this issue Apr 24, 2019 · 11 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ghost
Copy link

ghost commented Apr 24, 2019

when used with amd processor cpu freq options dont work.
amd gpu/amd apu support to have frequency scaling.
if possible add support for nvidia gpu frequency scaling.

@jsalatas
Copy link
Owner

Unfortunately I don't own any AMD hardware, so I can't really support it. However I'll accept any pull requests for such support, even the widget is named "Intel P-state.... " :)

Regarding NVidia support, as I already mentioned at #6 I personally never had the need to modify nvidia gpu parameters, and I would appreciate any suggestions about what options would you be interesting in modifying through the widget.

@jsalatas jsalatas added enhancement New feature or request help wanted Extra attention is needed labels Apr 24, 2019
@cmpute
Copy link

cmpute commented Nov 21, 2019

I have AMD processors and wish to help, but have no idea how to contribute...

@cmpute
Copy link

cmpute commented Jan 6, 2020

find this repo to be useful: https://github.com/kevinlekiller/amdctl
I have already set it up and I'm trying to test if it can set pstate of my AMD Ryzen 2700

other repos that might be useful: https://github.com/ocerman/zenmonitor

@cmpute
Copy link

cmpute commented Jan 6, 2020

I can get the p-state information from this tool by sudo ./amdctl -g -c0

Voltage ID encodings: SVI (serial)
Detected CPU model 8h, from family 17h with 16 CPU cores.

Core 0 | P-State Limits (non-turbo): Highest: 3 ; Lowest 3 | Current P-State: 3
 Pstate Status CpuFid CpuDid CpuVid CpuMult CpuFreq CpuVolt IddVal IddDiv CpuCurr CpuPower
      0      1    128      8     88  32.00x 3200MHz  1000mV     32     10  42.00A   42.00W
      1      1    140     10    108  28.00x 2800MHz   875mV     28     10  38.00A   33.25W
      2      1    124     16    122  15.50x 1400MHz   788mV     15     10  25.00A   19.69W
      3      disabled
Northbridge:
No P-States on AMD17H Northbridge.

But I actually have no idea how can I set the p-state, this tool enables modification of voltages and frequencies of p-states

@jsalatas
Copy link
Owner

jsalatas commented Jan 6, 2020

I have already set it up and I'm trying to test if it can set pstate of my AMD Ryzen 2700

That might be interesting! I'm a little bit busy at that time (and I guess for at least a couple of months more) but in any case, if you could create a PR, I'll for surre merge it..... at some time :\

Thanks for your help and feedback!

@kermeat
Copy link

kermeat commented Jan 30, 2020

Take a look at cpupower. It can handle all supported by kernel cpu
https://github.com/torvalds/linux/tree/master/tools/power/cpupower

@lapineige
Copy link

Ryzen 5 3600 here, I'm willing to help to, but I can't contribute do any code, sorry. AMD support would be very neat :)
I'm ready to test something if you wish.
(I also have an intel CPU on another computer, if you need to test something on both)
I'm my case I'm specially interested in the CPU governor parameter, to have a one-click tool to switch between power saving, "balanced" and full performance. Overclocking/changing frequencies could be a nice addition, but it's not important for me.

@jsalatas
Copy link
Owner

jsalatas commented Sep 17, 2020

Ryzen 5 3600 here, I'm willing to help to, but I can't contribute do any code, sorry. AMD support would be very neat :)
I'm ready to test something if you wish.

@lapineige I would appreciate your feedback in a couple of questions. I'm actually implementing part of my widget in the upstream KDE, and there are some open questions regarding AMD support.

Could you please email me and I'll come back to you.

Thanks for your help!

@ghost
Copy link
Author

ghost commented Sep 17, 2020

Hope this helps

I just added some extra things to your scripts

performance.sh

`#!/bin/sh
gov=performance
if [ -n "$gov" ]; then
for cpu in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
printf '%s\n' "$gov" > $cpu; 2> /dev/null
done
fi

energyperf=performance
if [ -n "$energyperf" ]; then
    if [ -f /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference ]; then
        for cpu in /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference; do
            printf '%s\n' "$energyperf" > $cpu; 2> /dev/null
        done
    else
        pnum=$(echo $energyperf | sed -r 's/^performance$/0/;
                            s/^balance_performance$/4/;
                            s/^(default|normal)$/6/;
                            s/^balance_power?$/8/;
                            s/^power(save)?$/15/')

        x86_energy_perf_policy $pnum > /dev/null 2>&1
    fi
fi



nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=1" 2> /dev/null
echo performance > /sys/class/drm/card0/device/power_dpm_state
echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level
echo performance > /sys/module/pcie_aspm/parameters/policy
echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo
echo 1 > /sys/devices/system/cpu/cpufreq/boost

`

Powersave.sh

`#!/bin/sh

gov=powersave
if [ -n "$gov" ]; then
    for cpu in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
        printf '%s\n' "$gov" > $cpu; 2> /dev/null
    done
fi


energyperf=power
if [ -n "$energyperf" ]; then
    if [ -f /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference ]; then
        for cpu in /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference; do
            printf '%s\n' "$energyperf" > $cpu; 2> /dev/null
        done
    else
        pnum=$(echo $energyperf | sed -r 's/^performance$/0/;
                            s/^balance_performance$/4/;
                            s/^(default|normal)$/6/;
                            s/^balance_power?$/8/;
                            s/^power(save)?$/15/')

        x86_energy_perf_policy $pnum > /dev/null 2>&1
    fi
fi



nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=2" 2> /dev/null
echo battery > /sys/class/drm/card0/device/power_dpm_state
echo low > /sys/class/drm/card0/device/power_dpm_force_performance_level
echo powersave > /sys/module/pcie_aspm/parameters/policy
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
echo 0 > /sys/devices/system/cpu/cpufreq/boost

`

@lapineige
Copy link

lapineige commented Jun 12, 2021

I'm actually implementing part of my widget in the upstream KDE

Hello @jsalatas, do you have any piece of news regarding that ?

@jsalatas
Copy link
Owner

jsalatas commented Jun 12, 2021

Hi! This is handled by Kai Uwe Broulik (from the KDE team) and hopefully we will see some initial implementation in 5.23

https://invent.kde.org/plasma/powerdevil/-/merge_requests/34#note_230681

Notice that recent kernels have introduced the platform profile API (https://www.kernel.org/doc/html/latest/userspace-api/sysfs-platform_profile.html) and I'm not sure at the moment how many devices and configurations are supported by that API.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants