aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/CLUtils.cpp
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2022-12-30 16:07:45 +0000
committerGian Marco Iodice <gianmarco.iodice@arm.com>2023-01-10 09:57:51 +0000
commit3cce35dcad8bc8f53a1e6613f719af9ab04feda6 (patch)
treee1015566852ebce4af897db37cf5cb1989c29924 /src/core/CL/CLUtils.cpp
parentd2d9361a0a338bce478f7d85b4af70d1ed20f26c (diff)
downloadComputeLibrary-3cce35dcad8bc8f53a1e6613f719af9ab04feda6.tar.gz
Extend cl image support to input and output tensors
- Add support for texture image to input and output of direct convolution - Extend T_LOAD2D_INDIRECT macro to read values from cl image storages Resolves COMPMID-5715 Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Change-Id: Idb0410f53f6d0763cd9e39895a7cbf9bc826d33a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8904 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Viet-Hoa Do <viet-hoa.do@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CL/CLUtils.cpp')
-rw-r--r--src/core/CL/CLUtils.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/core/CL/CLUtils.cpp b/src/core/CL/CLUtils.cpp
index 8f39c2d700..84cf88e099 100644
--- a/src/core/CL/CLUtils.cpp
+++ b/src/core/CL/CLUtils.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2022 Arm Limited.
+ * Copyright (c) 2020-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -32,7 +32,7 @@
namespace arm_compute
{
-cl::Image2D create_image2d_from_buffer(const cl::Context &ctx, const cl::Buffer &buffer, const TensorShape &shape2d, DataType data_type, size_t image_row_pitch)
+cl::Image2D create_image2d_from_buffer(const cl::Context &ctx, const cl::Buffer &buffer, const TensorShape &shape2d, DataType data_type, size_t image_row_pitch, CLImage2DType type)
{
cl_channel_type cl_data_type;
@@ -61,7 +61,17 @@ cl::Image2D create_image2d_from_buffer(const cl::Context &ctx, const cl::Buffer
desc.image_width = shape2d[0];
desc.image_height = shape2d[1];
- cl_image = clCreateImage(ctx(), CL_MEM_READ_ONLY, &format, &desc, nullptr, &err);
+ switch(type)
+ {
+ case CLImage2DType::ReadOnly:
+ cl_image = clCreateImage(ctx(), CL_MEM_READ_ONLY, &format, &desc, nullptr, &err);
+ break;
+ case CLImage2DType::WriteOnly:
+ cl_image = clCreateImage(ctx(), CL_MEM_WRITE_ONLY, &format, &desc, nullptr, &err);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Unsupported CLImage2DType");
+ }
ARM_COMPUTE_UNUSED(err);
ARM_COMPUTE_ERROR_ON_MSG(err != CL_SUCCESS, "Error during the creation of CL image from buffer");
@@ -176,4 +186,4 @@ void PostOpCLKernelUtils::set_post_ops_cl_kernel_name(std::string &kernel_name,
}
} // namespace experimental
-} // namespace arm_compute \ No newline at end of file
+} // namespace arm_compute