Compute Library
ICLSimpleFunction Class Reference

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

#include <ICLSimpleFunction.h>

Collaboration diagram for ICLSimpleFunction:

Public Member Functions

 ICLSimpleFunction ()
 Default constructor. 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 36 of file ICLSimpleFunction.h.

Constructor & Destructor Documentation

◆ ICLSimpleFunction()

Default constructor.

Definition at line 31 of file ICLSimpleFunction.cpp.

32  : _kernel(),
33  _border_handler()
34 {
35 }

Member Function Documentation

◆ run()

void run ( )

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

38 {
39  ARM_COMPUTE_ERROR_ON_MSG(!_kernel, "The child class didn't set the CL kernel or function isn't configured");
41  CLScheduler::get().enqueue(_border_handler, false);
42  CLScheduler::get().enqueue(*_kernel);
43 }
static CLScheduler & get()
Access the scheduler singleton.
Definition: CLScheduler.cpp:41
void enqueue(ICLKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
Definition: CLScheduler.cpp:95
#define ARM_COMPUTE_ERROR_ON_MSG(cond,...)
Definition: Error.h:328

References ARM_COMPUTE_ERROR_ON_MSG, CLScheduler::enqueue(), and CLScheduler::get().

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

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