Compute Library
 21.02
CLFill Class Reference

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

#include <CLFill.h>

Collaboration diagram for CLFill:
[legend]

Public Member Functions

 CLFill ()
 Constructor. More...
 
 ~CLFill ()
 Destructor. More...
 
 CLFill (const CLFill &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLFill (CLFill &&)
 Default move constructor. More...
 
CLFilloperator= (const CLFill &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLFilloperator= (CLFill &&)
 Default move assignment operator. More...
 
void configure (ICLTensor *tensor, const PixelValue &constant_value, Window *window=nullptr)
 Initialize the kernel's tensor and filling value. More...
 
void configure (const CLCompileContext &compile_context, ICLTensor *tensor, const PixelValue &constant_value, Window *window=nullptr)
 Initialise the kernel's tensor and filling value. 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 *tensor, const PixelValue &constant_value, Window *window=nullptr)
 Static function to check if given info will lead to a valid configuration of CLFill. More...
 

Detailed Description

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

Definition at line 38 of file CLFill.h.

Constructor & Destructor Documentation

◆ CLFill() [1/3]

CLFill ( )

Constructor.

Definition at line 44 of file CLFill.cpp.

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

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

◆ ~CLFill()

~CLFill ( )
default

Destructor.

Referenced by CLFill::CLFill().

◆ CLFill() [2/3]

CLFill ( const CLFill )
delete

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

◆ CLFill() [3/3]

CLFill ( CLFill &&  )
default

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( ICLTensor tensor,
const PixelValue constant_value,
Window window = nullptr 
)

Initialize the kernel's tensor and filling value.

Parameters
[in,out]tensorInput tensor to fill. Supported data types: All.
[in]constant_valueThe value used to fill the planes of the tensor
[in]windowWindow to be used in case setting only part of a tensor. Default is nullptr.

Definition at line 52 of file CLFill.cpp.

References CLKernelLibrary::get().

Referenced by CLDeconvolutionLayerUpsample::configure(), CLSpaceToBatchLayer::configure(), CLMaxUnpoolingLayer::configure(), and CLLSTMLayer::configure().

53 {
54  configure(CLKernelLibrary::get().get_compile_context(), tensor, constant_value, dst_window);
55 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(ICLTensor *tensor, const PixelValue &constant_value, Window *window=nullptr)
Initialize the kernel&#39;s tensor and filling value.
Definition: CLFill.cpp:52

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
ICLTensor tensor,
const PixelValue constant_value,
Window window = nullptr 
)

Initialise the kernel's tensor and filling value.

Parameters
[in]compile_contextThe compile context to be used.
[in,out]tensorInput tensor to fill. Supported data types: All.
[in]constant_valueThe value used to fill the planes of the tensor
[in]windowWindow to be used in case setting only part of a tensor. Default is nullptr.

Definition at line 57 of file CLFill.cpp.

References ARM_COMPUTE_ERROR_ON_NULLPTR.

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

◆ operator=() [1/2]

CLFill& operator= ( const CLFill )
delete

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

Referenced by CLFill::CLFill().

◆ operator=() [2/2]

CLFill & operator= ( CLFill &&  )
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 72 of file CLFill.cpp.

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

Referenced by CLDeconvolutionLayerUpsample::run(), CLMaxUnpoolingLayer::run(), CLSpaceToBatchLayer::run(), and CLLSTMLayer::run().

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

◆ validate()

Status validate ( const ITensorInfo tensor,
const PixelValue constant_value,
Window window = nullptr 
)
static

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

Parameters
[in]tensorSource tensor info. Data types supported: All.
[in]constant_valueThe value used to fill the planes of the tensor
[in]windowWindow to be used in case setting only part of a tensor. Default is nullptr.
Returns
a status

Definition at line 67 of file CLFill.cpp.

References ClFill::validate().

Referenced by CLSpaceToBatchLayer::validate().

68 {
69  return opencl::ClFill::validate(tensor, constant_value, dst_window);
70 }
static Status validate(const ITensorInfo *tensor, const PixelValue &constant_value, Window *window=nullptr)
Static function to check if given info will lead to a valid configuration of kernels::ClFillKernel.
Definition: ClFill.cpp:40

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