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

Update for upstream tflm #63

Open
wants to merge 97 commits into
base: master
Choose a base branch
from

Conversation

yair-ehrenwald
Copy link

@yair-ehrenwald yair-ehrenwald commented Aug 7, 2021

Hi,

Note: Used branch bugfix/failing_fallback_opdata_parsing as a starting point as it seemed to be the most up to date code.

Made some updates in order to be able to use (sort of) the latest TFLM build.
Rewrote the node/registration scanning loops to support the new subgraph API requirements.

Had some issues with data structures being defined as private in TFLM and the #define private public trick didn't work when used on compiler.cc, so for this to work I had to add a getter to the micro_interpreter for the new MicroGraph type:

MicroGraph *getGraph() {return &graph_;}

Pretty sure this can be worked around, but I couldn't find a decent solution.

Other than that, seems to work on the tests I tried.

andrewstevens-infineon and others added 30 commits August 11, 2020 11:44
    TODO: modeify examples return pass/fail stauts
     Major refactor switching to fully tracking allocations / identifying head/tail gap
     TODO: use instrumented MicroInterpreter (patch) rather than evil-half-brother of AllocateTensors
    ScratchBuffer's offsets in arena are captured and dumped in table in compiled application
…ulus data for footprint comparison

        Set TF_LITE_MICRO_FOOTPRINT_ONLY
wackston and others added 25 commits January 7, 2021 19:31
…g id meant it never te4sted streaming version
    Ref examples relied on variant code selcted by the "portable_optimized" buildtag
     code in tflite_u which is now rename "ifx_fast".
strange that CONV_2D, QUANTIZE and FULLY_CONNECTED are gone?
While most of the tflite operators/kernels have a Register_* function returning the type TfLiteRegistration,
this is nor the the case for custom TFLite Micro Operators. The AddCustom() function of the MicroOpsResolver
still expects a pointer to a static struct.

My proposal to fix this issue:
- Update external function prototype for registering custom ops to use a pointer
- Dereference pointer when building the registrations_ array
# Conflicts:
#	examples/Makefile
#	src/Compiler.cc
#	src/RecordAllocations.cc
@andrewstevens-infineon
Copy link
Collaborator

andrewstevens-infineon commented Aug 9, 2021

Hi Yair,

Thanks for the PR! FYI: the ifx branches (pushing bugfix was actually sloppiness on my part - it should really have been pushed as ifx/bugifx/....) reference a (currently) Infineon-internal version of tflite(u) with some extended APIs and kernel suite plus associated in-house-CI scripts etc. I'm currently wrapping updating these for tflite(u) from tensorflow v2.5.0 when that's done switching to support tflite(u) from the "new" standalone repo is "next on the list". Your PR is obvisouly very helpful in that regard.

What would be super-helpful would to fix up the PR so that checks pass again for stock tflite(u). Pressure on "other fronts" has meant this has repeatedly postpone for ifx/ branches which is blocking a proper merge back into Christoph's main code branch.

If you feel it would help your efforts I can push the current state of the v.2.5.0 update

@yair-ehrenwald
Copy link
Author

I'd be glad to see the current state of what you have for v2.5.0
Just as a clarification, since I'm pretty clueless about git workflows - On my side at least, this PR pulls in the latest stock tflm version (from the new separate repo) and builds with it.
I got around the MicroGraph access issue with the gcc compiler flag -fno-access-control so it requires no change to stock tflm.

In general - I would be very happy to collaborate on this project. In addition to code size savings, I think it can also serve as a platform for model modification/optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants