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

module update #5

Closed
wants to merge 1,335 commits into from
Closed

Conversation

JordanYates
Copy link

Update tflite-micro to a version compatible with CMSIS-NN v6.0.0

turbotoribio and others added 30 commits July 13, 2023 19:27
`port c++ energy op to open source in tflm_signal`

-port energy op and corresponding to new open source location for C++

BUG=[b/289422411](https://b.corp.google.com/issues/289422411)
`port c++ filter_bank ops to open source in tflm_signal`

-port filter_bank ops and corresponding to new open source location for C++

BUG=[b/289422411](https://b.corp.google.com/issues/289422411)
This will (hopefully) ensure that RISC-V failures result in a github issue being created.

BUG=http://b/291335234
The generic benchmarking utilities added in PR 2125 did not compile on RISC-V due to two separate issues:

 * An incorrect format specifier for int32_t on RISC-V. This is resolved by using PRId32 instead of %ld or %d.
 * The fileno() is undeclared with the RISC-V toolchain, similar to how it is with the Embedded ARM toolchain. This PR resolves this by forgoing the fstat() check on file size (as this is what used fileno), and instead attempting to read the maximum number of bytes we can fit in the model buffer. We can then use feof() to verify that we read the entirety of the model, and error out if we did not. This solution also eliminates needing to worry about different file types, such as how the Xtensa simulator treats files from the host system as character devices.

BUG=2129
This PR adds additional FFT op functionality in the Signal library, namely adding the FFT Auto Scale operation.
Testing added in the original `fft_test.cc` and `fft_ops_test.py`.
BUG=[287346710](http://b/287346710)
BUG=[549343727](http://cl/549343727)
Extends the Signal Library Delay OP to be usable from python.
Can test via `bazel run python/tflite_micro/signal:delay_op_test`

BUG=[287346710](http://b/287346710)
Inverse-RFFT as part of Signal library ops.
Testing via current FFT Op tests.

BUG=[287346710](http://b/287346710)
Our Cortex-m55 build is failing for fft_test.cc due to strict tolerance in irfft tests. Increasing tolerance slightly similar to what we did for rfft.

Can test locally with
```make -f tensorflow/lite/micro/tools/make/Makefile -j24 test_kernel_signal_fft_test TARGET=cortex_m_corstone_300 TARGET_ARCH=cortex-m55```

BUG=[287518815](http://b/287518815)
…low#2142)

We this PR, you can use these ops directly from python, including in TF graphs.

Test with `bazel run python/tflite_micro/signal:framer_op_test`, etc.

BUG=[287346710](http://b/287346710)
…#2143)

Functionality to use the rest of the Signal Library OPs directly from python.

Test with `bazel run python/tflite_micro/signal:stacker_op_test` and `bazel run python/tflite_micro/signal:filter_bank_ops_test`

BUG=[287346710](http://b/287346710)
With tensorflow#1818, TFLM does not need the TfLite OpResolver.

BUG=http://b/272808609
…nsorflow#2151)

Add the build configuration and integrated test to generate a Python
distribution package named `tflite_micro` for publishing the tflm interpreter
as a Python module with a native extension.

Use the build tools provided in @rules_python, augmented by a custom rule
`py_namespace` for the reasons documented in `python/py_namespace.bzl`.

Provide an integration test at `//python/tflite_micro:whl_test`. Use a .tflite
model copied from the hello_world example. (Copied to avoid creating a
dependency.)

BUG=part of tensorflow#1484
Adds support for 16-bit activations + 8-bit weights for depthwise convolution in the reference kernel. Uses 64-bit bias to match TFLite. Also adds passthrough to the q16x8 reference kernel for Xtensa, CEVA, and ARC (CMSIS already has it's own implementation).

Tested:
depthwise_conv_test

BUG=2141
Upgrade @rules_python in preparation for adding build stamp information to the
tflite_micro Python distribution package. This new version contains necessary
fixes.

Move the call to workspace(), which defines several external repositories,
ahead of the repository definitions in WORKSPACE itself. workspace() defines
@bazel_skylib, which is needed by the new version of @rules_python, and
therefore must be defined first.

Add a few comments about the use of @rules_python.

BUG=part of tensorflow#1484
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
…aze/Bazel (tensorflow#2160)

`load()`s are being added in preparation for changes being made to Blaze/Bazel !

corresponding [google3 cl](https://critique.corp.google.com/cl/553849494)

BUG=[b/295216390](https://b.corp.google.com/issues/295216390)
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
This PR creates the initial code generator scaffolding for performing inference without an interpreter. Currently, this does nothing other create a header and source file from Mako templates. Mako was chosen as a template engine due to existing dependency.

BUG=b/295076487
This PR adds a codegen inference example for the hello world model to demonstrate how to invoke the code generator and build the generated source. For now, we're just checking the generated source into the repo to skip over building out the make rules and also ensuring the generated source complies with formatting rules.

This also fixes a minor formatting issue in the source templates, as clang-format now properly complained about it.

BUG=b/295390000
The new codegen python build rules were added without properly loading the rules.

BUG=b/295216390
* tensorflow@a76d154 has the changes needed to create test data for the current PR. I reverted the changes back to have the script be mostly unchanged (except for some typos and trailing whitespaces).
 * To get the new quantization parameters:
```bash
bazel run tensorflow/lite/micro/kernels/testdata:lstm_test_data_generator
```
And then manually copy over the parameters into `lstm_test_data.cc`

BUG=http://b/296130372
mansnils and others added 26 commits April 29, 2024 17:39
BUG=CMSIS-NN glue is updated to support int32bias for int16x8
Just noticed this while reading through the code;  obviously not urgent but thought I'd submit a PR just in case :-)

BUG=typo
The latest CMSIS-NN adds MVE support for int4 convolution, depthwise and fully connected.
BUG=just updating to latest
@tensorflow/micro

Update README with additional makefile targets for this example application.

bug=fixes tensorflow#2561
…tensorflow#2566)

Prevents program crash due to null pointer dereference.

BUG=none
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
@tensorflow/micro

Add meta-data strings to the binary.  Meta-data is output each time binary is executed.  See the README for a sample of the output.

If a Git repo. is not available at ```${TENSORFLOW_ROOT}```, an appropriate message is generated in the meta-data.

Changes to how the CMSISNN and XTENSA NN library download scripts work.

Adds run of generic benchmark with embedded model for default build of x86, Corstone-300, Xtensa to test scripts executed during CI.

bug=fixes tensorflow#2495
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
* Updates x86 corstone300 version
 
 BUG=Corstone300 tests were not able to be ran on aarch64 hosts
 Author: Ryan O'Shea <ryan.oshea3@arm.com>
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
…ensorflow#2577)

First, the definition -DMIN_RFFT_PWR=MAX_RFFT_PWR
is meaningless, because MAX_RFFT_PWR doesn't evaluate to a number. That's a bug.
Second, both #definitions are only applicable when building Nature DSP for hifi3 and hifimini. Later archs (hifi4, hifi5) stopped using them. That's confusing to define them for all archs.
Finally, there are a lot of possible #definitions and there's no reason to define these particular two in the main Xtensa makefile. A user can add any #define to XTENSA_EXTRA_CFLAGS.
BUG=340206722
@tensorflow/micro

PR#2573 updated the corstone-300 simulator download.  This resulted in the path to the simulator binary changing.  This PR updates the PATH environment.

bug=fixes tensorflow#2578
@tensorflow/micro

Update README to use cortex-m4 (it has instruction cycle timer)

Update README sample output to reflect cortex-m4

Update test script to not use Ethos-U co-processor (instruction cycle timer non-functional in simulator) when running benchmark.

bug=fixes tensorflow#2580
* Update path for new corstone300 downloads
 * Add missing benchmark arena size to generic benchmark test
 
BUG=Corstone300 Ci Job fails to run
Author: Ryan O'Shea <ryan.oshea3@arm.com>
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
@tensorflow/micro

Add person_detection_vela.tflite to tensorflow/lite/micro/models.

Use the ethos-u co-processor and ethos-u enabled model when running benchmark.

bug=fixes tensorflow#2591
When running the gen_micro_mutable_op_resolver script as a regular python script without bazel, it cannot find visualize because it is not part of the tflite-micro wheel. When running the script with bazel, bazel can pick up visualize from the path
tflite_micro/tensorflow/lite/tools as long as tflite-micro wheel is not installed. If it is installed, then bazel will only look at that, which it is not a part of.

This PR switches the import to just be from tensorflow, which should work regardless of whether it is from the tf package or relative path.

BUG=tensorflow#2564
…ow#2589)

The change introduces the support for ML models with 16 bit activations and 8 bit weights in the ExpandDims operation.

BUG=fixes #68293
The TFLiteConverter recently switched over to using per-channel quantization for all Dense/FullyConnected layers. TFLite-Micro does not yet have support for this, and was using incorrect quantization parameters for FullyConnected layers on newly converted models. Unsurprisingly, this leads to invalid output.

While we intend to add per-channel quantization support for FullyConnected, this PR adds a runtime check for per-channel quantization until it can be supported by individual kernels. If you encounter this runtime error, you can disable the new Converter behavior by setting:

`TfLiteConverter._experimental_disable_per_channel_quantization_for_dense_layers = True` https://github.com/tensorflow/tensorflow/blob/377f47694fa790e98db6665b9adecde00b5e0d68/tensorflow/lite/python/lite.py#L674

BUG=b/324385802
Add `zephyr/module.yml` to enable repo as zephyr module.

Signed-off-by: Jordan Yates <jordan@embeint.com>
Add a script which automates the process of exporting the third party
dependencies for Zephyr.

Signed-off-by: Jordan Yates <jordan@embeint.com>
Export third party sources with `zephyr_static_export.sh`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
@JordanYates
Copy link
Author

Turns out main is the branch kept up to date, not zephyr, so this PR was targeting the wrong place.
See #6

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.