From aed7c6ffc757245a9b0955a3f11a9b95a3c69de4 Mon Sep 17 00:00:00 2001 From: Rachel Guo <35738743+YUNQIUGUO@users.noreply.github.com> Date: Wed, 23 Aug 2023 10:13:19 -0700 Subject: [PATCH] Exclude fp16 support flag definition from minimal build (#17259) ### Description As title. ### Motivation and Context Reduce minimal build binary size for mobile to meet office team requirement. cc @chenfucn Co-authored-by: rachguo --- onnxruntime/core/mlas/inc/mlas.h | 2 ++ onnxruntime/core/mlas/lib/halfgemm_kernel_neon.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/onnxruntime/core/mlas/inc/mlas.h b/onnxruntime/core/mlas/inc/mlas.h index fd6b3df934..ab79559716 100644 --- a/onnxruntime/core/mlas/inc/mlas.h +++ b/onnxruntime/core/mlas/inc/mlas.h @@ -77,6 +77,7 @@ Abstract: #define MLAS_SUPPORTS_GEMM_DOUBLE #endif +#if !defined(ORT_MINIMAL_BUILD) || defined(ORT_EXTENDED_MINIMAL_BUILD) #if (!defined(_MSC_VER)) || (_MSC_VER >= 1930) #if defined(MLAS_TARGET_ARM64) || defined(MLAS_TARGET_ARM64EC) #if !defined(__APPLE__) @@ -90,6 +91,7 @@ Abstract: #endif // #endif // ARM64 #endif // Visual Studio 16 or earlier does not support fp16 intrinsic +#endif // !defined(ORT_MINIMAL_BUILD) || defined(ORT_EXTENDED_MINIMAL_BUILD) // // Basic Linear Algebra Subprograms (BLAS) types. diff --git a/onnxruntime/core/mlas/lib/halfgemm_kernel_neon.cpp b/onnxruntime/core/mlas/lib/halfgemm_kernel_neon.cpp index d7f5a90b00..35576b3e67 100644 --- a/onnxruntime/core/mlas/lib/halfgemm_kernel_neon.cpp +++ b/onnxruntime/core/mlas/lib/halfgemm_kernel_neon.cpp @@ -14,6 +14,8 @@ Abstract: --*/ +#if !defined(ORT_MINIMAL_BUILD) || defined(ORT_EXTENDED_MINIMAL_BUILD) + #include "mlasi.h" #include "halfgemm.h" @@ -185,3 +187,5 @@ const MLAS_HALFGEMM_DISPATCH MlasHalfGemmDispatchNeon = { MLAS_HALF_GEMM_KERNEL_NEON::KernelMaxM, 32 // kernel may read beyond buffer end by 32 bytes }; + +#endif // !defined(ORT_MINIMAL_BUILD) || defined(ORT_EXTENDED_MINIMAL_BUILD) \ No newline at end of file