MTLCopyAllDevices different from MTLCreateSystemDefaultDevice?

Hello,


On macOS, I noticed devices taken from MTLCopyAllDevices perform very, very differently from MTLCreateSystemDefaultDevice. In fact, grabbing the very same device from MTLCopyAllDevices that's produced by MTLCreateSystemDefaultDevice (literally the same id and everything) I get about half the peformance.


This can be easily reproduced by simply downloading Apple's Hello Triangle demo and replace the MTLCreateSystemDefaultDevice() function call with MTLCopyAllDevices()[1] (or something similar. Just make sure you find the same device). The demo will now perform at roughly half the framerate compared to using the system's default device. This becomes more apparent once you increase the window's size.


This has been tested on a MacBook Pro 2016.


I can understand the major difference in performance when selecting the integrated graphics device (i.e. the low power device) from MTLCopyAllDevices. But why would the dedicated graphics device (in my case the Radeon Pro 460) differ from MTLCreateSystemDefaultDevice, despite being the exact same?


Cheers in advance for any information! 🙂

Replies

Would have loved to see a doubling of performance so I tested this right away with a compute kernel. Unfortunately no difference at all with the Radeon Pro 555 of a 2017 MBP. Tested with Hello Triangle and no difference there either. This is on macOS 10.13.2

Well that may very well make things even more confusing haha.


Here I create a system default device with MTLCreateSystemDefaultDevice(): https://imgur.com/zEdTfnC

The framerate is 60fps, and of the two available devices the AMD Radeon device is selected and used.


Here I pick a device from MTLCopyAllDevices(): https://imgur.com/fBDD41z

According to the logs I still picked the AMD Radeon device. However, notice how the framerate dropped severely to 30fps.

Did you ever figure this out?

I'm struggling right now to properly select a MTL device and seeing oddness.

In my case, I'm seeing different behaviour setting up a CIContext using MTLCreateSystemDefaultDevice() and the default CIContext constructor, which the docs say should use the default MTL device.

https://forums.developer.apple.com/thread/110428