-
Notifications
You must be signed in to change notification settings - Fork 527
/
Copy pathtargets.bzl
72 lines (67 loc) · 2.58 KB
/
targets.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
load("@fbsource//xplat/executorch/backends/xnnpack/third-party:third_party_libs.bzl", "third_party_dep")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
def _get_preprocessor_flags():
"""
Disable if someone explictly specified a config option,
else Enable otherwise
"""
preprocessor_flags = []
if native.read_config("executorch", "xnnpack_workspace_sharing", "0") != "0":
preprocessor_flags.append("-DENABLE_XNNPACK_SHARED_WORKSPACE")
if native.read_config("executorch", "xnnpack_weights_cache", "0") != "0":
preprocessor_flags.append("-DENABLE_XNNPACK_WEIGHTS_CACHE")
# Enable if not disabled through config
return preprocessor_flags
def define_common_targets():
runtime.cxx_library(
name = "dynamic_quant_utils",
srcs = [
"runtime/utils/utils.cpp",
],
exported_headers = ["runtime/utils/utils.h"],
deps = [
"//executorch/runtime/core/exec_aten:lib",
"//executorch/runtime/backend:interface",
],
visibility = [
"//executorch/backends/xnnpack/...",
"@EXECUTORCH_CLIENTS",
],
)
runtime.cxx_library(
name = "xnnpack_backend",
srcs = native.glob([
"runtime/*.cpp",
"runtime/profiling/*.cpp",
]),
headers = native.glob([
"runtime/*.h",
"runtime/profiling/*.h",
]),
visibility = [
"//executorch/exir/backend:backend_lib",
"//executorch/exir/backend/test/...",
"//executorch/backends/xnnpack/test/...",
"//executorch/extension/pybindings/...",
"@EXECUTORCH_CLIENTS",
],
preprocessor_flags = [
# Uncomment to enable per operator timings
# "-DENABLE_XNNPACK_PROFILING",
# Uncomment to enable using KleidiAI Kernels
# "-DENABLE_XNNPACK_KLEIDI"
] + _get_preprocessor_flags(),
exported_deps = [
"//executorch/runtime/backend:interface",
],
deps = [
third_party_dep("XNNPACK"),
"//executorch/backends/xnnpack/serialization:xnnpack_flatbuffer_header",
"//executorch/extension/threadpool:threadpool",
"//executorch/runtime/core/exec_aten/util:tensor_util",
"//executorch/runtime/executor:pte_data_map"
],
# XnnpackBackend.cpp needs to compile with executor as whole
# @lint-ignore BUCKLINT: Avoid `link_whole=True` (https://fburl.com/avoid-link-whole)
link_whole = True,
)