CoreML Crash on iOS18 Beta5

Hello, My App works well on iOS17 and previous iOS18 Beta version, while it crashes on latest iOS18 Beta5, when it calling model predictionFromFeatures.

Calling stack of crash is as:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unrecognized ANE execution priority MLANEExecutionPriority_Unspecified'
Last Exception Backtrace:
0   CoreFoundation                      0x000000019bd6408c __exceptionPreprocess + 164
1   libobjc.A.dylib                     0x000000019906b2e4 objc_exception_throw + 88
2   CoreFoundation                      0x000000019be5f648 -[NSException initWithCoder:]
3   CoreML                              0x00000001b7507340 -[MLE5ExecutionStream _setANEExecutionPriorityWithOptions:] + 248
4   CoreML                              0x00000001b7508374 -[MLE5ExecutionStream _prepareForInputFeatures:options:error:] + 248
5   CoreML                              0x00000001b7507ddc -[MLE5ExecutionStream executeForInputFeatures:options:error:] + 68
6   CoreML                              0x00000001b74ce5c4 -[MLE5Engine _predictionFromFeatures:stream:options:error:] + 80
7   CoreML                              0x00000001b74ce7fc -[MLE5Engine _predictionFromFeatures:options:error:] + 208
8   CoreML                              0x00000001b74cf110 -[MLE5Engine _predictionFromFeatures:usingState:options:error:] + 400
9   CoreML                              0x00000001b74cf270 -[MLE5Engine predictionFromFeatures:options:error:] + 96
10  CoreML                              0x00000001b74ab264 -[MLDelegateModel _predictionFromFeatures:usingState:options:error:] + 684
11  CoreML                              0x00000001b70991bc -[MLDelegateModel predictionFromFeatures:options:error:] + 124

And my model file type is ml package file. Source code is as below:

//model
MLModel *_model;
......

// model init
        MLModelConfiguration* config = [[MLModelConfiguration alloc]init];
        config.computeUnits = MLComputeUnitsCPUAndNeuralEngine;
        _model = [MLModel modelWithContentsOfURL:compileUrl configuration:config error:&error];

.....
// model prediction
        MLPredictionOptions *option = [[MLPredictionOptions alloc]init];
        id<MLFeatureProvider> outFeatures = [_model predictionFromFeatures:_modelInput options:option error:&error];

Is there anything wrong? Any advice would be appreciated.

Hi @TTZ, thank you for reporting. We are aware of this issue and working on the fix.

Hey there! Could you please keep us updated here once your team resolves this issue? We've just launched a brand-new AI feature which is super cool and definitely requires CoreML inference on NPU. Our app has millions of users. Nevertheless, we've witnessed numerous online crashes with iOS 18. The utilization of NPU is extremely crucial for us. Please assist in solving it at the earliest. Thank you so much!

Absolutely. Please try the latest iOS 18 Beta 6. The issue should be resolved.

CoreML Crash on iOS18 Beta5
 
 
Q