Compute Library
 21.05
ICLOperator Class Reference

Basic interface for functions which have a single async CL kernel. More...

#include <ICLOperator.h>

Collaboration diagram for ICLOperator:
[legend]

Public Member Functions

 ICLOperator (IRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 ICLOperator (const ICLOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 ICLOperator (ICLOperator &&)=default
 Default move constructor. More...
 
ICLOperatoroperator= (const ICLOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
ICLOperatoroperator= (ICLOperator &&)=default
 Default move assignment operator. More...
 
void run (ITensorPack &tensors) override
 Run the kernels contained in the function. More...
 
void prepare (ITensorPack &constants) override
 Prepare the function for executing. More...
 
MemoryRequirements workspace () const override
 Return the memory requirements required by the workspace. More...
 
- Public Member Functions inherited from IOperator
virtual ~IOperator ()=default
 Destructor. More...
 

Detailed Description

Basic interface for functions which have a single async CL kernel.

Definition at line 41 of file ICLOperator.h.

Constructor & Destructor Documentation

◆ ICLOperator() [1/3]

ICLOperator ( IRuntimeContext ctx = nullptr)

Constructor.

Parameters
[in]ctxRuntime context to be used by the function

Definition at line 33 of file CLOperator.cpp.

34  : _kernel(), _ctx(ctx), _workspace()
35 {
36 }

◆ ICLOperator() [2/3]

ICLOperator ( const ICLOperator )
delete

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

◆ ICLOperator() [3/3]

ICLOperator ( ICLOperator &&  )
default

Default move constructor.

Member Function Documentation

◆ operator=() [1/2]

ICLOperator& operator= ( const ICLOperator )
delete

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

◆ operator=() [2/2]

ICLOperator& operator= ( ICLOperator &&  )
default

Default move assignment operator.

◆ prepare()

void prepare ( ITensorPack constants)
overridevirtual

Prepare the function for executing.

Any one off pre-processing step required by the function is handled here

Parameters
[in]constantsVector that contains the constants tensors.
Note
Prepare stage might not need all the function's buffers' backing memory to be available in order to execute

Implements IOperator.

Definition at line 48 of file CLOperator.cpp.

49 {
50  ARM_COMPUTE_UNUSED(constants);
51 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

References ARM_COMPUTE_UNUSED.

◆ run()

void run ( ITensorPack tensors)
overridevirtual

Run the kernels contained in the function.

Parameters
[in]tensorsVector that contains the tensors to operate on.

Implements IOperator.

Reimplemented in ClDirectConvolution, ClConcatenate, ClPooling, ClScale, ClSoftmax, ClPRelu, ClQuantization, and ClDequantization.

Definition at line 38 of file CLOperator.cpp.

39 {
40  if(tensors.empty())
41  {
42  ARM_COMPUTE_ERROR("No inputs provided");
43  }
44 
45  CLScheduler::get().enqueue_op(*_kernel.get(), tensors, false);
46 }
static CLScheduler & get()
Access the scheduler singleton.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
void enqueue_op(ICLKernel &kernel, ITensorPack &tensors, bool flush=true)
Schedule the execution of the passed kernel if possible.

References ARM_COMPUTE_ERROR, ITensorPack::empty(), CLScheduler::enqueue_op(), and CLScheduler::get().

Referenced by CLLogicalAnd::run(), ClPRelu::run(), and CLLogicalOr::run().

◆ workspace()

MemoryRequirements workspace ( ) const
overridevirtual

Return the memory requirements required by the workspace.

Implements IOperator.

Reimplemented in ClSoftmax.

Definition at line 53 of file CLOperator.cpp.

54 {
55  return {};
56 }

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