GPU delegate: Add Android to tflite_extra_gles_deps, instead of manually linking against system libraries for EGL and GLESv3.
PiperOrigin-RevId: 312847902 Change-Id: I6859765a7baa3180897855670672241e71887d87
This commit is contained in:
parent
4797b3b908
commit
f29c4058a4
@ -29,6 +29,17 @@ cc_library(
|
||||
name = "gl_delegate",
|
||||
srcs = ["gl_delegate.cc"],
|
||||
hdrs = ["gl_delegate.h"],
|
||||
linkopts = select({
|
||||
"//tensorflow:android": [
|
||||
"-lEGL",
|
||||
# We don't need to link libGLESv3, because if it exists,
|
||||
# it is a symlink to libGLESv2.
|
||||
# See Compatibility Definition Document:
|
||||
# https://source.android.com/compatibility/10/android-10-cdd#7_1_4_1_opengl_es
|
||||
"-lGLESv2",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
"@com_google_absl//absl/types:span",
|
||||
@ -109,6 +120,11 @@ cc_binary(
|
||||
linkopts = [
|
||||
"-Wl,-soname=libtensorflowlite_gpu_gl.so",
|
||||
] + select({
|
||||
"//tensorflow:android": [
|
||||
"-lEGL",
|
||||
"-lGLESv3",
|
||||
"-fvisibility=hidden",
|
||||
],
|
||||
"//tensorflow:windows": [],
|
||||
"//conditions:default": [
|
||||
"-fvisibility=hidden",
|
||||
@ -120,7 +136,7 @@ cc_binary(
|
||||
"nobuilder",
|
||||
"notap",
|
||||
],
|
||||
deps = [":gl_delegate"] + tflite_extra_gles_deps(),
|
||||
deps = [":gl_delegate"],
|
||||
)
|
||||
|
||||
# build -c opt --config android_arm64 --copt -Os --copt -DTFLITE_GPU_BINARY_RELEASE --copt --linkopt -s --strip always :libtensorflowlite_gpu_delegate.so
|
||||
@ -129,6 +145,11 @@ cc_binary(
|
||||
linkopts = [
|
||||
"-Wl,-soname=libtensorflowlite_gpu_delegate.so",
|
||||
] + select({
|
||||
"//tensorflow:android": [
|
||||
"-lEGL",
|
||||
"-lGLESv3",
|
||||
"-fvisibility=hidden",
|
||||
],
|
||||
"//tensorflow:windows": [],
|
||||
"//conditions:default": [
|
||||
"-fvisibility=hidden",
|
||||
@ -140,7 +161,7 @@ cc_binary(
|
||||
"nobuilder",
|
||||
"notap",
|
||||
],
|
||||
deps = [":delegate"] + tflite_extra_gles_deps(),
|
||||
deps = [":delegate"],
|
||||
)
|
||||
|
||||
# bazel build -c opt --cpu ios_arm64 --copt -Os --copt -DTFLITE_GPU_BINARY_RELEASE --copt -fvisibility=hidden --linkopt -s --strip always --cxxopt=-std=c++14 :libtensorflowlite_gpu_metal --apple_platform_type=ios
|
||||
@ -200,9 +221,18 @@ cc_library(
|
||||
name = "delegate",
|
||||
srcs = ["delegate.cc"],
|
||||
hdrs = ["delegate.h"],
|
||||
linkopts = select({
|
||||
"//tensorflow:android": [
|
||||
"-lEGL",
|
||||
# We don't need to link libGLESv3, because if it exists,
|
||||
# it is a symlink to libGLESv2.
|
||||
# See Compatibility Definition Document:
|
||||
# https://source.android.com/compatibility/10/android-10-cdd#7_1_4_1_opengl_es
|
||||
"-lGLESv2",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/types:span",
|
||||
"//tensorflow/lite:kernel_api",
|
||||
"//tensorflow/lite:minimal_logging",
|
||||
"//tensorflow/lite/c:common",
|
||||
@ -216,5 +246,7 @@ cc_library(
|
||||
"//tensorflow/lite/delegates/gpu/common:status",
|
||||
"//tensorflow/lite/delegates/gpu/gl:api2",
|
||||
"//tensorflow/lite/kernels/internal:optimized_base",
|
||||
] + tflite_extra_gles_deps(),
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/types:span",
|
||||
],
|
||||
)
|
||||
|
@ -1,6 +1,8 @@
|
||||
load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
|
||||
load("//tensorflow/core/platform:build_config_root.bzl", "tf_gpu_tests_tags")
|
||||
load("//tensorflow/lite:special_rules.bzl", "tflite_extra_gles_deps")
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config_root.bzl",
|
||||
"tf_gpu_tests_tags",
|
||||
)
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
@ -265,11 +267,17 @@ cc_library(
|
||||
name = "gpu_api_delegate",
|
||||
srcs = ["gpu_api_delegate.cc"],
|
||||
hdrs = ["gpu_api_delegate.h"],
|
||||
linkopts = select({
|
||||
"//tensorflow:android": [
|
||||
"-lEGL",
|
||||
"-lGLESv3",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [
|
||||
":api",
|
||||
":opencl_wrapper",
|
||||
":tensor_type_util",
|
||||
"@com_google_absl//absl/types:span",
|
||||
"//tensorflow/lite:kernel_api",
|
||||
"//tensorflow/lite/c:common",
|
||||
"//tensorflow/lite/delegates/gpu:api",
|
||||
@ -279,7 +287,8 @@ cc_library(
|
||||
"//tensorflow/lite/delegates/gpu/common:model_transformer",
|
||||
"//tensorflow/lite/delegates/gpu/common:status",
|
||||
"//tensorflow/lite/delegates/gpu/common/transformations:general_transformations",
|
||||
] + tflite_extra_gles_deps(),
|
||||
"@com_google_absl//absl/types:span",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
|
@ -35,6 +35,10 @@ cc_library(
|
||||
cc_test(
|
||||
name = "opengl_test",
|
||||
srcs = ["opengl_test.cc"],
|
||||
linkopts = [
|
||||
"-lEGL",
|
||||
"-lGLESv3",
|
||||
],
|
||||
tags = tf_gpu_tests_tags() + [
|
||||
"local",
|
||||
"nobuilder",
|
||||
|
@ -1,5 +1,8 @@
|
||||
load("//tensorflow/lite:special_rules.bzl", "tflite_extra_gles_deps", "tflite_portable_test_suite_combined")
|
||||
load("//tensorflow/core/platform:build_config_root.bzl", "tf_gpu_tests_tags")
|
||||
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite_combined")
|
||||
load(
|
||||
"//tensorflow/core/platform:build_config_root.bzl",
|
||||
"tf_gpu_tests_tags",
|
||||
)
|
||||
|
||||
package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
@ -29,6 +32,10 @@ cc_test(
|
||||
name = "converter_test",
|
||||
size = "small",
|
||||
srcs = ["converter_test.cc"],
|
||||
linkopts = [
|
||||
"-lEGL",
|
||||
"-lGLESv3",
|
||||
],
|
||||
tags = tf_gpu_tests_tags() + [
|
||||
"local",
|
||||
"nobuilder",
|
||||
@ -37,15 +44,15 @@ cc_test(
|
||||
],
|
||||
deps = [
|
||||
":converter",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
"@com_google_absl//absl/types:span",
|
||||
"//tensorflow/lite/delegates/gpu/common:convert",
|
||||
"//tensorflow/lite/delegates/gpu/common:shape",
|
||||
"//tensorflow/lite/delegates/gpu/common:status",
|
||||
"//tensorflow/lite/delegates/gpu/gl:egl_environment",
|
||||
"//tensorflow/lite/delegates/gpu/gl:gl_buffer",
|
||||
"//tensorflow/lite/delegates/gpu/gl:portable",
|
||||
] + tflite_extra_gles_deps(),
|
||||
"@com_google_absl//absl/types:span",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
@ -648,9 +655,11 @@ cc_library(
|
||||
testonly = 1,
|
||||
srcs = ["test_util.cc"],
|
||||
hdrs = ["test_util.h"],
|
||||
linkopts = [
|
||||
"-lEGL",
|
||||
"-lGLESv3",
|
||||
],
|
||||
deps = [
|
||||
"@com_google_googletest//:gtest",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
"//tensorflow/lite/delegates/gpu/common:model",
|
||||
"//tensorflow/lite/delegates/gpu/common:operations",
|
||||
"//tensorflow/lite/delegates/gpu/common:status",
|
||||
@ -664,7 +673,9 @@ cc_library(
|
||||
"//tensorflow/lite/delegates/gpu/gl:request_gpu_info",
|
||||
"//tensorflow/lite/delegates/gpu/gl:runtime_options",
|
||||
"//tensorflow/lite/delegates/gpu/gl/workgroups:default_calculator",
|
||||
] + tflite_extra_gles_deps(),
|
||||
"@com_google_googletest//:gtest",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
|
@ -13,6 +13,13 @@ cc_library(
|
||||
name = "native",
|
||||
srcs = ["gpu_delegate_jni.cc"],
|
||||
copts = tflite_copts(),
|
||||
linkopts = select({
|
||||
"//tensorflow:android": [
|
||||
"-lGLESv3",
|
||||
"-lEGL",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
tags = [
|
||||
"manual",
|
||||
"notap",
|
||||
|
Loading…
Reference in New Issue
Block a user