forked from pytorch/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtargets.bzl
More file actions
78 lines (70 loc) · 3 KB
/
targets.bzl
File metadata and controls
78 lines (70 loc) · 3 KB
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
73
74
75
76
77
78
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")
def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""
# Define the filegroup once outside the loop since it doesn't vary by aten mode
runtime.filegroup(
name = "prim_ops_sources",
srcs = ["register_prim_ops.cpp"],
visibility = ["PUBLIC"],
)
runtime.filegroup(
name = "selective_build_prim_ops.h",
srcs = ["selective_build_prim_ops.h"],
visibility = ["PUBLIC"],
)
for aten_mode in get_aten_mode_options():
aten_suffix = ("_aten" if aten_mode else "")
runtime.cxx_library(
name = "et_copy_index" + aten_suffix,
srcs = ["et_copy_index.cpp"],
# To allow for selective prim ops to depend on this library.
# Used by selective_build.bzl
visibility = ["PUBLIC"],
exported_headers = ["et_copy_index.h"],
deps = [
"//executorch/runtime/kernel:kernel_includes" + aten_suffix,
"//executorch/runtime/core:core",
],
exported_deps = [
"//executorch/runtime/core:evalue" + aten_suffix,
"//executorch/runtime/kernel:kernel_runtime_context" + aten_suffix,
],
)
runtime.cxx_library(
name = "et_view" + aten_suffix,
srcs = ["et_view.cpp"],
# To allow for selective prim ops to depend on this library.
# Used by selective_build.bzl
visibility = ["PUBLIC"],
exported_headers = ["et_view.h"],
deps = [
"//executorch/runtime/kernel:kernel_includes" + aten_suffix,
"//executorch/runtime/core:core",
],
exported_deps = [
"//executorch/runtime/core:evalue" + aten_suffix,
"//executorch/runtime/kernel:kernel_runtime_context" + aten_suffix,
],
)
runtime.cxx_library(
name = "prim_ops_registry" + aten_suffix,
srcs = ["register_prim_ops.cpp"],
visibility = ["PUBLIC"],
# @lint-ignore BUCKLINT link_whole, need this to register prim ops.
link_whole = True,
# prim ops are registered through a global table so the ctor needs to be allowed
compiler_flags = select({
"DEFAULT": ["-Wno-global-constructors"],
"ovr_config//os:windows": [],
}),
deps = [
":et_copy_index" + aten_suffix,
":et_view" + aten_suffix,
"//executorch/runtime/core:evalue" + aten_suffix,
"//executorch/runtime/kernel:operator_registry" + aten_suffix,
"//executorch/runtime/kernel:kernel_includes" + aten_suffix,
],
)