Compute Library
 21.02
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 44 of file CLCopy.cpp.

References CLCopy::operator=(), and CLCopy::~CLCopy().

45  : _impl(std::make_unique<Impl>())
46 {
47 }

◆ ~CLCopy()

~CLCopy ( )
default

Destructor.

Referenced by CLCopy::CLCopy().

◆ 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 ( ICLTensor input,
ICLTensor output,
Window dst_window = nullptr 
)

Initialise the function's source and destination.

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 52 of file CLCopy.cpp.

References CLKernelLibrary::get().

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

53 {
54  configure(CLKernelLibrary::get().get_compile_context(), input, output, dst_window);
55 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(ICLTensor *input, ICLTensor *output, Window *dst_window=nullptr)
Initialise the function&#39;s source and destination.
Definition: CLCopy.cpp:52

◆ configure() [2/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 57 of file CLCopy.cpp.

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

58 {
60 
61  _impl->src = input;
62  _impl->dst = output;
63 
64  _impl->op = std::make_unique<opencl::ClCopy>();
65  _impl->op->configure(compile_context, _impl->src->info(), _impl->dst->info(), dst_window);
66 }
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

◆ operator=() [1/2]

CLCopy& operator= ( const CLCopy )
delete

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

Referenced by CLCopy::CLCopy().

◆ operator=() [2/2]

CLCopy & operator= ( CLCopy &&  )
default

Default move assignment operator.

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For Neon 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 73 of file CLCopy.cpp.

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

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

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

◆ 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 68 of file CLCopy.cpp.

References ClCopy::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE(), CLPadLayer::validate(), CLLSTMLayer::validate(), and CLQLSTMLayer::validate().

69 {
70  return opencl::ClCopy::validate(input, output, dst_window);
71 }
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 of kernels::ClCopyKernel.
Definition: ClCopy.cpp:40

The documentation for this class was generated from the following files: