Skip to content

Commit 58c042d

Browse files
authored
Build/test //kernels/portable/cpu/... in unittest-buck (#9041)
Just needed to get ATen-mode ops out of the OSS build. Differential Revision: D70791340
1 parent ddf0d9e commit 58c042d

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

.ci/scripts/unittest-buck2.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ buck2 query "//backends/apple/... + //backends/example/... + \
2020
# TODO: expand the covered scope of Buck targets.
2121
# //runtime/kernel/... is failing because //third-party:torchgen_files's shell script can't find python on PATH.
2222
# //runtime/test/... requires Python torch, which we don't have in our OSS buck setup.
23-
buck2 build //runtime/backend/... //runtime/core/... //runtime/executor: //runtime/kernel/... //runtime/platform/...
24-
buck2 test //runtime/backend/... //runtime/core/... //runtime/executor: //runtime/kernel/... //runtime/platform/...
23+
buck2 test //kernels/portable/cpu/... //runtime/backend/... //runtime/core/... \
24+
//runtime/executor: //runtime/kernel/... //runtime/platform/...

kernels/portable/cpu/targets.bzl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")
22
load("@fbsource//xplat/executorch/kernels/portable:op_registration_util.bzl", "ATEN_OPS", "CUSTOM_OPS", "define_op_target")
33

44
def define_common_targets():
@@ -29,12 +29,13 @@ def define_common_targets():
2929
exported_deps = all_op_targets,
3030
)
3131

32-
runtime.cxx_library(
33-
name = "cpu_aten",
34-
srcs = [],
35-
visibility = ["//executorch/kernels/portable/..."],
36-
exported_deps = [t + "_aten" for t in custom_op_targets],
37-
)
32+
if True in get_aten_mode_options():
33+
runtime.cxx_library(
34+
name = "cpu_aten",
35+
srcs = [],
36+
visibility = ["//executorch/kernels/portable/..."],
37+
exported_deps = [t + "_aten" for t in custom_op_targets],
38+
)
3839

3940
# Only for use by op targets under //executorch. This API needs to be
4041
# reevaluated before becoming a public API.

shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "is_xplat", "runtime")
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "is_xplat", "runtime")
22
load("@fbsource//xplat/executorch/build:selects.bzl", "selects")
33

44
def get_compiler_optimization_flags():
@@ -170,7 +170,7 @@ def define_op_target(name, deps, android_deps, is_aten_op, is_et_op = True, _all
170170

171171
# If this is a custom op, define a target that builds it with at::Tensor
172172
# so that it can be imported into a host PyTorch environment for authoring.
173-
if not is_aten_op:
173+
if not is_aten_op and True in get_aten_mode_options():
174174
define_op_library(
175175
name = name,
176176
deps = _aten_mode_deps if _aten_mode_deps else deps,

0 commit comments

Comments
 (0)