darktable for M1 computers?

Wondering if someone could briefly explain the darktable situation for M1 MacBooks. Based on my reading Apple no longer supports OpenCL in favor or their own Metal API.

If I understand OpenCL broadly, compiled code generates “kernels” or GPU functions, and the OpenCL driver provides a GPU wrapper/API to execute the Kernels from the main/CPU app?

If that is roughly correct then Rosetta2 will translate the Intel CPU code, but there is no M1 GPU support behind it? Even compiling directly for M1 will not address this gap without an M1 OpenCL driver?

That there is an effort for next gen portable GPU code Vulkan to run on macOS via MoltenVK and a Vulcan version of darktable, vkdt but that is a very long way off?

Just to be clear this is not a gripe, just trying to understand the situation as it relates to me/my current computer. Thx

I’m not at all familiar with Apple hardware, but basically, there are two parts with dt for M1.

First, someone has to be able to set up a building environment for Apple M1 hardware (compiler, libraries, etc.)
Once that’s in place, it should be possible to get dt working on M1, even without OpenCL or other hardware acceleration. Some activity over on Github seems to indicate that that’s already underway:
“Add ARM64/Apple M1 support” and
“Help Offer: Compiling on M1 Apple computer”

Then there’s the whole problem of hardware acceleration (GPU use). I don’t think OpenCL code readily translates to either Metal or Vulkan code, so that’s the big obstacle to use the GPU on M1: the opencl code would have to be rewritten, and the new code maintained in parallel with the existing code.

You can compile darktable on apple M1 arm processor after installing the dependancies with brew and you can install it on your machine. The script for making the dmg is not working and you can’t distribute a package to install on another computer. On my macbook pro 14" with macos 12.3.1 darktable detect opencl and use the gpu. I think macos translate the calls from opencl to metal “on the fly”. I never made benchmarks to test the efficiency but modules like “diffuse or sharpen” is 3 to 5 times faster when opencl is enabled. There are some little bugs in the interface but darktable is perfectly usable.


There’s some work in progress about that: Provide instructions and helper scripts to generate dmg of homebrew-based build for macOS by apfelkraut · Pull Request #11579 · darktable-org/darktable · GitHub

1 Like

Probably not for you, but maybe others will be interested to know about Asahi Linux, an effort to bring Linux to Apple Silicon Macs.

Asahi Linux don’t use GPU for now.

Thanks, I will try that.

Scripts from apfelkraut to generate dmg works perfectly on my macbook pro 14 with macos 12.3.1.
Thanks for the link.