Bionic devices take forever and ANECF error

Without giving any real detail, our CoreML models, which work well on the other devices, take several seconds to load on devices with the Bionic chipset, and give a message indicating an error. I assume they're causing a lower level error, and it's then defaulting to the same solution used by the other devices. These models then execute normally, but it's several seconds for all three of our models to load really affecting our augmented reality, not to mention using more GPU power than we'd want.


[espresso] [Espresso::handle_ex_plan] exception=ANECF error:


[coreml] Error plan build: -1.


Normally if I knew which particular operation is failing, we could address it. It's been happening through all iOS versions, since iOS 11 at least.


As a workaround until this bug is addressed by Apple, is there anything in particular I can do to force it to ignore the Bionic chipset? I can't use CPU only. The GPU processing of the neural net definitely improves the speed a lot for us, but this slowdown is causing the app to be quite difficult to uses on the more modern devices. If there is some way at getting to the underlying reason for this issue, I would also like to know. The above message just isn't much to go off of.

Replies

This workaround at least prevents the load time issue, but of course using the bionic engine would be preferable, especially since we use the GPU for other things.


MLModelConfiguration *config = [[MLModelConfiguration alloc] init];
config.computeUnits = MLComputeUnitsCPUAndGPU;
MLModel *model = [MLModel modelWithContentsOfURL:modelUrl configuration:config error:&error];

I'm also having an issue with the Neural Engine which forced me to use the same work-around.

Have you filed a radar already?


You could also try to add an Exception Breakpoint (for C++) in Xcode which might cause the debugger to halt when the internal exception is thrown. Maybe the stack trace will offer some clues.


Please keep us posted if you find anything useful!

I ran into the exact same issue.

In the devices log I found that there is a crash in ANECompilerService, in the routine ZinIrLocalRegAlloc.

Maybe it helps.

I have the stack trace but I don't know how to exploit this information.


Thread 1 name:  Dispatch queue: com.apple.compilerService.csQueue
Thread 1 Crashed:
0   libsystem_kernel.dylib         0x0000000192cb00cc __pthread_kill + 8
1   libsystem_pthread.dylib       0x0000000192d26a88 pthread_kill + 300
2   libsystem_c.dylib             0x0000000192c0914c abort + 144
3   libsystem_c.dylib             0x0000000192bd62d0 basename_r + 0
4   ANECompiler                   0x00000001bc35da5c ZinIrLocalRegAlloc+ 322140 (ZinIrContext*) + 5068
5   ANECompiler                   0x00000001bc36ad04 ZinAneCoreCompile+ 376068 (ZinIrContext*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > > > > const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > > > > const&, ZinIrCompilationStatus&) + 912
6   ANECompiler                   0x00000001bc39acf0 ANECCompileProcedure+ 572656 (__CFDictionary const*, __CFDictionary const*, ZinIrCompilerParameters&, ZinIrContext*&, ZinIrConstManager&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > > > > const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator > > > > const&, ZinIrCompilationStatus&) + 576