Commit graph

13 commits

Author SHA1 Message Date
RJ Ascani
a0f8970856
Generate op table and subgraph invoke functions (#2176)
As the next step in the codegen experiment, we want to generate the invoke calls for each layer. This is slightly challenging with the existing sources, as kernels only expose a registration function, not their individual Eval functions. In an effort to keep the code churn to a minimum, this PR introduces an inference only registration structure and function. It includes just two function pointers: invoke and reset. For this CL, we've only introduced it for FullyConnected.

In the code generator, this PR creates a new op_table array in the generated source, with an enum for lookup. It also generates an invoke function for each subgraph, that calls each operator's invoke function.

BUG=295174388
2023-08-18 20:38:16 +00:00
TANMAY DAS
101d2bb935
TFLM swapping TfLiteRegistration_V1 struct to a new more embedded friendly api in the TFLMRegistration struct (#2001)
BUG=http://b/279811848
2023-05-26 06:48:51 +00:00
Advait Jain
29b683a35b
Explicitly use TfLiteRegistration_V1 in TFLM. (#1817)
Change generated with the following command:
```bash
cd tensorflow/lite/micro/
sed -i 's/TfLiteRegistration/TfLiteRegistration_V1/g' `find . -name "*.h" -o -name "*.cc"`
cd -
cd third_party/hexagon/
sed -i 's/TfLiteRegistration/TfLiteRegistration_V1/g' `find . -name "*.h" -o -name "*.cc"`
cd -
tensorflow/lite/micro/tools/ci_build/test_code_style.sh --fix_formatting
```

BUG=http://b/272808609
2023-03-11 01:12:03 +00:00
Vamsi Krishna Manchala
6fdade1aed
Update TFLM examples, kernels and integration tests to clean-up the usage of ErrorReporter
This PR updates remainder of the TFLM examples, all the kernels and integration tests to remove the usage of ErrorReporter as per the changes made to the TFLM Framework API in https://github.com/tensorflow/tflite-micro/pull/1415; replaces TF_LITE_REPORT_ERROR with MicroPrintf.

BUG=http://b/192091017, http://b/245802069
2022-09-20 20:46:26 +00:00
Steven Toribio
dfaeaf54a8
remove TF_LITE_KERNEL_LOG test (#1251) 2022-08-03 21:31:25 +00:00
sasapetr
07a2624796
Fix linter issues in a few files. (#1268)
* Fix linter issues in a few files.

* restore file whose source of truth is the upstream TF repo.

Co-authored-by: Advait Jain <advaitjain@google.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-21 20:47:45 +00:00
Pauline Sho
1bc9862118
Enable -Wmissing-field-initializers and update all registration (#1084)
* Enable -Wmissing-field-initializers and update all registration
references

In https://github.com/tensorflow/tflite-micro/pull/1082/, we disabled
the compiler error as a workaround for a successful upstream sync from
TFLite. This PR re-enables the error after addressing all errors. A new
`RegisterOp` API is added, and all prior TfLiteRegistration struct
initializations are updated to use the new API. At the minimum, this
ensures that such additions in future will only require an update to
RegisterOp if TFLM doesn't use that field.

BUG=b/230507399

* Added new RegisterOpWithFree for LSTM

* Remove LSTM Free

* Changed inline to normal function to save code size

* Changed inline to normal function to save code size

* Replace cmsis_nn static initialization with RegisterOp

* Removed extra code

* Add dropped namespace in hard_swish
2022-05-03 21:07:43 +00:00
deqiangc
b92f248ad3
Import third_party/hexagon (#1028)
Importing third_party/hexagon from codelinario at commit:
5bee22654219b89efdd35e447cc89d50369ad168

This is generated by running ci/import_third_party_hexagon.sh

BUG=https://b/227665919
2022-04-06 17:04:45 +00:00
deqiangc
ce9451f542
Replace (almost) all kernel's GetInput/GetOutput with AllocateTempXXx and DeallocateTempXxx micro context api (#894)
* Replace GetInput/GetOutput with micro context api

* Replace GetInput/GetOutput in kernels with micro_context api. Ther are three kernels (strided_slice, squeeze, transpose)that are not changed yet because:
they put the returned value of GetInput/GetOutput in an OpData structure that is persistent.
It is better to have separate change to opdata of those kernels

* Fix corner case in pad

* Fix cmsis-nn

* Fix xtensa, cmsis_nn, hexagon
2022-02-01 17:53:16 +00:00
rockyrhodes
c8c08497e0
Add reference kernel support for SVDF op with all 8 bit weights and state (#506) 2021-09-21 09:58:44 -07:00
deqiangc
e8dd8174b5
Fix hexagon build due to file movement (#500)
BUG=
2021-09-13 20:45:13 +00:00
Nat Jeffries
f9e68f1156
Implement svdf and fully_connected kernel variants for hexagon. (#380) 2021-08-27 06:05:11 +00:00
Advait Jain
217ad9fcb5
Add Hexagon optimized kernels. (#160)
* Add Hexagon optimized kernels.

 * Hexagon optimized kernels copied from https://source.codeaurora.org/quic/embedded_ai/tensorflow at 2d052806c211144875c89315a4fc6f1393064cf6
 * Changed the include paths and directory structure a bit.
 * Modified Makefile to allow optimized kernels to be in a separate directory
 * Path to the Hexagon lib is now specified on the command line.

Verified that the optimized kernels are properly built and linked with:

```
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=hexagon OPTIMIZED_KERNEL_DIR=hexagon OPTIMIZED_KERNEL_DIR_PREFIX=third_party HEXAGON_TFLM_LIB=~/Qualcomm/tflm_google/hexagon_tflm_core.a  -j8 run_keyword_benchmark
```

Gives:
```
KeywordRunNIerations(1) took 52608 ticks (52 ms)
```

Whereas reference kernels with:
```
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=hexagon  -j8 run_keyword_benchmark
```

Gives:
```
KeywordRunNIerations(1) took 110248 ticks (110 ms)
```

BUG=http://b/190754463

* enable code style checks for third_party as well.

* clang-formatted the hexagon kernels.

* Rename to keep scope focused on what we currently need.
2021-06-15 21:01:02 +00:00