WIP Freebird - Switch Clock Speed Control Sysmodule

Discussion in 'Switch - Emulation, Homebrew & Software Projects' started by JK_, Feb 5, 2019.

  1. AliciaBurrito

    AliciaBurrito Member

    Newcomer
    3
    Sep 8, 2018
    United States
    Rei's Mommy
    Yep, this simple copy/paste seems to make it work in ReiNX no issues :)
     
    Draxzelex and Adran_Marit like this.
  2. AliciaBurrito

    AliciaBurrito Member

    Newcomer
    3
    Sep 8, 2018
    United States
    Rei's Mommy
    After some more testing of Switch overclocking in both Atmosphere and ReiNX, I have some very interesting findings to share.
    First, let's get everyone up to speed on everything the current overclock implementation allows, and some of the basics.

    Undocked Default Clock Speeds
    CPU: 1020MHz
    GPU: 307MHz
    RAM: 1331MHz

    Docked Default Clock Speeds
    CPU: 1020MHz
    GPU: 768MHz
    RAM: 1600MHz

    Max Clockspeeds Available
    CPU: 1785MHz
    GPU: 921MHz
    RAM: 1600MHz

    You are able to reach the maximum GPU clock speeds on both handheld and docked, however you must be plugged into the official Nintendo charger to enable GPU clock speeds of 844MHz and above. On both handheld and docked you are able to reach the maximum available overclock of the CPU of 1785MHz without needing the official Nintendo charger.
    Now that we have the basics covered, onto the findings:

    Test Environment
    Firmware: 6.2.0
    Atmosphere: 0.8.3
    ReiNX: 2.0 and Latest Nightly 80095f252597d4006d15f09c6866fd9efe0ef893
    Hekate: 4.6

    On Atmosphere, myself and others that have tested alongside me have found that in general it is far more prone to instability and crashes than ReiNX when running an otherwise identical setup and overclock settings on the same system.

    Testing Methodology
    On both systems, I launched each game that I had in NSP format alongside RetroArch in NSP format (non-forwarded) and the regular RetroArch.nro.
    In Atmosphere, if I had an overclock that was too high (what is determined as too high is variable, but usually above 1122MHz) a game launch (or RetroArch) would cause the Switch to immediately turn off.
    Entering any game without an OC, and re-enabling it afterwards would usually allow the game to play fine. However very likely would the Switch would immediately power off (crash) soon afterwards at random, in particular during loading screens. This issue is exacerbated the higher the CPU OC. GPU and RAM clock speed changes did not seem to affect stability or the chance of system crashes.
    I was unable to reproduce any of the system crashes while using ReiNX. My testing on ReiNX was playing every game on both docked and handheld at the maximum available clock speeds for CPU, GPU and RAM and I did not encounter a single system crash, or the Switch immediately turning off.

    Conclusion
    I am unsure what causes stability issues in Atmosphere when changing the CPU clock speed, as ReiNX seems to be perfectly stable even with everything cranked at all times. Myself and others have tested with and without Hekate as the bootloader for Atmosphere, and that does not seem to change anything. Whatever the difference is, it seems inherent to a difference in Atmosphere.
    Perhaps it would be possible to achieve higher clock speeds on the Switch than what Freebird supplies in ReiNX given the lack of stability issues.

    TL;DR
    Atmosphere has stability issues with overclocking and will crash often causing the Switch to immediately shut off.
    ReiNX does not suffer from the same issues and I haven't been able to invoke a single crash.
     
    Last edited by AliciaBurrito, Feb 12, 2019
    zexcster, Draxzelex, Dennieh and 13 others like this.
  3. PikachuR77

    PikachuR77 GBAtemp Regular

    Member
    3
    Feb 6, 2018
    United States
    Does this override the overclock setting set by other apps such as retroarch? Or can those apps override freebird?
     
  4. ZachyCatGames

    ZachyCatGames GBAtemp Advanced Fan

    Member
    5
    Jun 19, 2018
    United States
    Hell
    Maybe try an older version of atmos to see if it's because of a recent thing? Current versions of ReiNX (including nighlies) are pretty much equivalent Atmosphere 0.7.4/0.7.5, so try one of those versions maybe?
     
    Last edited by ZachyCatGames, Feb 12, 2019
  5. AliciaBurrito

    AliciaBurrito Member

    Newcomer
    3
    Sep 8, 2018
    United States
    Rei's Mommy
    The lowest version I am able to try on my Switch without dealing with NAND restore as I'm on 6.2.0 is Atmosphere 0.8.0. This version still exhibits the same behavior.

    If someone is willing and on a lower firmware, would you be able to max out the CPU, GPU and RAM and try launching and playing a few games on the older versions?
     
    Draxzelex and ZachyCatGames like this.
  6. bytar

    bytar Holy Knight

    Member
    3
    Jan 5, 2016
    Japan
    how do you consider the optimum settings for each game?
     
  7. AliciaBurrito

    AliciaBurrito Member

    Newcomer
    3
    Sep 8, 2018
    United States
    Rei's Mommy
    I just run the max overclock tbh lol
    If I'm on handheld not connected to the charger, I'll likely only bump the GPU to 460MHz and RAM to 1600Mhz.
     
    Draxzelex likes this.
  8. Xebastron

    Xebastron Member

    Newcomer
    1
    Nov 3, 2014
    I have the same problem with atmosphere, the blocks are random, although I managed to stabilize 1.1Ghz CPU since the GPU and RAM were not affected by this problem. There may be a frequency block in CFW and that's why it does not work well.
     
  9. ZachyCatGames

    ZachyCatGames GBAtemp Advanced Fan

    Member
    5
    Jun 19, 2018
    United States
    Hell
    Oh :/. 0.8.0 was the one I thought may have broken it, because it was a HUGE update. I guess I could try downgrading my system to 6.1.0 and then try 0.7.5 myself
     
  10. crow132

    crow132 GBAtemp Regular

    Member
    3
    Jan 19, 2016
    Saint Helena
    could the reason be that your CPU oc aint taking place on Reinx? how do you make sure its applied?
     
    ZachyCatGames likes this.
  11. AliciaBurrito

    AliciaBurrito Member

    Newcomer
    3
    Sep 8, 2018
    United States
    Rei's Mommy
    That's not the issue, it is being applied correctly. An easy way to test would be to turn the CPU to 1.7GHz and scroll around in hbmenu. It will perform at 2x of its usual speed.

    Also I can measure the additional power draw when overclocking, and see the performance differences between games. Eg. Skyrim as an example on handheld, I have disabled the framecap of 30FPS and on handheld it cannot hit 60 at all, but when overclocked it easily hits 60FPS.

    These are just a few examples, but the overclock is certainly taking place. Keep in mind though, that the Tegra X1 in the Switch comes factory underclocked, so stability shouldn't be a huge concern. Even when overclocking to the limits of Freebird, it is still considered underclocked compared to a stock Tegra X1 in eg. the Nvidia Shield.

    This is perhaps a bug that only appears in Atmosphere that only presents itself when the system runs outside of spec. Or maybe a bug in Freebird that only happens in Atmosphere? Outside of that I am unsure why ReiNX is unaffected. Curious if SX OS could load Freebird if it would exhibit the bug or not.
     
    Last edited by AliciaBurrito, Feb 12, 2019
    Draxzelex likes this.
  12. mrcroket

    mrcroket Member

    Newcomer
    2
    Mar 14, 2018
    Spain
    I can confirm that cpu oc even at 1,75ghz its stable on reinx in any game. I tried wolfenstein and the switch sounds like a hair dryer :lol: but stable.
     
    Assasin1990 and ZeroFX like this.
  13. ZeroFX

    ZeroFX Member

    Newcomer
    2
    Jun 18, 2018
    United Kingdom
    Yeah hahaha just like an hair dryer. i could really see the difference in games like dark souls, skyrim, naruto etc.
     
    Last edited by ZeroFX, Feb 13, 2019 at 12:55 AM
    mrcroket likes this.
  14. m4xw

    m4xw Ancient Deity

    Member
    13
    May 25, 2018
    Germany
    This doesn't make sense. Stock system using a patched PPC service exhibits the same behaviour.
    The system simply uses a lot of timings based to ticks that then get converted into nanoseconds, changing the clocks will skew all of ninties internal calculations in nearly all sysmodules, especially nvservices.
    The issue is inherently a race condition.
     
    Last edited by m4xw, Feb 13, 2019 at 1:02 AM
    ZachyCatGames likes this.
  15. JK_
    OP

    JK_ GBAtemp Advanced Fan

    Member
    8
    Sep 4, 2015
    United States
    Update: The simple menu is done, but the advanced menu is taking longer than expected. It works, but I don't like the current layout I slapped together. I want it to be easier to read. It has also shown a few new bugs in the module itself I need to get straightened out.

    It will override them.
     
    whateverg1012 and ZeroFX like this.
  16. m4xw

    m4xw Ancient Deity

    Member
    13
    May 25, 2018
    Germany
    Yea you should absolutely not touch CPU if it is running != 1020MHz.
    You kill all our workarounds for using the high clocks, for example the system will get a nice cyan panic screen if u override it to max clocks and open swkbd (we handle it properly)
     
    ZachyCatGames likes this.
  17. AliciaBurrito

    AliciaBurrito Member

    Newcomer
    3
    Sep 8, 2018
    United States
    Rei's Mommy
    What part of it does not make sense? I gave results based on an observation that others have corroborated.

    Perhaps I'm misunderstanding something, but Nintendo's services and kernel need to support changing clocks if it wants to function at all. I don't see how this would be any different. And I don't see how anything would be a race condition when the system is just running faster than normal. It doesn't introduce any other variables into the mix that could cause that.

    Also doesn't explain why it happens in Atmosphere but not ReiNX.
     
    Draxzelex and YlwHrt like this.
  18. m4xw

    m4xw Ancient Deity

    Member
    13
    May 25, 2018
    Germany
    [... cut ...]
    Some hw parts expect you to wait at least a certain amount of time when sending commands, some get potentially broken.
    It would indicate either a broken hw init if it would actually work on reinx, or given it's a race, it's random by nature. I could often start games with atmo, other loads it would fail at max clocks and so on.

    Clarified in https://gbatemp.net/threads/freebird-switch-clock-speed-control-sysmodule.530641/page-8#post-8511733
    https://gbatemp.net/threads/freebird-switch-clock-speed-control-sysmodule.530641/page-8#post-8511899

    [​IMG]
     
    Last edited by m4xw, Feb 13, 2019 at 1:38 PM
    ZachyCatGames likes this.
  19. AliciaBurrito

    AliciaBurrito Member

    Newcomer
    3
    Sep 8, 2018
    United States
    Rei's Mommy
    Power management is not hard coded, the Switch is used to changing frequencies within a predefined limit based on load similar to a full computer and the X1 is made within the specs that Freebird allows you to "overclock" to. I also very highly doubt that there is a switch statement in every sysmodule that handles sync / sleep operations for every single clock. The only failure points would be touch, SD, internal NAND, and UART for the Joycons - but those all work. Can you give any examples of where this is the case?

    Also hwinit is mostly Hekate code as a base, with some minor tweaks and changes. It's very much possible that one of the developers might have fixed an edge-case in the existing code that happened to cause this issue. Calling it a bug in ReiNX because it functions correctly seems a bit disingenuous.
     
    Draxzelex and YlwHrt like this.
  20. YlwHrt

    YlwHrt Member

    Newcomer
    1
    Jan 23, 2016
    United States
    Everything you just said is a bold face lie, i replaced my thermal paste this morning with mx4 and have been running my switch undocked but on charger for 10 hours at 1785mhz cpu, 921 mhz gpu, and 1600mhz ram, and not only did the thermal paste make it run at the same temp as normal undocked (the paste nintendo uses is awful) but its been stable the whole time, no game crashes, no homebrew crashes, no errors in the error history, no artifacts in game, why are you lying, everyone who knows how the switches internals work KNOWS youre lying, youre only impressing the average gbatemp user who can barely into homebrew.
     
    Last edited by YlwHrt, Feb 13, 2019 at 2:42 AM
    Shibbro, Aisuga, Centergaming and 7 others like this.
Loading...