cmake: build the Arm DOTPROD DNN kernels (vdotq_s32)#482
Open
czoli1976 wants to merge 1 commit into
Open
Conversation
CMake never compiled the int8 dot-product DNN tier: cmake/OpusSources.cmake
reads DNN_SOURCES_DOTPROD into ${dnn_sources_arm_dotprod}, but it was never
added to a target, and CMake had no Arm DOTPROD detection at all. As a
result, CMake builds with DNN features (DRED / OSCE / Deep PLC) ran the
multi-instruction vmull_s8 / vpadalq_s16 emulation in cgemv8x4 instead of the
one-instruction vdotq_s32 -- unlike the Autotools and Meson builds, which
wire it correctly.
Add an opus_detect_dotprod() compiler test (mirroring opus_detect_neon) and,
when supported, define OPUS_ARM_MAY_HAVE_DOTPROD and compile
${dnn_sources_arm_dotprod} (nnet_dotprod.c) with -march=armv8.2-a+dotprod.
The kernel is dispatched at runtime via the existing RTCD table; targets
without DOTPROD keep the NEON path.
Verified on Apple M4: `cmake -DOPUS_DRED=ON` now detects DOTPROD, compiles
nnet_dotprod.c with the flag, and links compute_linear_dotprod; the default
(non-DNN) build is unaffected.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CMake builds never compiled the int8 dot-product DNN tier.
cmake/OpusSources.cmakereadsDNN_SOURCES_DOTPRODinto${dnn_sources_arm_dotprod}, but that variable was never added to a target, and CMake had no Arm DOTPROD detection at all. So CMake builds with DNN features (DRED / OSCE / Deep PLC) ran the multi-instructionvmull_s8/vpadalq_s16emulation incgemv8x4instead of the one-instructionvdotq_s32— unlike the Autotools and Meson builds, which wire it correctly.Fix
opus_detect_dotprod()inOpusFunctions.cmake— a compiler test forvdotq_s32under-march=armv8.2-a+dotprod, mirroringopus_detect_neon().OpusConfig.cmake— call it on Arm and setOPUS_MAY_HAVE_DOTPRODwhen supported.CMakeLists.txt— when supported, defineOPUS_ARM_MAY_HAVE_DOTPRODand (for DNN builds) compile${dnn_sources_arm_dotprod}with the dotprod-marchflag.The kernel is dispatched at runtime via the existing RTCD table; non-DOTPROD targets keep the NEON path. This brings CMake in line with Autotools/Meson.
Verification (Apple M4)
cmake -DOPUS_DRED=ON: configure reportsCheck DOTPROD support by compiler ... Success,nnet_dotprod.ccompiles with-march=armv8.2-a+dotprod, andcompute_linear_dotprodis linked (previously absent).Independent of, and complementary to, #471 / #478 (which gate the Arm DNN RTCD source / fix a Windows-ARM linker issue when DNN is disabled); this adds the DOTPROD tier when DNN is enabled.