*.ci.metal Build Rule Fails with "metal: no such file or directory"

I've created a simple identity kernel as a starting point (it immediately returns the sample). I named the file "Kernel.ci.metal". I copied the 2 build rules shown in the demo exactly, but when I build the app, the "*.ci.metal" build rule fails because the output file "Kernal.ci.air" does not exist:

metal: error: no such file or directory: '<PATH>/DerivedSources/Kernel.ci.air'

When I run the 2 commands in the build scripts directly from the command line, it works fine. Are my build rules happening at the wrong time in the build process and the target directory has been removed already?


Accepted Reply

Thank you for sharing your project. We took a quick look and noticed that you use -O (upper case) instead of -o (lower case) to specify the output file for the Metal compiler. Using -o will solve this specific problem for you.

Given this discovery there is no need for you to file a TSI. Please save that TSI for another question. If you have already filed a TSI then DTS will refund it for you.

Replies

I have created a sample project on GitHub that suffers from this issue when it tries to compile.

https://github.com/JoshuaSullivan/MetalKernel
Hi, I can help you with this through a Technical Support Incident (TSI).
Please create a TSI with DTS and we can talk in greater depth and also share code easily through that channel.
I actually have some sample code that might meet your needs directly.

If there are concise takeaways from our TSI conversation then I will post them back here in the forums for the benefit of others.
Looking forward to talking with you.
Thank you for sharing your project. We took a quick look and noticed that you use -O (upper case) instead of -o (lower case) to specify the output file for the Metal compiler. Using -o will solve this specific problem for you.

Given this discovery there is no need for you to file a TSI. Please save that TSI for another question. If you have already filed a TSI then DTS will refund it for you.
Argh! I can't believe I missed that. Thank you so much!
It would be really helpful to put the script contents of those 2 slides into the code pane of the developer app so other people don't get tripped up by a mistyping a very case-sensitive string.
How do you declare all this in Swift Package Manager ?