Skip to content

Commit 0adaa53

Browse files
dbortfacebook-github-bot
authored andcommitted
Split out :executor_runner_lib
Summary: It will be helpful to create other runner targets that link against specific backends or kernel libs. Rather than adding those dependencies to this common target, create a library that can be used to create, e.g., `xnnpack_runner`. Differential Revision: D48579335 fbshipit-source-id: b96f7dea96e370d648e8bb22329bec9c59eddafe
1 parent 8a4d879 commit 0adaa53

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

examples/executor_runner/targets.bzl

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ def define_common_targets():
77
TARGETS and BUCK files that call this function.
88
"""
99

10+
# Wraps a commandline executable that can be linked against any desired
11+
# kernel or backend implementations. Contains a main() function.
12+
runtime.cxx_library(
13+
name = "executor_runner_lib",
14+
srcs = ["executor_runner.cpp"],
15+
deps = [
16+
"//executorch/runtime/executor:program",
17+
"//executorch/extension/data_loader:file_data_loader",
18+
"//executorch/util:util",
19+
],
20+
external_deps = [
21+
"gflags",
22+
],
23+
define_static_target = True,
24+
visibility = [
25+
"//executorch/examples/...",
26+
],
27+
)
28+
1029
register_custom_op = native.read_config("executorch", "register_custom_op", "0")
1130

1231
if register_custom_op == "1":
@@ -16,20 +35,18 @@ def define_common_targets():
1635
else:
1736
custom_ops_lib = []
1837

19-
# Test driver for models, uses all portable kernels.
38+
# Test driver for models, uses all portable kernels and a demo backend. This
39+
# is intended to have minimal dependencies. If you want a runner that links
40+
# against a different backend or kernel library, define a new executable
41+
# based on :executor_runner_lib.
2042
runtime.cxx_binary(
2143
name = "executor_runner",
22-
srcs = ["executor_runner.cpp"],
44+
srcs = [],
2345
deps = [
46+
":executor_runner_lib",
2447
"//executorch/runtime/executor/test:test_backend_compiler_lib",
25-
"//executorch/runtime/executor:program",
26-
"//executorch/extension/data_loader:file_data_loader",
27-
"//executorch/util:util",
2848
"//executorch/kernels/portable:generated_lib_all_ops",
2949
] + custom_ops_lib,
30-
external_deps = [
31-
"gflags",
32-
],
3350
define_static_target = True,
3451
**get_oss_build_kwargs()
3552
)

0 commit comments

Comments
 (0)