Skip to content

coreml: expose configurable MLComputeUnits for encoder fallback #3914

Description

@macmixing

Problem

whisper.cpp currently loads the Core ML encoder with a fixed compute-unit policy. Downstream apps do not have a supported way to force CPU-only or CPU/GPU Core ML execution when Apple Neural Engine execution fails.

This matters for production apps because ANE/Core ML failures can be OS- or hardware-specific, and the app may need to recover without disabling Core ML entirely or patching whisper-encoder.mm.

Real-world case

I am seeing an iOS 27 beta regression where a Whisper Core ML encoder path fails during ANE execution in an iOS app / keyboard-extension speech-to-text flow.

The same app and same model assets work on public iOS 26.6.

The failure signatures include:

ANEProgramProcessRequestDirect() failed
com.apple.appleneuralengine Code=8
E5RT: ANE inference operation failed
Unable to compute the prediction using ML Program

The app’s macOS build is not affected in my testing.

Workaround

If I patch whisper-encoder.mm so a fallback Core ML model context uses:

config.computeUnits = MLComputeUnitsCPUOnly;

then the same Whisper model can recover on iOS 27 beta.

The current downstream workaround is to maintain a local patch to the Core ML loader, which is fragile.

Request

Please expose Core ML compute-unit selection through an official API or configuration path, for example:

  • MLComputeUnitsAll
  • MLComputeUnitsCPUOnly
  • MLComputeUnitsCPUAndGPU
  • MLComputeUnitsCPUAndNeuralEngine

This would let downstream apps implement fallback behavior without matching private Apple error codes and without carrying a long-term fork/patch of the Core ML runtime.

Additional context

This is motivated by a production iOS app compatibility issue, but I am not claiming whisper.cpp caused the iOS 27 beta regression. The request is for a supported recovery/configuration path when Core ML ANE execution fails or is undesirable.

I have also seen similar user-facing iOS 27 dictation failures reported by users of another dictation app. I cannot verify that app’s internal provider or compute path, but the report is consistent with the same class of failure: local dictation starts, fails, and returns a generic error instead of text.

Related

I did not find an existing whisper.cpp issue or PR that exposes Core ML MLComputeUnits selection to callers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions