From 6089f9a057e9f3639a1e750252df3bf54a3b5dfa Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Jul 2021 17:37:19 +0200 Subject: [PATCH] NEON arch: dead ref cycle fix: when neon_available_ is ON, the DotProduct was set to point to DotProduct, which should have been DotProductNative, as dotProduct is the *target* global itself: see simddetect.h --> effectively making that part of the SetDotProduct() call identical to this (no-op) statement: `DotProduct = DotProduct;` Also added the Neon check in the Update() API, where it exists together with the other checks (for AVX/SSE/etc.) --- src/arch/simddetect.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/arch/simddetect.cpp b/src/arch/simddetect.cpp index 6c7f822239..5561728fbf 100644 --- a/src/arch/simddetect.cpp +++ b/src/arch/simddetect.cpp @@ -258,7 +258,7 @@ SIMDDetect::SIMDDetect() { #if defined(HAVE_NEON) || defined(__aarch64__) } else if (neon_available_) { // NEON detected. - SetDotProduct(DotProduct, IntSimdMatrix::intSimdMatrixNEON); + SetDotProduct(DotProductNative, IntSimdMatrix::intSimdMatrixNEON); #endif } } @@ -308,6 +308,12 @@ void SIMDDetect::Update() { // SSE selected by config variable. SetDotProduct(DotProductSSE, IntSimdMatrix::intSimdMatrixSSE); dotproduct_method = "sse"; +#endif +#if defined(HAVE_NEON) || defined(__aarch64__) + } else if (!strcmp(dotproduct.c_str(), "neon") && neon_available_) { + // NEON selected by config variable. + SetDotProduct(DotProductNative, IntSimdMatrix::intSimdMatrixNEON); + dotproduct_method = "neon"; #endif } else if (!strcmp(dotproduct.c_str(), "std::inner_product")) { // std::inner_product selected by config variable.