Skip to content

Commit c99652e

Browse files
committed
determine fht_avx.c/fht_neon.c based on CMake target processor
Might fix #6691. ghstack-source-id: 45e1cde ghstack-comment-id: 2648965140 Pull Request resolved: #8346
1 parent b87ea4e commit c99652e

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

build/cmake_deps.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,7 @@ buck_targets = [
365365
"//extension/llm/custom_ops:custom_ops",
366366
]
367367
filters = [
368-
# Second clause is to pick up fht_neon.c/fht_avx.c from FFHT. TODO:
369-
# remove filters and patch extract_sources.py's Buck query to fetch
370-
# srcs; presumably filters is here to remove .h files.
371-
"(.cpp$)|(fht.*\\.c$)",
368+
".cpp$",
372369
]
373370
excludes = [
374371
"^codegen",

extension/llm/custom_ops/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ list(APPEND custom_ops_libs cpuinfo)
4545
list(APPEND custom_ops_libs cpublas)
4646
list(APPEND custom_ops_libs eigen_blas)
4747

48+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|armv7)$")
49+
list(APPEND _custom_ops__srcs
50+
"extension/llm/custom_ops/spinquant/third-party/FFHT/fht_neon.c"
51+
)
52+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
53+
list(APPEND _custom_ops__srcs
54+
"extension/llm/custom_ops/spinquant/third-party/FFHT/fht_avx.c"
55+
)
56+
else()
57+
message(
58+
FATAL_ERROR
59+
"Unsupported CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}. (If \
60+
32-bit x86, try using fht_avx.c and send a PR if it works!)"
61+
)
62+
endif()
63+
4864
list(TRANSFORM _custom_ops__srcs PREPEND "${EXECUTORCH_ROOT}/")
4965

5066
if(NOT EXECUTORCH_BUILD_XNNPACK)

0 commit comments

Comments
 (0)