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>
diff --git a/arm_compute/runtime/CL/functions/CLCopy.h b/arm_compute/runtime/CL/functions/CLCopy.h
index f1a091d..795a183 100644
--- a/arm_compute/runtime/CL/functions/CLCopy.h
+++ b/arm_compute/runtime/CL/functions/CLCopy.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 Arm Limited.
+ * Copyright (c) 2018-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -25,9 +25,9 @@
#define ARM_COMPUTE_CLCOPY_H
#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/ICLSimpleFunction.h"
-
-#include <cstdint>
+#include "arm_compute/core/Window.h"
+#include "arm_compute/runtime/IFunction.h"
+#include <memory>
namespace arm_compute
{
@@ -35,32 +35,54 @@
class ICLTensor;
class ITensorInfo;
-class CLCopy : public ICLSimpleFunction
+/** Basic function to run @ref opencl::kernels::ClCopyKernel */
+class CLCopy : public IFunction
{
public:
+ /** Constructor */
+ CLCopy();
+ /** Destructor */
+ ~CLCopy();
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLCopy(const CLCopy &) = delete;
+ /** Default move constructor */
+ CLCopy(CLCopy &&);
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLCopy &operator=(const CLCopy &) = delete;
+ /** Default move assignment operator */
+ CLCopy &operator=(CLCopy &&);
/** Initialise the function's source and destination.
*
- * @param[in] input Source tensor. Data types supported: All.
- * @param[out] output Output tensor. Data types supported: Same as @p input.
- *
+ * @param[in] input Source tensor. Data types supported: All.
+ * @param[out] output Output tensor. Data types supported: Same as @p input.
+ * @param[in] dst_window (Optional) Window to be used in case only copying into part of a tensor. Default is nullptr.
*/
- void configure(ICLTensor *input, ICLTensor *output);
+ void configure(ICLTensor *input, ICLTensor *output, Window *dst_window = nullptr);
/** Initialise the function's source and destination.
*
* @param[in] compile_context The compile context to be used.
* @param[in] input Source tensor. Data types supported: All.
* @param[out] output Output tensor. Data types supported: Same as @p input.
+ * @param[in] dst_window (Optional) Window to be used in case only copying into part of a tensor. Default is nullptr.
*
*/
- void configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output);
+ void configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, Window *dst_window = nullptr);
/** Static function to check if given info will lead to a valid configuration of @ref CLCopy
*
- * @param[in] input Source tensor. Data types supported: All.
- * @param[in] output Output tensor. Data types supported: Same as @p input.
+ * @param[in] input Source tensor. Data types supported: All.
+ * @param[in] output Output tensor. Data types supported: Same as @p input.
+ * @param[in] dst_window (Optional) Window to be used in case only copying into part of a tensor. Default is nullptr.
*
* @return a status
*/
- static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output, Window *dst_window = nullptr);
+
+ // Inherited methods overridden:
+ void run() override;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> _impl;
};
} // namespace arm_compute
#endif /*ARM_COMPUTE_CLCOPY_H */