aboutsummaryrefslogtreecommitdiff
path: root/src/graph/Utils.cpp
diff options
context:
space:
mode:
authorAnthony Barbier <anthony.barbier@arm.com>2018-08-22 13:44:36 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:54:54 +0000
commit890ad1be4eff1a805fe07667f4044b1d38a07b39 (patch)
tree98d2e9e4ef76d1e015d867dd6945bee3cb7ba5f0 /src/graph/Utils.cpp
parentaaba4c626bcc6365e0108130633ce43fafe9da45 (diff)
downloadComputeLibrary-890ad1be4eff1a805fe07667f4044b1d38a07b39.tar.gz
COMPMID-1246: Fix bug in handling backends that can't be loaded in the Graph API
Change-Id: Iefd175af2f472179d86df5358a1527a79c5666ed Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/145182 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/graph/Utils.cpp')
-rw-r--r--src/graph/Utils.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/graph/Utils.cpp b/src/graph/Utils.cpp
index 75644a8933..0a85a7f119 100644
--- a/src/graph/Utils.cpp
+++ b/src/graph/Utils.cpp
@@ -101,7 +101,10 @@ void release_default_graph_context(GraphContext &ctx)
{
for(const auto &backend : backends::BackendRegistry::get().backends())
{
- backend.second->release_backend_context(ctx);
+ if(backend.second->is_backend_supported())
+ {
+ backend.second->release_backend_context(ctx);
+ }
}
}
@@ -109,7 +112,10 @@ void setup_default_graph_context(GraphContext &ctx)
{
for(const auto &backend : backends::BackendRegistry::get().backends())
{
- backend.second->setup_backend_context(ctx);
+ if(backend.second->is_backend_supported())
+ {
+ backend.second->setup_backend_context(ctx);
+ }
}
}
@@ -172,11 +178,10 @@ void configure_tensor(Tensor *tensor)
{
if(tensor != nullptr && tensor->handle() == nullptr)
{
- Target target = tensor->desc().target;
- auto backend = backends::BackendRegistry::get().find_backend(target);
- ARM_COMPUTE_ERROR_ON_MSG(!backend, "Requested backend doesn't exist!");
- auto handle = backend->create_tensor(*tensor);
- ARM_COMPUTE_ERROR_ON_MSG(!backend, "Couldn't create backend handle!");
+ Target target = tensor->desc().target;
+ backends::IDeviceBackend &backend = backends::BackendRegistry::get().get_backend(target);
+ std::unique_ptr<ITensorHandle> handle = backend.create_tensor(*tensor);
+ ARM_COMPUTE_ERROR_ON_MSG(!handle, "Couldn't create backend handle!");
tensor->set_handle(std::move(handle));
}
}