If a .metallib was compiled with a target iOS version that's newer than the current device, loading the .metallib as an id<MTLLibrary> may succeed, but finding main0 (or any other function in it) will fail and return nil. Currently, this causes a crash due to an assert; logging the error and returning MetalFunctionBundle::error() will still crash, but in a way that's easier to diagnose.
(Note that in practice, this will probably be a useless "Compiler encountered an internal error" message -- the GPU backend is crashing, and the Metal stub library sees as XPC_ERROR_CONNECTION_INTERRUPTED. It retries up to 3 times, crashing each time, and then gives up.)
If a .metallib was compiled with a target iOS version that's newer than the current device, loading the .metallib as an
id<MTLLibrary>
may succeed, but findingmain0
(or any other function in it) will fail and return nil. Currently, this causes a crash due to an assert; logging the error and returningMetalFunctionBundle::error()
will still crash, but in a way that's easier to diagnose.(Note that in practice, this will probably be a useless "Compiler encountered an internal error" message -- the GPU backend is crashing, and the Metal stub library sees as
XPC_ERROR_CONNECTION_INTERRUPTED
. It retries up to 3 times, crashing each time, and then gives up.)