Commit graph

1495 commits

Author SHA1 Message Date
cad-audio
258cf48f95
Adding streaming_conv reference code. (#2521)
* Adding streaming_conv reference code.

* Streaming conv support under xtensa

* Enabled HiFi5 support for streaming conv kernel.

* Add bazel build rules for streaming_conv

* Fix formatting

* Fix dims_shape array type

* Fix VP6 build

* Fix asan error

* Disable streaming conv test on HIFIMINI & VP6

---------

Co-authored-by: Nileshkumar Vaishnav <nileshv@cadence.com>
Co-authored-by: RJ Ascani <rjascani@google.com>
2024-04-23 08:33:44 -07:00
RJ Ascani
ba203cf8a2
Create streaming conv script (#2550)
This adds a new script that can identify the kws_streaming conv2d
pattern and replace this pattern with the custom Xtensa StreamingConv2d
operator.

BUG=b/327502734
2024-04-19 16:37:28 -07:00
RJ Ascani
8c4273f08d
Parse StreamingConv2D operator (#2500)
The prototype streaming conv2d operator re-uses the Conv2D options, so
we can re-use the ParseConv2D function for parsing the flatbuffer
options.

BUG=b/327502734
2024-03-12 10:08:03 -07:00
RJ Ascani
4f5ed241b1
Fix tests_entry & tests_post workflows (#2493) (#2494)
The tests_entry workflow was invalid due to parsing error when a `==`
was expected instead of `=`. The tests_post needed to remove the
ci:run_full label.

BUG=b/327686165
2024-03-08 09:33:56 -08:00
RJ Ascani
dd0ac1c701 Merge branch 'main' into streaming_conv 2024-03-06 23:13:45 +00:00
RJ Ascani
1f7f54b95e
Fix GitHub workflow conditionals (#2489)
BUG=b/327686165
2024-03-04 23:56:23 +00:00
RJ Ascani
9adee084ec
Remove experimental flag for per-channel FC quantization (#2482)
Per-channel quantization in fully connected layers are still not supported by TFLM, but the converter now has proper support so we can remove the flag.

BUG=cl/610755484
2024-02-28 18:45:56 +00:00
RJ Ascani
20fd5b23ac
Prevent runtime_shape.cc removal during sync (#2484)
Despite existing in TFLite, the runtime_shape.h has long differed
between TFLite and TFLM. The file is not copied during the sync and the
sync script does a `git checkout` on the file to ensure that the
existing version in the TFLM tree remains.

In PR #2476, we needed to add a runtime_shape.cc file. This PR ensures
that the runtime_shape.cc file will not be removed during the sync by
performing a `git checkout` on the existing file.

BUG=323856831
2024-02-28 10:20:50 -08:00
Shlomi Regev
b991e726b0
Fix a linker error: undefined kMaxSmallSize (#2476)
When building with a recent version of xt-clang and -std=c++11, the linker errs on missing definition of a static constexpr class member. In C++11, static class members still had to be defined in a C++11 file and TFLM code is expected to be compatible with C++11.

BUG=323856831
2024-02-27 14:35:14 +00:00
RJ Ascani
0445accf11
Use absl::Status instead of tsl::Status (#2477)
tsl::Status has been deprecated and is just an alias for absl::Status. This PR updates the usage to just use absl::Status directly.

BUG=cl/609910156
2024-02-27 03:19:11 +00:00
Alpha BAO
cfa4c91d1b
Fix array out-of-bounds access in WideDynamicFuncLut (#2468)
### Problem description:

In the original code, pointer arithmetic of gain_lut and the assignment of gain_lut[4 * interval + 3] could potentially lead to out-of-bounds array access.
On certain architectures (e.g., macOS ARM64), this out-of-bounds access causes the program to crash.
BUG=None, reported issue#2464

### Solution:

Increase the size of the gain_lut_storage array by 1 to provide an extra buffer and prevent overflow during the calculation within the loop.

### Risks and considerations:

Increasing the array size will slightly increase memory usage.
In extremely resource-constrained systems, alternative algorithm implementations may need to be considered.
2024-02-24 05:40:47 +00:00
Måns Nilsson
8085cecefc
Add kernel build flag for prioritizing speed or size (#2408)
Adds a build flag that can be used by any kernel to provide a different implementation depending on use case.
Adds a first use case for cmsis-nn transpose conv.

The background for this PR is in https://github.com/tensorflow/tflite-micro/pull/2345

BUG=none
2024-02-23 18:03:57 +00:00
Måns Nilsson
f5e498b68b
cmsis-nn: update fully connected int8 (#2469)
- Adds non zero filter offset support.
- Adds support for batch matmul like behavior where weights are like input, i.e. not initialized before eval.

BUG=non zero filter offset not supported for CMSIS-NN
2024-02-23 17:41:53 +00:00
RJ Ascani
29526e413b
Replace tensorflow-cpu usage with tensorflow (#2396)
The tensorflow-cpu package does not support MacOS or non-x86 hardware. Replacing the tensorflow-cpu python package requirement with the tensorflow meta package should enable the bazel build and the dependent python scripts to be used on those platforms.

BUG=#2367, #1781
2024-02-23 00:35:22 +00:00
RJ Ascani
a7238a13e0
Disable per channel quantization for FC layers (#2465)
BUG=b/324385802
2024-02-22 21:32:07 +00:00
RJ Ascani
31196328df
Add workflow_call to cortex_m.yml (#2466)
This is to allow the cortex m workflow to be called from other
workflows.

BUG=cleanup
2024-02-22 13:08:41 -08:00
RJ Ascani
ab767105ff
Add missing micro_context dependency (#2462)
BUG=cleanup
2024-02-22 00:24:31 +00:00
David Davis
09c796e8d4
Fix Corstone Ethos-U CI failure (#2460)
@tensorflow/micro

Capture size, then remove model size var from person_detect_model_data_vela.cc

Update model size var in person_detect_model_data.h

Add cortex_m_generic and cortex_m_corstone_300 tests to CI full run

bug=fixes #2455
2024-02-20 16:18:53 +00:00
Shlomi Regev
ce72f7b82d
Fix a linker error: undefined kMaxBufferCount (#2458)
When building with a recent version of xt-clang and -std=c++, the linker errs on missing definition of a static constexpr class member. In C++11, static class members still had to be defined in a C++11 file and TFLM code is expected to be compatible with C++11.

BUG=323856831
2024-02-16 18:22:53 +00:00
Shlomi Regev
699564d39e
Fix broken hifi3 NDSP lib patch file (#2457)
Not clear if/how it worked before, because there were no updates to the library since the patch was created.

BUG=322146544
2024-02-16 18:01:20 +00:00
Shlomi Regev
749892abf4
Remove unused variables in Xtensa implmenetation of LSTM. (#2456)
We only started getting "unused variable" errors with latest versions of the Xtensa toolchain.

BUG=323856831
2024-02-15 16:48:20 +00:00
Shlomi Regev
a00b9a0364
Remove initialized but unused variables. (#2453)
We're seeing these warnings/errors only with newer version of the Xtensa toolchains.
The warnings/errors can be silenced, but that might mask other occurances.

BUG=323856831
2024-02-14 17:46:03 +00:00
David Davis
66034beacf
Generic Benchmark Tool changes (#2451)
@tensorflow/micro

Add ability to build with a model chosen at compile time. Add README with build instructions.

bug=fixes #2450
2024-02-14 04:22:00 +00:00
Adrian Lundell
0ec823ed2f
Update CMSIS-NN CONV and LSTM implementations (#2446)
CONV
- Set filter_dims.c to allow for use of grouped convolution
- Additionally moves all consistency checks to the prepare stage

LSTM
- Updates CMSIS-NN download SHA
- New API for arm_lstm_unidirectional_s8
- New API for arm_vector_sum_s8

BUG=#2074, bit exactness of lstm kernel.
2024-02-09 20:33:05 +00:00
Shlomi Regev
a549448bb2
RISC-V target makefile: make the arch, abi and mcmodel configurable. (#2447)
These are the options that change between different riscv configurations.

BUG=321746747
2024-02-07 16:44:38 +00:00
TFLM-bot
42f4bb836a
Automated sync from github.com/tensorflow/tensorflow (#2445)
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
2024-02-06 16:29:07 +00:00
suleshahid
9d1dd7b0ca
revert xtensa include vector (#2441)
post merge is broken because of it, reverting for now.

BUG=[323060097](https://b.corp.google.com/issues/323060097)
2024-01-31 19:24:51 +00:00
TFLM-bot
13de409ade
Automated sync from github.com/tensorflow/tensorflow (#2414)
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
2024-01-31 18:03:55 +00:00
Måns Nilsson
f2b8cfcc88
cortex_m_corstone_300_makefile: add build fix workaround for armclang (#2416)
BUG=benchmark test does not build with armclang
2024-01-31 17:41:55 +00:00
suleshahid
fd3ca738e4
adds dep needed for xtensa fft (#2409)
BUG=[323060097](https://b.corp.google.com/issues/323060097)
2024-01-31 00:24:37 +00:00
Shlomi Regev
c93be16630
Add a makefile for generic Cortex-A targets. (#2405)
BUG=322777625
2024-01-30 16:35:36 +00:00
Måns Nilsson
0c4738a216
cmsis-nn: refactor conv to get rid of duplicate code (#2402)
BUG=Some duplicate code in cmsis-nn/conv.cc
2024-01-29 12:24:20 +00:00
RJ Ascani
324ae1eaba
Enable bool input for CAST (#2401)
BUG=none
2024-01-22 18:40:02 +00:00
RJ Ascani
4b2bdd1a6c
Remove unused visibility spec (#2403)
BUG=cleanup
2024-01-19 19:11:43 +00:00
RJ Ascani
73e419e793
Enable optimized ADD/SUB for HiFi5 (#2399)
The HiFi5 nnlib has the same optimized kernels for ADD and SUB as the HiFi4 nnlib, but the proper defines were not added to the kernel implementation. This was resulting in falling back to reference kernels for both of those operators on HiFi5.

BUG=none
2024-01-19 01:50:10 +00:00
RJ Ascani
2d80ee4dce
Enable tflm_benchmark on HiFi5 (#2400)
The tflm_benchmark utility runs fine on HiFi5. It is unclear why it was disabled.

BUG=none
2024-01-19 01:23:02 +00:00
TFLM-bot
21d72039cc
Automated sync from github.com/tensorflow/tensorflow (#2395)
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
2024-01-19 00:52:33 +00:00
RJ Ascani
2b5f0fdba1
Update TF Sync PR reviewer (#2398)
BUG=cleanup
2024-01-17 21:55:49 +00:00
suleshahid
fdf7876bbf
Remove unused BUILD load (#2397)
BUG=[318738218](https://b.corp.google.com/issues/318738218)
2024-01-17 18:20:19 +00:00
RJ Ascani
5399638a02
Remove dynamic allocation from VP6 Reduce kernel (#2394)
The Vision P6 reduce kernel used a temporary std::vector to calculate which axis should be reduced. This commit replaces that with an array of 4 elements because the number of axis to reduce should already be resolved to less than or equal to the input tensor rank, which is also limited to 4.

This commit also aligns variable naming conventions and types in this file for consistency.

BUG=b/287051090
2024-01-12 18:17:17 +00:00
RJ Ascani
a3296d6a29
Disable DTLN test on hifimini & VP6 (#2391)
The new DTLN test is failing on HiFi Mini & VP6. This PR disables the test on those targets while being investigated.

BUG=b/319712246
2024-01-11 23:11:48 +00:00
RJ Ascani
7a63bce432
Revert "Compute output shapes for some kernels (#2356)" (#2390)
This change broke some internal models, so reverting this until we can better understand why.

This also reverts PR #2383. When relanded, both should go back in together.

BUG=b/318738218
2024-01-11 22:24:58 +00:00
cad-audio
ca5358f468
DTLN example: (#2012)
Adding DTLN example to demonstrates LSTM layers on HiFi DSP and NOT for evaluating noise suppression quality.

BUG=none
2024-01-10 17:37:33 +00:00
RJ Ascani
85e19ddd45
Add missing ops to OpResolvers (#2386)
The PythonOpsResolver and the utility TflmOpResolver are intended to support all built-in ops allow for models to be tested without code changes. This PR syncs those op resolvers with all available ops from the MicroMutableOpResolver, notably adding BatchMatMul and the Signal ops.

Additionaly, this PR sorts the list alphabetically for readability and adds an alias for the utility TflmOpResolver since it is used in both the benchmarking tool and the layer by layer debugging tool.

BUG=cleanup
2024-01-10 02:50:40 +00:00
RJ Ascani
06499e832f
codegen: Remove make helpers for codegen (#2378)
This partially reverts commit 1e9b4c5d84. The make helpers for running the inference code generator were somewhat of a hack due to the desire to integrate a target-specific preprocessor binary as part of the process. Since that is no longer necessary, we can now switch over to just using Bazel for running the code generator.

BUG=b/294230402
2024-01-09 19:54:12 +00:00
Shlomi Regev
a9405e3233
Exclude xa_nn_activations_asym8_asym8.c from NNLib build for Hifi4 (#2384)
Due to an assembler error:
/tmp/xa_nn_activations_asym8_asym8-037a85.s: Assembler messages: /tmp/xa_nn_activations_asym8_asym8-037a85.s:470: Error: operand 3 of 'slli' has invalid value '0' clang-3.9: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
BUG=319139235
2024-01-09 18:16:47 +00:00
suleshahid
833f7bb84c
Add dep for codegen build (#2385)
BUG=[318738218](https://b.corp.google.com/issues/318738218)
2024-01-09 01:04:19 +00:00
Måns Nilsson
515cfd27e4
Adjust checks in reshape (#2383)
BUG=https://github.com/tensorflow/tflite-micro/issues/2382
2024-01-08 17:19:50 +00:00
Steven Toribio
95467d2066
removing usage of tflm_runtime and replacing usage with new runtime target target in g3 TFLM repo (#2375)
removing usage of `tflm_runtime` and replacing usage with new runtime target target in g3 TFLM repo

[g3 cl](https://critique.corp.google.com/cl/595884672)

BUG=[b/286456378](https://b.corp.google.com/issues/286456378)
2024-01-05 17:01:02 +00:00
RJ Ascani
f7c8793ed9
Fix layer_by_layer build (#2377)
The layer_by_layer tool re-uses the OpResolver from the benchmarking
utility, so the size of the MicroMutableOpResolver needs to be increased
in sync with each other.
2024-01-05 08:49:51 -08:00