Provide builtin_op_kernels target with Ruy and GEMV caching unconditionally enabled

PiperOrigin-RevId: 311776871
Change-Id: I948ea5524fdcf17c36e6219fb1ae18fafdecee4e
This commit is contained in:
T.J. Alumbaugh 2020-05-15 12:09:13 -07:00 committed by TensorFlower Gardener
parent 73d63eefe6
commit 0b59eaf0bf

View File

@ -235,6 +235,15 @@ cc_library(
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(
name = "tflite_with_ruy_default",
build_for_embedded = True,
@ -423,9 +432,7 @@ cc_library(
],
)
cc_library(
name = "builtin_op_kernels",
srcs = [
BUILTIN_KERNEL_SRCS = [
"activations.cc",
"add.cc",
"add_n.cc",
@ -518,13 +525,9 @@ cc_library(
"where.cc",
"while.cc",
"zeros_like.cc",
],
hdrs = [
"dequantize.h",
],
copts = tflite_copts() + tf_opts_nortti_if_android() + EXTRA_EIGEN_COPTS,
visibility = ["//visibility:private"],
deps = [
]
BUILTIN_KERNEL_DEPS = [
":cpu_backend_context",
":cpu_backend_gemm",
":cpu_backend_threadpool",
@ -534,6 +537,10 @@ cc_library(
":lstm_shared",
":op_macros",
":padding",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings",
"//third_party/eigen3",
"@flatbuffers",
"//tensorflow/lite:framework_lib",
"//tensorflow/lite:minimal_logging",
"//tensorflow/lite:string_util",
@ -551,12 +558,31 @@ cc_library(
"//tensorflow/lite/kernels/internal:tensor",
"//tensorflow/lite/kernels/internal:tensor_utils",
"//tensorflow/lite/kernels/internal:types",
"//third_party/eigen3",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings",
"@farmhash_archive//:farmhash",
"@flatbuffers",
]
cc_library(
name = "builtin_op_kernels",
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(
@ -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
# target uses reference kernels only, and is useful for validation and testing.
# It should *not* generally be used in production.