From 8a383694445dfebb84732b19d5b3299961e8ffe3 Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Mon, 3 Jul 2017 17:41:47 +0100 Subject: COMPMID-434 - Port CLGEMM to support 16 bit fixed point Change-Id: I30aef3c7ecd1ee740c2a7f2ce65a63c7dcd66e49 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79630 Reviewed-by: Anthony Barbier Tested-by: Kaizen --- src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp') diff --git a/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp b/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp index 7c5b3d7866..2d6b83a97d 100644 --- a/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp +++ b/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp @@ -50,7 +50,7 @@ CLGEMMMatrixMultiplyKernel::CLGEMMMatrixMultiplyKernel() void CLGEMMMatrixMultiplyKernel::configure(const ICLTensor *input0, const ICLTensor *input1, ICLTensor *output, float alpha) { - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input0, 1, DataType::QS8, DataType::F16, DataType::F32); + ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input0, 1, DataType::QS8, DataType::QS16, DataType::F16, DataType::F32); ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input0, input1, output); ARM_COMPUTE_ERROR_ON_MISMATCHING_FIXED_POINT(input0, input1, output); @@ -74,8 +74,18 @@ void CLGEMMMatrixMultiplyKernel::configure(const ICLTensor *input0, const ICLTen std::ostringstream mm_arguments; mm_arguments << "-DWIDTH_MATRIX_B=" << input1->info()->dimension(0) << " "; - mm_arguments << "-DALPHA=" << (input0->info()->data_type() == DataType::QS8 ? scvt_qs8_f32(alpha, input0->info()->fixed_point_position()) : alpha) << " "; - mm_arguments << "-DFIXED_POINT_POSITION=" << input0->info()->fixed_point_position() << " "; + if(is_data_type_fixed_point(input0->info()->data_type())) + { + mm_arguments << "-DALPHA=" << (input0->info()->data_type() == DataType::QS8 ? + scvt_qs8_f32(alpha, input0->info()->fixed_point_position()) : + scvt_qs16_f32(alpha, input0->info()->fixed_point_position())) + << " "; + mm_arguments << "-DFIXED_POINT_POSITION=" << input0->info()->fixed_point_position() << " "; + } + else + { + mm_arguments << "-DALPHA=" << alpha << " "; + } std::set build_opts; // Check if the output tensor is a vector. If so,the kernel runs the vector-matrix multiplication -- cgit v1.2.1