cpetig / tflite_micro_compiler

generate tflite micro code which bypasses the interpreter (directly calls into kernels)
Apache License 2.0
76 stars 26 forks source link

Draft: Efforts to support latest tflite-micro #71

Open PhilippvK opened 1 year ago

PhilippvK commented 1 year ago

For reference here is a summary of my past efforts to get TFLMC running with current tflite-micro. This heavily depends on @andrewstevens-infineon works over the past two years and should mainly be for reference and to compare with the approach used in #70.

I've tried to strip down the changes to the bare essentials, removing all IFX-related boilerplate code as well as the history as I am not sure if these should be available upstream.

On top of that I fixed the Cake configuration to build the custom tflite-micro lib (no need to use the tflite-micro Makefile) anymore.

To use this codebase, a patched tflite-micro codebase is required. See my branch feature/tflmc_support2 (Diff) for reference. It builds up on upstream commit 17b795d4233844144624df04c11ca1d967e81033 and the impressive work of @andrewstevens-infineon. Again, I cut the changes down to only the minimum required for the preinterpretation (adding hooks to records allocations etc.)

I do not want to merge this as-is. The main work was done by the people around @andrewstevens-infineon. My contribution was "just" digging through all the changes and pick/cleanup them to generate a meaningful diff as shown below.

PhilippvK commented 1 year ago

CC @rafzi @panickal-xmos

panickal-xmos commented 1 year ago

Thank you @PhilippvK! :) Brilliant that you have put up the changes. Will have a look through the PR.

panickal-xmos commented 1 year ago

The upstream commit on which the patch is based is mentioned as 17b795d4233844144624df04c11ca1d967e81033 which seems to be a fork of tflite-micro. Has this been selected for some reason?

PhilippvK commented 1 year ago

The upstream commit on which the patch is based is mentioned as 17b795d4233844144624df04c11ca1d967e81033 which seems to be a fork of tflite-micro. Has this been selected for some reason?

Oh, this was just a copy-paste mistake from my side. I updated the URL to point to the upstream repository instead: https://github.com/tensorflow/tflite-micro/commit/17b795d4233844144624df04c11ca1d967e81033

andrewstevens-infineon commented 1 year ago

Hi Philipp,

Thanks for taking the initiative on this. I'm currently refactoring / cleaning up on our side. The aim is to move the IFX-specific stuff as a changeset on top of your version which will be the mainline. I'll see if I can walk through a diff of the current status to see where we may need to align/sync up to resolve conflicts.