Optimal CPU Tuning settings for i9 MBP to stop VRM throttling / Explanation of Apple's Engineering F

Discussion in 'MacBook Pro' started by winterny, Jul 22, 2018.

  1. winterny, Jul 22, 2018
    Last edited: Jul 24, 2018

    winterny macrumors 6502

    Joined:
    Jul 5, 2010
    #1
    *[Updated]*
    Apple released an update to address this issue: https://support.apple.com/kb/DL1973?locale=en_US

    You should install it.

    Apple's update handles this better than my patch for several reasons:

    1) It does not require you to disable SIP for kext

    2) it regulates power at a higher level, not at the CPU. This means that a combined workload of both CPU and GPU will work much better with Apple's update than it does with my MSR change.

    3) You don't want to be stuck on an old version, so ultimately, you have no choice but to take the update :)

    4) I've done some preliminary testing, and it essentially has the same burst characteristics for purely-CPU load as my patch. I actually get very slightly lower Cinebench scores on a cold run than with my MSR, likely because apple is throttling power very slightly below my thresholds.

    5) If you have already installed the patch as I described below, you should reboot back into recovery mode and re-enable SIP (csrutil enable), and if you added a launchd (which I never actually described how to do), you should remove it. If you did not add a launchd, and just followed what I posted, a reboot will remove the setting.

    6) For those who are curious, because Apple is managing this at a higher level, the MSR 0x610 is unchanged, and still reads as it did before.


    Original post below:

    Hello all,

    tl;dr ... I found the magical command which makes my i9 MBP capable of Cinebench scores of ~1100 on the first run, and 1000-1100 on each successive run, without throttling even if I run it back-to-back-to-back-to-back.

    Like many here, I've got an i9 2018 MBP, and I've also experienced the throttling as others have seen.

    As you may have read on other threads, the ultimate root cause of the very bad performance drop during the throttling is not thermal throttling of the CPU, but rather power throttling of the VRM (voltage regulator module), being unable to satisfy the power desires of the i9 CPU.

    When the VRM maxes out (overheats ... but this is different from CPU thermal throttling), the motherboard sends a signal to the CPU to drop it's speed to minimum (800Mhz) to allow the VRM a chance to cool down. The CPU then returns to it's previous desire to pull maximum power, spins up to high turbo speeds, and the cycle repeats again. When the CPU keeps switching from Turbo to 800Mhz, it is in a very inefficient state, so the amount of work being done relative to the amount of power drawn decreases.

    I'm not giving Apple a free pass on this, and wholeheartedly agree with others that such tuning should not be necessary for users to do, but, if you have one of these machines and would like to mitigate the situation, you do have an option.

    Warning: To do this, you will have to put your system in a "custom" SIP (System Integrity Protection) state to allow unsigned KEXT (Kernel Extensions), this reduces security on your system somewhat, but this is at least not completely disabling SIP.

    Warning2: If you do this, and it damages your laptop, and Apple does not cover your warranty, that is your own problem. You are doing this at your own risk. With that said, In my personal opinion, the default state is actually more damaging to the laptop than this custom state (As you will see below).

    1) install https://github.com/sicreative/VoltageShift

    2) CHANGE DIRECTORY to where voltageshift was installed (you can't just run it with a full path in the command line, there is a bug in it which makes it require you actually being in the directory and writing ./voltageshift ... not ~/voltageshift/voltageshift)

    3) sudo chown -R root:wheel VoltageShift.kext

    4) ./voltageshift read 0x610

    RDMSR 610 returns value 0x4283e800dd8320

    I'll translate what the important bits here means:
    MSR 610 is the MSR_TURBO_POWER_LIMIT
    Hex 3e8 == 1000
    1000 / 8 == 125
    This means that PL2 (Power_Limit_2) is set to 125 Watts. Power Limit 2 is the "Turbo Boost" limit.

    Hex 320 == 800
    800/8 = 100
    This means that PL1 (Power_Limit_1) is set to 100 Watts. Power Limit 1 is the "Steady State" limit, ie: how much power the CPU is configured to try and pull for extended periods of time.

    The math for the timing variable is complicated, so just take my word for it, but:
    Power_Limit_1_Time ...
    dd = 28 Seconds.

    So, Apple has shipped the i9 Macbook Pro to 125 Watt Turbo for 28 seconds, 100 Watt Steady state.

    I've spent a few hours testing at many different draw rates until I could find the rate at which the VRM does not max out, for my machine, that is 49 Watts. Note that this does not include power draw for other accessories (ie: the GPU), so if you are drawing heavy power using other chips, you might need to set the limit lower than 49 watts.

    I've also spent a few hours testing the maximum amount of time you can draw in Turbo from the VRM without maxing it out, and for my machine, it is 8 seconds.

    So, putting this all together ...
    49 * 8 = 392
    392 in hex is 188

    Like I said earlier, the time values are complicated, so just take my word for it, but ...

    D9 = 7 seconds.

    1B = 8 seconds.

    9B = 10 seconds.

    [...]

    DD = 28 seconds. (default)


    Compiling this all together leads to the CORRECT MSR for this machine:
    0x4283E8001B8188

    5) And you can set this using this command:
    ./voltageshift write 0x610 0x4283E8001B8188

    Note, this gets overwritten every time you reboot, so if you want to set this, you will need to do it on boot. I'll probably write up a launchd script to do this.

    In my opinion, Apple seriously screwed up here. The testing that I did was easily within Apple's capabilities, and it is highly irresponsible of them to ship these machines out this way. As far as I am aware, the MSR is set to the intel's default ... and clearly Intel expects that if you are going to use this default, you will have a machine capable of delivering 100 Watts of power steady state. Intel does not expect that you must have thermal capabilities of shedding those 100 Watts, as the chip will thermally throttle if it reaches TJunction (100C), and that thermal throttling would not be nearly as painful as this type of VRM throttling. Most likely, if Apple wanted to handle things that way, they could have figured out a way to attach the heatpipe to the VRM. Even if they did not want to handle things that way, they should have reduced the MSR value from the factory to something that the VRM is actually capable of delivering (ie: My settings).

    The good news is that these settings increase the performance by at least 20% (and possibly much more depending on the workload), and Apple can adjust this setting (or handle the VRM overload using other power management logic). Even if Apple doesn't, you as a consumer can do this yourself.

    The bad news is that it's clear that this i9 chip can probably do signifigantly better if it were driven with a better VRM (and had adequate cooling as well), and could probably get 20-25% faster speeds than with my settings if the power system were up to task. There is no way that Apple can get that additional gain with the current hardware design, short of a recall to change out the heatsink to something that cooled the VRMs, and replace the thermal paste with something like Liquid Metal. It's pretty clear that there is no additional space for bigger fans, so apple's options here are very limited.

    The even worse news: If apple does nothing, and you do not change the MSR settings, when your system throttles this way and alternates back and forth between 800Mhz and full-Turbo, it is putting an EXTREME load on the VRM ... This will almost certainly shorten the lifespan of the VRM causing early logic board failure.

    If anyone has a 2018 15" MBP with the i7 2.6 chip, I'm very interested to hear what the default MSR settings are for that chip, and also how Cinebench scores look with my tuned settings. These tuned settings should be acceptable for any 2018 15" MBP.

    Of course, as I said above, if you have a heavy GPU load, this does not leave any budget for that, so you will need to adjust your settings accordingly (and that's homework for you -- I don't use my GPU in heavy sustained workloads ever). Also, these settings assume reasonably sane cooling environment ... Ie: sitting on a desk in an air conditioned room. If you are testing this outdoors at 100F, I'd assume you will still get VRM throttling. If you are testing in a freezer, or outdoors in the wintertime ... you might be able to get more than 49W steady-state.

    Edited to add:

    If you want timing values shorter than 7 seconds ....
    6 Seconds: 99
    5 Seconds: 59
    4 Seconds: 19
    3.5 Seconds: D7
    2.5 Seconds: 57
    2 Seconds: 17
    1.5 Seconds: 95
    1 Second: 15
     
  2. zshane1125 macrumors regular

    Joined:
    Jul 16, 2018
    #2
    nice, you have any cinebench / power gadget graphs for these benchmarks? Would be nice to see how the system behaves.
     
  3. winterny thread starter macrumors 6502

    Joined:
    Jul 5, 2010
    #3
    Screenshot on left is of Power Gadget with 3 back-to-back Cinebench's.

    Screenshot on right is of Power Gadget after 2 minutes of Prime95 with "In-Place Large FFT" Torture test.

    Notice on the Cinebench screenshot how there are nice perfectly symmetrical dips in the power graph when it stops for a second before I click it to run again, with the dip perfectly lining up to the spike immediately after ... This is what turbo is supposed to do, allow you to use the budget of power which was not used in recent time ... Not just haphazardly spiking up and down as the VRM is maxing out.
     

    Attached Files:

  4. leman macrumors G3

    Joined:
    Oct 14, 2008
    #4
    This is by far the best analysis of the issue I’ve seen and what you say makes perfect sense. Thank you for this amazing work. Now it’s for Apple to offer a quick response.
     
  5. zshane1125 macrumors regular

    Joined:
    Jul 16, 2018
    #5
    The turbo boost seems completely useless. Imagine if the CPU kept constant rate of 4.9ghz like the Helios, 1500 cinebench score.

    Basically the new macbook's i9 CPU performance is reduced by 95% with this throttling lol.
     
  6. simonsi macrumors 601

    simonsi

    Joined:
    Jan 3, 2014
    Location:
    Auckland
    #6
    Wow. Personally I'd send this with a copy of your CV to the CEO's of Apple's largest <investors> asking them why you shouldn't run Apple's technical design operations seeing as Apple seem incapable of doing so.

    You should be able to earn $1M or so as a consultant to the sure-to-be-formed class action lawyers...

    Its <really> hard to see how their implementation is in any way a reasonable compromise of power vs enclosure etc etc and not just a seriously dropped design ball.
     
  7. winterny thread starter macrumors 6502

    Joined:
    Jul 5, 2010
    #7
    If anyone would like to pay $1M as a consultant, feel free to send a private message :p
    It isn't a reasonable compromise. It's proof that apple literally did zero engineering/testing work before shipping this out. They literally slapped the i9 chip on the logic board, put it into the 2017 case, left the settings at the intel default, and shipped it out.
     
  8. ksj1 macrumors newbie

    Joined:
    Jul 17, 2018
    #8
    I think many are going to be surprised when Apple comes out with a full firmware update for the 2018's.

    I still stick to thinking Apple got beat up after WWDC and released these early as a result. I bet they never thought that they would get crap for releasing the fastest MacBook ever. After all, no one was going to complain about a x% performance bump from a firmware update.

    Have they already implemented all of the microcode for their implementation of the chip? It wasn't released until April, and while I'm sure they've had early release chips, they also design their own chipsets that control the cpu. So they have to port that to their chipsets. Note that linux systems are provided microcode for the chip. This is used for the OS in case the firmware doesn't have full support. It is not the best way to do it at all, but may be what Apple did to get it out the door until the firmware is complete.

    In any case, for my workflow it already blows the 2017 i7 out of the water, so anything more is icing on the cake.
     
  9. Sterkenburg macrumors 6502

    Joined:
    Oct 27, 2016
    #9
    Amazing analysis! Not sure that Apple can afford to not respond in some way now. The fact that users got to the root of the issue better than them (and in a matter of a few days) is quite embarrassing.

    Or suggests that they just chose to ignore the issue and rush the release anyway, either way it puts them in an awkward position.
     
  10. simonsi macrumors 601

    simonsi

    Joined:
    Jan 3, 2014
    Location:
    Auckland
    #10
    Exactly :-(
     
  11. Sterkenburg macrumors 6502

    Joined:
    Oct 27, 2016
    #11
    I agree. My guess is that they felt under pressure for an update to respond to competitors using the new chips (even knowing that such competitors also suffered from these issues).

    They tried the easy way out of it and it backfired.
     
  12. karanlyons macrumors member

    karanlyons

    Joined:
    Jul 20, 2018
    #12
    I can confirm this greatly improves things (though I may have not fared as well in the silicon lottery). Note that Intel XTU under windows will allow you to alter these settings as well, though with a much nicer GUI. That also confirms that Apple left practically everything at stock parameters.
     
  13. fate0311 macrumors 6502

    Joined:
    Dec 31, 2015
  14. karanlyons macrumors member

    karanlyons

    Joined:
    Jul 20, 2018
    #14
    Not sure you’d want to do that now. I wish Apple put the VRMs on the heat pipe path, but this at least gets us much closer to the performance seen by this chip in other machines.
     
  15. ksj1 macrumors newbie

    Joined:
    Jul 17, 2018
    #15
    Hmmm, the point is that this can and will be fixed. They just did what every other vendor does for once and released it since it was super fast before all the optimizations were done.
     
  16. ESA macrumors member

    Joined:
    Oct 25, 2015
    #16
    How big is the difference with this method compared to Volta?

    This method sure is the best, because you can get higher than 45W. And you get that boost in the beginning.

    I think Apple will get problems, because if they make that change, it will NEVER reach 4.8 GHz .. that is false advertising... they do not want that.
     
  17. winterny thread starter macrumors 6502

    Joined:
    Jul 5, 2010
    #17
    I agree that apple was under pressure to put something out, but seriously ... why couldn't one of their 100K employees have done the work that I did in a weekend?
     
  18. karanlyons macrumors member

    karanlyons

    Joined:
    Jul 20, 2018
    #18
    @winterny Have you been able to get this working as a launch daemon? I think this would do it:
    <?xml version=1.0 encoding=UTF-8?>
    <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
    <plist version=1.0>
    <dict>
    <key>RunAtLoad</key>
    <true/>
    <key>Label</key>
    <string>com.sicreative.VoltageShift</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Library/Application Support/VoltageShift/voltageshift</string>
    <string>write</string>
    <string>0x610</string>
    <string>0x4283E8001B8188</string>
    </array>
    <key>StartCalendarInterval</key>
    <array>
    <dict>
    <key>Minute</key>
    <integer>0</integer>
    </dict>
    </array>
    </dict>
    </plist>​
    --- Post Merged, Jul 22, 2018 ---
    Volta can only do a constant cap at the moment, VoltageShift allows for both setting things without needing an open application sitting in your menubar, and additionally exposed more of the available parameters for the CPU.

    This is a good deal better, basically.
     
  19. winterny thread starter macrumors 6502

    Joined:
    Jul 5, 2010
    #19
    I get a 963 in Cinebench with Volta 45W, and 1100 (when starting cold) with my settings, or ~1050 when starting warm.

    So, for a single test in Cinebench, 14.2% faster than Volta, and for a continuous workload, 9% faster than Volta.

    My change allows the full turbo, so it would be almost the same initial boost as it got from the factory. Note I say almost because while it will get the same clock speeds ... the system probably could boost for more than 8 seconds if it were completely cool ... but the tradeoff for uncontrolled VRM throttling is not acceptable.

    Also, for maximum turbo, the CPU would want ~130 Watts (plus 5 Watts for DRAM, plus something for GPU, etc) ... The highest power delivery I've seen to the CPU has been only around 80 Watts, so it probably would never get 4.8 Ghz under any condition. On mine, the highest I see is 4.2.
    --- Post Merged, Jul 22, 2018 ---
    I actually haven't put any effort into a launch daemon yet ... Will probably test your script out later :)
     
  20. karanlyons macrumors member

    karanlyons

    Joined:
    Jul 20, 2018
    #20
    [QUOTE="winterny, post: 26275788, member: 459265”]I actually haven't put any effort into a launch daemon yet ... Will probably test your script out later :)[/QUOTE]

    Definitely keep me posted. I’m headed to the Genius Bar to lodge a litany of issues with them for hopeful escalation.

    Note that that daemon will also update the MSR on the hour, which just felt like some nice extra insurance.
     
  21. fate0311 macrumors 6502

    Joined:
    Dec 31, 2015
    #21
    Problem is Apple isn’t going to do anything about this and I am not about to eat 3899.99 on a machine I have to jerry rig to run correctly.
     
  22. borgranta macrumors 6502

    borgranta

    Joined:
    May 9, 2018
    #22
    Any offices that it was tested in probably had air conditioning. The air conditioning probably skewed the tests since the thermal throttling was probably offset by the air conditioning.
     
  23. stringerhye macrumors 6502

    stringerhye

    Joined:
    Jul 5, 2010
    Location:
    Brooklyn, NY
    #23
    That's silly. I am in a very cold air conditioned apartment and it's being throttled all the same.
     
  24. ksj1 macrumors newbie

    Joined:
    Jul 17, 2018
    #24
    I would disagree that Apple isn't going to do anything about it. Do you not get updates for your OS regularly from them?
     
  25. winterny thread starter macrumors 6502

    Joined:
    Jul 5, 2010
    #25
    Not sure if your post was sarcastic, but in any event, not only do I own a 2018 Macbook Pro, but I also have air conditioning!

    I am fairly sure most people who can afford a $4000 laptop have air conditioning too, but I could be wrong!
     

Share This Page