From c7948a7b2eed32cd85bdccc3c4d068e14270edef Mon Sep 17 00:00:00 2001 From: lucylq Date: Tue, 15 Apr 2025 09:10:38 -0700 Subject: [PATCH] Update llama cmake for custom ops (#10176) Fix https://github.com/pytorch/executorch/issues/10166 target_link_options_shared_lib has different behavior for macos and other platforms; seems like whole-archive was causing issues. Test Plan `sh .ci/scripts/test_llama_torchao_lowbit.sh` https://github.com/pytorch/executorch/blob/main/examples/models/llama/README.md#running-with-low-bit-kernels (cherry picked from commit 580942864a480e4975b0e3ef4509485f6a794879) --- examples/models/llama/CMakeLists.txt | 3 ++- examples/models/llama/README.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/models/llama/CMakeLists.txt b/examples/models/llama/CMakeLists.txt index e6d45424bd4..12385f32d20 100644 --- a/examples/models/llama/CMakeLists.txt +++ b/examples/models/llama/CMakeLists.txt @@ -111,7 +111,8 @@ target_link_options_shared_lib(quantized_ops_lib) list(APPEND link_libraries quantized_kernels quantized_ops_lib) if(EXECUTORCH_BUILD_KERNELS_CUSTOM) - list(APPEND link_libraries $) + target_link_options_shared_lib(custom_ops) + list(APPEND link_libraries custom_ops) endif() if(EXECUTORCH_BUILD_TORCHAO) diff --git a/examples/models/llama/README.md b/examples/models/llama/README.md index 93ef71769b5..aff527c59cf 100644 --- a/examples/models/llama/README.md +++ b/examples/models/llama/README.md @@ -431,7 +431,7 @@ cmake -DPYTHON_EXECUTABLE=python \ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ - -DEXECUTORCH_BUILD_XNNPACK=ON \ + -DEXECUTORCH_BUILD_XNNPACK=OFF \ -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \ -DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \ -DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \