44 std::unique_ptr<OperatorType> op{
nullptr };
51 bool is_prepared{
false };
55 : _impl(
std::make_unique<Impl>())
58 _impl->weights_manager = weights_manager;
73 _impl->op = std::make_unique<OperatorType>();
76 _impl->op->configure(compile_context, a->
info(), b->
info(), c !=
nullptr ? c->
info() :
nullptr, output->
info(), alpha, beta,
gemm_info);
77 _impl->aux_mem_req = _impl->op->workspace();
80 if(_impl->is_prepared)
82 _impl->run_pack.add_const_tensor(
ACL_SRC_0, a);
83 _impl->run_pack.add_tensor(
ACL_DST, output);
88 _impl->prep_pack = { {
ACL_SRC_1, _impl->b } };
90 _impl->workspace_tensors = manage_workspace<CLTensor>(_impl->op->workspace(), _impl->memory_group, _impl->run_pack, _impl->prep_pack);
105 _impl->op->run(_impl->run_pack);
110 if(!_impl->is_prepared)
112 _impl->op->prepare(_impl->prep_pack);
114 auto has_reshape = std::find_if(_impl->aux_mem_req.begin(),
115 _impl->aux_mem_req.end(),
116 [](
const MemoryInfo &
m) ->
bool {
return m.lifetime == MemoryLifetime::Persistent; });
118 if(has_reshape !=
std::end(_impl->aux_mem_req))
120 _impl->b->mark_as_unused();
125 _impl->run_pack.add_const_tensor(
ACL_SRC_1, _impl->b);
127 _impl->is_prepared =
true;
std::vector< WorkspaceDataElement< TensorType > > WorkspaceData
void prepare() override
Prepare the function for executing.
~CLGEMM()
Default destructor.
void run() override
Run the kernels contained in the function.
CLGEMM(std::shared_ptr< IMemoryManager > memory_manager=nullptr, IWeightsManager *weights_manager=nullptr)
Default constructor.
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...
bool retain_internal_weights() const
Flag which specifies if the weights tensor has to be retained from previous run.
Copyright (c) 2017-2023 Arm Limited.
std::vector< MemoryInfo > MemoryRequirements
void configure(const CLCompileContext &compile_context, const ICLTensor *a, const ICLTensor *b, const ICLTensor *c, ICLTensor *output, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo())
Initialise the kernel's inputs and output.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
void end(TokenStream &in, bool &valid)
Weights manager interface to handle weights transformations.
Memory group resources scope handling class.
Interface for OpenCL tensor.
static Status validate(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *output, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo())
Static function to check if given info will lead to a valid configuration of CLGEMM.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
static Status validate(const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *output, float alpha, float beta, const GEMMInfo &gemm_info)
Static function to check if given info will lead to a valid configuration.
Basic function to execute GEMM on OpenCL.