Compute Library
 22.05
CLGEMMLowpOutputStage Class Reference

Basic function to execute GEMMLowpQuantizeDown kernels on CL. More...

#include <CLGEMMLowpOutputStage.h>

Collaboration diagram for CLGEMMLowpOutputStage:
[legend]

Public Member Functions

 CLGEMMLowpOutputStage ()
 
 CLGEMMLowpOutputStage (const CLGEMMLowpOutputStage &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLGEMMLowpOutputStage (CLGEMMLowpOutputStage &&)
 Default move constructor. More...
 
CLGEMMLowpOutputStageoperator= (const CLGEMMLowpOutputStage &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLGEMMLowpOutputStageoperator= (CLGEMMLowpOutputStage &&)
 Default move assignment operator. More...
 
 ~CLGEMMLowpOutputStage ()
 Default destructor. More...
 
void configure (const ICLTensor *input, const ICLTensor *bias, ICLTensor *output, const GEMMLowpOutputStageInfo &info)
 Initialise the kernel's inputs, output. More...
 
void configure (const CLCompileContext &compile_context, const ICLTensor *input, const ICLTensor *bias, ICLTensor *output, const GEMMLowpOutputStageInfo &info)
 Initialise the kernel's inputs, output. 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 *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo &info)
 Static function to check if given info will lead to a valid configuration of opencl::kernels::ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel. More...
 

Detailed Description

Basic function to execute GEMMLowpQuantizeDown kernels on CL.

This function calls the following CL kernels:

  1. opencl::kernels::ClGemmLowpQuantizeDownInt32ScaleKernel
  2. opencl::kernels::ClGemmLowpQuantizeDownInt32ScaleByFloatKernel
  3. opencl::kernels::ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel

Definition at line 56 of file CLGEMMLowpOutputStage.h.

Constructor & Destructor Documentation

◆ CLGEMMLowpOutputStage() [1/3]

Definition at line 50 of file CLGEMMLowpOutputStage.cpp.

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

51  : _impl(std::make_unique<Impl>())
52 {
53 }

◆ CLGEMMLowpOutputStage() [2/3]

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

◆ CLGEMMLowpOutputStage() [3/3]

Default move constructor.

◆ ~CLGEMMLowpOutputStage()

~CLGEMMLowpOutputStage ( )
default

Default destructor.

Referenced by CLGEMMLowpOutputStage::CLGEMMLowpOutputStage().

Member Function Documentation

◆ configure() [1/2]

void configure ( const ICLTensor input,
const ICLTensor bias,
ICLTensor output,
const GEMMLowpOutputStageInfo info 
)

Initialise the kernel's inputs, output.

Valid data layouts:

  • All

Valid data type configurations:

src0 src1 dst
S32 S32 QASYMM8
S32 S32 QASYMM8_SIGNED
S32 S32 QSYMM16
Parameters
[in]inputInput tensor. Data type supported: S32
[in]biasBiases tensor. Only shared biases supported and it can be a nullptr if the biases addition is not required. Biases are 1D tensor with dimensions [OFM]. Data type supported: Same as input.
[out]outputOutput tensor. Data type supported: QASYMM8/QASYMM8_SIGNED/QSYMM16
[in]infoGEMMLowp output stage metadata.

Definition at line 58 of file CLGEMMLowpOutputStage.cpp.

References CLKernelLibrary::get().

Referenced by CLQLSTMLayer::CLQLSTMLayer(), CLGEMMDeconvolutionLayer::configure(), CLLSTMLayerQuantized::configure(), and CLQLSTMLayer::configure().

59 {
60  configure(CLKernelLibrary::get().get_compile_context(), input, bias, output, info);
61 }
void configure(const ICLTensor *input, const ICLTensor *bias, ICLTensor *output, const GEMMLowpOutputStageInfo &info)
Initialise the kernel&#39;s inputs, output.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
const int32_t * bias

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
const ICLTensor input,
const ICLTensor bias,
ICLTensor output,
const GEMMLowpOutputStageInfo info 
)

Initialise the kernel's inputs, output.

Parameters
[in]compile_contextThe compile context to be used.
[in]inputInput tensor. Data type supported: S32
[in]biasBiases tensor. Only shared biases supported and it can be a nullptr if the biases addition is not required. Biases are 1D tensor with dimensions [OFM]. Data type supported: Same as input.
[out]outputOutput tensor. Data type supported: QASYMM8/QASYMM8_SIGNED
[in]infoGEMMLowp output stage metadata.

Definition at line 63 of file CLGEMMLowpOutputStage.cpp.

References arm_compute::ACL_BIAS, arm_compute::ACL_DST, arm_compute::ACL_SRC, ARM_COMPUTE_ERROR_ON_NULLPTR, bias, ITensor::info(), arm_compute::test::validation::info, and arm_compute::test::validation::input.

64 {
66 
67  _impl->src = input;
68  _impl->bias = bias;
69  _impl->dst = output;
70 
71  _impl->op = std::make_unique<opencl::ClGemmLowpOutputStage>();
72  _impl->op->configure(compile_context, input->info(), bias != nullptr ? bias->info() : nullptr, output->info(), info);
73  _impl->run_pack = { { ACL_SRC, _impl->src }, { ACL_BIAS, _impl->bias }, { ACL_DST, _impl->dst } };
74 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157
const int32_t * bias

◆ operator=() [1/2]

CLGEMMLowpOutputStage& operator= ( const CLGEMMLowpOutputStage )
delete

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

Referenced by CLGEMMLowpOutputStage::CLGEMMLowpOutputStage().

◆ operator=() [2/2]

CLGEMMLowpOutputStage & operator= ( CLGEMMLowpOutputStage &&  )
default

Default move assignment operator.

◆ 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 81 of file CLGEMMLowpOutputStage.cpp.

Referenced by CLGEMMDeconvolutionLayer::run(), CLLSTMLayerQuantized::run(), and CLQLSTMLayer::run().

82 {
83  _impl->op->run(_impl->run_pack);
84 }

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo bias,
const ITensorInfo output,
const GEMMLowpOutputStageInfo info 
)
static

Static function to check if given info will lead to a valid configuration of opencl::kernels::ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel.

Parameters
[in]inputInput tensor. It is the output of CLGEMMLowpMatrixMultiplyCore function. Data type supported: S32
[in]biasBiases tensor. Only shared biases supported and it can be a nullptr if the addition of biases is not required. Biases are 1D tensor with dimensions [OFM]. Data type supported: Same as input.
[in]outputOutput tensor. Data type supported: QASYMM8/QASYMM8_SIGNED
[in]infoGEMMLowp output stage metadata.
Returns
a status

Definition at line 76 of file CLGEMMLowpOutputStage.cpp.

References ClGemmLowpOutputStage::validate().

Referenced by CLGEMMDeconvolutionLayer::validate(), CLLSTMLayerQuantized::validate(), and CLQLSTMLayer::validate().

77 {
79 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
static Status validate(const ITensorInfo *src, const ITensorInfo *bias, const ITensorInfo *dst, const GEMMLowpOutputStageInfo &info)
Static function to check if given info will lead to a valid configuration.
const int32_t * bias

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