kendryte / kendryte-standalone-sdk

Standalone SDK for kendryte K210
https://kendryte.com
Apache License 2.0
438 stars 159 forks source link

Layer completion interrupt #108

Open janhildebrand opened 4 years ago

janhildebrand commented 4 years ago

Hello,

we want to use the k210 on a larger scale and i am currently testing it among other edge devices. I need to know the exact layer execution times of a pretrained tensorflow model.

I am trying to set a gpio pin to high after a layer completion to measure the execution time of each layer with an oscilloscope.

I see that there is a possibility to enable an interrupt in the layer argument.

I am using nncase to convert my tensorflow model to the kmodel format. (+ kendryte-standalone-sdk-develop from 16. April 2020)

How can i enable the layer interrupt and which function does this interrupt call.

Thank you very much for your help, Jan Hildebrand

tjmc commented 4 years ago

For what it is worth, I turn on NNCASE_DEBUG https://github.com/kendryte/kendryte-standalone-sdk/blob/28ff67adf27f06a92cd4f1b81ab9aa5d0bb93740/lib/nncase/nncase.cpp#L25

it will output layer timing statistics. It might be enough.

For example

KPUConv2D: 0.485000ms
KPUConv2D: 0.083000ms
KPUConv2D: 1.441000ms
KPUConv2D: 0.079000ms
KPUConv2D: 1.245000ms
KPUConv2D: 0.079000ms
KPUConv2D: 3.308000ms