@@ -6,6 +6,21 @@ def _get_operator_lib(aten = False):
66 else :
77 return ["//executorch/configurations:optimized_native_cpu_ops" , "//executorch/extension/llm/custom_ops:custom_ops" ]
88
9+ def _get_torchao_lowbit_deps ():
10+ """Returns torchao lowbit kernel deps for shared embedding and linear on ARM builds."""
11+ if runtime .is_oss :
12+ return []
13+ else :
14+ # Use select to conditionally include torchao lowbit kernels only on ARM64 builds
15+ # These kernels are only available for aarch64 architecture
16+ return select ({
17+ "DEFAULT" : [],
18+ "ovr_config//cpu:arm64" : [
19+ "//xplat/pytorch/ao/torchao/csrc/cpu/shared_kernels/embedding_xbit:op_embedding_xbit_executorch" ,
20+ "//xplat/pytorch/ao/torchao/csrc/cpu/shared_kernels/linear_8bit_act_xbit_weight:op_linear_8bit_act_xbit_weight_executorch" ,
21+ ],
22+ })
23+
924def get_qnn_dependency ():
1025 # buck build -c executorch.enable_qnn=true //executorch/examples/models/llama/runner:runner
1126 # Check if QNN is enabled before including the dependency
@@ -48,7 +63,7 @@ def define_common_targets():
4863 "//pytorch/tokenizers:llama2c_tokenizer" ,
4964 "//pytorch/tokenizers:hf_tokenizer" ,
5065 "//pytorch/tokenizers:regex_lookahead" ,
51- ] + (_get_operator_lib (aten )) + ([
66+ ] + (_get_operator_lib (aten )) + _get_torchao_lowbit_deps () + ([
5267 # Vulkan API currently cannot build on some platforms (e.g. Apple, FBCODE)
5368 # Therefore enable it explicitly for now to avoid failing tests
5469 "//executorch/backends/vulkan:vulkan_backend_lib" ,
0 commit comments