xref: /aosp_15_r20/external/executorch/kernels/portable/test/targets.bzl (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "is_xplat", "runtime")
2load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", "executorch_generated_lib")
3load("@fbsource//xplat/executorch/kernels/test:util.bzl", "define_supported_features_lib", "op_test")
4
5def define_common_targets():
6    """Defines targets that should be shared between fbcode and xplat.
7
8    The directory containing this targets.bzl file should also contain both
9    TARGETS and BUCK files that call this function.
10    """
11    define_supported_features_lib()
12
13    op_test(name = "op_allclose_test")
14    op_test(name = "op_div_test")
15    op_test(name = "op_gelu_test")
16    op_test(name = "op_mul_test")
17
18    if is_xplat():
19        et_operator_library(
20            name = "add_float",
21            ops_dict = {
22                "aten::add.out": ["v1/6;0,1"],  # float
23            },
24        )
25
26        executorch_generated_lib(
27            name = "add_float_lib",
28            functions_yaml_target = "//executorch/kernels/portable:functions.yaml",
29            kernel_deps = [
30                "//executorch/kernels/portable:operators",
31            ],
32            visibility = ["//executorch/..."],
33            deps = [
34                ":add_float",
35            ],
36            dtype_selective_build = True,
37        )
38
39        runtime.cxx_test(
40            name = "dtype_selective_build_test",
41            srcs = ["dtype_selective_build_test.cpp"],
42            deps = [
43                ":add_float_lib",
44                "//executorch/kernels/portable/cpu:scalar_utils",
45            ],
46        )
47