diff options
author | Sheri Zhang <sheri.zhang@arm.com> | 2021-02-02 11:49:34 +0000 |
---|---|---|
committer | Sheri Zhang <sheri.zhang@arm.com> | 2021-02-08 13:35:26 +0000 |
commit | 7e20e29904c98adae5a91c6492fd78da88b7a9bf (patch) | |
tree | 96309359fd28c2244984ed1d4d1a9069528b64dc /arm_compute/runtime/CL/functions/CLFill.h | |
parent | afc9c3df7600dcecf12d3d3a4686d2008502a813 (diff) | |
download | ComputeLibrary-7e20e29904c98adae5a91c6492fd78da88b7a9bf.tar.gz |
Make memset/copy functions state-less
Port following functions:
- CLCopy
- CLFill
- CLPermute
- CLReshapeLayer
- CLCropResize
Resolves: COMPMID-4002
Signed-off-by: Sheri Zhang <sheri.zhang@arm.com>
Change-Id: I8392aa515aaeb5b44dab6122be6a795d08376d5f
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5003
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/runtime/CL/functions/CLFill.h')
-rw-r--r-- | arm_compute/runtime/CL/functions/CLFill.h | 57 |
1 files changed, 44 insertions, 13 deletions
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 <memory> 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> _impl; }; } // namespace arm_compute #endif /*ARM_COMPUTE_CLFILL_H */ |