提交 50ec85cd 编写于 作者: R Raman Sarokin 提交者: TensorFlower Gardener

environment renamed to device_info and changed to cc target (instead of objc).

Added A14 GPU to enum.

PiperOrigin-RevId: 339964411
Change-Id: I13439c83c6f3d0f75a166b950a5f088843dd2023
上级 41dc507d
......@@ -99,7 +99,7 @@ objc_library(
"//tensorflow/lite/delegates/gpu/metal:api",
"//tensorflow/lite/delegates/gpu/metal:buffer_convert",
"//tensorflow/lite/delegates/gpu/metal:compiled_model",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:device_info",
"//tensorflow/lite/delegates/gpu/metal:inference_context",
"@com_google_absl//absl/types:span",
],
......
......@@ -26,7 +26,7 @@ cc_library(
deps = [
":compiled_model",
":compute_task_descriptor",
":environment",
":device_info",
":runtime_options",
"//tensorflow/lite/delegates/gpu/common:model",
"//tensorflow/lite/delegates/gpu/common:operations",
......@@ -196,18 +196,10 @@ objc_library(
],
)
objc_library(
name = "environment",
srcs = ["environment.mm"],
hdrs = ["environment.h"],
copts = DEFAULT_COPTS,
sdk_frameworks = ["Metal"],
deps = [
":common",
# TODO(b/152322289): The following dependency is not needed, but a Bazel
# bug causes a build failure without an additional dummy dependency.
"//tensorflow/lite/delegates/gpu/common:convert",
],
cc_library(
name = "device_info",
srcs = ["device_info.cc"],
hdrs = ["device_info.h"],
)
cc_library(
......@@ -323,7 +315,7 @@ objc_library(
"//tensorflow/lite/delegates/gpu/common:types",
"//tensorflow/lite/delegates/gpu/metal:buffer",
"//tensorflow/lite/delegates/gpu/metal:common",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:device_info",
"//tensorflow/lite/delegates/gpu/metal:inference_context",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
"//tensorflow/lite/delegates/gpu/metal/kernels:test_util",
......
......@@ -25,7 +25,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/util.h"
#include "tensorflow/lite/delegates/gpu/metal/compiled_model.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/add.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/concat.h"
#include "tensorflow/lite/delegates/gpu/metal/kernels/conv.h"
......
......@@ -19,7 +19,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/model.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/metal/compiled_model.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
namespace tflite {
......
......@@ -22,7 +22,7 @@ limitations under the License.
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
using ::tflite::gpu::metal::GetBestSupportedMetalDevice;
using ::tflite::gpu::metal::CreateComputeProgram;
......
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include <map>
#include <string>
......@@ -39,18 +39,13 @@ Vendor GetVendorFromString(const std::string& device_name) {
AppleGPUInfo::AppleGPUInfo(const std::string& device_name) {
const std::map<std::string, AppleGPU> kMapping = {
{"Apple A7 GPU", AppleGPU::kA7},
{"Apple A8 GPU", AppleGPU::kA8},
{"Apple A8X GPU", AppleGPU::kA8X},
{"Apple A9 GPU", AppleGPU::kA9},
{"Apple A9X GPU", AppleGPU::kA9X},
{"Apple A10 GPU", AppleGPU::kA10},
{"Apple A10X GPU", AppleGPU::kA10X},
{"Apple A11 GPU", AppleGPU::kA11},
{"Apple A12 GPU", AppleGPU::kA12},
{"Apple A12X GPU", AppleGPU::kA12X},
{"Apple A12Z GPU", AppleGPU::kA12Z},
{"Apple A13 GPU", AppleGPU::kA13},
{"Apple A7 GPU", AppleGPU::kA7}, {"Apple A8 GPU", AppleGPU::kA8},
{"Apple A8X GPU", AppleGPU::kA8X}, {"Apple A9 GPU", AppleGPU::kA9},
{"Apple A9X GPU", AppleGPU::kA9X}, {"Apple A10 GPU", AppleGPU::kA10},
{"Apple A10X GPU", AppleGPU::kA10X}, {"Apple A11 GPU", AppleGPU::kA11},
{"Apple A12 GPU", AppleGPU::kA12}, {"Apple A12X GPU", AppleGPU::kA12X},
{"Apple A12Z GPU", AppleGPU::kA12Z}, {"Apple A13 GPU", AppleGPU::kA13},
{"Apple A14 GPU", AppleGPU::kA14},
};
auto it = kMapping.find(device_name);
if (it != kMapping.end()) {
......@@ -67,11 +62,9 @@ bool AppleGPUInfo::IsLocalMemoryPreferredOverGlobal() const {
}
bool AppleGPUInfo::IsBionic() const {
return gpu_type == AppleGPU::kA11 ||
gpu_type == AppleGPU::kA12 ||
gpu_type == AppleGPU::kA12X ||
gpu_type == AppleGPU::kA12Z ||
gpu_type == AppleGPU::kA13;
return gpu_type == AppleGPU::kA11 || gpu_type == AppleGPU::kA12 ||
gpu_type == AppleGPU::kA12X || gpu_type == AppleGPU::kA12Z ||
gpu_type == AppleGPU::kA13 || gpu_type == AppleGPU::kA14;
}
bool AppleGPUInfo::IsRoundToNearestSupported() const {
......@@ -108,12 +101,15 @@ int AppleGPUInfo::GetComputeUnitsCount() const {
return 8;
case AppleGPU::kA13:
return 4;
case AppleGPU::kA14:
return 4;
case AppleGPU::kUnknown:
return 1;
}
}
DeviceInfo::DeviceInfo(const std::string& device_name) : vendor(GetVendorFromString(device_name)) {
DeviceInfo::DeviceInfo(const std::string& device_name)
: vendor(GetVendorFromString(device_name)) {
if (vendor == Vendor::kApple) {
apple_info = AppleGPUInfo(device_name);
}
......
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......@@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_ENVIRONMENT_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_ENVIRONMENT_H_
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_DEVICE_INFO_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_DEVICE_INFO_H_
#include <string>
......@@ -43,6 +43,7 @@ enum class AppleGPU {
kA12X,
kA12Z,
kA13,
kA14,
};
struct AppleGPUInfo {
......@@ -88,4 +89,4 @@ struct DeviceInfo {
} // namespace gpu
} // namespace tflite
#endif // TENSORFLOW_LITE_DELEGATES_GPU_METAL_ENVIRONMENT_H_
#endif // TENSORFLOW_LITE_DELEGATES_GPU_METAL_DEVICE_INFO_H_
......@@ -130,7 +130,7 @@ cc_library(
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/common:winograd_util",
"//tensorflow/lite/delegates/gpu/metal:compute_task_descriptor",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:device_info",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
"@com_google_absl//absl/strings",
],
......@@ -232,7 +232,7 @@ cc_library(
"//tensorflow/lite/delegates/gpu/common:operations",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/metal:compute_task_descriptor",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:device_info",
"@com_google_absl//absl/strings",
],
)
......@@ -270,7 +270,7 @@ cc_library(
"//tensorflow/lite/delegates/gpu/common:types",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/metal:compute_task_descriptor",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:device_info",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
"@com_google_absl//absl/strings",
],
......@@ -696,7 +696,7 @@ cc_library(
"//tensorflow/lite/delegates/gpu/common:types",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/metal:compute_task_descriptor",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:device_info",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
],
)
......@@ -770,7 +770,7 @@ cc_library(
"//tensorflow/lite/delegates/gpu/common:shape",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/metal:compute_task_descriptor",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:device_info",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
"@com_google_absl//absl/strings",
],
......@@ -830,7 +830,7 @@ objc_library(
"//tensorflow/lite/delegates/gpu/metal:api",
"//tensorflow/lite/delegates/gpu/metal:common",
"//tensorflow/lite/delegates/gpu/metal:compiled_model",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:device_info",
"//tensorflow/lite/delegates/gpu/metal:inference_context",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
"@FP16",
......@@ -910,7 +910,7 @@ objc_library(
"//tensorflow/lite/delegates/gpu/common:types",
"//tensorflow/lite/delegates/gpu/common:util",
"//tensorflow/lite/delegates/gpu/metal:common",
"//tensorflow/lite/delegates/gpu/metal:environment",
"//tensorflow/lite/delegates/gpu/metal:device_info",
"//tensorflow/lite/delegates/gpu/metal:inference_context",
"//tensorflow/lite/delegates/gpu/metal:runtime_options",
],
......
......@@ -32,7 +32,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/util.h"
#include "tensorflow/lite/delegates/gpu/common/winograd_util.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
namespace tflite {
......
......@@ -21,7 +21,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/model.h"
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
namespace tflite {
......
......@@ -29,7 +29,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/common/util.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
namespace tflite {
......
......@@ -21,7 +21,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/model.h"
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
namespace tflite {
......
......@@ -25,7 +25,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/common/util.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
namespace tflite {
......
......@@ -21,7 +21,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/model.h"
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
namespace tflite {
......
......@@ -34,7 +34,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/inference_context.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
namespace tflite {
namespace gpu {
......
......@@ -27,7 +27,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/shape.h"
#include "tensorflow/lite/delegates/gpu/common/util.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
namespace tflite {
......
......@@ -21,7 +21,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/model.h"
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
namespace tflite {
......
......@@ -43,7 +43,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/metal/buffer_convert.h"
#include "tensorflow/lite/delegates/gpu/metal/common.h"
#include "tensorflow/lite/delegates/gpu/metal/compiled_model.h"
#include "tensorflow/lite/delegates/gpu/metal/environment.h"
#include "tensorflow/lite/delegates/gpu/metal/device_info.h"
#include "tensorflow/lite/delegates/gpu/metal/inference_context.h"
#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
#include "tensorflow/lite/kernels/kernel_util.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册