23.08
|
Go to the documentation of this file.
56 bool file_exists(
const std::string &filename)
58 std::ifstream file(filename);
64 static detail::BackendRegistrar<CLDeviceBackend> CLDeviceBackend_registrar(
Target::CL);
67 : _context_count(0), _tuner(), _gemm_heuristics(), _allocator(nullptr), _tuner_file(), _backend_type(
CLBackendType::
Native)
91 _allocator = std::make_unique<CLBufferAllocator>();
98 if(_context_count == 0)
100 _allocator =
nullptr;
108 if(_context_count == 1)
118 if(file_exists(_tuner_file))
161 return _allocator.get();
174 return std::make_unique<CLTensorHandle>(
info);
179 if(parent ==
nullptr)
184 return std::make_unique<CLSubTensorHandle>(parent,
shape, coords, extend_parent);
212 auto lifetime_mgr = std::make_shared<BlobLifetimeManager>();
213 auto pool_mgr = std::make_shared<PoolManager>();
214 auto mm = std::make_shared<MemoryManagerOnDemand>(lifetime_mgr, pool_mgr);
221 auto weights_mgr = std::make_shared<IWeightsManager>();
CLGEMMHeuristicsHandle * gemm_heuristics() const
Accessor for the associated CLGEMMHeuristicsHandle.
MemoryManagerContext * memory_management_ctx(Target target)
Gets a memory manager context for a given target.
@ Offset
Affinity at offset level.
bool use_tuner
Use a tuner in tunable backends.
bool opencl_is_available()
Check if OpenCL is available.
Contains structs required for weights management.
std::string mlgo_file
Filename to load MLGO heuristics from.
const GraphConfig & config() const
Graph configuration accessor.
@ CL
OpenCL capable target device.
bool save_to_file(const std::string &filename) const
Save the content of the tuning parameters table to file.
void sync()
Blocks until all commands in the associated command queue have finished.
@ Buffer
Affinity at buffer level.
#define ARM_COMPUTE_LOG_GRAPH_WARNING(x)
static Status validate(INode *node)
Validate a node.
std::shared_ptr< arm_compute::IMemoryGroup > cross_group
Cross-function memory group.
Contains structs required for memory management.
WeightsManagerContext * weights_management_ctx(Target target)
Gets a weights manager context for a given target.
QuantizationInfo quant_info
Quantization info.
#define ARM_COMPUTE_LOG_GRAPH_VERBOSE(x)
~CLDeviceBackend()
Destructor.
CLDeviceBackend()
Default Constructor.
MemoryManagerAffinity
Backend Memory Manager affinity.
bool insert_memory_management_ctx(MemoryManagerContext &&memory_ctx)
Inserts a memory manager context.
CLTunerMode tuner_mode
Tuner mode to be used by the CL tuner.
Status validate_node(INode &node) override
Validate a node.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
DataLayout layout
Data layout.
void release_backend_context(GraphContext &ctx) override
Release the backend specific resources associated to a given graph context.
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
bool insert_weights_management_ctx(WeightsManagerContext &&weights_ctx)
Inserts a weights manager context.
std::unique_ptr< ITensorHandle > create_tensor(const Tensor &tensor) override
Create a backend Tensor.
TensorShape shape
Tensor shape.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
CLTensor * tensor
Pointer to the auxiliary tensor.
bool reload_from_file(const std::string &filename)
(Re)Load the heuristics from reading a dotmlgo file
bool is_backend_supported() override
Checks if an instantiated backend is actually supported.
static CLScheduler & get()
Access the scheduler singleton.
void initialize_backend() override
Initializes the backend.
CLBackendType
List the possible OpenCL backends.
CLBackendType backend_type
CL backend type to use.
void set_kernel_tuning(bool enable_tuning)
Switchs on or off the kernel tuning.
@ Native
OpenCL native backend.
Store the tensor's metadata.
void default_init(ICLTuner *cl_tuner=nullptr, CLGEMMHeuristicsHandle *gemm_h=nullptr, CLBackendType cl_backend_type=CLBackendType::Native)
Initialises the context and command queue used by the scheduler to default values and sets a default ...
std::shared_ptr< arm_compute::IMemoryManager > cross_mm
Cross-function memory manager.
std::shared_ptr< arm_compute::IWeightsManager > create_weights_manager() override
Create a backend weights manager.
Copyright (c) 2017-2023 Arm Limited.
std::unique_ptr< arm_compute::IFunction > configure_node(INode &node, GraphContext &ctx) override
Configure a backend Node.
void set_kernel_tuning_mode(CLTunerMode tuning_mode)
Set kernel tuning mode.
static std::unique_ptr< arm_compute::IFunction > create(INode *node, GraphContext &ctx)
Create a backend execution function depending on the node type.
void setup_backend_context(GraphContext &ctx) override
Setups the given graph context.
CLTunerMode
< OpenCL tuner modes
void sync() override
Synchronize kernels execution on the backend.
void load_from_file(const std::string &filename)
Load the tuning parameters table from file.
void set_tuner_mode(CLTunerMode mode)
Set OpenCL tuner mode.
Target assigned_target() const
Returns assigned target for this node.
std::shared_ptr< arm_compute::IWeightsManager > wm
Weights manager.
std::shared_ptr< arm_compute::IMemoryManager > intra_mm
Intra-function memory manager.
std::unique_ptr< ITensorHandle > create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) override
Create a backend Sub-Tensor.
void set_tune_new_kernels(bool tune_new_kernels)
Setter for tune_new_kernels option.
DataType data_type
Data type.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
NodeID id() const
Returns node's ID.
Tensor handle interface object.
IAllocator * allocator
Backend allocator to use.
std::shared_ptr< arm_compute::IMemoryManager > create_memory_manager(MemoryManagerAffinity affinity) override
Create a backend memory manager given its affinity.
IAllocator * backend_allocator() override
Gets a backend memory allocator.
std::string tuner_file
File to load/store tuning values from.