File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed
torchao/experimental/kernels/cpu/aarch64 Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ FetchContent_MakeAvailable(kleidiai)
2020CMAKE_DEPENDENT_OPTION(BUILD_KLEIDI "Download, build, and link against Arm KleidiAI library"
2121 OFF "CMAKE_SYSTEM_PROCESSOR STREQUAL \" arm64\" " ON )
2222
23- add_compile_definitions ("TORCHAO_ENABLE_KLEIDI=$<BOOL:${BUILD_KLEIDI} >" )
24-
2523if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" )
2624 add_library (
2725 torchao_kernels_aarch64
@@ -31,6 +29,9 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
3129 ${TORCHAO_INCLUDE_DIRS} /torchao/experimental/kernels/cpu/aarch64/valpacking/interleave.cpp
3230 )
3331 if (BUILD_KLEIDI)
32+ # Temporarily exposing this to the parent scope until we wire
33+ # this up properly from the top level
34+ set (TORCHAO_ENABLE_KLEIDI ON PARENT_SCOPE)
3435 message (STATUS "Building with Kleidi" )
3536 target_link_libraries (torchao_kernels_aarch64 PUBLIC kleidiai)
3637 endif ()
Original file line number Diff line number Diff line change @@ -32,8 +32,15 @@ add_library(
3232if (NOT TORCHAO_INCLUDE_DIRS)
3333 set (TORCHAO_INCLUDE_DIRS ${TORCHAO_LIBRARIES} )
3434endif ()
35+
3536add_subdirectory (${TORCHAO_LIBRARIES} /torchao/experimental/kernels/cpu/aarch64 ${CMAKE_CURRENT_BINARY_DIR} /torchao_kernels_aarch64)
3637
38+ # The TORCHAO_ENABLE_KLEIDI cmake variable should be set by `torchao_kernels_aarch64"
39+ # This is a temporary work around.
40+ if (TORCHAO_ENABLE_KLEIDI)
41+ add_compile_definitions (TORCHAO_ENABLE_KLEIDI)
42+ endif ()
43+
3744enable_testing ()
3845
3946add_executable (test_quantization test_quantization.cpp)
Original file line number Diff line number Diff line change 1414#include < torchao/experimental/kernels/cpu/aarch64/linear/linear.h>
1515#include < torchao/experimental/kernels/cpu/aarch64/tests/test_utils.h>
1616
17+ #ifdef TORCHAO_ENABLE_KLEIDI
1718#include < torchao/experimental/kernels/cpu/aarch64/kleidi/kai_matmul_clamp_f32_qai8dxp1x8_qsi4c32p4x8_1x4x32_neon_dotprod.h>
1819#include < torchao/experimental/kernels/cpu/aarch64/kleidi/kai_matmul_clamp_f32_qai8dxp1x8_qsi4c32p8x8_1x8x32_neon_dotprod.h>
20+ #endif
1921
2022float kTol = 0.0001 ;
2123
@@ -354,9 +356,7 @@ TEST(
354356 }
355357}
356358
357- // #ifdef TORCHAO_ENABLE_KLEIDI
358- // TODO: Wire up the the compile defination for TORCHAO_ENABLE_KLEIDI
359-
359+ #ifdef TORCHAO_ENABLE_KLEIDI
360360template <bool has_bias, bool has_clamp>
361361void test_kai_matmul_clamp_f32_qai8dxp1x8_qsi4c32p4x8_1x4x32_neon_dotprod (
362362 int m,
@@ -585,5 +585,5 @@ TEST(
585585 true /* has_clamp*/ >(
586586 /* m=*/ 11 , /* k=*/ 128 , /* n=*/ 182 , /* group_size=*/ 128 );
587587}
588- // #endif // defined( TORCHAO_ENABLE_KLEIDI)
588+ #endif // TORCHAO_ENABLE_KLEIDI
589589#endif // defined(__aarch64__) || defined(__ARM_NEON)
You can’t perform that action at this time.
0 commit comments