aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/kernels/CLArgMinMaxLayerKernel.cpp
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2020-01-17 11:27:49 +0000
committerMichalis Spyrou <michalis.spyrou@arm.com>2020-01-21 16:12:25 +0000
commit7317e393de848cb20dd326a45a9efb18a3ee7701 (patch)
treec5af35d7986fba95a40b655b2f7408302c2a7c57 /src/core/CL/kernels/CLArgMinMaxLayerKernel.cpp
parent74ef1db2263d73d893549cc79418f5be71753d1c (diff)
downloadComputeLibrary-7317e393de848cb20dd326a45a9efb18a3ee7701.tar.gz
COMPMID-2941 Add QAsymm8 and S32 support for ArgMinMax to CL
Select operation does not work with any combination of datatypes. Added a new OpenCL build option, DATA_TYPE_SELECT, in oder to specify the select result. Change-Id: I5c73c2a6b1d121288b7f6edba3e0cb1104636844 Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-on: https://review.mlplatform.org/c/2601 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Diffstat (limited to 'src/core/CL/kernels/CLArgMinMaxLayerKernel.cpp')
-rw-r--r--src/core/CL/kernels/CLArgMinMaxLayerKernel.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/core/CL/kernels/CLArgMinMaxLayerKernel.cpp b/src/core/CL/kernels/CLArgMinMaxLayerKernel.cpp
index c8e87ba5ce..bdb7ab76d5 100644
--- a/src/core/CL/kernels/CLArgMinMaxLayerKernel.cpp
+++ b/src/core/CL/kernels/CLArgMinMaxLayerKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 ARM Limited.
+ * Copyright (c) 2019-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -46,7 +46,7 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *prev_outp
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output);
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(input);
- ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::S32, DataType::F16, DataType::F32);
+ ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::S32, DataType::F16, DataType::F32);
ARM_COMPUTE_RETURN_ERROR_ON_MSG(op != ReductionOperation::ARG_IDX_MAX && op != ReductionOperation::ARG_IDX_MIN, "Only ARG_IDX_MAX and ARG_IDX_MIN are supported");
ARM_COMPUTE_RETURN_ERROR_ON_MSG(axis >= TensorShape::num_max_dimensions, "Reduction axis greater than max number of dimensions");
ARM_COMPUTE_RETURN_ERROR_ON_MSG(axis > 3, "Unsupported reduction axis");
@@ -128,17 +128,14 @@ void CLArgMinMaxLayerKernel::configure(const ICLTensor *input, const ICLTensor *
_op = op;
// Set build options
- CLBuildOptions build_opts;
- const std::string data_type_promoted = get_cl_type_from_data_type(input->info()->data_type());
+ CLBuildOptions build_opts;
build_opts.add_option_if(_prev_output != nullptr, "-DPREV_OUTPUT");
build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->info()->data_type()));
- build_opts.add_option("-DDATA_TYPE_PROMOTED=" + data_type_promoted);
build_opts.add_option_if(is_data_type_float(input->info()->data_type()), "-DFLOAT_DATA_TYPE");
- build_opts.add_option_if(op == ReductionOperation::ARG_IDX_MAX, "-DARG_MAX");
- build_opts.add_option_if(op == ReductionOperation::ARG_IDX_MIN, "-DARG_MIN");
- build_opts.add_option("-DCOND_DATA_TYPE=" + get_cl_select_type_from_data_type(input->info()->data_type()));
+ build_opts.add_option_if_else(op == ReductionOperation::ARG_IDX_MAX, "-DARG_MAX", "-DARG_MIN");
build_opts.add_option("-DDATA_TYPE_OUTPUT=" + get_cl_type_from_data_type(output->info()->data_type()));
+ build_opts.add_option("-DDATA_TYPE_SELECT=" + get_cl_signed_type_from_element_size(input->info()->element_size()));
// Create kernel
cl::NDRange lws_hint = CLKernelLibrary::get().default_ndrange();