From 6f9313477f6a158210479996523c210452d4f07a Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Tue, 15 Sep 2020 14:17:41 +0100 Subject: COMPMID-3671: Extend cl image support to f16 in CLGEMMMatrixMultiplyReshapedKernel Resolves: COMPMID-3671, COMPMID-3672 - Extend cl image support to f16 in CLGEMMMatrixMultiplyReshapedKernel - Extend cl image support to f16 in CLGEMMMatrixMultiplyReshapedOnlyRHSKernel - Change the interface of create_image2d_from_buffer - Extend test Change-Id: I27363be71fa515fbf71aa4be5ed0d6c730f38f34 Signed-off-by: Gian Marco Iodice Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3992 Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- src/core/CL/CLUtils.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/core/CL/CLUtils.cpp') diff --git a/src/core/CL/CLUtils.cpp b/src/core/CL/CLUtils.cpp index 5d0cdf7f46..67af240044 100644 --- a/src/core/CL/CLUtils.cpp +++ b/src/core/CL/CLUtils.cpp @@ -26,12 +26,26 @@ #include "src/core/CL/CLUtils.h" -cl::Image2D arm_compute::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) +cl::Image2D arm_compute::create_image2d_from_buffer(const cl::Context &ctx, const cl::Buffer &buffer, const TensorShape &shape2d, DataType data_type, size_t image_row_pitch) { + cl_channel_type cl_data_type; + + switch(data_type) + { + case DataType::F32: + cl_data_type = CL_FLOAT; + break; + case DataType::F16: + cl_data_type = CL_HALF_FLOAT; + break; + default: + ARM_COMPUTE_ERROR("Data type not support with OpenCL image2d"); + } + cl_mem cl_image; cl_int err = CL_SUCCESS; - const cl_image_format format = { CL_RGBA, data_type }; + const cl_image_format format = { CL_RGBA, cl_data_type }; cl_image_desc desc; memset(&desc, 0, sizeof(desc)); -- cgit v1.2.1