diff --git a/.ci/scripts/unittest-buck2.sh b/.ci/scripts/unittest-buck2.sh index 4b614e32320..018e23a5567 100755 --- a/.ci/scripts/unittest-buck2.sh +++ b/.ci/scripts/unittest-buck2.sh @@ -20,5 +20,5 @@ buck2 query "//backends/apple/... + //backends/example/... + \ # TODO: expand the covered scope of Buck targets. # //runtime/kernel/... is failing because //third-party:torchgen_files's shell script can't find python on PATH. # //runtime/test/... requires Python torch, which we don't have in our OSS buck setup. -buck2 build //runtime/backend/... //runtime/core/... //runtime/executor: //runtime/kernel/... //runtime/platform/... -buck2 test //runtime/backend/... //runtime/core/... //runtime/executor: //runtime/kernel/... //runtime/platform/... +buck2 test //kernels/portable/cpu/... //runtime/backend/... //runtime/core/... \ + //runtime/executor: //runtime/kernel/... //runtime/platform/... diff --git a/kernels/portable/cpu/targets.bzl b/kernels/portable/cpu/targets.bzl index f6ef7150679..b428a5d107e 100644 --- a/kernels/portable/cpu/targets.bzl +++ b/kernels/portable/cpu/targets.bzl @@ -1,4 +1,4 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime") load("@fbsource//xplat/executorch/kernels/portable:op_registration_util.bzl", "ATEN_OPS", "CUSTOM_OPS", "define_op_target") def define_common_targets(): @@ -29,12 +29,13 @@ def define_common_targets(): exported_deps = all_op_targets, ) - runtime.cxx_library( - name = "cpu_aten", - srcs = [], - visibility = ["//executorch/kernels/portable/..."], - exported_deps = [t + "_aten" for t in custom_op_targets], - ) + if True in get_aten_mode_options(): + runtime.cxx_library( + name = "cpu_aten", + srcs = [], + visibility = ["//executorch/kernels/portable/..."], + exported_deps = [t + "_aten" for t in custom_op_targets], + ) # Only for use by op targets under //executorch. This API needs to be # reevaluated before becoming a public API. diff --git a/shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl b/shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl index acab7cb03f3..b56413b92f4 100644 --- a/shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl +++ b/shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl @@ -1,4 +1,4 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "is_xplat", "runtime") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "is_xplat", "runtime") load("@fbsource//xplat/executorch/build:selects.bzl", "selects") 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 # If this is a custom op, define a target that builds it with at::Tensor # so that it can be imported into a host PyTorch environment for authoring. - if not is_aten_op: + if not is_aten_op and True in get_aten_mode_options(): define_op_library( name = name, deps = _aten_mode_deps if _aten_mode_deps else deps,