From 7e20e29904c98adae5a91c6492fd78da88b7a9bf Mon Sep 17 00:00:00 2001 From: Sheri Zhang Date: Tue, 2 Feb 2021 11:49:34 +0000 Subject: Make memset/copy functions state-less Port following functions: - CLCopy - CLFill - CLPermute - CLReshapeLayer - CLCropResize Resolves: COMPMID-4002 Signed-off-by: Sheri Zhang Change-Id: I8392aa515aaeb5b44dab6122be6a795d08376d5f Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5003 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins --- arm_compute/runtime/CL/functions/CLFill.h | 57 ++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 13 deletions(-) (limited to 'arm_compute/runtime/CL/functions/CLFill.h') diff --git a/arm_compute/runtime/CL/functions/CLFill.h b/arm_compute/runtime/CL/functions/CLFill.h index fef8324432..9a27d158a6 100644 --- a/arm_compute/runtime/CL/functions/CLFill.h +++ b/arm_compute/runtime/CL/functions/CLFill.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. + * Copyright (c) 2019-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,32 +24,63 @@ #ifndef ARM_COMPUTE_CLFILL_H #define ARM_COMPUTE_CLFILL_H -#include "arm_compute/core/PixelValue.h" #include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" +#include "arm_compute/core/Window.h" +#include "arm_compute/runtime/IFunction.h" +#include namespace arm_compute { class CLCompileContext; class ICLTensor; -/** Function to run @ref CLMemsetKernel to fill a tensor with a scalar value */ -class CLFill : public ICLSimpleFunction +/** Basic function to run @ref opencl::kernels::ClFillKernel */ +class CLFill : public IFunction { public: - /** Initialize the function + /** Constructor */ + CLFill(); + /** Destructor */ + ~CLFill(); + /** Prevent instances of this class from being copied (As this class contains pointers) */ + CLFill(const CLFill &) = delete; + /** Default move constructor */ + CLFill(CLFill &&); + /** Prevent instances of this class from being copied (As this class contains pointers) */ + CLFill &operator=(const CLFill &) = delete; + /** Default move assignment operator */ + CLFill &operator=(CLFill &&); + /** Initialize the kernel's tensor and filling value * - * @param[in,out] tensor Source tensor. Data types supported: All. - * @param[in] constant_value Constant value to use to fill tensor. + * @param[in,out] tensor Input tensor to fill. Supported data types: All. + * @param[in] constant_value The value used to fill the planes of the tensor + * @param[in] window Window to be used in case setting only part of a tensor. Default is nullptr. */ - void configure(ICLTensor *tensor, PixelValue constant_value); - /** Initialize the function + void configure(ICLTensor *tensor, const PixelValue &constant_value, Window *window = nullptr); + /** Initialise the kernel's tensor and filling value * * @param[in] compile_context The compile context to be used. - * @param[in,out] tensor Source tensor. Data types supported: All. - * @param[in] constant_value Constant value to use to fill tensor. + * @param[in,out] tensor Input tensor to fill. Supported data types: All. + * @param[in] constant_value The value used to fill the planes of the tensor + * @param[in] window Window to be used in case setting only part of a tensor. Default is nullptr. */ - void configure(const CLCompileContext &compile_context, ICLTensor *tensor, PixelValue constant_value); + void configure(const CLCompileContext &compile_context, ICLTensor *tensor, const PixelValue &constant_value, Window *window = nullptr); + /** Static function to check if given info will lead to a valid configuration of @ref CLFill + * + * @param[in] tensor Source tensor info. Data types supported: All. + * @param[in] constant_value The value used to fill the planes of the tensor + * @param[in] window Window to be used in case setting only part of a tensor. Default is nullptr. + * + * @return a status + */ + static Status validate(const ITensorInfo *tensor, const PixelValue &constant_value, Window *window = nullptr); + + // Inherited methods overridden: + void run() override; + +private: + struct Impl; + std::unique_ptr _impl; }; } // namespace arm_compute #endif /*ARM_COMPUTE_CLFILL_H */ -- cgit v1.2.1