tum-ei-eda / mlonmcu

Tool for the deployment and analysis of TinyML applications on TFLM and MicroTVM backends
Apache License 2.0
29 stars 12 forks source link

Implement Timeouts #36

Open PhilippvK opened 2 years ago

PhilippvK commented 2 years ago

There are several situations where it would make sense to time-out a Python function after some defined period:

While some components offer ways to manage timeouts by themselves (i.e. corstone300) it would still be great to have a consistent API for such things

Actually Target-related timeouts are already part of of MLonMCU codebase but currently raise NotImplementedError.

PhilippvK commented 2 years ago

@rafzi I think the exec_timeout you implemented in the old mlonmcu would be suitable for this. However I would like to offer you to add it to the new codebase by yourself whenever you start working with it. This does not need to be very soon.

rafzi commented 2 years ago

yes, that function was intended for exactly that purpose.

a small annoyance with it is that you have to account for broken object identity between objects: https://gitlab.lrz.de/de-tum-ei-eda-esl/ml_on_mcu/-/blob/master/tvm/plan_memory.py#L8

an option was multiprocessing.dummy, which uses threading instread of processes, but i decided against it, because there was some compatibility issue between platforms.

PhilippvK commented 1 year ago

I recently implemented it on my dev branch. It works most of the time, but in some weird special cases, it causes random freezes. If we decide to implement this for all components, it should be marked experimental and should be turned off by default.