Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@amazon.com>2023-11-29 07:18:50 +0300
committerJean-Marc Valin <jmvalin@amazon.com>2023-11-29 07:18:50 +0300
commit08eefed7cc81c82382c2b7a34e7465868f9da885 (patch)
tree0628e1fbf61258e70d9c4cbd1de2204d693e2f3e
parentc28b0f10bc6f683ddfb025781960f92d1d3b52e1 (diff)
Add dotprod support to meson
Also default to disabling dnn float debugging
-rw-r--r--dnn/meson.build4
-rw-r--r--meson.build57
-rw-r--r--meson_options.txt1
3 files changed, 59 insertions, 3 deletions
diff --git a/dnn/meson.build b/dnn/meson.build
index 877f6434..6e520fbc 100644
--- a/dnn/meson.build
+++ b/dnn/meson.build
@@ -10,7 +10,7 @@ dnn_sources_sse4_1 = sources['DNN_SOURCES_SSE4_1']
dnn_sources_avx2 = sources['DNN_SOURCES_AVX2']
dnn_sources_neon_intr = sources['DNN_SOURCES_NEON']
-dnn_sources_dotprod = sources['DNN_SOURCES_DOTPROD']
+dnn_sources_dotprod_intr = sources['DNN_SOURCES_DOTPROD']
dnn_includes = [opus_includes]
dnn_static_libs = []
@@ -25,7 +25,7 @@ if host_cpu_family in ['arm', 'aarch64'] and have_arm_intrinsics_or_asm
endif
endif
-foreach intr_name : ['sse2', 'sse4_1', 'avx2', 'neon_intr']
+foreach intr_name : ['sse2', 'sse4_1', 'avx2', 'neon_intr', 'dotprod_intr']
have_intr = get_variable('have_' + intr_name)
if not have_intr
continue
diff --git a/meson.build b/meson.build
index e64e6e28..289c5917 100644
--- a/meson.build
+++ b/meson.build
@@ -174,6 +174,10 @@ if disable_float_api
opus_conf.set('DISABLE_FLOAT_API', 1)
endif
+if not get_option('enable-dnn-debug-float')
+ opus_conf.set('DISABLE_DEBUG_FLOAT', 1)
+endif
+
# This is for the description in the pkg-config .pc file
if opt_fixed_point
pc_build = 'fixed-point'
@@ -314,6 +318,15 @@ if not opt_asm.disabled()
rtcd_support += ['NEON']
endif
endif
+ if opus_arm_may_have_dotprod
+ opus_conf.set('OPUS_ARM_MAY_HAVE_DOTPROD', 1)
+ if opus_arm_presume_dotprod
+ opus_conf.set('OPUS_ARM_PRESUME_DOTPROD', 1)
+ asm_optimization += ['DOTPROD']
+ else
+ rtcd_support += ['DOTPROD']
+ endif
+ endif
if cc.get_define('__APPLE__')
arm2gnu_args = ['--apple']
@@ -340,12 +353,14 @@ endif
# -mfloat-abi=softfp to enable NEON. F.ex., on Android. It should
# be set in the cross file.
arm_neon_intr_link_args = ['-mfpu=neon']
+arm_dotprod_intr_link_args = ['-march=armv8.2-a+dotprod']
have_sse = false
have_sse2 = false
have_sse4_1 = false
-have_avx2 = false # no avx opus code yet
+have_avx2 = false
have_neon_intr = false
+have_dotprod_intr = false
intrinsics_support = []
if not opt_intrinsics.disabled()
@@ -421,6 +436,46 @@ if not opt_intrinsics.disabled()
else
message('Compiler does not support @0@ intrinsics'.format(intrin_name))
endif
+
+ # Check for ARMv8.2 dotprod intrinsics
+ intrin_check = '''
+ #include <arm_neon.h>
+ int main (void) {
+ static int8x16_t a, b;
+ static int32x4_t SUMM;
+ SUMM = vdotq_s32(SUMM, a, b);
+ return (int)vgetq_lane_s32(SUMM, 0);
+ }'''
+ intrin_name = 'AArch64 DOTPROD'
+ if cc.links(intrin_check,
+ name: 'compiler supports @0@ intrinsics'.format(intrin_name))
+ opus_arm_presume_dotprod_intr = opus_can_presume_simd
+ opus_arm_may_have_dotprod_intr = true
+ else
+ opus_arm_presume_dotprod_intr = false
+ if cc.links(intrin_check,
+ args: arm_dotprod_intr_link_args,
+ name: 'compiler supports @0@ intrinsics with @1@'.format(intrin_name, ' '.join(arm_dotprod_intr_link_args)))
+ opus_arm_may_have_dotprod_intr = true
+ else
+ opus_arm_may_have_dotprod_intr = false
+ endif
+ endif
+
+ if opus_arm_may_have_dotprod_intr
+ have_dotprod_intr = true
+ intrinsics_support += [intrin_name]
+ opus_conf.set('OPUS_ARM_MAY_HAVE_DOTPROD', 1)
+ if opus_arm_presume_dotprod_intr
+ opus_conf.set('OPUS_ARM_PRESUME_DOTPROD', 1)
+ else
+ rtcd_support += [intrin_name]
+ opus_dotprod_intr_args = arm_dotprod_intr_link_args
+ endif
+ else
+ message('Compiler does not support @0@ intrinsics'.format(intrin_name))
+ endif
+
elif host_cpu_family in ['x86', 'x86_64']
# XXX: allow external override/specification of the flags
x86_intrinsics = [
diff --git a/meson_options.txt b/meson_options.txt
index d558ee07..d5b69eea 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -9,6 +9,7 @@ option('intrinsics', type : 'feature', value : 'auto', description : 'Intrinsics
option('enable-deep-plc', type : 'boolean', value : false, description : 'Enable Deep Packet Loss Concealment (PLC)')
option('enable-dred', type : 'boolean', value : false, description : 'Enable Deep Redundancy (DRED)')
+option('enable-dnn-debug-float', type : 'boolean', value : false, description : 'Compute DNN using float weights')
option('custom-modes', type : 'boolean', value : false, description : 'Enable non-Opus modes, e.g. 44.1 kHz & 2^n frames')
option('extra-programs', type : 'feature', value : 'auto', description : 'Extra programs (demo and tests)')