[code-reflection] RFR: Add support for other onnx providers (CoreML) [v2]
Adam Pocock
duke at openjdk.org
Fri Oct 17 15:11:54 UTC 2025
On Fri, 17 Oct 2025 12:53:44 GMT, Ana Maria Mihalceanu <duke at openjdk.org> wrote:
>> This PR contains a series of changes meant to integrate other ONNX providers.
>>
>> * It contains generated Java bindings for CoreML provider: `oracle.code.onnx.foreign.coreml_provider_factory_h`
>> * Configurations of providers are present in `oracle.code.onnx.provider`.
>> * Provider configuration should occur via `SessionOptions` on inference session, prior to any work done by the native library. Hence why `OnnxRuntime` has an `executeWithOptions` method.
>> * There is a small UI example that use [Facial Emotion Recognition](https://github.com/onnx/models/tree/main/validated/vision/body_analysis/emotion_ferplus) model on how use the CoreML provider under `test` directory, inside `oracle.code.onnx.fer`.
>> * The `README.md` file contains instructions on how to run the example and how to regenerate the bindings for the provider. Instructions and scripts to regenerate the bindings were provided for macOS users only since CoreML is an Apple software.
>>
>> Work done in this PR is done together with Lize Raes.
>
> Ana Maria Mihalceanu has updated the pull request incrementally with one additional commit since the last revision:
>
> Update full name
cr-examples/onnx/src/main/java/oracle/code/onnx/provider/CoreMLProvider.java line 42:
> 40: try {
> 41: int coremlFlag = COREML_FLAG_USE_CPU_AND_GPU();
> 42: var status = OrtSessionOptionsAppendExecutionProvider_CoreML(sessionOptionsAddress, coremlFlag);
The [ML_PROGRAM flag](https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/providers/coreml/coreml_provider_factory.h#L32) is probably useful to turn on here as it expands the set of things that ORT can accelerate with CoreML (e.g. I can't get it to do anything to [sd4j](https://github.com/oracle/sd4j) without it, but it does help a bit with it, or at least it did when I tested it in 2023). ML programs are the more modern way of accelerating things with CoreML, but they might need slightly higher OS versions.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/618#discussion_r2440337171
More information about the babylon-dev
mailing list