Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions backends/xnnpack/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ set(XNNPACK_BUILD_ALL_MICROKERNELS
OFF
CACHE BOOL ""
)

# XNNPACK nests variadic macros (XNN_RETURN_IF_ERROR expands to xnn_log_error),
# which MSVC's default legacy preprocessor mis-expands. Only observable where
# XNN_LOG_LEVEL is non-zero, i.e. Debug configurations. Not applied to clang-cl,
# which sets MSVC but already has a conforming preprocessor.
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/Zc:preprocessor)
endif()

add_subdirectory("${XNNPACK_SOURCE_DIR}")
include_directories(SYSTEM ${XNNPACK_INCLUDE_DIR})
list(APPEND xnnpack_third_party XNNPACK)
Expand Down
6 changes: 4 additions & 2 deletions tools/cmake/preset/llm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ set_overridable_option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED ON)
set_overridable_option(EXECUTORCH_BUILD_XNNPACK ON)

# Turn on the quantized and LLM kernels unless on Windows with MSVC build since
# they don't currently compile.
# they don't currently compile. MSVC is also set for clang-cl, which does
# compile them, so key off the compiler ID instead.
if(NOT ((CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL
"WIN32") AND MSVC)
"WIN32")
AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_QUANTIZED ON)
set_overridable_option(EXECUTORCH_BUILD_KERNELS_LLM ON)
Expand Down
Loading