Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mobile] NNapi with Android API 25 #19496

Closed
GregCornis opened this issue Feb 12, 2024 · 2 comments
Closed

[Mobile] NNapi with Android API 25 #19496

GregCornis opened this issue Feb 12, 2024 · 2 comments
Labels
platform:mobile issues related to ONNX Runtime mobile; typically submitted using template

Comments

@GregCornis
Copy link

Describe the issue

I'm trying to run a U-Net on a device with Android API Level 25. The device has a Mali T860 which I'm trying to use.

Apparently, NNAPI is not available on devices < API 27, but it is listed by OrtEnvironment.getProviders() : CPU, NNAPI, XNNPACK. How is that possible ? Will NNAPI use the GPU or simply revert to their CPU implementation ?

From the profiler, I can tell that everything runs on the CPU, no matter what configuration I try.

Alternatively, is there any way to run the inference on the GPU ?

To reproduce

Urgency

No response

Platform

Android

OS Version

25

ONNX Runtime Installation

Released Package

Compiler Version (if 'Built from Source')

No response

Package Name (if 'Released Package')

onnxruntime-android

ONNX Runtime Version or Commit ID

1.17.0

ONNX Runtime API

Java/Kotlin

Architecture

ARM64

Execution Provider

NNAPI

Execution Provider Library Version

No response

@GregCornis GregCornis added the platform:mobile issues related to ONNX Runtime mobile; typically submitted using template label Feb 12, 2024
@skottmckay
Copy link
Contributor

The NNAPI EP dynamically creates an NNAPI model at runtime from the ONNX model based on the device capabilities. So it's included in the build and will be returned by getProviders, but won't be used for any execution of the model if the device doesn't support NNAPI.

We don't have a GPU-only execution provider for mobile. There is an experimental opencl based execution provider but it only supports a limited number of operators as there wasn't a use-case that justified doing further work on it. FWIW executing a model on GPU can potentially impact the device responsiveness as you're competing with UI updates so using an approach that can utilize NPU is generally preferrable. One possibility is Chrome now supports WebGPU on Android and onnxruntime web might be able to be used, but that requires Android 12.

@GregCornis
Copy link
Author

Thanks for all the info, I understand why NNAPI shows up then. Good point about the GPU bottleneck, I might actually change gears and run on the CPU, with only one thread for example, to avoid using all ressources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:mobile issues related to ONNX Runtime mobile; typically submitted using template
Projects
None yet
Development

No branches or pull requests

2 participants