Compute Library
 23.11
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 40 of file CLFill.h.

Constructor & Destructor Documentation

◆ CLFill() [1/3]

CLFill ( )

Constructor.

Definition at line 45 of file CLFill.cpp.

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

◆ ~CLFill()

~CLFill ( )
default

Destructor.

◆ 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 ( 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.

61 {
63 
64  _impl->src = tensor;
65 
66  _impl->op = std::make_unique<opencl::ClFill>();
67  _impl->op->configure(compile_context, _impl->src->info(), constant_value, dst_window);
68 }

References ARM_COMPUTE_ERROR_ON_NULLPTR, and tensor.

◆ configure() [2/2]

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

Initialize the kernel's tensor and filling value.

Valid data layouts:

  • All

Valid data type configurations:

src dst
All All
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.

53 {
54  configure(CLKernelLibrary::get().get_compile_context(), tensor, constant_value, dst_window);
55 }

References CLKernelLibrary::get(), and tensor.

Referenced by CLDeconvolutionLayerUpsample::configure(), CLSpaceToBatchLayer::configure(), CLMaxUnpoolingLayer::configure(), CLLSTMLayer::configure(), and CLSynthetizeFunctionInitOutputWithZeroAndWithZeroConstantBorder< K, bordersize >::configure().

◆ operator=() [1/2]

CLFill & operator= ( CLFill &&  )
default

Default move assignment operator.

◆ operator=() [2/2]

CLFill& operator= ( const CLFill )
delete

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

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For CPU 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 75 of file CLFill.cpp.

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

References arm_compute::ACL_SRC, ITensorPack::add_tensor(), and arm_compute::test::validation::pack.

Referenced by CLDeconvolutionLayerUpsample::run(), CLMaxUnpoolingLayer::run(), CLSpaceToBatchLayer::run(), CLSynthetizeFunctionInitOutputWithZeroAndWithZeroConstantBorder< K, bordersize >::run(), and CLLSTMLayer::run().

◆ 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 70 of file CLFill.cpp.

71 {
72  return opencl::ClFill::validate(tensor, constant_value, dst_window);
73 }

References tensor, and ClFill::validate().

Referenced by CLSpaceToBatchLayer::validate().


The documentation for this class was generated from the following files:
arm_compute::ITensorPack::add_tensor
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:38
arm_compute::CLKernelLibrary::get
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Definition: CLKernelLibrary.cpp:41
ARM_COMPUTE_ERROR_ON_NULLPTR
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
arm_compute::CLFill::configure
void configure(ICLTensor *tensor, const PixelValue &constant_value, Window *window=nullptr)
Initialize the kernel's tensor and filling value.
Definition: CLFill.cpp:52
arm_compute::test::validation::pack
ITensorPack pack
Definition: Im2Col.cpp:188
tensor
CLTensor * tensor
Pointer to the auxiliary tensor.
Definition: ClWorkloadRuntime.cpp:67
arm_compute::opencl::ClFill::validate
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.
Definition: ClFill.cpp:45
arm_compute::ACL_SRC
@ ACL_SRC
Definition: Types.h:44