Arun Raghavan pushed to branch master at PulseAudio / webrtc-audio-processing
Commits: b22ce018 by Alper Nebi Yasak at 2024-12-30T14:16:43-05:00 meson: Drop obsolete WEBRTC_DETECT_NEON macro Upstream has dropped runtime checks for NEON instructions around 2016, and the WEBRTC_DETECT_NEON macro is removed along with it. Disable NEON when building with -Dneon=runtime and omit a warning instead. Link: https://webrtc.googlesource.com/src/+/e305d956c0717a28ca88cd8547e5b310dfa74594 Signed-off-by: Alper Nebi Yasak <[email protected]> - - - - - 8b025599 by Alper Nebi Yasak at 2024-12-30T14:16:43-05:00 meson: Set WEBRTC_HAS_NEON macro after handling neon build option The WEBRTC_HAS_NEON macro that enables using NEON implementations is unconditionally set for arm64 and the 'neon' build option is ignored, assuming we always want to use the NEON-specific implementations instead of generic ones. This is an OK assumption to make because arm64 CPUs always support NEON. But the code handling the build option ended up quite convoluted. As part of cleaning up, set the relevant cflags after we handle the build option. This also means that we can make 'runtime' fall back to 'no', and disable NEON-specific code with -Dneon=no. Signed-off-by: Alper Nebi Yasak <[email protected]> - - - - - 6c914be9 by Alper Nebi Yasak at 2024-12-30T14:16:43-05:00 meson: Make -Dneon=no disable neon-specific code When the neon build option is set to 'no', we should disable optimized implementations that use NEON. Change have_neon to false in that case, so that we skip the flags and skip building NEON-specific files. Signed-off-by: Alper Nebi Yasak <[email protected]> - - - - - b7a194f8 by Alper Nebi Yasak at 2024-12-30T14:16:43-05:00 meson: Check arm neon support before parsing neon option The main if statment for the NEON option has been quite convoluted. The previous commits reduced what it does to a simple case: check NEON support and set have_neon on 32-bit ARM CPUs. Do that near the architecture definitions. Signed-off-by: Alper Nebi Yasak <[email protected]> - - - - - fc5a4946 by Alper Nebi Yasak at 2024-12-30T14:17:32-05:00 meson: Set 'auto' as the default neon option value The default for the neon build option is 'no', which disabled NEON code for 32-bit ARM but enabled it for ARM64. Now that 'no' can disable NEON code for ARM64, the default should be 'auto' which would enable it where possible. Handle the 'auto' value, and set it as the default. Signed-off-by: Alper Nebi Yasak <[email protected]> - - - - - 2493b6e6 by Alper Nebi Yasak at 2024-12-30T14:18:00-05:00 meson: Raise error for setting 'neon' when unsupported We can set -Dneon=yes on x86, which will fail during build because the x86 compiler doesn't understand the resulting `-mfpu=neon` flag. Make the 'neon' build option cause an error in the setup stage if we didn't detect hardware support for NEON. Signed-off-by: Alper Nebi Yasak <[email protected]> - - - - - 73aed233 by Alper Nebi Yasak at 2024-12-30T14:18:44-05:00 meson: Use neon_opt to control building neon files Using the have_neon boolean to enable NEON code means we have to either fully enable it or fully disable it. When using -Dneon=runtime, ideally only the parts that support runtime checks would be built for NEON, and those that don't would be built without NEON. Though, there are no longer any runtime checks for NEON anywhere, so it's equivalent to 'no' with a warning. In general, we should use have_* variables to indicate compiler support, and *_opt options to choose if and how we want to utilize that. Use neon_opt to control NEON compilation and avoid modifying have_neon which now would fully refer to compiler support. Signed-off-by: Alper Nebi Yasak <[email protected]> - - - - - d63a2c97 by Alper Nebi Yasak at 2024-12-30T14:19:07-05:00 meson: pffft: Warn about not having runtime neon checks The pffft.c file does not have runtime checks for NEON, and silently falls back to disabling it when the neon option is 'runtime'. Print a warning in this case. Signed-off-by: Alper Nebi Yasak <[email protected]> - - - - - 54a632f0 by Arun Raghavan at 2024-12-30T16:21:08-05:00 meson: Convert the 'neon' option into a feature Easier to express things, now that runtime is a no-op. - - - - - 774ac54e by Arun Raghavan at 2024-12-30T16:21:20-05:00 meson: Only disable SIMD for non-SSE machines on x86 This ended up disabling SIMD everywhere except where SSE/AVX was enabled. - - - - - 5 changed files: - meson.build - meson_options.txt - webrtc/common_audio/meson.build - webrtc/modules/audio_processing/meson.build - webrtc/third_party/pffft/meson.build Changes: ===================================== meson.build ===================================== @@ -111,6 +111,7 @@ endif arch_cflags = [] have_arm = false have_armv7 = false +have_arm64 = false have_neon = false have_mips = false have_mips64 = false @@ -130,12 +131,14 @@ if host_machine.cpu_family() == 'arm' have_armv7 = true arch_cflags += ['-DWEBRTC_ARCH_ARM_V7'] endif + if cc.compiles('#include <arm_neon.h>', args : '-mfpu=neon') + have_neon = true + endif endif -if cc.compiles('''#ifndef __aarch64__ -#error no aarch64 arch -#endif''') +if host_machine.cpu_family() == 'aarch64' + have_arm64 = true have_neon = true - arch_cflags += ['-DWEBRTC_ARCH_ARM64', '-DWEBRTC_HAS_NEON'] + arch_cflags += ['-DWEBRTC_ARCH_ARM64'] endif if ['mips', 'mips64'].contains(host_machine.cpu_family()) have_mips = true @@ -160,16 +163,12 @@ if ['x86', 'x86_64'].contains(host_machine.cpu_family()) endif endif -neon_opt = get_option('neon') -if neon_opt != 'no' and not have_neon - if neon_opt != 'runtime' - if cc.compiles('#include <arm_neon.h>', args : '-mfpu=neon') - arch_cflags += ['-mfpu=neon', '-DWEBRTC_HAS_NEON'] - have_neon = true - endif - else - arch_cflags += ['-DWEBRTC_DETECT_NEON', '-mfpu=neon'] - have_neon = true +neon_opt = get_option('neon').require(have_neon) + +if neon_opt.enabled() + arch_cflags += ['-DWEBRTC_HAS_NEON'] + if not have_arm64 + arch_cflags += ['-mfpu=neon'] endif endif ===================================== meson_options.txt ===================================== @@ -1,8 +1,8 @@ option('gnustl', type: 'feature', value: 'auto', description: 'Use gnustl for a c++ library implementation (only used on Android)') -option('neon', type: 'combo', - choices: ['no', 'yes', 'auto', 'runtime'], +option('neon', type: 'feature', + value: 'auto', description: 'Enable NEON optimisations') option('inline-sse', type: 'boolean', value: true, ===================================== webrtc/common_audio/meson.build ===================================== @@ -112,7 +112,7 @@ if have_armv7 ] endif -if have_neon +if neon_opt.enabled() common_audio_sources += [ 'fir_filter_neon.cc', 'resampler/sinc_resampler_neon.cc', ===================================== webrtc/modules/audio_processing/meson.build ===================================== @@ -180,7 +180,7 @@ else ] endif -if have_neon +if neon_opt.enabled() webrtc_audio_processing_sources += [ 'aecm/aecm_core_neon.cc', ] ===================================== webrtc/third_party/pffft/meson.build ===================================== @@ -4,7 +4,7 @@ pffft_sources = [ pffft_cflags = [ '-D_GNU_SOURCE' ] -if not have_inline_sse or (have_arm and not have_neon) or (have_mips and host_machine.endian() == 'little') or have_mips64 +if (have_x86 and not have_inline_sse) or (have_arm and not neon_opt.enabled()) or (have_mips and host_machine.endian() == 'little') or have_mips64 pffft_cflags += [ '-DPFFFT_SIMD_DISABLE' ] endif View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/compare/a1ccd6c7001c285d936d742cddeb473cf89db355...774ac54e71d71e222918e49baec1e9dc203d2ed8 -- View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/compare/a1ccd6c7001c285d936d742cddeb473cf89db355...774ac54e71d71e222918e49baec1e9dc203d2ed8 You're receiving this email because of your account on gitlab.freedesktop.org.
