MediaTek-NeuroPilot / tflite-neuron-delegate

MediaTek's TFLite delegate
MIT License
39 stars 6 forks source link

Tflite Neuron delegate fails to apply NNAPI delegate on MT6893 #12

Open adarsh044 opened 1 year ago

adarsh044 commented 1 year ago

I am trying to run a tflite SR model (few convolution layers & casting layer) on the MT6893 using an Android app with NeuronDelegate ,added as AAR dependency.

I declared the Neurondelegate class like this :

`public NeuronDelegate neuronDelegate; neuronDelegate = new NeuronDelegate();

......

new Interpreter.Options().addDelegate(neuronDelegate).setNumThreads(4)) `

I get the following logs : ` I neuron error: Neuron adapter API exists: 0 I Found interface mtk-dsp (version = ACCELERATOR_APUSYS) I Found interface mtk-gpu (version = ACCELERATOR_APUSYS) I Found interface mtk-mdla (version = ACCELERATOR_APUSYS) I Found interface mtk-neuron (version = ACCELERATOR_APUSYS) I Created TensorFlow Lite delegate for NNAPI. Internal error: Failed to apply delegate: NN API returned error ANEURALNETWORKS_BAD_DATA at line 4483 while completing NNAPI compilation.

` So Error here is :

  1. Failed to apply delegate: NN API returned error ANEURALNETWORKS_BAD_DATA at line 4483 while completing NNAPI compilation.
  2. I neuron error: Neuron adapter API exists: 0

What could be the error here : Is there something wrong with the declaration , if not what could be the error here. ?

Regards Adarsh

freedomtan commented 1 year ago

I neuron error: Neuron adapter API exists: 0 means the Neuron Delegate could not find necessary underlying libraries, so it falls back to NNAPI (calling NNAPI delegate for you). Probably because your Android is not updated?

For the NN API error: it's returned by NNAPI runtime. You can find the clue in the AOSP NNAPI runtime source code.

adarsh044 commented 1 year ago

Hi @freedomtan

I : neuron error: Neuron adapter API exists: 0 still persists after updating Android . Current android verison : 12, updated to latest patch. I am thinking is the AI processor integrated in with the Dimensity 1200-AI not accessible or does not support the Tflite Neuron delegate.

freedomtan commented 1 year ago

Hi @freedomtan

I : neuron error: Neuron adapter API exists: 0 still persists after updating Android . Current android verison : 12, updated to latest patch. I am thinking is the AI processor integrated in with the Dimensity 1200-AI not accessible or does not support the Tflite Neuron delegate.

Sorry to hear that. I don't have any Dimensity 1200 phone. Something must be wrong. I have an old Dimesity 1000 device, running Android 10, on my desk, latest Neuron delegate still works on it.

Does CLI program, e.g., benchmark_model_plus_neuron_delegate, work?

adarsh044 commented 1 year ago

Hi @freedomtan

Thanks for the response.

I am able to run my app on the Dimensity 9000+. I would like to close the issue.

Before that I have a couple of questions: 1.Are there any documentation on the delegate, which contain info about what operations does the delegate support, what sort of inputs can be processed by the delegate like : int8 , float32 etc.

  1. Is there any way to access the nueropilot documentation, I have written mail to register but not getting any response.

Regards Adarsh

freedomtan commented 1 year ago

Hi @freedomtan

Thanks for the response.

I am able to run my app on the Dimensity 9000+. I would like to close the issue.

Before that I have a couple of questions: 1.Are there any documentation on the delegate, which contain info about what operations does the delegate support, what sort of inputs can be processed by the delegate like : int8 , float32 etc. 2. Is there any way to access the nueropilot documentation, I have written mail to register but not getting any response.

Regards Adarsh

  1. basically, Neuron Delegate supports a superset of NNAPI delegate. @code0910: do we have documentation on what are supported?
  2. for NeuroPilot, please contact neuropilot@mediatek.com
adarsh044 commented 1 year ago

Hi @freedomtan

Thanks for the response.

  1. I was asking for the documentation on which ops are supported as I am trying to run super resolution model on the neuron . It has a tensorflow cast layer to convert to uint8 , which seems is not supported by the delegate. @code0910 It would be helpful if could confirm , if there are any documentation.
  2. Also does the neuron delegate support fp16 operations?

Regards Adarsh

adarsh044 commented 1 year ago

Hi @freedomtan

Any updates on the documentation?

Regards Adarsh