aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2017-08-14 11:26:37 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitdef665a1a2e92baa1cfb192b65425b91ff6046b3 (patch)
tree03271d3e78190d81709618f40191d105b7c94917 /src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
parentfc2817dc0436ef2d5064df0a061aafd3d324d894 (diff)
downloadComputeLibrary-def665a1a2e92baa1cfb192b65425b91ff6046b3.tar.gz
COMPMID-474 - Add support for QS8/QS16 DirectConvolution CL
Change-Id: I537e4acbc02c8d880ff8630ea62223e0f1a1dda3 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/82875 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp')
-rw-r--r--src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
index 5f14d16ff4..c5fdb77a4a 100644
--- a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
+++ b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
@@ -50,7 +50,7 @@ BorderSize CLDirectConvolutionLayerKernel::border_size() const
void CLDirectConvolutionLayerKernel::configure(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info)
{
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F16, DataType::F32);
+ ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QS8, DataType::QS16, DataType::F16, DataType::F32);
ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input, weights);
ARM_COMPUTE_ERROR_ON_MSG(weights->info()->dimension(0) != weights->info()->dimension(1),
"Only kernel sizes 1x1 and 3x3 are supported");
@@ -102,12 +102,32 @@ void CLDirectConvolutionLayerKernel::configure(const ICLTensor *input, const ICL
std::stringstream kernel_name;
std::set<std::string> options;
kernel_name << "direct_convolution" << kernel_size << "x" << kernel_size;
+ DataType promoted_type = input->info()->data_type();
options.emplace("-DDATA_TYPE=" + get_cl_type_from_data_type(input->info()->data_type()));
options.emplace("-DDATA_SIZE=" + get_data_size_from_data_type(input->info()->data_type()));
options.emplace("-DWEIGHTS_DEPTH=" + support::cpp11::to_string(_weights->info()->dimension(2)));
options.emplace("-DSTRIDE_X=" + support::cpp11::to_string(_conv_stride_x));
+ if(is_data_type_fixed_point(input->info()->data_type()))
+ {
+ options.emplace("-DFIXED_POINT_POSITION=" + support::cpp11::to_string(input->info()->fixed_point_position()));
+
+ switch(input->info()->data_type())
+ {
+ case DataType::QS8:
+ promoted_type = DataType::QS16;
+ break;
+ case DataType::QS16:
+ promoted_type = DataType::QS32;
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Datatype not supported");
+ }
+ }
+
+ options.emplace("-DDATA_TYPE_PROMOTED=" + get_cl_type_from_data_type(promoted_type));
+
if(_biases != nullptr)
{
options.emplace("-DHAS_BIAS");