aboutsummaryrefslogtreecommitdiff
path: root/src/graph/backends/CL/CLDeviceBackend.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-05-31 18:53:52 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:52:54 +0000
commitdf473eab0ab8a52e6b58e0f6442b39ba4c1d68ea (patch)
tree5c96fcc41cf079849b6f392bc266b82c43a4766b /src/graph/backends/CL/CLDeviceBackend.cpp
parent087eaf67dc4be4234a7fcfc3b109c1e4f5e7dd5e (diff)
downloadComputeLibrary-df473eab0ab8a52e6b58e0f6442b39ba4c1d68ea.tar.gz
COMPMID-1182: printf doesn't work
Change-Id: I013d57f6e2becbd6d2d7700ce5fbbeca670443c4 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/133735 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'src/graph/backends/CL/CLDeviceBackend.cpp')
-rw-r--r--src/graph/backends/CL/CLDeviceBackend.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/graph/backends/CL/CLDeviceBackend.cpp b/src/graph/backends/CL/CLDeviceBackend.cpp
index 7f2be674f6..b235c3aa48 100644
--- a/src/graph/backends/CL/CLDeviceBackend.cpp
+++ b/src/graph/backends/CL/CLDeviceBackend.cpp
@@ -66,7 +66,7 @@ static detail::BackendRegistrar<CLDeviceBackend> CLDeviceBackend_registrar(Targe
static const std::string tuner_data_filename = "acl_tuner.csv";
CLDeviceBackend::CLDeviceBackend()
- : _tuner(), _allocator(cl::Context::getDefault())
+ : _initialized(false), _tuner(), _allocator(nullptr)
{
}
@@ -96,11 +96,18 @@ void CLDeviceBackend::initialize_backend()
CLScheduler::get().default_init(&_tuner);
// Create allocator with new context
- _allocator = CLBufferAllocator();
+ _allocator = support::cpp14::make_unique<CLBufferAllocator>();
}
void CLDeviceBackend::setup_backend_context(GraphContext &ctx)
{
+ // Force backend initialization
+ if(!_initialized)
+ {
+ initialize_backend();
+ _initialized = true;
+ }
+
// Setup tuner
set_kernel_tuning(ctx.config().use_tuner);
@@ -124,7 +131,7 @@ bool CLDeviceBackend::is_backend_supported()
IAllocator *CLDeviceBackend::backend_allocator()
{
- return &_allocator;
+ return _allocator.get();
}
std::unique_ptr<ITensorHandle> CLDeviceBackend::create_tensor(const Tensor &tensor)
@@ -180,7 +187,7 @@ std::shared_ptr<arm_compute::IMemoryManager> CLDeviceBackend::create_memory_mana
auto pool_mgr = std::make_shared<PoolManager>();
auto mm = std::make_shared<MemoryManagerOnDemand>(lifetime_mgr, pool_mgr);
- mm->set_allocator(&_allocator);
+ mm->set_allocator(_allocator.get());
return mm;
}