From fab7f799a7fac819d334e9f337204caea5f067b7 Mon Sep 17 00:00:00 2001 From: Tracy Sharpe <42477615+tracysh@users.noreply.github.com> Date: Thu, 8 Oct 2020 18:03:45 -0700 Subject: [PATCH] MLAS: fix ARM64 + VS2017 build break (#5423) --- onnxruntime/core/mlas/lib/qgemm.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/onnxruntime/core/mlas/lib/qgemm.cpp b/onnxruntime/core/mlas/lib/qgemm.cpp index d22dccab15..0e1a69964a 100644 --- a/onnxruntime/core/mlas/lib/qgemm.cpp +++ b/onnxruntime/core/mlas/lib/qgemm.cpp @@ -1721,7 +1721,17 @@ Return Value: RowSums = vpadalq_u16(RowSums, vpaddlq_u8(v)); } +#if defined(_M_ARM64) + // N.B. The workaround of defining a local vaddvq_u32 doesn't work here + // as VS2019 added new intrinsics to make the operation work. Also, not + // all build environments using VS2019 have the up-to-date arm64_neon.h, + // so fallback to pairwise addition. + RowSums = vpaddq_u32(RowSums, RowSums); + RowSums = vpaddq_u32(RowSums, RowSums); + vst1q_lane_u32(reinterpret_cast(RowSumBuffer), RowSums, 0); +#else *RowSumBuffer = int32_t(vaddvq_u32(RowSums)); +#endif } }