Skip to content

Commit 6410d47

Browse files
authored
Add extension/llm/custom_ops/spinquant/test to CMake (#8345)
Need to run it to make sure build changes in this directory aren't breaking things. Test Plan: added EXPECT_TRUE(false) to fast_hadamard_transform_test.cpp, saw failure in test/run_oss_cpp_tests.sh
1 parent 696d766 commit 6410d47

File tree

8 files changed

+64
-0
lines changed

8 files changed

+64
-0
lines changed

build/Test.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function(et_cxx_test target_name)
3636
cmake_parse_arguments(ET_CXX_TEST "" "" "${multi_arg_names}" ${ARGN})
3737

3838
add_executable(${target_name} ${ET_CXX_TEST_SOURCES} ${EXECUTORCH_ROOT}/runtime/core/exec_aten/testing_util/tensor_util.cpp)
39+
find_package(GTest)
3940
# Includes gtest, gmock, executorch by default
4041
target_link_libraries(
4142
${target_name} GTest::gtest GTest::gtest_main GTest::gmock executorch

build/build_android_llm_demo.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ build_android_native_library() {
4444
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
4545
-DANDROID_ABI="${ANDROID_ABI}" \
4646
-DANDROID_PLATFORM=android-26 \
47+
-DBUILD_TESTING=OFF \
4748
-DEXECUTORCH_ENABLE_LOGGING=ON \
4849
-DEXECUTORCH_LOG_LEVEL=Info \
4950
-DEXECUTORCH_BUILD_XNNPACK=ON \
@@ -73,6 +74,7 @@ build_android_native_library() {
7374
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
7475
-DANDROID_ABI="${ANDROID_ABI}" \
7576
-DANDROID_PLATFORM=android-26 \
77+
-DBUILD_TESTING=OFF \
7678
-DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
7779
-DEXECUTORCH_ENABLE_LOGGING=ON \
7880
-DEXECUTORCH_LOG_LEVEL=Info \

extension/android_test/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ build_native_library() {
2121
cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
2222
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
2323
-DANDROID_ABI="${ANDROID_ABI}" \
24+
-DBUILD_TESTING=OFF \
2425
-DEXECUTORCH_BUILD_XNNPACK=ON \
2526
-DEXECUTORCH_XNNPACK_SHARED_WORKSPACE=ON \
2627
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
@@ -36,6 +37,7 @@ build_native_library() {
3637
cmake extension/android \
3738
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}"/build/cmake/android.toolchain.cmake \
3839
-DANDROID_ABI="${ANDROID_ABI}" \
40+
-DBUILD_TESTING=OFF \
3941
-DCMAKE_INSTALL_PREFIX=c"${CMAKE_OUT}" \
4042
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
4143
-DEXECUTORCH_BUILD_LLAMA_JNI=ON \

extension/llm/custom_ops/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,8 @@ if(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT)
121121
LIBRARY DESTINATION executorch/extension/llm/custom_ops
122122
)
123123
endif()
124+
125+
add_subdirectory(spinquant/third-party/FFHT)
126+
if(BUILD_TESTING)
127+
add_subdirectory(spinquant/test)
128+
endif()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# @generated by test/utils/generate_gtest_cmakelists.py
8+
#
9+
# This file should be formatted with
10+
# ~~~
11+
# cmake-format -i CMakeLists.txt
12+
# ~~~
13+
# It should also be cmake-lint clean.
14+
#
15+
16+
cmake_minimum_required(VERSION 3.19)
17+
18+
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../../..)
19+
20+
include(${EXECUTORCH_ROOT}/build/Test.cmake)
21+
22+
set(_test_srcs
23+
fast_hadamard_transform_test.cpp fast_hadamard_transform_test_impl.cpp
24+
op_fast_hadamard_transform_test.cpp
25+
)
26+
27+
et_cxx_test(
28+
extension_llm_custom_ops_spinquant_test SOURCES ${_test_srcs} EXTRA_LIBS
29+
custom_ops dumb_fht
30+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# Please this file formatted by running:
8+
# ~~~
9+
# cmake-format -i CMakeLists.txt
10+
# ~~~
11+
12+
add_library(dumb_fht dumb_fht.c)

test/run_oss_cpp_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ build_executorch() {
3535
cmake . \
3636
-DCMAKE_INSTALL_PREFIX=cmake-out \
3737
-DEXECUTORCH_USE_CPP_CODE_COVERAGE=ON \
38+
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
3839
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
3940
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
4041
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \

test/utils/OSSTestConfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
{ "tests": [
2+
{
3+
"directory": "extension/llm/custom_ops/spinquant/test",
4+
"sources": [
5+
"fast_hadamard_transform_test.cpp",
6+
"fast_hadamard_transform_test_impl.cpp",
7+
"op_fast_hadamard_transform_test.cpp"
8+
],
9+
"additional_libs": [
10+
"custom_ops"
11+
]
12+
},
213
{
314
"directory": "extension/data_loader/test",
415
"sources": [

0 commit comments

Comments
 (0)