Mid 2015 15-inch MacBook Pro eGPU Master Thread
 
Notifications
Clear all

Mid 2015 15-inch MacBook Pro eGPU Master Thread  

  RSS

goalque
(@goalque)
Noble Member Admin
Joined: 3 years ago
 

Thanks to @nando4's and @itsage's earlier implementations, I was interested in trying out a direct M.2 PCIe 3.0 x4 interface of my Mid 2015 15" MBP (M370X) for eGPU. This is now my primary Mac as it has a brand new battery and top case with the keyboard. Official battery replacement was not as expensive as I thought and the cycle count was 0! This model supports "silent clicking", a nice feature that turns off the sound of your trackpad's click. The new MBPs do not have this feature. There are so many things we miss from this machine. The most interesting thing is PCIe 3.0 x4 of course, more than doubling the transfer speed compared to TB2, and leaves behind TB3 as well due to its 22Gbps limit and complex design.

As we know, Apple uses a proprietary interface but luckily there exists M.2 NVMe adapters for upgrading 2013-2015 MBP's SSD. So I ordered both the short and longer adapters from Sintech:

https://www.amazon.de/gp/product/B01CWWAENG
https://www.amazon.de/gp/product/B07FYY3H5F

It turned out that the socket of the longer adapter was too tall. During reassembly of the lower case, the other plastic clip in the middle did not seem to snap in. For this reason, I recommend to use the short Sintech adapter which did not have this issue.

The root issue with the Thunderbolt is too narrow PCIe bridges. This is a big obstacle in Windows, resulting in error code 12. I decided to put my theory in practice and enlarged the problematic memory area the eGPU requests. To my knowledge, this method is not described anywhere else. I originally got the idea some years ago when someone asked how to fix the error code 12 with the nMP on this forum. The memory areas presented here are machine specific and not applicable to other systems as such. However, if you choose the right values, there is a high chance it will work.

The iGPU activation also differs from previous implementions because now we control the gmux directly, not through nvram variables. It follows the same memory address sequences that Linux driver uses:

https://github.com/torvalds/linux/blob/master/drivers/platform/x86/apple-gmux.c

The fastest way to clone your internal disk is to use dd command, for example I am using Corsair MP510 960GB (be careful with disk identifiers):

diskutil unmountDisk /dev/disk2
diskutil eraseDisk ExFAT MP510 /dev/disk2
sudo dd if=/dev/rdisk0 of=/dev/rdisk2 bs=2m conv=noerror,sync

Works well between two NVMe SSD Boot Camp installations but Windows does not like if you are cloning from the original AHCI SSD or from the NVMe SSD to USB. Use Boot Camp Assistant with your new NVMe SSD. My shortcut was WinClone but that also failed if the destination was USB drive. The final fix was sysprep, otherwise the boot got stuck at blue screen:

https://twocanoes.com/knowledge-base/migrating-a-real-pc-to-boot-camp/

With NVMeFix ( https://github.com/acidanthera/NVMeFix ) I saw a reduce in power consumption, not close to original Apple SSD readings but very welcome improvement. NVMe SSDs are completely another story, let's now focus on eGPU.

A TB2 disk is possible but it takes more PCIe resources due to bridges and shows up irregularly in startup manager. For these reasons, I recommend an external USB for Boot Camp. I chose Samsung Portable SSD T5, attached to the right side USB 3 port (up to 5Gbps).

Installation steps:

1) Identify your external disk.

diskutil list

/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.1 GB disk2
1: EFI EFI 209.7 MB disk2s1
2: Microsoft Basic Data BOOTCAMP 499.9 GB disk2s2

2) sudo mkdir /Volumes/EFI

3) sudo mount -t msdos /dev/disk2s1 /Volumes/EFI (where disk2s1 is your EFI disk identifier)

4) Download EFI Dev Kit: https://sourceforge.net/projects/efidevkit/files/latest/download

5) Create startup.nsh EFI Shell script

Rows 4-6 are only necessary if your eGPU occupies the TB2 port (left top) and you are using a Radeon VII, because it requires twice as much non-prefetchable memory in 32bit space than RX 580. The tested eGPU enclosures via TB2 were Netstor HL23T and Asus XG-Station Pro. You might need to disable and enable the PCI Express Root Port as shown in the image below:

Uncomment these rows (remove the # character) in that case. The R43SG does not need rows 4-6 so you can use the script as shown. The rest of the commands activate the iGPU and completely switches off the dGPU, making possible to install latest official AMD drivers.

echo -off
fs0:
EFIBootapple_set_os.efi
#mm 00010122 2 ;PCI :BA10 -n
#mm 00010124 2 ;PCI :BA20 -n
#mm 00010126 2 ;PCI :DC10 -n
mm 7C2 ;IO :1 -n
mm 7D4 ;IO :28 -n
mm 7C2 ;IO :2 -n
mm 7D4 ;IO :10 -n
mm 7C2 ;IO :2 -n
mm 7D4 ;IO :40 -n
mm 7C2 ;IO :1 -n
mm 7D4 ;IO :50 -n
mm 7C2 ;IO :0 -n
mm 7D4 ;IO :50 -n
EFIMicrosoftBootbootmgfw.efi

6) Your folder structure in Finder should look as follows:

where bootx64.efi is the renamed Shell_Full.efi file from EFI Dev Kit's /Edk/Other/Maintained/Application/UefiShell/bin/x64/ folder.

apple_set_os.efi from here:

https://github.com/0xbb/apple_set_os.efi/files/3877561/apple_set_os.zip

and Microsoft's bootx64.efi renamed as bootx64-original.efi

7) Not sure if this step is necessary but disable SIP and run:

sudo nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00

8) Shut down your Mac, then turn on with the option key pressed down, and select "EFI boot".

Benchmarks (RX 580)

  M.2 external TB2 external difference M.2 internal TB2 internal difference
Forza Horizon 4 94.9 49.5 47.4% 90.6 37 59.2%
3DMark 11 Extr. 4769 4612 3.3% 4776 4575 4.2%
Superposition 8405 7774 7.5% 8329 5988 28,1%
TimeSpy 4445 4157 6.5% N/A N/A N/A


Benchmarks (Radeon VII)

  M.2 external TB2 external difference M.2 internal TB2 internal difference
Forza Horizon 4 129.3 70.3 45.6% 117.8 55.6 52.8%
3DMark 11 Extr. 9609 9338 2.8% 9654 8848 8.3%
Superposition 17409 15838 9.0% 15838 8744 44.8%
TimeSpy 8719 7673 12% N/A N/A N/A

 

M.2 interface and RX 580 beats Radeon VII and TB2 in Forza Horizon 4. Amazing. For some reason TimeSpy produced an error when I tried to use internal screen. Nowadays, setting the preference is easy in Windows 10:

 

On the macOS side, you don't need any workarounds with the ADT-Link R43SG. The eGPU works as if it was a built-in GPU.

This topic was modified 3 weeks ago

automate-eGPU EFIapple_set_os.efi

Mid 2015 15-inch MacBook Pro eGPU Master Thread


atlr, itsage, nando4 and 1 people liked
ReplyQuote
nando4
(@nando4)
Noble Member Admin
Joined: 3 years ago
 

@goalque, thank you for this first M.2 eGPU implementation on a MacBook.   Excellent results on a 32Gbps M.2 port compared to the 16Gbps TB2 port.

eGPU Setup 1.35    •    eGPU Port Bandwidth Reference Table

2015 15" Dell Precision 7510 (6th,4C,H) + GTX 1080 Ti @32Gbps-M2 (ADT-Link R43SG) + Win10 // compares M.2 vs TB3 performance


goalque liked
ReplyQuote
tsakal
(@tsakal)
Reputable Member
Joined: 2 years ago
 

@goalque

Would this implementation work with the trash can Mac Pro?

A. 2.7 GHz I7 4 Cores, 16Gb, 1TB MBP 13 2018 TB3 , EGPU Razer Core X, Nitro+ RX5700 xt 8Gb, LG 32UK550
Mac OS Catalina 10.15.2, Ext SSD Windows 10 1903 V1 .295

B. 2.7 GHz I7 4 Cores, 16Gb, 1TB MBP 13 2018 TB3 , EGPU Gigabyte Gaming Box RX580 8Gb, Mac OS Catalina 10.15.2, Ext SSD Windows 10 1803

C. 3.1 GHz I7, 16Gb, 1TB MBP 13 2015 TB2 , EGPU Gigabyte Gaming Box RX580 8Gb


ReplyQuote
goalque
(@goalque)
Noble Member Admin
Joined: 3 years ago
 

@tsakal

I don't know but very possible. I don't have the nMP. It depends on the card. Some old cards such as a Quadro NVS 295 have low base address register requirements and should be plug-and-play on Windows Boot Camp. Modern cards aren't and you have to resize Thunderbolt bridges to get around error code 12 via TB2.

The R43SG attachs itself to the PCI Express Root Port and has higher chance to work without workarounds.

This post was modified 2 months ago

automate-eGPU EFIapple_set_os.efi

Mid 2015 15-inch MacBook Pro eGPU Master Thread


ReplyQuote
itsage
(@itsage)
Illustrious Member Admin
Joined: 3 years ago
 

@goalque Thank you for your pioneering work as always! I will follow the instructions to replicate a similar build on my 2015 15-in MacBook Pro.

@tsakal In terms of hardware, the SSD drive slot in the 2013 Mac Pro is routed through the Graphics B card and runs at x4 PCIe 2.0 to the PCH. The Thunderbolt 2 ports has direct CPU access and run at x4 PCIe 2.0. Another physical challenge is a magnet placed near the Power Button on the outter shell. Without which the computer won't turn on.

In terms of software, I think it's possible and would be nice to have a solid solution to error 12. This of course depends on the connected eGPU.

external graphics card builds
best laptops for external GPU
eGPU enclosure buyer's guide


goalque liked
ReplyQuote
goalque
(@goalque)
Noble Member Admin
Joined: 3 years ago
 

@itsage

Here's the script for iGPU-only 2015 15" MBP if you are going to try a TB3 enclosure & Apple TB2 to TB3 adapter:

echo -off
fs0:
\EFI\Boot\apple_set_os.efi
mm 00010122 2 ;PCI :BA10 -n
mm 00010124 2 ;PCI :BA20 -n
mm 00010126 2 ;PCI :DC10 -n
\EFI\Microsoft\Boot\bootmgfw.efi

As long as the PCIe root port of the eGPU is located at the same address. The address might be different.

It doesn't matter if you boot up from an internal SSD or external USB. The internal SSD slot can be empty.

However, do not try to boot with multiple Boot Camp installations (for example the other on the internal SSD), always make sure that Apple's startup manager shows a single "EFI Boot".

This post was modified 2 months ago

automate-eGPU EFIapple_set_os.efi

Mid 2015 15-inch MacBook Pro eGPU Master Thread


itsage liked
ReplyQuote
joevt
(@joevt)
Noble Member
Joined: 3 years ago
 

@itsage

Use an amfeltec angelshark carrier board and connect two GPUs plus keep the SSD.

 

Mac mini (2018), Mac Pro (Early 2008), MacBook Pro (Retina, 15-inch, Mid 2015), GA-Z170X-Gaming 7, Sapphire Pulse Radeon RX 580 8GB GDDR5, Sonnet Echo Express III-D, Trebleet Thunderbolt 3 to NVMe M.2 case


ReplyQuote
itsage
(@itsage)
Illustrious Member Admin
Joined: 3 years ago
 

@joevt I think the PCIe drive slot in the nMP is not as good as Thunderbolt 2 ports. It provides no higher bandwidth and goes through the PCH compared to TB2 ports that has direct access to CPU through a x8 PCIe 3.0 switch.

external graphics card builds
best laptops for external GPU
eGPU enclosure buyer's guide


ReplyQuote
joevt
(@joevt)
Noble Member
Joined: 3 years ago
 

@itsage

But the PCIe slot won't have the latency of Thunderbolt. You've shown gaming benchmarks before where PCIe 3.0 x1 can beat Thunderbolt 3.

In this case we are comparing PCIe 2.0 x4 and Thunderbolt 2 which should have a greater difference since PCIe 2.0 x4 is twice as fast as PCIe 3.0 x1, and Thunderbolt 2 is slower than Thunderbolt 3.

I don't think going through the PCH will reduce the PCI 2.0 x4 bandwidth of the SSD slot as much as going through Thunderbolt 2 does (also limited to PCIe 2.0 x4) even though the PCH is shared with WiFi, SSD, SMC, HD Audio, and Ethernet because they're not all used at the same time.

 

 

Mac mini (2018), Mac Pro (Early 2008), MacBook Pro (Retina, 15-inch, Mid 2015), GA-Z170X-Gaming 7, Sapphire Pulse Radeon RX 580 8GB GDDR5, Sonnet Echo Express III-D, Trebleet Thunderbolt 3 to NVMe M.2 case


ReplyQuote
itsage
(@itsage)
Illustrious Member Admin
Joined: 3 years ago
 

@joevt I agree Thunderbolt encoding/decoding speed would make the Thunderbolt 2 connection slower than PCIe 2.0 through the PCH. If we consider the Amfeltec Angelshark carrier board to host stock SSD, and one or two eGPU that would be quite a bit more convoluted than in my test of dGPU running at x1 PCIe 3.0 straight to CPU.

 

external graphics card builds
best laptops for external GPU
eGPU enclosure buyer's guide


ReplyQuote
goalque
(@goalque)
Noble Member Admin
Joined: 3 years ago
 

Has anyone tried enabling the iGPU of 2016-2019 MBPs by using this new method and my recent change in loading apple_set_os.efi?

https://egpu.io/forums/pc-setup/how-to-keep-mbps-irisiris-pro-activated-when-booting-into-windows-boot-camp/paged/9/#post-74286

echo -off
fs0:
stall 1000000
\EFI\Boot\apple_set_os.efi
if not %lasterror% == 0 then
reset -w
endif
\EFI\Microsoft\Boot\bootmgfw.efi

This thread is not just about the ADT-Link R43SG, it is more about how to enable the iGPU and solve error code 12 if you using a TB3 enclosure.

automate-eGPU EFIapple_set_os.efi

Mid 2015 15-inch MacBook Pro eGPU Master Thread


itsage liked
ReplyQuote
itsage
(@itsage)
Illustrious Member Admin
Joined: 3 years ago
 

@goalque,  I tried the new method with the revised apple_set_os.efi on my 2017 13-in MacBook Pro. It worked well with Win10 1903 (OS Build 18363.657). Do I need to create a startup.nsh if I was to try it on 2018 Mac mini and 2019 13-in MacBook Pro? Thank you!

external graphics card builds
best laptops for external GPU
eGPU enclosure buyer's guide


goalque liked
ReplyQuote
goalque
(@goalque)
Noble Member Admin
Joined: 3 years ago
 

The best thing in using startup.nsh is its configurability. You can choose whether or not to load apple_set_os.efi, resize PCIe root bridge windows (the most difficult part and machine specific), change the gmux state by 6 mm commands and/or power off the dGPU (the last 4 mm commands). If you decide to switch off the dGPU, the screen goes black but the iGPU takes over and Windows login screen should appear in a few seconds, or in about half a minute if you are booting from an USB drive.

I am not sure if apple_set_os.efi can be used with Mac minis, iMacs or the nMP. You can always put a # character in front of the line you don't want to run. The above code block worked with my 2018 13" MBP so it should work with the 2019 13" MBP as well.

Feel free to ask more if some points are unclear.

For example: stall 1000000 waits for a second and reset -w makes a warm restart if apple_set_os.efi does not load successfully.

This post was modified 1 month ago

automate-eGPU EFIapple_set_os.efi

Mid 2015 15-inch MacBook Pro eGPU Master Thread


itsage liked
ReplyQuote
itsage
(@itsage)
Illustrious Member Admin
Joined: 3 years ago
 

@goalque,  I tried this new solution on 2019 13-in MacBook Pro last night. The revised apple_set_os.efi works very well in keeping the iGPU activated during boot. However the laptop struggles with Thunderbolt device detection once Windows fully loads. Hot-plug would detect the Thunderbolt device but causes error 12. This could be due to the latest Windows 10 version 2004 I'm running on this laptop. I created startup.nsh using a text editor and paste the code you provided in #post-74447.

 

external graphics card builds
best laptops for external GPU
eGPU enclosure buyer's guide


ReplyQuote
goalque
(@goalque)
Noble Member Admin
Joined: 3 years ago
 

@itsage That's the only purpose of the apple_set_os.efi - to keep iGPU enabled.

It took a couple of days to figure out workable mm commands for the Radeon VII with the 2015 15" MBP (M370X). Ideally, the adjusted memory regions would allow hot plugging too as Windows enumerates with values it gets from the EFI. The problem is that deep hierarchy of bridges with Thunderbolt connection. Most of the bridges have no initial address value so Windows is clueless what to do with them.

You can edit the startup.nsh easily with the built-in ASCII editor in EFI Shell. Change to correct directory and type: edit startup.nsh.

You are correct, the Windows version does matter, how it enumerates. That algorithm is a mystery.

automate-eGPU EFIapple_set_os.efi

Mid 2015 15-inch MacBook Pro eGPU Master Thread


itsage liked
ReplyQuote
itsage
(@itsage)
Illustrious Member Admin
Joined: 3 years ago
 

@goalque,  I will try pci.sys replacement next (using one from Win10 1903 V1 ISO) and see if either Thunderbolt detection or hot-plug would improve.

This new solution is certainly more flexible but I'm afraid it's too technical. Your automate-eGPU EFI is more friendly for beginners. Is there a chance you can revise it to auto-reset when apple_set_os.efi is not active?

 

external graphics card builds
best laptops for external GPU
eGPU enclosure buyer's guide


ReplyQuote
goalque
(@goalque)
Noble Member Admin
Joined: 3 years ago
 

Yep, you need a hex calculator and lots of patience if you want to apply this method with other Macs.

The automate-eGPU EFI does provide an easy DSDT override mechanism, thanks to Clover. However, the code is not pretty to look at. I can look if I find time...

automate-eGPU EFIapple_set_os.efi

Mid 2015 15-inch MacBook Pro eGPU Master Thread


itsage liked
ReplyQuote
orchoidizer
(@orchoidizer)
Active Member
Joined: 7 months ago
 

So the only way I can get my Razer Core X / Vega 64 to load is by going through the whole Enable / Disable PCIE Ports procedure but I need to go through it numerous times and it's a bit hit and miss. Is this usual?
Would somebody be kind enough put up a screenshot of the ports to you need to target and the correct order in which to hit them.
I'm pretty sure I'm doing something wrong.

I was also wondering, does this procedure need to be done with each boot? Is there not some kind of script so the system 'remembers' how to allocate the devices once and for all?

Thanks in advance for any assistance.

Mid 2015 15-inch MacBook Pro Retina (2.2GHz Intel quad Core i7)
Intel Iris Pro Graphics (integrated). Thunderbolt 2
OS High Sierra - Bootcamp Win10 1903 (18362.295)
Razer Core X - Vega 64
T2-T3 Adapter - 2m T2 cable


ReplyQuote
goalque
(@goalque)
Noble Member Admin
Joined: 3 years ago
 

@orchoidizer It's not a hit and miss with Radeon VII. The screenshot is shown above (left top TB2 port), all the ports enabled.

This script is not tested with the Vega 64.

EDIT: I cancel my words. Something has changed while I tested the Samsung Portable SSD T5 on the other MBP. The Radeon VII shuts down during the boot into Windows and the start address of the PCIe root brige that I jotted down is now different. Disabling and enabling the root bridge does not seem to help. I am still on 18363.592.

This post was modified 1 month ago

automate-eGPU EFIapple_set_os.efi

Mid 2015 15-inch MacBook Pro eGPU Master Thread


ReplyQuote
syphus
(@syphus)
Active Member
Joined: 3 years ago
 

I had this setup working fine (except I am using a 5700xt).

I was forced to reinstall my windows after an update stopped it working. I installed the 1809 (I think) version, didn’t do much to make it work.

 

Have been gaming on it for weeks now but tonight something has mysteriously made it code 12 again. I should mentioned that my Windows doesn’t update anything as I change what was necessary in the reg to make it not.

 

Any ideas on what made it stop working? 

 

And also, more related to this tread, any simpler ways to get this setup to work?

Pending: MacBook Pro 15" Mid 2015 Razer Core + 5700XT on macOS 10.15.3 + Win10


ReplyQuote
dumman59
(@dumman59)
New Member
Joined: 3 weeks ago
 

i just followed the above steps on my 15in 2018 mbp and it booted into windows. I thought all was good so far until I installed theintel gpu drivers. It installed with no errors but in device manager there is aMicrosoft basic display adapter and theintel one. The display is running off of basic drivers but theintel drivers are installed. Also the amd drivers do not detect my egpu when installing them. Is there something I might need to fix.
https://imgur.com/a/g6JKxls

Pending: Add my system information and expected eGPU configuration to my signature to give context to my posts


ReplyQuote