48 struct CLGEMMConvolutionLayer::Impl
50 const ITensor *weights{
nullptr };
51 std::unique_ptr<opencl::ClGemmConvolution> op{
nullptr };
52 ITensorPack run_pack{};
53 ITensorPack prep_pack{};
54 MemoryGroup memory_group{};
55 IWeightsManager *weights_manager{
nullptr };
57 WorkspaceData<CLTensor> workspace_tensors{};
58 bool is_prepared{
false };
62 : _impl(
std::make_unique<Impl>())
65 _impl->weights_manager = weights_manager;
73 configure(
CLKernelLibrary::get().get_compile_context(), input, weights, biases, output, conv_info, weights_info, dilation, act_info, num_groups);
81 _impl->weights = weights;
82 _impl->op = std::make_unique<opencl::ClGemmConvolution>();
84 _impl->op->configure(compile_context, input->
info(), weights->
info(), (biases !=
nullptr ? biases->
info() :
nullptr), output->
info(), conv2d_info,
weights_info);
98 _impl->aux_mem_req = _impl->op->workspace();
99 _impl->workspace_tensors = manage_workspace<CLTensor>(_impl->aux_mem_req, _impl->memory_group, _impl->run_pack, _impl->prep_pack);
113 _impl->op->run(_impl->run_pack);
118 if(!_impl->is_prepared)
120 _impl->op->prepare(_impl->prep_pack);
121 auto has_reshape = std::find_if(_impl->aux_mem_req.begin(),
122 _impl->aux_mem_req.end(),
123 [](
const MemoryInfo & m) ->
bool {
return m.lifetime == MemoryLifetime::Persistent; });
125 if(has_reshape !=
std::end(_impl->aux_mem_req))
127 _impl->weights->mark_as_unused();
132 _impl->run_pack.add_const_tensor(
ACL_SRC_1, _impl->weights);
135 _impl->is_prepared =
true;
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const Conv2dInfo &conv2d_info, const WeightsInfo &weights_info=WeightsInfo())
Static function to check if given info will lead to a valid configuration.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info=WeightsInfo(), const Size2D &dilation=Size2D(1U, 1U), const ActivationLayerInfo &act_info=ActivationLayerInfo(), unsigned int num_groups=1)
Static function to check if given info will lead to a valid configuration of CLGEMMConvolutionLayer.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Store the tensor's metadata.
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context...
Activation Layer Information class.
Copyright (c) 2017-2021 Arm Limited.
std::vector< MemoryInfo > MemoryRequirements
Convolution Layer Weights Information class.
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
CLGEMMConvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr, IWeightsManager *weights_manager=nullptr)
Constructor.
const unsigned int num_groups
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
Padding and stride information class.
void end(TokenStream &in, bool &valid)
void run() override
Run the kernels contained in the function.
Weights manager interface to handle weights transformations.
void release_temporaries(const experimental::MemoryRequirements &mem_reqs, WorkspaceData< TensorType > &workspace)
Utility function to release tensors with lifetime marked as Prepare.
Descriptor used by the Convolution function.
void configure(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info=WeightsInfo(), const Size2D &dilation=Size2D(1U, 1U), const ActivationLayerInfo &act_info=ActivationLayerInfo(), unsigned int num_groups=1)
Set the input and output tensors.
Memory group resources scope handling class.
Interface for OpenCL tensor.
Class for specifying the size of an image or rectangle.
void prepare() override
Prepare the function for executing.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
~CLGEMMConvolutionLayer()
Default destructor.