1

For context, I am researching upgrades into our OpenCL code at work as we are quite far behind current spec. The team I work in develops on all three of the major OSes and as far as I can tell Apple doesn't support past OpenCL 1.2 on any of their machines instead prompting you to learn and use Metal performance shaders. I would like to update our code base to C++ for OpenCL which is based on OpenCL 2.0 or 3.0 depending on which version you use. C++ for OpenCL is fine on Windows and Linux as they have GPU drivers which support up to and past the 2.0 requirement, but Mac might have a problem with it without official support in the drivers. So I had the idea that if we could cross compile the CL kernels to Metal for the Mac users they would be able to run a Metal version of the code locally.

Has anyone got any solutions to this problem.

  • Not sure if it will help, but  has Metal-cpp: https://developer.apple.com/metal/cpp/ – Jeshua Lacock Feb 22 '22 at 19:30
  • 1
    I don't know how realistic this is, but in theory it might be possible to use https://github.com/google/clspv (which integrates Clang) to compile C++ for OpenCL to *Vulkan* SPIR-V, and then use https://github.com/KhronosGroup/SPIRV-Cross to compile the Vulkan SPIR-V to Metal Shading Language. I suspect there'd be all sorts of problems though. – Andrea Feb 22 '22 at 21:12
  • 1
    @Andrea that sounds crazy enough that I feel like I have to try it just to see if it works. :D – Louis Child Feb 22 '22 at 22:17

0 Answers0