Overclocking the Pi3b+ GPU (Results)
-
@Brunnis said in Overclocking the Pi3b+ GPU (Results):
@dankcushions
That's just converting top's CPU load (which is for all four cores) to the estimated resulting single core load. So:("Total CPU load"/25)*100 gives you the value in the "Est. single CPU load" column.
actually top's percentage is cumulative. eg, 100% load on 4 cores would appear on top as 400%
that said, these emulators are not threaded so they won't be using the other cores, so top's total load will be - or very close to - the load on one core (some OS tasks might be working on other cores)
if you press 1 within top you get a % per core - https://unix.stackexchange.com/a/146090
-
@dankcushions said in Overclocking the Pi3b+ GPU (Results):
@Brunnis said in Overclocking the Pi3b+ GPU (Results):
@dankcushions
That's just converting top's CPU load (which is for all four cores) to the estimated resulting single core load. So:("Total CPU load"/25)*100 gives you the value in the "Est. single CPU load" column.
actually top's percentage is cumulative. eg, 100% load on 4 cores would appear on top as 400%
that said, these emulators are not threaded so they won't be using the other cores, so top's total load will be - or very close to - the load on one core (some OS tasks might be working on other cores)
if you press 1 within top you get a % per core - https://unix.stackexchange.com/a/146090
The %Cpu(s) value at the top (which is what I looked at, should have just looked at RetroArch in the process list below instead) is not cumulative unless you press 1. So, unless you press 1, a full load on all four cores will show as a combined value of 100. But thanks for the tip about pressing 1. Didn't know that!
I'll see if I can update the figures with slightly more accurate ones anyway.
-
I just updated the chart to be a bit more clear on what it's showing.
-
@Brunnis yeah i couldn't quite work out why you were "estimating" them but that checks out :)
i guess i still don't see a smoking gun with the figures being given, especially when the issue is only apparent using video settings where stutter is a known risk under cpu load situations. however if it's a binary thing to your eyes where the stutter is eliminated once the performance governor is set, i guess that is all that needs to be said.
this seems like a perfect test case for my benchmarking script that i never got back to :) https://github.com/dankcushions/retropie-auto-testing/blob/master/retropie-auto-testing.sh
-
@dankcushions said in Overclocking the Pi3b+ GPU (Results):
i guess i still don't see a smoking gun with the figures being given, especially when the issue is only apparent using video settings where stutter is a known risk under cpu load situations. however if it's a binary thing to your eyes where the stutter is eliminated once the performance governor is set, i guess that is all that needs to be said.
Well, in this case the stuttering does not occur because the CPU isn't fast enough, but because the ondemand governor is not able to determine that the CPU should stay at max frequency. That's a pretty big difference in my eyes.
The figures I posted above show us that the ondemand governor doesn't work as we'd expect and that the resulting performance issue is simply masked by buffering with the default settings. With this testing alone, I can't say for sure that it doesn't affect some marginal games even at default settings. It's certainly possible that only video_max_swapchain_images=2 exposes it. In that case, it would of course be okay to leave the governor at the current default.
I didn't post this to press for a change of default governor (since BuZz has already said it won't happen). However, I thought the figures were interesting, since the frequency rollercoaster behavior at default settings didn't seem to be common knowledge.
-
@mitu said in Overclocking the Pi3b+ GPU (Results):
@robertvb83 said in Overclocking the Pi3b+ GPU (Results):
updating mame2003-plus almost always freezes or stops with errors..
What kind of errors ? If they're memory related error (not enough memory), then you can increase the amount of swap added during compilation to get over those issues. Do you get the same kind of errors without overclocking ?
I did not have any errors without overclocking!
this is where compiling ends when overclocked:
-
@Brunnis said in Overclocking the Pi3b+ GPU (Results):
@dankcushions said in Overclocking the Pi3b+ GPU (Results):
i guess i still don't see a smoking gun with the figures being given, especially when the issue is only apparent using video settings where stutter is a known risk under cpu load situations. however if it's a binary thing to your eyes where the stutter is eliminated once the performance governor is set, i guess that is all that needs to be said.
Well, in this case the stuttering does not occur because the CPU isn't fast enough, but because the ondemand governor is not able to determine that the CPU should stay at max frequency. That's a pretty big difference in my eyes.
The figures I posted above show us that the ondemand governor doesn't work as we'd expect and that the resulting performance issue is simply masked by buffering with the default settings.
forgive me, but i don't think they neccesarily show that. they only show that the governor has decided the CPU should be downclocked (to 600) during some tests. we know the emulators in question do not exert a constant load on the cpu (~90% usage). from the earlier information, it looks like the governor should be checking CPU load and making this decision every 0.01 of a second (
sampling_rate
defaults to 10000 usecs?), so given that fidelity i am now not surprised that you will see it downlocking every so often. it's probably changing the core speed 100s of times a second.the performance issue you observe must be caused by his process, agreed, but that stutters is not specifically measured in the above data, if you get what i mean. we need an fps benchmark for that.
anyway, it seems to me like a good fix might be to increase the sampling_rate fidelity to something north of a frame. eg over 16666667 usec. that way, applications that are generally low load will still downlock, but cpu-heavy emulators will stay full speed. i don't know if that's a good idea, just my initial thought.
-
@robertvb83 said in Overclocking the Pi3b+ GPU (Results):
I did not have any errors without overclocking!
this is where compiling ends when overclocked:remember that retropie compiles use 2 of the 4 cores, but emulation mostly uses 1 core, so an overclock that is stable in games can definitely be unstable in compiles.
-
@dankcushions said in Overclocking the Pi3b+ GPU (Results):
forgive me, but i don't think they neccesarily show that. they only show that the governor has decided the CPU should be downclocked (to 600) during some tests. we know the emulators in question do not exert a constant load on the cpu (~90% usage). from the earlier information, it looks like the governor should be checking CPU load and making this decision every 0.01 of a second (sampling_rate defaults to 10000 usecs?), so given that fidelity i am now not surprised that you will see it downlocking every so often. it's probably changing the core speed 100s of times a second.
Yes, I think I may have expressed myself a bit unclear. I agree that the governor probably just behaves according to spec. The "unexpected" part is that it affects the performance in a negative way in certain cases. Ideally, the "ondemand" governor should produce the same (or very close to the same) end result (i.e. performance) as the "performance" governor.
the performance issue you observe must be caused by his process, agreed, but that stutters is not specifically measured in the above data, if you get what i mean. we need an fps benchmark for that.
Yeah, we can definitely measure the performance delta, but what would we do with the data? Would it affect the current discussion in any significant way? For an initial discussion on whether the ondemand governor can cope with the load without affecting the result, audio-visual cues are certainly sufficient. The regression in the end result is not exactly subtle.
anyway, it seems to me like a good fix might be to increase the sampling_rate fidelity to something north of a frame. eg over 16666667 usec. that way, applications that are generally low load will still downlock, but cpu-heavy emulators will stay full speed. i don't know if that's a good idea, just my initial thought.
They write sample rate in the docs, but I guess they mean period? Increasing the sampling period wouldn't really help. The average load over the period would then often be too low to clock up at all. We'd instead need a really small sample period, so that the downclocked core spins up as fast as possible when the load increases (i.e. the next frame rendering kicks off). The current issue is probably that the default of, say, 10 ms means that once the core is clocked down and the emulator kicks off again, you're spending up to 10 ms rendering the frame at 600 MHz before the governor checks the load and decides to clock back up. Then it's too late and you won't be able to submit the frame on time.
-
@hhromic just found this in the official RPI documentation:
"NOTE: Setting any overclocking parameters to values other than those used by raspi-config may set a permanent bit within the SoC, making it possible to detect that your Pi has been overclocked. The specific circumstances where the overclock bit is set are if force_turbo is set to 1 and any of the over_voltage_* options are set to a value > 0. See the blog post on Turbo Mode for more information."
So force turbo
orAND any amount of over voltage applied will set the warranty bit. -
@Brunnis said in Overclocking the Pi3b+ GPU (Results):
@dankcushions said in Overclocking the Pi3b+ GPU (Results):
forgive me, but i don't think they neccesarily show that. they only show that the governor has decided the CPU should be downclocked (to 600) during some tests. we know the emulators in question do not exert a constant load on the cpu (~90% usage). from the earlier information, it looks like the governor should be checking CPU load and making this decision every 0.01 of a second (sampling_rate defaults to 10000 usecs?), so given that fidelity i am now not surprised that you will see it downlocking every so often. it's probably changing the core speed 100s of times a second.
Yes, I think I may have expressed myself a bit unclear. I agree that the governor probably just behaves according to spec. The "unexpected" part is that it affects the performance in a negative way in certain cases. Ideally, the "ondemand" governor should produce the same (or very close to the same) end result (i.e. performance) as the "performance" governor.
the performance issue you observe must be caused by his process, agreed, but that stutters is not specifically measured in the above data, if you get what i mean. we need an fps benchmark for that.
Yeah, we can definitely measure the performance delta, but what would we do with the data? Would it affect the current discussion in any significant way?
no, i'm just articulating what i mean when i say that the data presented is not the "smoking gun", but your personal observations of a stutter is.
i think the sampling_down_factor might be the one we would tweak:
-
sampling_down_factor:
This parameter controls the rate at which the kernel makes a decision
on when to decrease the frequency while running at top speed. When set
to 1 (the default) decisions to reevaluate load are made at the same
interval regardless of current clock speed. But when set to greater
than 1 (e.g. 100) it acts as a multiplier for the scheduling interval
for reevaluating load when the CPU is at its top speed due to high
load. This improves performance by reducing the overhead of load
evaluation and helping the CPU stay at its top speed when truly busy,
rather than shifting back and forth in speed. This tunable has no
effect on behavior at lower speeds/lower CPU loads.
-
-
@quicksilver said in Overclocking the Pi3b+ GPU (Results):
So force turbo or any amount of over voltage applied will set the warranty bit.
No, it is
force_turbo=1
andover_voltage_* > 0
. If you don't useforce_turbo
, you are fine.The specific circumstances where the overclock bit is set are if force_turbo is set to 1 and any of the over_voltage_* options are set to a value > 0.
-
@hhromic Ah thank you for the clarification! I completely missed the "AND".
-
Interesting discussions and investigations guys!
I still advocate to leaveondemand
as the system default and educate users on how overclocking works and how to use the governorruncommand
option, as it's the soundest/safest approach. This topic should definitively be used to update/populate the Wiki entry on the topic.The only improvement I would consider in this subject would be to implement a per-command governor setting in
runcommand
, similar to how video modes are set currently. For example create agovernors.cfg
file alongsidevideomodes.cfg
.This would give the flexibility for the governor to be configured per-emulator as necessary, e.g.
performance
forlr-mupen64plus
anddefault
forlr-gambatte
, or any other customisation.What do you think @buzz? should be a fairly easy thing to code taking the videomode functionality as template.
-
@hhromic The interface is busy enough as it is. I don't think this warrants that level of configuration. So no thanks.
-
@BuZz umm I could have sworn there was already a menu entry for the cpu governor in
runcommand
, but you are right, it is only read from the global options and configured externally in theruncommand
scriptmodule. I agree that adding this to the menu would add two more entries to the already crowded interface.The idea was more for these advanced tinker users (like in this topic!), so if you reconsider it in the future, perhaps we can add the functionality without exposing any menu items, i.e. requiring editing the governors config file manually.
-
@hhromic advanced users can do this via an onstart/onend script if they want.
-
@BuZz you mean adding something like this (and the corresponding reverting snippet in
onend
):#!/usr/bin/env bash system="$1" emulator="$2" if [[ "$emulator" == "lr-mupen64plus" ]]; then for cpu in /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor; do echo performance | sudo tee "$cpu" >/dev/null done fi
Instead of adding something like this to a
governors.cfg
file?lr-mupen64plus = performance
:)
-
Yes. If you're going to ignore the work involved putting it into runcommand and future maintenance of the code also.
But putting your sarcasm to one side - You can simplify that script on the RPI by just using cpu0 and skipping the loop.
no need for a corresponding reverting snippet either - can just be one line to restore to ondemand.
-
@BuZz sorry I didn't mean to be rude, I'm genuinely being friendly here. I realise being sarcastic wasn't a good move. Apologies.
Of course I'm not ignoring the work needed to code this functionality, and I was going to volunteer on doing it and testing it myself if you felt it was a contributing addition to the system. I understand your safety/maintainability concerns very well and respect your wishes as the project leader. If you don't think is worth it, no hard feelings and all good :thumbsup.
no need for a corresponding reverting snippet either - can just be one line to restore to ondemand.
I was just refering to the actual nice approach in
runcommand
where it saves the current governor and restores it on exit :)Actually
runcommand
has all the functionality built-in to set/unset the governor already and is robust, that's why I liked the idea of implementing it in there instead of onstart/onend scripts.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.