Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
128 changes: 3 additions & 125 deletions kernels/optimized/cpu/targets.bzl
Original file line number Diff line number Diff line change
@@ -1,127 +1,5 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/kernels/optimized:op_registration_util.bzl", "define_op_target", "op_target")

_OPTIMIZED_ATEN_OPS = (
op_target(
name = "op_add",
deps = [
":binary_ops",
":add_sub_impl",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
],
),
op_target(
name = "op_bmm",
deps = [
"//executorch/kernels/optimized:libblas",
"//executorch/kernels/portable/cpu/util:matmul_ops_util",
],
),
op_target(
name = "op_div",
deps = [
":binary_ops",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
],
),
op_target(
name = "op_elu",
deps = [
"//executorch/extension/threadpool:threadpool",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
],
),
op_target(name = "op_exp"),
op_target(
name = "op_fft_c2r",
compiler_flags = [] if runtime.is_oss else [
"-Wno-global-constructors",
"-Wno-shadow",
],
deps = [":fft_utils"],
),
op_target(
name = "op_fft_r2c",
compiler_flags = [] if runtime.is_oss else [
"-Wno-global-constructors",
"-Wno-shadow",
],
deps = [":fft_utils"],
),
op_target(name = "op_sigmoid"),
op_target(
name = "op_gelu",
deps = [
"//executorch/kernels/portable/cpu/util:activation_ops_util",
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
],
),
op_target(
name = "op_le",
deps = [
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
],
),
op_target(
name = "op_linear",
deps = [
"//executorch/kernels/optimized:libblas",
"//executorch/kernels/portable/cpu/util:matmul_ops_util",
],
),
op_target(
name = "op_log_softmax",
deps = [
"//executorch/kernels/portable/cpu/util:activation_ops_util",
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
],
),
op_target(
name = "op_mm",
deps = [
"//executorch/kernels/optimized:libblas",
"//executorch/kernels/portable/cpu/util:matmul_ops_util",
],
),
op_target(
name = "op_mul",
deps = [
":binary_ops",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
"//executorch/runtime/core/exec_aten/util:tensor_util",
],
),
op_target(
name = "op_native_layer_norm",
deps = [
":moments_utils",
"//executorch/kernels/portable/cpu/util:normalization_ops_util",
],
),
op_target(name = "op_neg"),
op_target(
name = "op_sub",
deps = [
":binary_ops",
":add_sub_impl",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
],
),
op_target(
name = "op_where",
deps = [
"//executorch/extension/threadpool:threadpool",
"//executorch/kernels/portable/cpu/util:elementwise_util",
],
),
)

load("@fbsource//xplat/executorch/kernels/optimized:op_registration_util.bzl", "OPTIMIZED_ATEN_OPS", "define_op_target", "op_target")

def get_sleef_preprocessor_flags():
if runtime.is_oss:
Expand All @@ -137,10 +15,10 @@ def define_common_targets():
"""

# Define build targets for all operators registered in the tables above.
for op in _OPTIMIZED_ATEN_OPS:
for op in OPTIMIZED_ATEN_OPS:
define_op_target(**op)

aten_op_targets = [":{}".format(op["name"]) for op in _OPTIMIZED_ATEN_OPS]
aten_op_targets = [":{}".format(op["name"]) for op in OPTIMIZED_ATEN_OPS]
all_op_targets = aten_op_targets

runtime.cxx_library(
Expand Down
121 changes: 121 additions & 0 deletions kernels/optimized/op_registration_util.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,124 @@ def define_op_target(name, compiler_flags, deps):
compiler_flags = compiler_flags,
deps = deps,
)

OPTIMIZED_ATEN_OPS = (
op_target(
name = "op_add",
deps = [
":binary_ops",
":add_sub_impl",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
],
),
op_target(
name = "op_bmm",
deps = [
"//executorch/kernels/optimized:libblas",
"//executorch/kernels/portable/cpu/util:matmul_ops_util",
],
),
op_target(
name = "op_div",
deps = [
":binary_ops",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
],
),
op_target(
name = "op_elu",
deps = [
"//executorch/extension/threadpool:threadpool",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
],
),
op_target(name = "op_exp"),
op_target(
name = "op_fft_c2r",
compiler_flags = [] if runtime.is_oss else [
"-Wno-global-constructors",
"-Wno-shadow",
],
deps = [":fft_utils"],
),
op_target(
name = "op_fft_r2c",
compiler_flags = [] if runtime.is_oss else [
"-Wno-global-constructors",
"-Wno-shadow",
],
deps = [":fft_utils"],
),
op_target(name = "op_sigmoid"),
op_target(
name = "op_gelu",
deps = [
"//executorch/kernels/portable/cpu/util:activation_ops_util",
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
],
),
op_target(
name = "op_le",
deps = [
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
],
),
op_target(
name = "op_linear",
deps = [
"//executorch/kernels/optimized:libblas",
"//executorch/kernels/portable/cpu/util:matmul_ops_util",
],
),
op_target(
name = "op_log_softmax",
deps = [
"//executorch/kernels/portable/cpu/util:activation_ops_util",
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
],
),
op_target(
name = "op_mm",
deps = [
"//executorch/kernels/optimized:libblas",
"//executorch/kernels/portable/cpu/util:matmul_ops_util",
],
),
op_target(
name = "op_mul",
deps = [
":binary_ops",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
"//executorch/runtime/core/exec_aten/util:tensor_util",
],
),
op_target(
name = "op_native_layer_norm",
deps = [
":moments_utils",
"//executorch/kernels/portable/cpu/util:normalization_ops_util",
],
),
op_target(name = "op_neg"),
op_target(
name = "op_sub",
deps = [
":binary_ops",
":add_sub_impl",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/portable/cpu/util:broadcast_util",
],
),
op_target(
name = "op_where",
deps = [
"//executorch/extension/threadpool:threadpool",
"//executorch/kernels/portable/cpu/util:elementwise_util",
],
),
)
Loading