Compiling CI kernels at runtime

In the "Explore Core Image kernel improvements" session, David mentioned that it is now possible to compile [[stitchable]] CI kernels at runtime. However, I fail to get it working.

The kernel requires the #import of <CoreImage/CoreImage.h> and linking against the CoreImage Metal library. But I don't know how to link against the library when compiling my kernel at runtime. Also, according to the Metal Best Practices Guide, "the #include directive is not supported at runtime for user files."

Any guidance on how the runtime compilation works is much appreciated! 🙂

  • The presentation talks about using #include <CoreImage/CoreImage.h> - please use #include instead of #import.

  • I'm sorry, I meant #include. I'm still getting fatal error: 'CoreImage/CoreImage.h' file not found when calling device.makeLibrary(source: ...).

Add a Comment

Replies

Thank you for mentioning Frank!

This looks like a bug and we’ve been able to reproduce it now as well. Good catch.

We're looking into it, and there is no need to create any additional bug reports.

  • Nice, thanks! Out of curiosity, what's the bug? I didn't even find out how to link to another library when compiling a metallib at runtime...

  • What a confusing mess these forums are.

  • Unfortunately, this is still the case (macOS 12 beta 6 + Xcode 13 beta 5)...