Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PERF] Subpar GPU performance due to wrong power profile mode #469

Open
kivoli opened this issue Oct 2, 2021 · 14 comments
Open

[PERF] Subpar GPU performance due to wrong power profile mode #469

kivoli opened this issue Oct 2, 2021 · 14 comments
Labels

Comments

@kivoli
Copy link

kivoli commented Oct 2, 2021

//EDIT: Changed the title to reflect findings and most likely cause

Original title: Frametimes just above selected threshold even after GPU upgrade

Describe the bug
When playing around with 90Hz, 120Hz and 144Hz I noticed that the frame times in SteamVR Home at 120 Hz miss the 8.3 ms mark but stay below 11.1 ms. Yet when switching to 90 Hz they would be constantly at above 12 ms.

This is particularly peculiar since I recently upgraded from an AMD Radeon Vega 56 to a 6800 XT which should deliver more than double the performance yet it feels like nothing changed.

To Reproduce
Steps to reproduce the behavior:

  1. Start SteamVR Home @ 90 Hz
  2. Check frame times
  3. Start SteamVR Home @ 120 Hz
  4. Check frame times

Expected behavior
Performance should not differ, average frame times should stay the same, especially if the target frame times cannot be met.

System Information:

Note:

Performance Data:

Screenshots
90Hz_overview
90Hz_details
120Hz_overview
120Hz_details

Additional context

The “loading room” between applications does not have any performance issues.

“Half Live: Alyx” suggests only the second-highest graphics settings after the upgrade. Also frame-times are perfect (about 4 ms) during the initial save-game loading screen when only the city map is seen but tank as soon as the maps is shown in the background. I haven’t played much yet so I can only guess what happens at level loading screens.

From what’s happening I would suspect something trying to hit the target frame rate but there’s other components that add a couple of extra milli seconds on top leading to the miss.

I scoured other issues for pointers or work arounds hence turning off VRR and TearFree but came up empty. Hope I did not miss a similar ticket.

Note: Commenters who are also experiencing this issue are encouraged to include the "System Information" and "Perf Data" sections in their replies.

@kivoli kivoli added the perf label Oct 2, 2021
@ChristophHaag
Copy link
Contributor

With my 6900XT I've seen it do something like this, especially in openbrush it's bad. The reason was power management.

As root, try echo 4 > /sys/class/drm/card0/device/pp_power_profile_mode. The power profile settings can be read with cat /sys/class/drm/card0/device/pp_power_profile_mode, number 4 should be a profile called VR. echo 0 > ... to reset to the default.

Or the blanket one, echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level with echo auto > ... to reset.

@kivoli
Copy link
Author

kivoli commented Oct 3, 2021

Thank you so much, much better. :)

@kivoli kivoli closed this as completed Oct 3, 2021
@ChristophHaag
Copy link
Contributor

How do you feel about keeping this issue open? I think there are two things about it

  1. Fixing the power management so it works properly on the default profile. This might be more an amdgpu thing, but still very relevant to SteamVR. My theory is that because VR applications are throttled down to the HMD refresh rate by the WaitGetPoses() call and the compositor running "asynchronously" to that, the power management is deceived into clocking down too much.
  2. Even with better default power management the VR profile is there and should be used. We don't actually want SteamVR switching power profiles though because when SteamVR is killed or crashes we don't want it to not switch back to the default and consume more power. Perhaps there could be a systemd service monitoring process start/stop and switch profiles based on start/stop of the process vrcompositor (or also monado-service).

@kivoli kivoli reopened this Oct 3, 2021
@kivoli kivoli changed the title [PERF] Frametimes just above selected threshold even after GPU upgrade [PERF] Subpar GPU performance due to wrong power profile mode Oct 3, 2021
@Zamundaaa
Copy link

Perhaps there could be a systemd service monitoring process start/stop and switch profiles based on start/stop of the process vrcompositor (or also monado-service).

CoreCtrl is such a service and I use it to set the VR profile, and also increase the power limit and overclock a little.

I don't think that's a great long term solution though with mobile VR headsets being a thing; always using max power would be bad for battery life there.

@kivoli
Copy link
Author

kivoli commented Oct 3, 2021

Hmm, what about Feral’s GameMode? I actually have it installed but forgot about it. ^^

https://github.com/FeralInteractive/gamemode

@dsalt
Copy link

dsalt commented Oct 12, 2021

Perhaps there could be a systemd service monitoring process start/stop and switch profiles based on start/stop of the process vrcompositor (or also monado-service).

As a user of a distribution which does not have systemd as init, I for one am against providing (only) a systemd-specific solution to this.

Hmm, what about Feral’s GameMode? I actually have it installed but forgot about it. ^^

That relies on systemd. It won't work here.

@ChristophHaag
Copy link
Contributor

Nobody prevents you from running

while true; do pgrep vrcompositor && echo 4 > /sys/class/drm/card0/device/pp_power_profile_mode || echo 0 > /sys/class/drm/card0/device/pp_power_profile_mode; sleep 1; done

with your favorite init system, but it can probably be done nicer without spawning pgrep processes etc. all the time with an event based system monitoring service.

@farmboy0
Copy link

I use corectrl so set the power profile to VR for vrcompositor.

@ClearlyClaire
Copy link

Just a note that until today I did not know about power profiles and I couldn't get some games to give me decent performance despite my hardware. Thanks to this issue I have enabled the VR power profile to play some games that previously ran with abysmal performances and it is much, much better. Thanks for the info!

@Goofybud16
Copy link

I use Radeon-Profile to set the VR profile, and find that it seemingly randomly bounces back to "Bootup Default." I usually open Radeon-Profile, set the value, and close it. It will reset with Radeon-Profile open or closed. Sometimes an entire VR session goes fine without it, sometimes it resets.

Not entirely sure why, but it is rather annoying because performance suddenly suffers (and frames become very stuttery, as the GPU seems to be aggressively clocking up/down every frame or two, resulting in frametimes that look roughly like 1, 0.5, 1, 0.5, 1, 0.5 and so on).

If it at all matters, I use a 6700XT. I usually have RadeonTop running as well in another terminal window (so that I can watch VRAM usage and check for the shader clock dropping, indicating the GPU has 'slipped out of gear' and gone back into Bootup Default)

@Goofybud16
Copy link

I did figure out what seems to be causing it to change from VR mode back to Bootup Default.

It seems when Firefox plays a video (I use it for music sometimes) it will set the GPU to "Video" mode, and then afterwards reset it back to "Bootup Default"

Not sure why, possibly because I have it set up to use GPU accelerated video decode.

@pfych
Copy link

pfych commented Jul 14, 2022

I can confirm that installing radeon-profile, running it as root, and changing the power profile to VR fixes most issues I was experiencing relating to GPU performace.

This fix does not work on linux_v1.14 which sadly is the last version where I did not have to apply this fix: #175 (comment)

I've got the startup ritual down now though.

@Redemption198
Copy link

Redemption198 commented Apr 14, 2023

It happened to me too, I have a 6700XT and managed to get around this bug by using CoreCtrl.

Edit: it appears to be a Mesa bug that should be fixed in Mesa 23.

@Atemu
Copy link

Atemu commented Sep 22, 2023

The power profiles are not a mesa bug that was fixed in mesa 23.

It's actually an upstream AMDGPU bug that affects other framerate-locked scenarios aswell: https://gitlab.freedesktop.org/drm/amd/-/issues/1500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants