Skip to content

Commit 01e6cf2

Browse files
committed
Add (and fix) OSS check that et_operator_library dtype_selective_build builds
This wasn't checked, and it's easy to forget to update the all_deps targets if we don't check. Now we check. ghstack-source-id: 347aa8d ghstack-comment-id: 2722784735 Pull Request resolved: #9245
1 parent 630d0cc commit 01e6cf2

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

.ci/scripts/unittest-buck2.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ BUILDABLE_KERNELS_PRIM_OPS_TARGETS=$(buck2 query //kernels/prim_ops/... | grep -
2424
# TODO: expand the covered scope of Buck targets.
2525
# //runtime/kernel/... is failing because //third-party:torchgen_files's shell script can't find python on PATH.
2626
# //runtime/test/... requires Python torch, which we don't have in our OSS buck setup.
27-
buck2 test $BUILDABLE_OPTIMIZED_OPS //kernels/portable/... \
27+
buck2 test \
28+
//examples/selective_build:select_all_dtype_selective_lib_portable_lib \
29+
$BUILDABLE_OPTIMIZED_OPS //kernels/portable/... \
2830
$BUILDABLE_KERNELS_PRIM_OPS_TARGETS //runtime/backend/... //runtime/core/... \
2931
//runtime/executor: //runtime/kernel/... //runtime/platform/...

examples/selective_build/targets.bzl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ def define_common_targets():
2525
],
2626
)
2727

28+
executorch_generated_lib(
29+
name = "select_all_dtype_selective_lib",
30+
functions_yaml_target = "//executorch/kernels/portable:functions.yaml",
31+
kernel_deps = [
32+
"//executorch/kernels/portable:operators",
33+
],
34+
# Setting dtype_selective_build without using list or dict selection isn't a
35+
# typical use case; we just do it here so that we can test that our mechanism
36+
# for getting buck deps right for dtype_selective_build is working.
37+
dtype_selective_build = True,
38+
deps = [
39+
":select_all_ops",
40+
],
41+
)
42+
2843
# Select a list of operators: defined in `ops`
2944
et_operator_library(
3045
name = "select_ops_in_list",

kernels/portable/cpu/pattern/targets.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def define_common_targets():
1111
# build, where the portable ops are built from source and linked with :all_deps
1212
runtime.cxx_library(
1313
name = "all_deps",
14-
deps = [
14+
exported_deps = [
1515
"//executorch/kernels/portable/cpu/pattern:pattern",
1616
"//executorch/kernels/portable/cpu/pattern:bitwise_op",
1717
"//executorch/kernels/portable/cpu/pattern:comparison_op",
@@ -54,14 +54,16 @@ def define_common_targets():
5454
"unary_ufunc_realhbbf16_to_floathbf16.cpp",
5555
"unary_ufunc_realh.cpp",
5656
],
57+
exported_deps = [
58+
"//executorch/runtime/kernel:kernel_includes",
59+
],
5760
exported_headers = [
5861
"pattern.h",
5962
],
6063
compiler_flags = ["-Wno-missing-prototypes"],
6164
deps = [
6265
"//executorch/kernels/portable/cpu/util:broadcast_util",
6366
"//executorch/kernels/portable/cpu/util:functional_util",
64-
"//executorch/runtime/kernel:kernel_includes",
6567
],
6668
visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/..."],
6769
)

kernels/portable/cpu/util/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def define_common_targets():
1111
# build, where the portable ops are built from source and linked with :all_deps
1212
runtime.cxx_library(
1313
name = "all_deps",
14-
deps = [
14+
exported_deps = [
1515
"//executorch/kernels/portable/cpu/util:functional_util",
1616
"//executorch/kernels/portable/cpu/util:broadcast_util",
1717
"//executorch/kernels/portable/cpu/util:kernel_ops_util",

shim_et/xplat/executorch/codegen/codegen.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def executorch_generated_lib(
631631
)
632632

633633
portable_lib = []
634-
if dtype_selective_build and is_xplat() and "//executorch/kernels/portable:operators" in kernel_deps:
634+
if dtype_selective_build and (is_xplat() or runtime.is_oss) and "//executorch/kernels/portable:operators" in kernel_deps:
635635
# Remove portable from kernel_deps as we're building it from source.
636636
kernel_deps.remove("//executorch/kernels/portable:operators")
637637

0 commit comments

Comments
 (0)