Skip to content

Build/test //kernels/portable/... in unittest-buck #9042

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 41 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
65aeed2
Update
swolchok Feb 25, 2025
545a05b
Update
swolchok Feb 25, 2025
d85e255
Update
swolchok Feb 25, 2025
5124a63
Update
swolchok Feb 25, 2025
146cfa6
Update
swolchok Feb 25, 2025
dce054b
Update
swolchok Feb 25, 2025
40bcf6f
Update
swolchok Feb 25, 2025
cece5bc
Update
swolchok Feb 25, 2025
3c40a8b
Update
swolchok Feb 26, 2025
96b69c8
Update
swolchok Feb 26, 2025
699a8f4
Update
swolchok Feb 26, 2025
9c10640
Update
swolchok Feb 26, 2025
8d3a9ba
Update
swolchok Feb 28, 2025
e90e779
Update
swolchok Feb 28, 2025
7560880
Update
swolchok Mar 4, 2025
e0cb34f
Update
swolchok Mar 4, 2025
ea92179
Update
swolchok Mar 5, 2025
891fb8e
Update
swolchok Mar 5, 2025
05528b4
Update
swolchok Mar 5, 2025
26a2025
Update
swolchok Mar 7, 2025
d8cd4f2
Update
swolchok Mar 7, 2025
b099a8a
Update
swolchok Mar 7, 2025
eabf3ff
Update
swolchok Mar 7, 2025
93e12a2
Update
swolchok Mar 7, 2025
c532461
Update
swolchok Mar 7, 2025
b03f0e0
Update
swolchok Mar 7, 2025
ffde1dc
Update
swolchok Mar 7, 2025
0a3a58b
Update
swolchok Mar 7, 2025
3c30f09
Update
swolchok Mar 7, 2025
f8d8e29
Update
swolchok Mar 7, 2025
dcbb2ca
Update
swolchok Mar 7, 2025
a088f9f
Update
swolchok Mar 8, 2025
c28f087
Update
swolchok Mar 8, 2025
2f5d526
Update
swolchok Mar 8, 2025
b5eeabb
Update
swolchok Mar 8, 2025
b9d9c8a
Update
swolchok Mar 10, 2025
2df7d06
Update
swolchok Mar 10, 2025
70d9902
Merge branch 'main' into gh/swolchok/321/head
swolchok Mar 11, 2025
878caea
Update
swolchok Mar 11, 2025
e49ce7a
Update
swolchok Mar 11, 2025
54ed7d4
Update
swolchok Mar 11, 2025
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
2 changes: 1 addition & 1 deletion .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 test //kernels/portable/cpu/... //runtime/backend/... //runtime/core/... \
buck2 test //kernels/portable/... //runtime/backend/... //runtime/core/... \
//runtime/executor: //runtime/kernel/... //runtime/platform/...
65 changes: 32 additions & 33 deletions kernels/portable/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/codegen:codegen.bzl", "et_operator_library", "executorch_generated_lib")

def define_common_targets():
Expand All @@ -20,17 +20,18 @@ def define_common_targets():
],
)

runtime.cxx_library(
name = "operators_aten",
srcs = [],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
exported_deps = [
"//executorch/kernels/portable/cpu:cpu_aten",
],
)
if True in get_aten_mode_options():
runtime.cxx_library(
name = "operators_aten",
srcs = [],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
exported_deps = [
"//executorch/kernels/portable/cpu:cpu_aten",
],
)

runtime.export_file(
name = "functions.yaml",
Expand Down Expand Up @@ -79,9 +80,6 @@ def define_common_targets():
)

generated_lib_common_args = {
"custom_ops_aten_kernel_deps": [
"//executorch/kernels/portable:operators_aten",
],
"custom_ops_yaml_target": "//executorch/kernels/portable:custom_ops.yaml",
# size_test expects _static targets to be available for these libraries.
"define_static_targets": True,
Expand All @@ -102,21 +100,22 @@ def define_common_targets():
**generated_lib_common_args
)

executorch_generated_lib(
name = "generated_lib_aten",
deps = [
":executorch_aten_ops",
":executorch_custom_ops",
"//executorch/kernels/portable:operators_aten",
],
custom_ops_aten_kernel_deps = [
"//executorch/kernels/portable:operators_aten",
],
custom_ops_yaml_target = "//executorch/kernels/portable:custom_ops.yaml",
aten_mode = True,
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
define_static_targets = True,
)
if True in get_aten_mode_options():
executorch_generated_lib(
name = "generated_lib_aten",
deps = [
":executorch_aten_ops",
":executorch_custom_ops",
"//executorch/kernels/portable:operators_aten",
],
custom_ops_aten_kernel_deps = [
"//executorch/kernels/portable:operators_aten",
],
custom_ops_yaml_target = "//executorch/kernels/portable:custom_ops.yaml",
aten_mode = True,
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
define_static_targets = True,
)
27 changes: 0 additions & 27 deletions kernels/portable/test/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# targets.bzl. This file can contain fbcode-only targets.

load(":targets.bzl", "define_common_targets")
load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

oncall("executorch")
Expand All @@ -28,29 +27,3 @@ runtime.cxx_library(
"libtorch",
],
)

python_unittest(
name = "op_upsample_bilinear2d_test",
srcs = [
"op_upsample_bilinear2d_test.py",
],
preload_deps = [
":aot_ops_test_lib",
],
deps = [
"//caffe2:torch",
],
)

python_unittest(
name = "op_upsample_nearest2d_test",
srcs = [
"op_upsample_nearest2d_test.py",
],
preload_deps = [
":aot_ops_test_lib",
],
deps = [
"//caffe2:torch",
],
)
39 changes: 34 additions & 5 deletions kernels/portable/test/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "is_xplat", "runtime")
load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", "executorch_generated_lib")
load("@fbsource//xplat/executorch/kernels/test:util.bzl", "define_supported_features_lib", "op_test")
Expand All @@ -8,12 +9,40 @@ def define_common_targets():
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""
define_supported_features_lib()
if not runtime.is_oss:
define_supported_features_lib()

op_test(name = "op_allclose_test")
op_test(name = "op_div_test")
op_test(name = "op_gelu_test")
op_test(name = "op_mul_test")
if not is_xplat():
python_unittest(
name = "op_upsample_bilinear2d_test",
srcs = [
"op_upsample_bilinear2d_test.py",
],
preload_deps = [
":aot_ops_test_lib",
],
deps = [
"//caffe2:torch",
],
)

python_unittest(
name = "op_upsample_nearest2d_test",
srcs = [
"op_upsample_nearest2d_test.py",
],
preload_deps = [
":aot_ops_test_lib",
],
deps = [
"//caffe2:torch",
],
)

op_test(name = "op_allclose_test")
op_test(name = "op_div_test")
op_test(name = "op_gelu_test")
op_test(name = "op_mul_test")

if is_xplat():
et_operator_library(
Expand Down
16 changes: 3 additions & 13 deletions runtime/core/portable_type/c10/c10/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,11 @@ def define_common_targets():
"util/irange.h",
],
exported_preprocessor_flags = [
# NOTE: If we define C10_EMBEDDED to prevent Half and
# BFloat16 from supporting streams, non-ExecuTorch-core
# uses of other ATen headers that try to print ATen
# primitive types fail to build because, apparently, there
# are implicit conversions from Half/BFloat16 to a variety
# of primitive types, not just float. Since merely
# including <ostream> shouldn't result in any runtime
# artifacts if stream code is never actually called, it
# seems best to just not define C10_EMBEDDED, but if you
# need it, it's there.
# "-DC10_EMBEDDED",
"-DC10_USING_CUSTOM_GENERATED_MACROS",
] + ([] if runtime.is_oss else [
"-DC10_USE_GLOG",
"-DC10_USE_MINIMAL_GLOG",
"-DC10_USING_CUSTOM_GENERATED_MACROS",
],
]),
visibility = [
"//executorch/...",
],
Expand Down
Loading