xref: /aosp_15_r20/external/executorch/kernels/portable/cpu/pattern/targets.bzl (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2
3def define_common_targets():
4    """Defines targets that should be shared between fbcode and xplat.
5
6    The directory containing this targets.bzl file should also contain both
7    TARGETS and BUCK files that call this function.
8    """
9
10    # Note: add all portable_op dependencies to all_deps. This is used for dtype selective
11    # build, where the portable ops are built from source and linked with :all_deps
12    runtime.cxx_library(
13        name = "all_deps",
14        deps = [
15            "//executorch/kernels/portable/cpu/pattern:pattern",
16            "//executorch/kernels/portable/cpu/pattern:bitwise_op",
17            "//executorch/kernels/portable/cpu/pattern:comparison_op",
18            "//executorch/kernels/portable/cpu/pattern:logical_op"
19        ],
20        visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"],
21    )
22
23    runtime.cxx_library(
24        name = "bitwise_op",
25        exported_headers = [
26            "bitwise_op.h",
27        ],
28        compiler_flags = [],
29        visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/..."],
30    )
31
32    runtime.cxx_library(
33        name = "comparison_op",
34        exported_headers = [
35            "comparison_op.h",
36        ],
37        compiler_flags = [],
38        visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/..."],
39    )
40
41    runtime.cxx_library(
42        name = "logical_op",
43        exported_headers = [
44            "logical_op.h",
45        ],
46        compiler_flags = [],
47        visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/..."],
48    )
49
50    runtime.cxx_library(
51        name = "pattern",
52        srcs = [
53            "unary_ufunc_realhb_to_bool.cpp",
54            "unary_ufunc_realhbbf16_to_floathbf16.cpp",
55            "unary_ufunc_realh.cpp",
56        ],
57        exported_headers = [
58            "pattern.h",
59        ],
60        compiler_flags = ["-Wno-missing-prototypes"],
61        deps = [
62            "//executorch/kernels/portable/cpu/util:broadcast_util",
63            "//executorch/kernels/portable/cpu/util:functional_util",
64            "//executorch/runtime/kernel:kernel_includes",
65        ],
66        visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/..."],
67    )
68