Compute Library
 23.08
CLCopy Class Reference

Basic function to run opencl::kernels::ClCopyKernel. More...

#include <CLCopy.h>

Collaboration diagram for CLCopy:
[legend]

Public Member Functions

 CLCopy ()
 Constructor. More...
 
 ~CLCopy ()
 Destructor. More...
 
 CLCopy (const CLCopy &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLCopy (CLCopy &&)
 Default move constructor. More...
 
CLCopyoperator= (const CLCopy &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLCopyoperator= (CLCopy &&)
 Default move assignment operator. More...
 
void configure (ICLTensor *input, ICLTensor *output, Window *dst_window=nullptr)
 Initialise the function's source and destination. More...
 
void configure (const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, Window *dst_window=nullptr)
 Initialise the function's source and destination. More...
 
void run () override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *output, Window *dst_window=nullptr)
 Static function to check if given info will lead to a valid configuration of CLCopy. More...
 

Detailed Description

Basic function to run opencl::kernels::ClCopyKernel.

Definition at line 39 of file CLCopy.h.

Constructor & Destructor Documentation

◆ CLCopy() [1/3]

CLCopy ( )

Constructor.

Definition at line 46 of file CLCopy.cpp.

47  : _impl(std::make_unique<Impl>())
48 {
49 }

◆ ~CLCopy()

~CLCopy ( )
default

Destructor.

◆ CLCopy() [2/3]

CLCopy ( const CLCopy )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ CLCopy() [3/3]

CLCopy ( CLCopy &&  )
default

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( const CLCompileContext compile_context,
ICLTensor input,
ICLTensor output,
Window dst_window = nullptr 
)

Initialise the function's source and destination.

Parameters
[in]compile_contextThe compile context to be used.
[in]inputSource tensor. Data types supported: All.
[out]outputOutput tensor. Data types supported: Same as input.
[in]dst_window(Optional) Window to be used in case only copying into part of a tensor. Default is nullptr.

Definition at line 59 of file CLCopy.cpp.

60 {
62  ARM_COMPUTE_LOG_PARAMS(input, output, dst_window);
63 
64  _impl->src = input;
65  _impl->dst = output;
66 
67  _impl->op = std::make_unique<opencl::ClCopy>();
68  _impl->op->configure(compile_context, _impl->src->info(), _impl->dst->info(), dst_window);
69 }

References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_LOG_PARAMS, and arm_compute::test::validation::input.

◆ configure() [2/2]

void configure ( ICLTensor input,
ICLTensor output,
Window dst_window = nullptr 
)

Initialise the function's source and destination.

Valid data layouts:

  • All

Valid data type configurations:

src dst
All All
Parameters
[in]inputSource tensor. Data types supported: All.
[out]outputOutput tensor. Data types supported: Same as input.
[in]dst_window(Optional) Window to be used in case only copying into part of a tensor. Default is nullptr.

Definition at line 54 of file CLCopy.cpp.

55 {
56  configure(CLKernelLibrary::get().get_compile_context(), input, output, dst_window);
57 }

References CLKernelLibrary::get(), and arm_compute::test::validation::input.

Referenced by CLRNNLayer::configure(), CLPadLayer::configure(), CLLSTMLayer::configure(), and CLQLSTMLayer::configure().

◆ operator=() [1/2]

CLCopy & operator= ( CLCopy &&  )
default

Default move assignment operator.

◆ operator=() [2/2]

CLCopy& operator= ( const CLCopy )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For CPU kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 76 of file CLCopy.cpp.

77 {
78  ITensorPack pack;
79  pack.add_tensor(TensorType::ACL_SRC, _impl->src);
80  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
81  _impl->op->run(pack);
82 }

References arm_compute::ACL_DST, arm_compute::ACL_SRC, ITensorPack::add_tensor(), and arm_compute::test::validation::pack.

Referenced by CLRNNLayer::run(), CLPadLayer::run(), CLLSTMLayer::run(), and CLQLSTMLayer::run().

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
Window dst_window = nullptr 
)
static

Static function to check if given info will lead to a valid configuration of CLCopy.

Parameters
[in]inputSource tensor. Data types supported: All.
[in]outputOutput tensor. Data types supported: Same as input.
[in]dst_window(Optional) Window to be used in case only copying into part of a tensor. Default is nullptr.
Returns
a status

Definition at line 71 of file CLCopy.cpp.

72 {
73  return opencl::ClCopy::validate(input, output, dst_window);
74 }

References arm_compute::test::validation::input, and ClCopy::validate().

Referenced by CLPadLayer::validate(), CLLSTMLayer::validate(), and CLQLSTMLayer::validate().


The documentation for this class was generated from the following files:
arm_compute::ITensorPack::add_tensor
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:39
arm_compute::CLCopy::configure
void configure(ICLTensor *input, ICLTensor *output, Window *dst_window=nullptr)
Initialise the function's source and destination.
Definition: CLCopy.cpp:54
arm_compute::CLKernelLibrary::get
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Definition: CLKernelLibrary.cpp:39
ARM_COMPUTE_ERROR_ON_NULLPTR
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161
arm_compute::ACL_DST
@ ACL_DST
Definition: Types.h:55
arm_compute::opencl::ClCopy::validate
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, Window *dst_window=nullptr)
Static function to check if given info will lead to a valid configuration.
Definition: ClCopy.cpp:43
arm_compute::test::validation::pack
ITensorPack pack
Definition: Im2Col.cpp:188
arm_compute::ACL_SRC
@ ACL_SRC
Definition: Types.h:44
ARM_COMPUTE_LOG_PARAMS
#define ARM_COMPUTE_LOG_PARAMS(...)
Definition: Log.h:35
arm_compute::test::validation::input
auto input
Definition: LSTMLayerQuantized.cpp:486