Skip to content

Commit

Permalink
Fix patch file for Nature NDSP library for hifi3 (#2541)
Browse files Browse the repository at this point in the history
BUG=327609938
  • Loading branch information
shlmregev authored May 2, 2024
1 parent a32a33b commit ed36c46
Showing 1 changed file with 43 additions and 7 deletions.
50 changes: 43 additions & 7 deletions tensorflow/lite/micro/tools/make/ext_libs/ndsplib-hifi3.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,45 @@
diff --git a/library/include/NatureDSP_Signal_math.h b/library/include/NatureDSP_Signal_math.h
index 2ffea63..eff0e47 100644
index 2ffea63..adf08ab 100644
--- a/library/include/NatureDSP_Signal_math.h
+++ b/library/include/NatureDSP_Signal_math.h
@@ -38,7 +38,7 @@ extern "C" {
vec_log Logarithm
vec_antilog Antilogarithm
vec_sqrt Square Root
- vec_rsqrt Reciprocal Square Root
+ vec_rsqrt Reciprocal Square Root
vec_sine,vec_cosine Sine/Cosine
vec_tan Tangent
vec_atan Arctangent
@@ -384,9 +384,9 @@ int32_t scl_sqrt64x32(int64_t x);
part left by exponent value.

Mantissa accuracy is 1 LSB, so relative accuracy is:
- vec_rsqrt16x16, scl_rsqrt16x16 6.2e-5
- scl_rsqrt32x32 2.4e-7
- vec_rsqrt32x32 9.2e-10
+ vec_rsqrt16x16, scl_rsqrt16x16 6.2e-5
+ scl_rsqrt32x32 2.4e-7
+ vec_rsqrt32x32 9.2e-10

Precision:
16x16 16-bit inputs, 16-bit output. Accuracy: 2LSB
@@ -406,11 +406,11 @@ int32_t scl_sqrt64x32(int64_t x);
----------------
Returned packed value:
scl_rsqrt32x32():
- bits 23…0 fractional part
- bits 31…24 exponent
+ bits 23�0 fractional part
+ bits 31�24 exponent
scl_rsqrt16x16():
- bits 15…0 fractional part
- bits 31…16 exponent
+ bits 15�0 fractional part
+ bits 31�16 exponent

-------------------------------------------------------------------------*/
void vec_rsqrt32x32 ( int32_t * frac, int16_t * exp, const int32_t * x, int N);
@@ -635,6 +635,7 @@ float32_t scl_atan2f (float32_t y, float32_t x);
return result, Q16.15
-------------------------------------------------------------------------*/
Expand Down Expand Up @@ -63,32 +101,30 @@ index 20206e4..74d4d42 100644
#ifdef __cplusplus
#define externC extern "C"
diff --git a/library/include_private/fft_real_twiddles.h b/library/include_private/fft_real_twiddles.h
index 10cd4b2..c5fe6b9 100644
index 10cd4b2..eb5765f 100644
--- a/library/include_private/fft_real_twiddles.h
+++ b/library/include_private/fft_real_twiddles.h
@@ -44,7 +44,10 @@
@@ -44,7 +44,9 @@
7 128
*/

+#if !defined MAX_RFFT_PWR
#define MAX_RFFT_PWR 13
+#endif
+
#define MAX_RFFT_LEN (1<<MAX_RFFT_PWR)

extern const int16_t twiddleSplit[MAX_RFFT_LEN/2];
diff --git a/library/include_private/fft_real_twiddles_24x24.h b/library/include_private/fft_real_twiddles_24x24.h
index 3017c61..1e52320 100644
index 3017c61..fd1e2ba 100644
--- a/library/include_private/fft_real_twiddles_24x24.h
+++ b/library/include_private/fft_real_twiddles_24x24.h
@@ -44,7 +44,10 @@
@@ -44,7 +44,9 @@
7 128
*/

+#if !defined MAX_RFFT_PWR
#define MAX_RFFT_PWR 13
+#endif
+
#define MAX_RFFT_LEN (1<<MAX_RFFT_PWR)

extern const int32_t twiddleSplit24x24[MAX_RFFT_LEN/2];

0 comments on commit ed36c46

Please sign in to comment.