CoreML model hangs/crashes on A15 devices only

A heads up to other developers using CoreML: Make sure to test your apps and CoreML models on an A15 device like the new iPhone 13.

My app uses CoreML for a custom image segmentation model. Which runs fine on all previous devices, but hangs/crashes on my iPhone 13 Pro, and (based on customer reports) on other devices with the A15.

The error seems to happen when part of the model is executing on the Neural Engine.

I worked around it for now by not using the Neural Engine when running on A15 devices.

modelConfig.computeUnits = UIDevice.current.hasA15Chip() ? .cpuAndGPU : .all

where hasA15Chip() is a custom helper method.

For Apple engineers: I provided additional information in FB9665812.

CoreML model hangs/crashes on A15 devices only
 
 
Q