23.08
|
OpenCL device backend. More...
#include <CLDeviceBackend.h>
Public Member Functions | |
CLDeviceBackend () | |
Default Constructor. More... | |
~CLDeviceBackend () | |
Destructor. More... | |
void | set_kernel_tuning (bool enable_tuning) |
Switchs on or off the kernel tuning. More... | |
void | set_kernel_tuning_mode (CLTunerMode tuning_mode) |
Set kernel tuning mode. More... | |
void | initialize_backend () override |
Initializes the backend. More... | |
void | setup_backend_context (GraphContext &ctx) override |
Setups the given graph context. More... | |
void | release_backend_context (GraphContext &ctx) override |
Release the backend specific resources associated to a given graph context. More... | |
bool | is_backend_supported () override |
Checks if an instantiated backend is actually supported. More... | |
IAllocator * | backend_allocator () override |
Gets a backend memory allocator. More... | |
std::unique_ptr< ITensorHandle > | create_tensor (const Tensor &tensor) override |
Create a backend Tensor. More... | |
std::unique_ptr< ITensorHandle > | create_subtensor (ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) override |
Create a backend Sub-Tensor. More... | |
std::unique_ptr< arm_compute::IFunction > | configure_node (INode &node, GraphContext &ctx) override |
Configure a backend Node. More... | |
Status | validate_node (INode &node) override |
Validate a node. More... | |
std::shared_ptr< arm_compute::IMemoryManager > | create_memory_manager (MemoryManagerAffinity affinity) override |
Create a backend memory manager given its affinity. More... | |
std::shared_ptr< arm_compute::IWeightsManager > | create_weights_manager () override |
Create a backend weights manager. More... | |
void | sync () override |
Synchronize kernels execution on the backend. More... | |
![]() | |
virtual | ~IDeviceBackend ()=default |
Virtual Destructor. More... | |
OpenCL device backend.
Definition at line 41 of file CLDeviceBackend.h.
CLDeviceBackend | ( | ) |
Default Constructor.
Definition at line 66 of file CLDeviceBackend.cpp.
References arm_compute::Native.
~CLDeviceBackend | ( | ) |
|
overridevirtual |
Gets a backend memory allocator.
Implements IDeviceBackend.
Definition at line 159 of file CLDeviceBackend.cpp.
|
overridevirtual |
Configure a backend Node.
[in] | node | The node we want to configure |
[in] | ctx | Context to use |
Implements IDeviceBackend.
Definition at line 187 of file CLDeviceBackend.cpp.
References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_LOG_GRAPH_VERBOSE, INode::assigned_target(), arm_compute::graph::CL, CLFunctionFactory::create(), and INode::id().
|
overridevirtual |
Create a backend memory manager given its affinity.
[in] | affinity | Memory Manager affinity |
Implements IDeviceBackend.
Definition at line 204 of file CLDeviceBackend.cpp.
References ARM_COMPUTE_LOG_GRAPH_WARNING, and arm_compute::graph::Offset.
Referenced by CLDeviceBackend::setup_backend_context().
|
overridevirtual |
Create a backend Sub-Tensor.
[in] | parent | Parent sub-tensor handle |
[in] | shape | Shape of the sub-tensor |
[in] | coords | Starting coordinates of the sub-tensor |
[in] | extend_parent | Extends parent shape if true |
Implements IDeviceBackend.
Definition at line 177 of file CLDeviceBackend.cpp.
References arm_compute::test::validation::shape.
|
overridevirtual |
Create a backend Tensor.
[in] | tensor | The tensor we want to create a backend tensor for |
Implements IDeviceBackend.
Definition at line 164 of file CLDeviceBackend.cpp.
References ARM_COMPUTE_ERROR_ON, arm_compute::graph::CL, TensorDescriptor::data_type, arm_compute::test::validation::info, TensorDescriptor::layout, TensorDescriptor::quant_info, TensorDescriptor::shape, TensorDescriptor::target, and tensor.
|
overridevirtual |
Create a backend weights manager.
Implements IDeviceBackend.
Definition at line 219 of file CLDeviceBackend.cpp.
Referenced by CLDeviceBackend::setup_backend_context().
|
overridevirtual |
Initializes the backend.
Implements IDeviceBackend.
Definition at line 86 of file CLDeviceBackend.cpp.
References CLScheduler::default_init(), and CLScheduler::get().
Referenced by CLDeviceBackend::setup_backend_context().
|
overridevirtual |
Checks if an instantiated backend is actually supported.
Implements IDeviceBackend.
Definition at line 154 of file CLDeviceBackend.cpp.
References arm_compute::opencl_is_available().
|
overridevirtual |
Release the backend specific resources associated to a given graph context.
[in,out] | ctx | Graph context |
Implements IDeviceBackend.
Definition at line 94 of file CLDeviceBackend.cpp.
References ARM_COMPUTE_UNUSED.
void set_kernel_tuning | ( | bool | enable_tuning | ) |
Switchs on or off the kernel tuning.
[in] | enable_tuning | Enables tuning if false else true |
Definition at line 76 of file CLDeviceBackend.cpp.
References CLTuner::set_tune_new_kernels().
Referenced by CLDeviceBackend::setup_backend_context().
void set_kernel_tuning_mode | ( | CLTunerMode | tuning_mode | ) |
Set kernel tuning mode.
[in] | tuning_mode | Indicates how exhaustive the search for the optimal LWS should be while tuning |
Definition at line 81 of file CLDeviceBackend.cpp.
References CLTuner::set_tuner_mode().
Referenced by CLDeviceBackend::setup_backend_context().
|
overridevirtual |
Setups the given graph context.
[in,out] | ctx | Graph context |
Implements IDeviceBackend.
Definition at line 104 of file CLDeviceBackend.cpp.
References MemoryManagerContext::allocator, ARM_COMPUTE_ERROR_ON, GraphConfig::backend_type, arm_compute::graph::Buffer, arm_compute::graph::CL, GraphContext::config(), CLDeviceBackend::create_memory_manager(), CLDeviceBackend::create_weights_manager(), MemoryManagerContext::cross_group, MemoryManagerContext::cross_mm, CLScheduler::gemm_heuristics(), CLScheduler::get(), CLDeviceBackend::initialize_backend(), GraphContext::insert_memory_management_ctx(), GraphContext::insert_weights_management_ctx(), MemoryManagerContext::intra_mm, CLTuner::load_from_file(), GraphContext::memory_management_ctx(), GraphConfig::mlgo_file, CLGEMMHeuristicsHandle::reload_from_file(), CLDeviceBackend::set_kernel_tuning(), CLDeviceBackend::set_kernel_tuning_mode(), MemoryManagerContext::target, WeightsManagerContext::target, GraphConfig::tuner_file, GraphConfig::tuner_mode, GraphConfig::use_tuner, GraphContext::weights_management_ctx(), and WeightsManagerContext::wm.
|
overridevirtual |
Synchronize kernels execution on the backend.
On GPU, this results in a blocking call waiting for all kernels to be completed.
Implements IDeviceBackend.
Definition at line 225 of file CLDeviceBackend.cpp.
References CLScheduler::get(), and CLScheduler::sync().
|
overridevirtual |
Validate a node.
[in] | node | The node we want to validate |
Implements IDeviceBackend.
Definition at line 196 of file CLDeviceBackend.cpp.
References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_LOG_GRAPH_VERBOSE, INode::assigned_target(), arm_compute::graph::CL, INode::id(), and CLNodeValidator::validate().