Skip to content

Build/test //kernels/portable/cpu/... in unittest-buck #9041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/scripts/unittest-buck2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/...
15 changes: 8 additions & 7 deletions kernels/portable/cpu/targets.bzl
Original file line number Diff line number Diff line change
@@ -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():
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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():
Expand Down Expand Up @@ -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,
Expand Down
Loading