shithub: opus

Download patch

ref: c1535c8ccfcb31008ce5528deeb2f206f95ce3c9
parent: 0b9f6bab8114131dc70a9474d552072682a1593a
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Thu Jun 24 13:31:05 EDT 2021

Adding option to disable int8 dot products

--- a/dnn/configure.ac
+++ b/dnn/configure.ac
@@ -73,6 +73,14 @@
   AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
 ])
 
+AC_ARG_ENABLE([dot-product],
+	      AS_HELP_STRING([--disable-dot-product], [Disable dot product implementation]),,
+  enable_dot_product=yes)
+
+AS_IF([test "$enable_dot_product" = "no"], [
+       AC_DEFINE([DISABLE_DOT_PROD], [1], [Disable dot product instructions])
+])
+
 AS_CASE(["$ac_cv_search_lrintf"],
   ["no"],[],
   ["none required"],[],
@@ -114,8 +122,8 @@
 ------------------------------------------------------------------------
   $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
 
+    Dot product intrinsics ....... ${enable_dot_product}
     Assertions ................... ${enable_assertions}
-
     Hidden visibility ............ ${cc_cv_flag_visibility}
 
     API documentation ............ ${enable_doc}
--- a/dnn/vec.h
+++ b/dnn/vec.h
@@ -45,8 +45,10 @@
 
 #define NO_OPTIMIZATIONS
 
+#ifndef DISABLE_DOT_PROD
 #define DOT_PROD
 //#define USE_SU_BIAS
+#endif
 
 #ifdef DOT_PROD
 typedef signed char qweight;
--- a/dnn/vec_avx.h
+++ b/dnn/vec_avx.h
@@ -34,8 +34,10 @@
 
 #include <immintrin.h>
 
+#ifndef DISABLE_DOT_PROD
 #define DOT_PROD
 #define USE_SU_BIAS
+#endif
 
 #ifdef __AVX2__
 static inline __m256 exp8_approx(__m256 X)
--- a/dnn/vec_neon.h
+++ b/dnn/vec_neon.h
@@ -30,7 +30,9 @@
 
 #include <arm_neon.h>
 
+#ifndef DISABLE_DOT_PROD
 #define DOT_PROD
+#endif
 typedef signed char qweight;
 
 
--