@@ -19,9 +19,6 @@ Module Name:
1919#include " mlas_float16.h"
2020
2121#include " halfgemm.h"
22- #if defined(USE_KLEIDIAI)
23- #include " kleidiai/mlasi_kleidiai.h"
24- #endif
2522
2623#include < exception>
2724
@@ -63,8 +60,7 @@ MlasFp16AccelerationSupported()
6360#endif
6461}
6562
66- #if defined(USE_KLEIDIAI)
67- bool
63+ static bool
6864TryGetHalfGemmBackendSelectorConfig (
6965 size_t BatchN,
7066 const MLAS_HALF_GEMM_DATA_PARAMS * DataParams,
@@ -90,7 +86,6 @@ TryGetHalfGemmBackendSelectorConfig(
9086
9187 return true ;
9288}
93- #endif
9489
9590void
9691MLASCALL
@@ -126,15 +121,13 @@ MlasHalfGemmBatch(
126121 return ;
127122 }
128123
129- #if defined(USE_KLEIDIAI)
130124 const MLAS_BACKEND_KERNEL_SELECTOR_CONFIG * BackendKernelSelectorConfig = nullptr ;
131125 if (TryGetHalfGemmBackendSelectorConfig (BatchN, DataParams, BackendKernelSelectorConfig) &&
132126 GetMlasPlatform ().MlasHalfGemmBatchOverride != nullptr &&
133127 GetMlasPlatform ().MlasHalfGemmBatchOverride (
134128 M, N, K, BatchN, DataParams, ThreadPool, BackendKernelSelectorConfig)) {
135129 return ;
136130 }
137- #endif
138131
139132 // BIsPacked denotes the generic MLAS halfgemm packed-B layout and can be
140133 // consumed here. Backend-native packed layouts are separate and must not
@@ -251,6 +244,7 @@ MlasHalfGemmPackB(
251244 )
252245{
253246 const auto * dispatch = MlasHalfGemmGetDispatch ();
247+ assert (N == 0 || K == 0 || (B != nullptr && PackedB != nullptr && ldb >= N));
254248 if (B == nullptr || PackedB == nullptr || ldb < N ||
255249 dispatch->CopyPackBRoutine == nullptr || MlasHalfGemmPackBSize (N, K, false ) == 0 ) {
256250 return ;
@@ -269,18 +263,11 @@ MlasHalfGemmNativePackBSize(
269263 const MLAS_BACKEND_KERNEL_SELECTOR_CONFIG * BackendKernelSelectorConfig
270264 )
271265{
272- #if defined(USE_KLEIDIAI)
273266 if ((!BackendKernelSelectorConfig || BackendKernelSelectorConfig->use_kleidiai ) &&
274267 GetMlasPlatform ().MlasHalfGemmPackBSizeOverride != nullptr ) {
275268 return GetMlasPlatform ().MlasHalfGemmPackBSizeOverride (TransA, TransB, N, K);
276269 }
277- #else
278- MLAS_UNREFERENCED_PARAMETER (TransA);
279- MLAS_UNREFERENCED_PARAMETER (TransB);
280- MLAS_UNREFERENCED_PARAMETER (N);
281- MLAS_UNREFERENCED_PARAMETER (K);
282- MLAS_UNREFERENCED_PARAMETER (BackendKernelSelectorConfig);
283- #endif
270+
284271 return 0 ;
285272}
286273
@@ -297,21 +284,11 @@ MlasHalfGemmNativePackB(
297284 const MLAS_BACKEND_KERNEL_SELECTOR_CONFIG * BackendKernelSelectorConfig
298285 )
299286{
300- #if defined(USE_KLEIDIAI)
301287 if ((!BackendKernelSelectorConfig || BackendKernelSelectorConfig->use_kleidiai ) &&
302288 GetMlasPlatform ().MlasHalfGemmPackBOverride != nullptr ) {
303289 return GetMlasPlatform ().MlasHalfGemmPackBOverride (TransA, TransB, N, K, B, ldb, PackedB);
304290 }
305- #else
306- MLAS_UNREFERENCED_PARAMETER (TransA);
307- MLAS_UNREFERENCED_PARAMETER (TransB);
308- MLAS_UNREFERENCED_PARAMETER (N);
309- MLAS_UNREFERENCED_PARAMETER (K);
310- MLAS_UNREFERENCED_PARAMETER (B);
311- MLAS_UNREFERENCED_PARAMETER (ldb);
312- MLAS_UNREFERENCED_PARAMETER (PackedB);
313- MLAS_UNREFERENCED_PARAMETER (BackendKernelSelectorConfig);
314- #endif
291+
315292 return false ;
316293}
317294
0 commit comments