From 35fa6af428cd518ae52453c5eeef862c69cd1c02 Mon Sep 17 00:00:00 2001 From: Dipanjan Sengupta Date: Fri, 16 Jun 2023 21:00:41 -0700 Subject: [PATCH] Fix for the build break in AMX feature on Mac OS. (#16390) ### Description Fixing the build break issue in Apple pipeline due to AMX flag removal. --- cmake/onnxruntime_mlas.cmake | 20 +++++++++++--------- onnxruntime/core/mlas/lib/platform.cpp | 4 ++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cmake/onnxruntime_mlas.cmake b/cmake/onnxruntime_mlas.cmake index 29c179076e..d89be400c2 100644 --- a/cmake/onnxruntime_mlas.cmake +++ b/cmake/onnxruntime_mlas.cmake @@ -522,15 +522,17 @@ else() ${mlas_platform_srcs_avx512core} ) - set(mlas_platform_srcs - ${mlas_platform_srcs} - ${MLAS_SRC_DIR}/qgemm_kernel_amx.cpp - ${MLAS_SRC_DIR}/amx_common.h - ${MLAS_SRC_DIR}/x86_64/QgemmU8S8KernelAmx.S - ${MLAS_SRC_DIR}/x86_64/QgemmU8S8KernelAmxCommon.S - ) - set_source_files_properties(${MLAS_SRC_DIR}/qgemm_kernel_amx.cpp PROPERTIES COMPILE_FLAGS "-masm=intel -mavx2 -mavx512bw -mavx512dq -mavx512vl -mavx512f") - set_source_files_properties(${MLAS_SRC_DIR}/x86_64/QgemmU8S8KernelAmx.S PROPERTIES COMPILE_FLAGS "-mavx2 -mavx512bw -mavx512dq -mavx512vl -mavx512f") + if(NOT APPLE) + set(mlas_platform_srcs + ${mlas_platform_srcs} + ${MLAS_SRC_DIR}/qgemm_kernel_amx.cpp + ${MLAS_SRC_DIR}/amx_common.h + ${MLAS_SRC_DIR}/x86_64/QgemmU8S8KernelAmx.S + ${MLAS_SRC_DIR}/x86_64/QgemmU8S8KernelAmxCommon.S + ) + set_source_files_properties(${MLAS_SRC_DIR}/qgemm_kernel_amx.cpp PROPERTIES COMPILE_FLAGS "-masm=intel -mavx2 -mavx512bw -mavx512dq -mavx512vl -mavx512f") + set_source_files_properties(${MLAS_SRC_DIR}/x86_64/QgemmU8S8KernelAmx.S PROPERTIES COMPILE_FLAGS "-mavx2 -mavx512bw -mavx512dq -mavx512vl -mavx512f") + endif() if(ONNXRUNTIME_MLAS_MULTI_ARCH) onnxruntime_add_static_library(onnxruntime_mlas_x86_64 ${mlas_platform_srcs}) diff --git a/onnxruntime/core/mlas/lib/platform.cpp b/onnxruntime/core/mlas/lib/platform.cpp index 9a1c81a039..387989972b 100644 --- a/onnxruntime/core/mlas/lib/platform.cpp +++ b/onnxruntime/core/mlas/lib/platform.cpp @@ -408,6 +408,8 @@ Return Value: } } +#ifndef __APPLE__ + // // Check if the processor supports AMX-TILE and AMX-INT8 // features. @@ -419,6 +421,8 @@ Return Value: } } +#endif // __APPLE__ + #endif // ORT_MINIMAL_BUILD }