OpenCL on Apple M1

That seems to be slightly faster than the Nvidia RTX 2070 Super utilizing CUDA .

It is not as fast if those cards use OPTIX instead.

Unfortunately, OpenData does not seem to publish the Blender 3.0 results yet, so this is not a super fair comparison in some ways.

MacMini M1 16GB:
BMW 2:04 min

2 Likes

this is super exciting! is this only working for apple silicon right now, or does it work with amd cards on older intel macs?

1 Like

I only have an ā€œoldā€ RX Vega56 in my Intel Mac and this does not seem to work (for now):
I1130 21:15:15.207152 343166 device.cpp:120] Ignoring device AMD Radeon RX Vega 56 due to too old compiler version.

iā€™ve got a vega64, so iā€™d likely be in the same boat. i mean iā€™m looking to get a new apple silicon mac anyway, but it would solidify the decision if i could do an apples to apples comparison of the performance boost offered over the amd card (and i could still use it as a backup machine)

The latest Metal patch requires macOS 12.0, which is more likely the source of the ā€œtoo old compiler versionā€ message. AMD and Intel GPUs are enabled, but I donā€™t know how well they work.

3 Likes

Where did you pull the build from, the ā€œPatchā€ section? Or did you compile it yourself?

Thanks.

I applied the patch that currently gets reviewed and turned on cycles for macOS in space_userpref.py. And I had to add a compiler flag in some of the Cmake files (I just do not remember which, i am on mobile now), where you turn on CUDA and OPTIX in the same way.

To build it for Intel a minimal deployment target of 10.14 is needed to avoid some compiler warnings, but my setup fails anyway as shown above. Sadly I can not upgrade my Intel Mac to Monterrey ATM for testing.

5 Likes

Ah, thanks for the info. Sounds pretty technical with the work arounds for getting it compiled, right now; more than I could manage anyways.

I think Iā€™ll wait for the first official test build.
Thanks for putting out the numbers with your machine. :metal:t2:

Iā€™ve got Cycles Metal working on my M1 Max (32 core). Itā€™s rather impressive as well.

I built Blender from source on my MBP15 i9 with VEGA 20 dGPU and applied the diff for the unreviewed patch. That gave me an X86 build of Blender that showed the Metal GPU options on the Intel Mac but alas didnā€™t render (kernel internal error).

I then tried to set the ARM flag to compile again but that didnā€™t work.

So as a last ditch I took the built X86 version over to my M1 Max and low and behold it renders on the GPU.

BMW in 43 seconds on the 32 core GPU - so not 30% faster than the 24 core version but it is an X86 build.

However, every scene I tried the live viewport performance is rather wonderful.

Iā€™d never built Blender from source until today. Iā€™ll keep this build now to play with until the proper one lands.

The only slightly difficult bit was getting the new patch added, which I did like this:
patch -p1 < ~/Developer/D13423.diff [downloaded the RAW file from the Dev site]

Then ran make again and that was it basically.

7 Likes

Wow, this is rather amazing. It means that the feature is pretty darn close.
Hereā€™s crossing fingers that the AMD Macs do get a fully featured pass too (i.e. MetalRT and all the Metal crunchies)

Certainly does. I read the diffs yesterday and the code committed seemed total genius and I couldnā€™t but help thinkā€¦ this looks like it might be very close indeed.

3 Likes

Absolutely canā€™t wait to have Metal support!

3 Likes

Trying to compile it with the patch applied but I keep getting errors any ideas why ?


You need to set WITH_METAL compile flag

not sure I understand, I think I managed to add it to ā€œmake configā€ and it is on, but still does not work.

Yes i thought i found the easy fix ā€¦ Sorry for giving you hope ā€¦ it also not workng for me .

No worries, I guess we will just have to wait.

Yes Christmas is coming :wink:

1 Like

I just tested the refactored patch and it still works, after some fiddling. So for the impatient people, here is a small guide to build it.

  1. Download the latest revision off the .diff-file (in Safari by right-clicking, otherwise the patch can get defective).
  2. in the terminal apply the patch, like so (including a successful output message):
bash-3.2$ patch -p1 <  ~/Downloads/D13423 
patching file intern/cycles/blender/CMakeLists.txt
patching file intern/cycles/blender/addon/engine.py
patching file intern/cycles/blender/addon/properties.py
patching file intern/cycles/blender/addon/ui.py
patching file intern/cycles/blender/device.cpp
patching file intern/cycles/blender/python.cpp
patching file intern/cycles/bvh/CMakeLists.txt
patching file intern/cycles/bvh/bvh.cpp
patching file intern/cycles/bvh/metal.h
patching file intern/cycles/bvh/metal.mm
patching file intern/cycles/cmake/external_libs.cmake
patching file intern/cycles/device/CMakeLists.txt
patching file intern/cycles/device/device.h
patching file intern/cycles/device/device.cpp
patching file intern/cycles/device/memory.h
patching file intern/cycles/device/metal/bvh.h
patching file intern/cycles/device/metal/bvh.mm
patching file intern/cycles/device/metal/device.h
patching file intern/cycles/device/metal/device.mm
patching file intern/cycles/device/metal/device_impl.h
patching file intern/cycles/device/metal/device_impl.mm
patching file intern/cycles/device/metal/kernel.h
patching file intern/cycles/device/metal/kernel.mm
patching file intern/cycles/device/metal/queue.h
patching file intern/cycles/device/metal/queue.mm
patching file intern/cycles/device/metal/util.h
patching file intern/cycles/device/metal/util.mm
patching file intern/cycles/device/multi/device.cpp
patching file intern/cycles/kernel/device/gpu/kernel.h
patching file intern/cycles/util/math.h
patching file intern/cycles/util/path.h
patching file intern/cycles/util/path.cpp
  1. In blender/CMakeLists.txt add i.e. after the CUDA/OPTIX-section:
if(APPLE)
option(WITH_CYCLES_DEVICE_METAL       "Enable Cycles APPLE METAL compute support" ON)
endif()
  1. In blender/release/scripts/startup/bl_ui/space_userpref.py

Search and delete:
and sys.platform != "darwin"

  1. In blender/cycles/CMakeList.txt add somewhere:
if(WITH_CYCLES_DEVICE_METAL)
  add_definitions(-DWITH_METAL)
endif()

I hope, this post will get obsolete soon and we will see it in the main repo. It looks really good to me.

7 Likes