Compute Library
 20.02.1
ICLSimpleFunction Class Reference

Basic interface for functions which have a single OpenCL kernel. More...

#include <ICLSimpleFunction.h>

Collaboration diagram for ICLSimpleFunction:
[legend]

Public Member Functions

 ICLSimpleFunction (CLRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 ICLSimpleFunction (const ICLSimpleFunction &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 ICLSimpleFunction (ICLSimpleFunction &&)=default
 Default move constructor. More...
 
ICLSimpleFunctionoperator= (const ICLSimpleFunction &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
ICLSimpleFunctionoperator= (ICLSimpleFunction &&)=default
 Default move assignment operator. More...
 
void run () override final
 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...
 

Detailed Description

Basic interface for functions which have a single OpenCL kernel.

Definition at line 39 of file ICLSimpleFunction.h.

Constructor & Destructor Documentation

◆ ICLSimpleFunction() [1/3]

ICLSimpleFunction ( CLRuntimeContext ctx = nullptr)

Constructor.

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

Definition at line 32 of file ICLSimpleFunction.cpp.

33  : _kernel(),
34  _border_handler(),
35  _ctx(ctx)
36 {
37 }

◆ ICLSimpleFunction() [2/3]

ICLSimpleFunction ( const ICLSimpleFunction )
delete

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

◆ ICLSimpleFunction() [3/3]

Default move constructor.

Member Function Documentation

◆ operator=() [1/2]

ICLSimpleFunction& operator= ( const ICLSimpleFunction )
delete

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

◆ operator=() [2/2]

ICLSimpleFunction& operator= ( ICLSimpleFunction &&  )
default

Default move assignment operator.

◆ run()

void run ( )
finaloverridevirtual

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 39 of file ICLSimpleFunction.cpp.

40 {
41  ARM_COMPUTE_ERROR_ON_MSG(!_kernel, "The child class didn't set the CL kernel or function isn't configured");
42  schedule_kernel_on_ctx(_ctx, &_border_handler, false);
43  schedule_kernel_on_ctx(_ctx, _kernel.get());
44 }
void schedule_kernel_on_ctx(CLRuntimeContext *ctx, ICLKernel *kernel, bool flush=true)
Schedules a kernel using the context if not nullptr else uses the legacy scheduling flow.
Definition: CLHelpers.cpp:108
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456

References ARM_COMPUTE_ERROR_ON_MSG, and arm_compute::schedule_kernel_on_ctx().

Referenced by CLFFTConvolutionLayer::prepare(), CLDirectDeconvolutionLayer::prepare(), CLGEMMDeconvolutionLayer::prepare(), CLLSTMLayerQuantized::prepare(), CLFullyConnectedLayer::prepare(), CLHOGGradient::run(), CLConvertFullyConnectedWeightsManaged::run(), CLReduceMean::run(), CLFullyConnectedLayerReshapeWeightsManaged::run(), CLLaplacianPyramid::run(), CLFastCorners::run(), CLDirectConvolutionLayer::run(), CLLaplacianReconstruct::run(), CLHarrisCorners::run(), CLWinogradConvolutionLayer::run(), CLFFTConvolutionLayer::run(), CLGEMMDeconvolutionLayer::run(), CLLSTMLayerQuantized::run(), CLLSTMLayer::run(), CLFullyConnectedLayer::run(), CLGEMMConvolutionLayer::run(), and arm_compute::test::validation::TEST_CASE().


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