Provide builtin_op_kernels target with Ruy and GEMV caching unconditionally enabled
PiperOrigin-RevId: 311776871 Change-Id: I948ea5524fdcf17c36e6219fb1ae18fafdecee4e
This commit is contained in:
parent
73d63eefe6
commit
0b59eaf0bf
@ -235,6 +235,15 @@ cc_library(
|
|||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:private"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "tflite_with_ruy_and_caching_enabled",
|
||||||
|
defines = [
|
||||||
|
"TFLITE_WITH_RUY",
|
||||||
|
"TFLITE_WITH_RUY_GEMV",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "tflite_with_ruy_default",
|
name = "tflite_with_ruy_default",
|
||||||
build_for_embedded = True,
|
build_for_embedded = True,
|
||||||
@ -423,9 +432,7 @@ cc_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
BUILTIN_KERNEL_SRCS = [
|
||||||
name = "builtin_op_kernels",
|
|
||||||
srcs = [
|
|
||||||
"activations.cc",
|
"activations.cc",
|
||||||
"add.cc",
|
"add.cc",
|
||||||
"add_n.cc",
|
"add_n.cc",
|
||||||
@ -518,13 +525,9 @@ cc_library(
|
|||||||
"where.cc",
|
"where.cc",
|
||||||
"while.cc",
|
"while.cc",
|
||||||
"zeros_like.cc",
|
"zeros_like.cc",
|
||||||
],
|
]
|
||||||
hdrs = [
|
|
||||||
"dequantize.h",
|
BUILTIN_KERNEL_DEPS = [
|
||||||
],
|
|
||||||
copts = tflite_copts() + tf_opts_nortti_if_android() + EXTRA_EIGEN_COPTS,
|
|
||||||
visibility = ["//visibility:private"],
|
|
||||||
deps = [
|
|
||||||
":cpu_backend_context",
|
":cpu_backend_context",
|
||||||
":cpu_backend_gemm",
|
":cpu_backend_gemm",
|
||||||
":cpu_backend_threadpool",
|
":cpu_backend_threadpool",
|
||||||
@ -534,6 +537,10 @@ cc_library(
|
|||||||
":lstm_shared",
|
":lstm_shared",
|
||||||
":op_macros",
|
":op_macros",
|
||||||
":padding",
|
":padding",
|
||||||
|
"@com_google_absl//absl/memory",
|
||||||
|
"@com_google_absl//absl/strings",
|
||||||
|
"//third_party/eigen3",
|
||||||
|
"@flatbuffers",
|
||||||
"//tensorflow/lite:framework_lib",
|
"//tensorflow/lite:framework_lib",
|
||||||
"//tensorflow/lite:minimal_logging",
|
"//tensorflow/lite:minimal_logging",
|
||||||
"//tensorflow/lite:string_util",
|
"//tensorflow/lite:string_util",
|
||||||
@ -551,12 +558,31 @@ cc_library(
|
|||||||
"//tensorflow/lite/kernels/internal:tensor",
|
"//tensorflow/lite/kernels/internal:tensor",
|
||||||
"//tensorflow/lite/kernels/internal:tensor_utils",
|
"//tensorflow/lite/kernels/internal:tensor_utils",
|
||||||
"//tensorflow/lite/kernels/internal:types",
|
"//tensorflow/lite/kernels/internal:types",
|
||||||
"//third_party/eigen3",
|
]
|
||||||
"@com_google_absl//absl/memory",
|
|
||||||
"@com_google_absl//absl/strings",
|
cc_library(
|
||||||
"@farmhash_archive//:farmhash",
|
name = "builtin_op_kernels",
|
||||||
"@flatbuffers",
|
srcs = BUILTIN_KERNEL_SRCS,
|
||||||
|
hdrs = [
|
||||||
|
"dequantize.h",
|
||||||
],
|
],
|
||||||
|
copts = tflite_copts() + tf_opts_nortti_if_android() + EXTRA_EIGEN_COPTS,
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
deps = BUILTIN_KERNEL_DEPS + ["@farmhash_archive//:farmhash"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Creates a target where Ruy is unconditionally enabled along with caching
|
||||||
|
# on GEMV operations. This is useful for TF Lite deployments where custom
|
||||||
|
# copts are not allowed, e.g. b/156119344
|
||||||
|
cc_library(
|
||||||
|
name = "builtin_op_kernels_ruy_and_caching",
|
||||||
|
srcs = BUILTIN_KERNEL_SRCS,
|
||||||
|
hdrs = [
|
||||||
|
"dequantize.h",
|
||||||
|
],
|
||||||
|
copts = tflite_copts() + tf_opts_nortti_if_android() + EXTRA_EIGEN_COPTS,
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
deps = BUILTIN_KERNEL_DEPS + ["@farmhash_archive//:farmhash"] + [":tflite_with_ruy_and_caching_enabled"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
@ -673,6 +699,22 @@ cc_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# TODO(b/156664104) Remove once runtime flag available.
|
||||||
|
cc_library(
|
||||||
|
name = "builtin_ops_ruy_and_caching_enabled",
|
||||||
|
srcs = ["register.cc"],
|
||||||
|
hdrs = [
|
||||||
|
"builtin_op_kernels.h",
|
||||||
|
"fully_connected.h",
|
||||||
|
"register.h",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
":builtin_op_kernels_ruy_and_caching",
|
||||||
|
"//tensorflow/lite:framework_lib",
|
||||||
|
"//tensorflow/lite/c:common",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
# The builtin_ops target will resolve to optimized kernels when available. This
|
# The builtin_ops target will resolve to optimized kernels when available. This
|
||||||
# target uses reference kernels only, and is useful for validation and testing.
|
# target uses reference kernels only, and is useful for validation and testing.
|
||||||
# It should *not* generally be used in production.
|
# It should *not* generally be used in production.
|
||||||
|
Loading…
Reference in New Issue
Block a user