gpu/cl/buffer split on Buffer (CL specific) and BufferDesc (API neutral).
BufferDesc moved to gpu/common/task/
PiperOrigin-RevId: 340496591
Change-Id: I7d2ea7b2e68c1c56afb489b069634ac526031bf7
diff --git a/tensorflow/lite/delegates/gpu/cl/BUILD b/tensorflow/lite/delegates/gpu/cl/BUILD
index 9626839..d3e4632 100644
--- a/tensorflow/lite/delegates/gpu/cl/BUILD
+++ b/tensorflow/lite/delegates/gpu/cl/BUILD
@@ -75,6 +75,7 @@
":util",
"//tensorflow/lite/delegates/gpu/common:data_type",
"//tensorflow/lite/delegates/gpu/common:status",
+ "//tensorflow/lite/delegates/gpu/common/task:buffer_desc",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
],
@@ -126,6 +127,7 @@
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common:types",
"//tensorflow/lite/delegates/gpu/common:util",
+ "//tensorflow/lite/delegates/gpu/common/task:util",
"@com_google_absl//absl/strings",
],
)
@@ -420,6 +422,7 @@
"//tensorflow/lite/delegates/gpu/common:tensor",
"//tensorflow/lite/delegates/gpu/common:types",
"//tensorflow/lite/delegates/gpu/common:util",
+ "//tensorflow/lite/delegates/gpu/common/task:gpu_object_desc",
"//tensorflow/lite/delegates/gpu/common/transformations:add_bias",
"//tensorflow/lite/delegates/gpu/common/transformations:merge_padding_with",
"@com_google_absl//absl/container:flat_hash_map",
@@ -633,7 +636,6 @@
"//tensorflow/lite/delegates/gpu/common:status",
"//tensorflow/lite/delegates/gpu/common:tensor",
"//tensorflow/lite/delegates/gpu/common:util",
- "//tensorflow/lite/delegates/gpu/common/task:gpu_object_desc",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
],
diff --git a/tensorflow/lite/delegates/gpu/cl/buffer.cc b/tensorflow/lite/delegates/gpu/cl/buffer.cc
index e672acd..fba1335 100644
--- a/tensorflow/lite/delegates/gpu/cl/buffer.cc
+++ b/tensorflow/lite/delegates/gpu/cl/buffer.cc
@@ -38,98 +38,6 @@
}
} // namespace
-BufferDescriptor::BufferDescriptor(BufferDescriptor&& desc)
- : GPUObjectDescriptor(std::move(desc)),
- element_type(desc.element_type),
- element_size(desc.element_size),
- memory_type(desc.memory_type),
- attributes(std::move(desc.attributes)),
- size(desc.size),
- data(std::move(desc.data)) {}
-
-BufferDescriptor& BufferDescriptor::operator=(BufferDescriptor&& desc) {
- if (this != &desc) {
- std::swap(element_type, desc.element_type);
- std::swap(element_size, desc.element_size);
- std::swap(memory_type, desc.memory_type);
- attributes = std::move(desc.attributes);
- std::swap(size, desc.size);
- data = std::move(desc.data);
- GPUObjectDescriptor::operator=(std::move(desc));
- }
- return *this;
-}
-
-void BufferDescriptor::Release() { data.clear(); }
-
-GPUResources BufferDescriptor::GetGPUResources() const {
- GPUResources resources;
- GPUBufferDescriptor desc;
- desc.data_type = element_type;
- desc.access_type = access_type_;
- desc.element_size = element_size;
- desc.memory_type = memory_type;
- desc.attributes = attributes;
- resources.buffers.push_back({"buffer", desc});
- return resources;
-}
-
-absl::Status BufferDescriptor::PerformSelector(
- const std::string& selector, const std::vector<std::string>& args,
- const std::vector<std::string>& template_args, std::string* result) const {
- if (selector == "Read") {
- return PerformReadSelector(args, result);
- } else if (selector == "GetPtr") {
- return PerformGetPtrSelector(args, template_args, result);
- } else {
- return absl::NotFoundError(absl::StrCat(
- "BufferDescriptor don't have selector with name - ", selector));
- }
-}
-
-absl::Status BufferDescriptor::PerformReadSelector(
- const std::vector<std::string>& args, std::string* result) const {
- if (args.size() != 1) {
- return absl::NotFoundError(
- absl::StrCat("BufferDescriptor Read require one argument, but ",
- args.size(), " was passed"));
- }
- *result = absl::StrCat("buffer[", args[0], "]");
- return absl::OkStatus();
-}
-
-absl::Status BufferDescriptor::PerformGetPtrSelector(
- const std::vector<std::string>& args,
- const std::vector<std::string>& template_args, std::string* result) const {
- if (args.size() > 1) {
- return absl::NotFoundError(absl::StrCat(
- "BufferDescriptor GetPtr require one or zero arguments, but ",
- args.size(), " was passed"));
- }
- if (template_args.size() > 1) {
- return absl::NotFoundError(
- absl::StrCat("BufferDescriptor GetPtr require one or zero teemplate "
- "arguments, but ",
- template_args.size(), " was passed"));
- }
- std::string conversion;
- if (template_args.size() == 1) {
- const std::string type_name = ToCLDataType(element_type, element_size);
- if (type_name != template_args[0]) {
- conversion = absl::StrCat("(", MemoryTypeToCLType(memory_type), " ",
- template_args[0], "*)&");
- }
- }
- if (args.empty()) {
- *result = absl::StrCat(conversion, "buffer");
- } else if (conversion.empty()) {
- *result = absl::StrCat("(buffer + ", args[0], ")");
- } else {
- *result = absl::StrCat(conversion, "buffer[", args[0], "]");
- }
- return absl::OkStatus();
-}
-
Buffer::Buffer(cl_mem buffer, size_t size_in_bytes)
: buffer_(buffer), size_(size_in_bytes) {}
diff --git a/tensorflow/lite/delegates/gpu/cl/buffer.h b/tensorflow/lite/delegates/gpu/cl/buffer.h
index 597fbf6..4614a17 100644
--- a/tensorflow/lite/delegates/gpu/cl/buffer.h
+++ b/tensorflow/lite/delegates/gpu/cl/buffer.h
@@ -24,42 +24,12 @@
#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
#include "tensorflow/lite/delegates/gpu/cl/util.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
+#include "tensorflow/lite/delegates/gpu/common/task/buffer_desc.h"
namespace tflite {
namespace gpu {
namespace cl {
-struct BufferDescriptor : public GPUObjectDescriptor {
- DataType element_type;
- int element_size;
- MemoryType memory_type = MemoryType::GLOBAL;
- std::vector<std::string> attributes;
-
- // optional
- int size = 0;
- std::vector<uint8_t> data;
-
- BufferDescriptor() = default;
- BufferDescriptor(const BufferDescriptor&) = default;
- BufferDescriptor& operator=(const BufferDescriptor&) = default;
- BufferDescriptor(BufferDescriptor&& desc);
- BufferDescriptor& operator=(BufferDescriptor&& desc);
-
- absl::Status PerformSelector(const std::string& selector,
- const std::vector<std::string>& args,
- const std::vector<std::string>& template_args,
- std::string* result) const override;
-
- GPUResources GetGPUResources() const override;
- absl::Status PerformReadSelector(const std::vector<std::string>& args,
- std::string* result) const;
- absl::Status PerformGetPtrSelector(
- const std::vector<std::string>& args,
- const std::vector<std::string>& template_args, std::string* result) const;
-
- void Release() override;
-};
-
// Buffer represent linear GPU data storage with arbitrary data format.
// Buffer is moveable but not copyable.
class Buffer : public GPUObject {
diff --git a/tensorflow/lite/delegates/gpu/cl/cl_arguments.cc b/tensorflow/lite/delegates/gpu/cl/cl_arguments.cc
index 2d10c0d..07609ee 100644
--- a/tensorflow/lite/delegates/gpu/cl/cl_arguments.cc
+++ b/tensorflow/lite/delegates/gpu/cl/cl_arguments.cc
@@ -27,6 +27,7 @@
#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
#include "tensorflow/lite/delegates/gpu/cl/texture2d.h"
+#include "tensorflow/lite/delegates/gpu/common/task/util.h"
#include "tensorflow/lite/delegates/gpu/common/util.h"
namespace tflite {
diff --git a/tensorflow/lite/delegates/gpu/cl/serialization.cc b/tensorflow/lite/delegates/gpu/cl/serialization.cc
index b965c1d..a1d1e99 100644
--- a/tensorflow/lite/delegates/gpu/cl/serialization.cc
+++ b/tensorflow/lite/delegates/gpu/cl/serialization.cc
@@ -28,6 +28,7 @@
#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
#include "tensorflow/lite/delegates/gpu/cl/texture2d.h"
#include "tensorflow/lite/delegates/gpu/common/model.h"
+#include "tensorflow/lite/delegates/gpu/common/task/gpu_object_desc.h"
namespace tflite {
namespace gpu {
@@ -274,23 +275,7 @@
}
} // namespace
-
-flatbuffers::Offset<data::Int2> Encode(
- const int2& v, flatbuffers::FlatBufferBuilder* builder) {
- data::Int2Builder int2_builder(*builder);
- int2_builder.add_x(v.x);
- int2_builder.add_y(v.y);
- return int2_builder.Finish();
-}
-
-flatbuffers::Offset<data::Int3> Encode(
- const int3& v, flatbuffers::FlatBufferBuilder* builder) {
- data::Int3Builder int3_builder(*builder);
- int3_builder.add_x(v.x);
- int3_builder.add_y(v.y);
- int3_builder.add_z(v.z);
- return int3_builder.Finish();
-}
+} // namespace cl
flatbuffers::Offset<tflite::gpu::data::GPUObjectDescriptor> Encode(
const GPUObjectDescriptor& desc, flatbuffers::FlatBufferBuilder* builder) {
@@ -307,13 +292,13 @@
auto state_vars_fb_vec = builder->CreateVector(state_vars_fb);
tflite::gpu::data::GPUObjectDescriptorBuilder obj_builder(*builder);
obj_builder.add_state_vars(state_vars_fb_vec);
- obj_builder.add_access_type(ToFB(desc.access_type_));
+ obj_builder.add_access_type(cl::ToFB(desc.access_type_));
return obj_builder.Finish();
}
void Decode(const tflite::gpu::data::GPUObjectDescriptor* fb_obj,
GPUObjectDescriptor* obj) {
- obj->access_type_ = ToEnum(fb_obj->access_type());
+ obj->access_type_ = cl::ToEnum(fb_obj->access_type());
for (auto state_fb : *fb_obj->state_vars()) {
std::string key(state_fb->key()->c_str(), state_fb->key()->size());
std::string value(state_fb->value()->c_str(), state_fb->value()->size());
@@ -321,6 +306,25 @@
}
}
+namespace cl {
+
+flatbuffers::Offset<data::Int2> Encode(
+ const int2& v, flatbuffers::FlatBufferBuilder* builder) {
+ data::Int2Builder int2_builder(*builder);
+ int2_builder.add_x(v.x);
+ int2_builder.add_y(v.y);
+ return int2_builder.Finish();
+}
+
+flatbuffers::Offset<data::Int3> Encode(
+ const int3& v, flatbuffers::FlatBufferBuilder* builder) {
+ data::Int3Builder int3_builder(*builder);
+ int3_builder.add_x(v.x);
+ int3_builder.add_y(v.y);
+ int3_builder.add_z(v.z);
+ return int3_builder.Finish();
+}
+
flatbuffers::Offset<data::BufferDescriptor> Encode(
const BufferDescriptor& desc, flatbuffers::FlatBufferBuilder* builder) {
auto obj_fb =
diff --git a/tensorflow/lite/delegates/gpu/cl/util.cc b/tensorflow/lite/delegates/gpu/cl/util.cc
index 901e2c3..d0e6553 100644
--- a/tensorflow/lite/delegates/gpu/cl/util.cc
+++ b/tensorflow/lite/delegates/gpu/cl/util.cc
@@ -241,19 +241,6 @@
return absl::OkStatus();
}
-std::string MemoryTypeToCLType(MemoryType type) {
- switch (type) {
- case MemoryType::GLOBAL:
- return "__global";
- case MemoryType::CONSTANT:
- return "__constant";
- break;
- case MemoryType::LOCAL:
- return "__local";
- }
- return "";
-}
-
} // namespace cl
} // namespace gpu
} // namespace tflite
diff --git a/tensorflow/lite/delegates/gpu/cl/util.h b/tensorflow/lite/delegates/gpu/cl/util.h
index 05a8f08..73f54e2 100644
--- a/tensorflow/lite/delegates/gpu/cl/util.h
+++ b/tensorflow/lite/delegates/gpu/cl/util.h
@@ -22,7 +22,6 @@
#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
#include "tensorflow/lite/delegates/gpu/common/data_type.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/task/gpu_object_desc.h"
#include "tensorflow/lite/delegates/gpu/common/tensor.h"
#include "tensorflow/lite/delegates/gpu/common/util.h"
@@ -57,9 +56,6 @@
absl::Status CreateRGBAImage2D(cl_context context, int width, int height,
cl_channel_type channel_type, void* data,
cl_mem* result);
-
-std::string MemoryTypeToCLType(MemoryType type);
-
} // namespace cl
} // namespace gpu
} // namespace tflite
diff --git a/tensorflow/lite/delegates/gpu/common/task/BUILD b/tensorflow/lite/delegates/gpu/common/task/BUILD
index e270fd9..39ad925 100644
--- a/tensorflow/lite/delegates/gpu/common/task/BUILD
+++ b/tensorflow/lite/delegates/gpu/common/task/BUILD
@@ -6,6 +6,19 @@
)
cc_library(
+ name = "buffer_desc",
+ srcs = ["buffer_desc.cc"],
+ hdrs = ["buffer_desc.h"],
+ deps = [
+ ":gpu_object_desc",
+ ":util",
+ "//tensorflow/lite/delegates/gpu/common:data_type",
+ "//tensorflow/lite/delegates/gpu/common:status",
+ "@com_google_absl//absl/strings",
+ ],
+)
+
+cc_library(
name = "gpu_object_desc",
hdrs = ["gpu_object_desc.h"],
deps = [
@@ -23,3 +36,12 @@
"--scoped-enums",
],
)
+
+cc_library(
+ name = "util",
+ srcs = ["util.cc"],
+ hdrs = ["util.h"],
+ deps = [
+ ":gpu_object_desc",
+ ],
+)
diff --git a/tensorflow/lite/delegates/gpu/common/task/buffer_desc.cc b/tensorflow/lite/delegates/gpu/common/task/buffer_desc.cc
new file mode 100644
index 0000000..155462a
--- /dev/null
+++ b/tensorflow/lite/delegates/gpu/common/task/buffer_desc.cc
@@ -0,0 +1,99 @@
+/* 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.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+#include "tensorflow/lite/delegates/gpu/common/task/buffer_desc.h"
+
+#include <string>
+
+#include "absl/strings/str_cat.h"
+#include "tensorflow/lite/delegates/gpu/common/data_type.h"
+#include "tensorflow/lite/delegates/gpu/common/status.h"
+#include "tensorflow/lite/delegates/gpu/common/task/util.h"
+
+namespace tflite {
+namespace gpu {
+
+void BufferDescriptor::Release() { data.clear(); }
+
+GPUResources BufferDescriptor::GetGPUResources() const {
+ GPUResources resources;
+ GPUBufferDescriptor desc;
+ desc.data_type = element_type;
+ desc.access_type = access_type_;
+ desc.element_size = element_size;
+ desc.memory_type = memory_type;
+ desc.attributes = attributes;
+ resources.buffers.push_back({"buffer", desc});
+ return resources;
+}
+
+absl::Status BufferDescriptor::PerformSelector(
+ const std::string& selector, const std::vector<std::string>& args,
+ const std::vector<std::string>& template_args, std::string* result) const {
+ if (selector == "Read") {
+ return PerformReadSelector(args, result);
+ } else if (selector == "GetPtr") {
+ return PerformGetPtrSelector(args, template_args, result);
+ } else {
+ return absl::NotFoundError(absl::StrCat(
+ "BufferDescriptor don't have selector with name - ", selector));
+ }
+}
+
+absl::Status BufferDescriptor::PerformReadSelector(
+ const std::vector<std::string>& args, std::string* result) const {
+ if (args.size() != 1) {
+ return absl::NotFoundError(
+ absl::StrCat("BufferDescriptor Read require one argument, but ",
+ args.size(), " was passed"));
+ }
+ *result = absl::StrCat("buffer[", args[0], "]");
+ return absl::OkStatus();
+}
+
+absl::Status BufferDescriptor::PerformGetPtrSelector(
+ const std::vector<std::string>& args,
+ const std::vector<std::string>& template_args, std::string* result) const {
+ if (args.size() > 1) {
+ return absl::NotFoundError(absl::StrCat(
+ "BufferDescriptor GetPtr require one or zero arguments, but ",
+ args.size(), " was passed"));
+ }
+ if (template_args.size() > 1) {
+ return absl::NotFoundError(
+ absl::StrCat("BufferDescriptor GetPtr require one or zero teemplate "
+ "arguments, but ",
+ template_args.size(), " was passed"));
+ }
+ std::string conversion;
+ if (template_args.size() == 1) {
+ const std::string type_name = ToCLDataType(element_type, element_size);
+ if (type_name != template_args[0]) {
+ conversion = absl::StrCat("(", MemoryTypeToCLType(memory_type), " ",
+ template_args[0], "*)&");
+ }
+ }
+ if (args.empty()) {
+ *result = absl::StrCat(conversion, "buffer");
+ } else if (conversion.empty()) {
+ *result = absl::StrCat("(buffer + ", args[0], ")");
+ } else {
+ *result = absl::StrCat(conversion, "buffer[", args[0], "]");
+ }
+ return absl::OkStatus();
+}
+
+} // namespace gpu
+} // namespace tflite
diff --git a/tensorflow/lite/delegates/gpu/common/task/buffer_desc.h b/tensorflow/lite/delegates/gpu/common/task/buffer_desc.h
new file mode 100644
index 0000000..09c93ab
--- /dev/null
+++ b/tensorflow/lite/delegates/gpu/common/task/buffer_desc.h
@@ -0,0 +1,63 @@
+/* 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.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TASK_BUFFER_DESC_H_
+#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TASK_BUFFER_DESC_H_
+
+#include <string>
+#include <vector>
+
+#include "tensorflow/lite/delegates/gpu/common/data_type.h"
+#include "tensorflow/lite/delegates/gpu/common/status.h"
+#include "tensorflow/lite/delegates/gpu/common/task/gpu_object_desc.h"
+
+namespace tflite {
+namespace gpu {
+
+struct BufferDescriptor : public GPUObjectDescriptor {
+ DataType element_type;
+ int element_size;
+ MemoryType memory_type = MemoryType::GLOBAL;
+ std::vector<std::string> attributes;
+
+ // optional
+ int size = 0;
+ std::vector<uint8_t> data;
+
+ BufferDescriptor() = default;
+ BufferDescriptor(const BufferDescriptor&) = default;
+ BufferDescriptor& operator=(const BufferDescriptor&) = default;
+ BufferDescriptor(BufferDescriptor&& desc) = default;
+ BufferDescriptor& operator=(BufferDescriptor&& desc) = default;
+
+ absl::Status PerformSelector(const std::string& selector,
+ const std::vector<std::string>& args,
+ const std::vector<std::string>& template_args,
+ std::string* result) const override;
+
+ GPUResources GetGPUResources() const override;
+ absl::Status PerformReadSelector(const std::vector<std::string>& args,
+ std::string* result) const;
+ absl::Status PerformGetPtrSelector(
+ const std::vector<std::string>& args,
+ const std::vector<std::string>& template_args, std::string* result) const;
+
+ void Release() override;
+};
+
+} // namespace gpu
+} // namespace tflite
+
+#endif // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TASK_BUFFER_DESC_H_
diff --git a/tensorflow/lite/delegates/gpu/common/task/gpu_object_desc.h b/tensorflow/lite/delegates/gpu/common/task/gpu_object_desc.h
index 103ef48..1140c23 100644
--- a/tensorflow/lite/delegates/gpu/common/task/gpu_object_desc.h
+++ b/tensorflow/lite/delegates/gpu/common/task/gpu_object_desc.h
@@ -28,7 +28,6 @@
namespace tflite {
namespace gpu {
-namespace cl {
struct GPUImage2DDescriptor {
DataType data_type;
@@ -142,7 +141,6 @@
using GPUObjectDescriptorPtr = std::unique_ptr<GPUObjectDescriptor>;
-} // namespace cl
} // namespace gpu
} // namespace tflite
diff --git a/tensorflow/lite/delegates/gpu/common/task/util.cc b/tensorflow/lite/delegates/gpu/common/task/util.cc
new file mode 100644
index 0000000..972a2b7
--- /dev/null
+++ b/tensorflow/lite/delegates/gpu/common/task/util.cc
@@ -0,0 +1,34 @@
+/* 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.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+#include "tensorflow/lite/delegates/gpu/common/task/util.h"
+
+namespace tflite {
+namespace gpu {
+
+std::string MemoryTypeToCLType(MemoryType type) {
+ switch (type) {
+ case MemoryType::GLOBAL:
+ return "__global";
+ case MemoryType::CONSTANT:
+ return "__constant";
+ case MemoryType::LOCAL:
+ return "__local";
+ }
+ return "";
+}
+
+} // namespace gpu
+} // namespace tflite
diff --git a/tensorflow/lite/delegates/gpu/common/task/util.h b/tensorflow/lite/delegates/gpu/common/task/util.h
new file mode 100644
index 0000000..cbbf0cf
--- /dev/null
+++ b/tensorflow/lite/delegates/gpu/common/task/util.h
@@ -0,0 +1,31 @@
+/* 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.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TASK_UTIL_H_
+#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TASK_UTIL_H_
+
+#include <string>
+
+#include "tensorflow/lite/delegates/gpu/common/task/gpu_object_desc.h"
+
+namespace tflite {
+namespace gpu {
+
+std::string MemoryTypeToCLType(MemoryType type);
+
+} // namespace gpu
+} // namespace tflite
+
+#endif // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TASK_UTIL_H_