Skip to content

Commit f53c315

Browse files
JacobSzwejbkafacebook-github-bot
authored andcommitted
Buckify the ao arm shared embedding kernels (pytorch#18086)
Summary: X-link: pytorch/ao#4047 Attempt 2 this time with the arm version flag passed Differential Revision: D96072438
1 parent 76dfb19 commit f53c315

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

examples/models/llama/runner/targets.bzl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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+
924
def 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

Comments
 (0)