aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/CLUtils.h
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2020-06-19 16:56:57 +0100
committerGian Marco Iodice <gianmarco.iodice@arm.com>2020-06-29 22:06:22 +0000
commit781cba7f33e056b1ca470ab34eb478177768eaf4 (patch)
tree58a33f8a3a98904a0463f601e5faaa1ce24c1baf /src/core/CL/CLUtils.h
parentc5b6d8822da0fae1807dda46674f68d00db8e321 (diff)
downloadComputeLibrary-781cba7f33e056b1ca470ab34eb478177768eaf4.tar.gz
COMPMID-3322: Add cl_image support for GEMMReshapedOnlyRHS NT
COMPMID-3323: Add cl_image support for GEMMReshapedOnlyRHS T - Added support for cl_image in CLGEMMMatrixMultiplyReshapedInlyRHSKernel (both NT and T kernels) - Extended the tests for the validating rhs_info.export_to_cl_image = true - Updated doxygen documentation in CLGEMMMatrixMultiplyReshapedOnlyRHSKernel.h Change-Id: If253794323aac072d84a4d8680b9a2339ab7ad92 Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3437 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CL/CLUtils.h')
-rw-r--r--src/core/CL/CLUtils.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/core/CL/CLUtils.h b/src/core/CL/CLUtils.h
new file mode 100644
index 0000000000..676daade12
--- /dev/null
+++ b/src/core/CL/CLUtils.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2020 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef ARM_COMPUTE_CL_CLUTILS_H
+#define ARM_COMPUTE_CL_CLUTILS_H
+
+#include "arm_compute/core/CL/OpenCL.h"
+
+namespace arm_compute
+{
+class TensorShape;
+
+/** Create a cl::Image2D object from an OpenCL buffer
+ *
+ * @note The following conditions are required to create a OpenCL image object from OpenCL buffer,
+ * -# The platform should support the OpenCL cl_khr_image2d_from_buffer extension
+ * -# The stride Y for the input1 should satisfy the OpenCL pitch alignment requirement
+ * -# input width should be less or equal to (CL_DEVICE_IMAGE2D_MAX_WIDTH * 4)
+ * -# input height should be less or equal to CL_DEVICE_IMAGE2D_MAX_HEIGHT
+ *
+ * It is user responsibility to ensure the above conditions are satisfied since no checks are performed within this function
+ *
+ * @param[in] ctx cl::Context object
+ * @param[in] buffer cl::Buffer object from which the OpenCL image2d object is created
+ * @param[in] shape2d 2D tensor shape
+ * @param[in] data_type cl_channel_type to use. Only supported CL_FLOAT
+ * @param[in] image_row_pitch Image row pitch (a.k.a. stride Y) to be used in the image2d object
+ *
+ * @return cl::Image2D object
+ */
+cl::Image2D create_image2d_from_buffer(const cl::Context &ctx, const cl::Buffer &buffer, const TensorShape &shape2d, cl_channel_type data_type, size_t image_row_pitch);
+
+} // arm_compute
+
+#endif /* ARM_COMPUTE_CL_CLUTILS_H */