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

Information request - DO NOT MERGE #113

Closed
wants to merge 68 commits into from

Conversation

andresovela
Copy link

@andresovela andresovela commented Oct 22, 2024

Since this repo does not have issues enabled, I didn't know how to reach out other than by opening a random PR.

I'm developing an application using HiFi kernels in TFLM for an NXP RT600, and I have several questions regarding this repository:

Sorry about the PR, I just didn't know how else to answer these questions.

ArmRyan and others added 30 commits May 16, 2024 15:40
* Updates x86 corstone300 version
 
 BUG=Corstone300 tests were not able to be ran on aarch64 hosts
 Author: Ryan O'Shea <[email protected]>
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 <[email protected]>
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
Change link of system_setup.h

BUG=cleanup
In this way an AOT can add metadata that could then be accessed with the couple GetCurrentSubgraphIndex, GetCurrentOperatorIndex.
These can be accessed from tflite::GetMicroContext(context)->graph()

Refers to tensorflow#2593
BUG=tensorflow#2593
The CI sync from the upstream TF has been failing for the last month due
to the relocation of certain TFLite files. In particular, some schema
files were relocated to tensorflow/compiler/mlir/lite subfolder. This PR
mirrors the migration and adds a few redirection headers to ensure
source compatibility for now.

This PR also includes a TF sync as well to get us caught up again. While
that could have been done separately, this is done together to ensure
everything continues to build with the relocations.

BUG=b/351824449
BUG="static code analysis result update"

Build test was done with the command below
  make -f tensorflow/lite/micro/tools/make/Makefile test

There will be an additional pull request later related to static code analysis
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
* Adds additional checks to various cmsis-nn prepare functions

BUG=1121
Authored-by: Ryan O'Shea <[email protected]>
Change-Id: Ic6481873f064a94a4dd0b4a49790842180d73dd9
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
Add the Python distribution package `hexdump`, to be used in tests
and utilities which display raw memory.

BUG=tensorflow#2636
Hoist the universally-useful tflite::Span out of
codegen/runtime/micro_codegen_context.h and into an independent header
usable from elsewhere in the project.

BUG=tensorflow#2636
* Update Ethos-U driver to the latest (v24.05)
* Allow passing extra C flags to the driver from the command line.
* Fixes tensorflow#2619

Note I tested with `TARGET=cortex_m_corstone_300 test_network_tester_test` and on real hardware as well built with:
```bash
make -j12 -f tensorflow/lite/micro/tools/make/Makefile \
TARGET=cortex_m_generic TARGET_ARCH=cortex-m55 \
CO_PROCESSOR=ethos_u ETHOSU_ARCH=u55 OPTIMIZED_KERNEL_DIR=ethos_u  \
CORE_OPTIMIZATION_LEVEL=-O2 KERNEL_OPTIMIZATION_LEVEL=-O2 \
THIRD_PARTY_KERNEL_OPTIMIZATION_LEVEL=-O2 \
TARGET_TOOLCHAIN_ROOT=/opt/arm-none-eabi/bin/ \ 
TARGET_TOOLCHAIN_PREFIX=arm-none-eabi- BUILD_TYPE=release microlite
```

BUG=tensorflow#2619
The updated Ethos-U driver v24.05 (introduced in tensorflow#2626), contains a second set of device functions for the U85. This can cause the linker to link the functions of the U85, instead of the U55-U65, if they're both included in the driver's sources files. Therefore a glob pattern can no longer be used to collect the driver's source files in the Makefile.

BUG=tensorflow#2639
The core platform sources were overwritten by typo. I tested this patch by triggering the Cortex-M workflow manually, and it completed successfully. See the run here in my fork:

https://github.com/iabdalkader/tflite-micro/actions/runs/10113795223

BUG=tensorflow#2639
mansnils and others added 24 commits September 23, 2024 15:47
BUG=uint16 missing in TfLiteTypeSizeOf
* Sync from upstream TF.

* Fix upstream TF Sync

The CI sync from the upstream TF has been failing for the last month
due to the relocation of certain TFLite files. In particular, the
error_reporter sources were moved to the compiler subdirectory.

This PR also includes a full sync to get us caught up again.

BUG=b/369123029

---------

Co-authored-by: TFLM-bot <[email protected]>
Numpy 2.0 will explicitly downcast now, which casues us to see a regerssion in the conversion for the audio model.

BUG=[361070678](https://b.corp.google.com/issues/361070678)
MicroPrintf is not found in some builds, added header include.

BUG=[369123029](https://b.corp.google.com/issues/369123029)
In the non_persistent_buffer_planner_shim_test, a tflite::BufferPlan is created using a statically allocated buffer. A static array is allocated and the address of it is used with a reinterpret_cast. This is undefined behavior, as it could result in misaligned member accesses. This PR forces the statically allocated array to align as if it was a tflite::BufferPlan, and then uses placement new to construct it within the buffer.

BUG=none
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
This PR adds int16 support to OP_RELU6. This is already supported in TF Lite.

bug=tensorflow#2681
BUG=missing build support for Ethos-U85
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
…#2673)

Adds per channel quantization support for fully connnected reference and cmsis-nn kernel.

BUG=missing support for FC per channel quantization
Add a --quiet option to the code_generator binary so that when it's used
within the build system, it doesn't print unexpected, distracting noise
to the console. Generally, compiler or generator commands don't print
output unless there's an error.

BUG=description
…flow#2709)

Add a .style.yapf file so yapf can be used to style Python code without
passing the project's style via command line option. Remove the
corresponding patch to pigweed's call to yapf, used by CI, and instead
let it too rely on .style.yapf. Remove the developer documentation's
instruction to use the command line option.

BUG=description
@tensorflow/micro

Add documentation describing some compression/decompression internals and makefile build procedures.

bug=tensorflow#2710
@cad-audio
Copy link
Owner

cad-audio commented Nov 2, 2024

Hi,
Yes, this tflite-micro fork is from Cadence.
In general, this fork has latest optimizations, so it should be okay to rely on this fork if you care about those.
Though it has fallen behind last few months, we intend to keep this repo in sync with main tflm repo (https://github.com/tensorflow/tflite-micro).
We also plan to upstream Xtensa optimizations from here to main tflm repo, but those may take some time.
You should use 'hifi_nnlib_latest_versions' branch from this fork.

@andresovela
Copy link
Author

Thank you for the answer! :)

@andresovela andresovela closed this Nov 2, 2024
@andresovela andresovela deleted the profiling-improvements branch November 2, 2024 03:32
@andresovela andresovela restored the profiling-improvements branch November 4, 2024 12:16
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.