aboutsummaryrefslogtreecommitdiff
path: root/src/graph
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2021-04-20 11:26:21 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-04-21 20:48:28 +0000
commit402740da11c4fd2a9dc7aee5dadf3b1fdda0afde (patch)
tree61501d2f0af7115b87d26907d6ca9a3d00f4ef5e /src/graph
parentbff2f9f2f92bf7a8d2f7532df0329dedfbe84693 (diff)
downloadComputeLibrary-402740da11c4fd2a9dc7aee5dadf3b1fdda0afde.tar.gz
Add support for CLVK
This patch enables CLVK through the graph API and inside the CLScheduler. By default the Native platform is selected. Selecting CLVK can be done via --target=clvk. Resolves COMPMID-4205 and COMPMID-4206 Change-Id: Ic60744980c6b8a60e776627ea677ed46be88f656 Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5475 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/graph')
-rw-r--r--src/graph/GraphManager.cpp14
-rw-r--r--src/graph/TypeLoader.cpp1
-rw-r--r--src/graph/backends/CL/CLDeviceBackend.cpp5
3 files changed, 17 insertions, 3 deletions
diff --git a/src/graph/GraphManager.cpp b/src/graph/GraphManager.cpp
index 9d53172dc8..ab7aac6230 100644
--- a/src/graph/GraphManager.cpp
+++ b/src/graph/GraphManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 Arm Limited.
+ * Copyright (c) 2018-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -57,6 +57,18 @@ void GraphManager::finalize_graph(Graph &graph, GraphContext &ctx, PassManager &
// Force target to all graph construct
// TODO (COMPMID-2014) : Support heterogeneous execution
Target forced_target = target;
+
+ // In case CLVK is selected, use the CL backend and
+ // update config
+ if(target == Target::CLVK)
+ {
+ forced_target = Target::CL;
+ GraphConfig config = ctx.config();
+ config.backend_type = CLBackendType::Clvk;
+
+ ctx.set_config(config);
+ }
+
if(!is_target_supported(target))
{
forced_target = get_default_target();
diff --git a/src/graph/TypeLoader.cpp b/src/graph/TypeLoader.cpp
index 8efd66f2c5..3c51289dba 100644
--- a/src/graph/TypeLoader.cpp
+++ b/src/graph/TypeLoader.cpp
@@ -59,6 +59,7 @@ Target target_from_name(const std::string &name)
{
{ "neon", Target::NEON },
{ "cl", Target::CL },
+ { "clvk", Target::CLVK },
};
#ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
diff --git a/src/graph/backends/CL/CLDeviceBackend.cpp b/src/graph/backends/CL/CLDeviceBackend.cpp
index f8e22ca7a0..eafda98669 100644
--- a/src/graph/backends/CL/CLDeviceBackend.cpp
+++ b/src/graph/backends/CL/CLDeviceBackend.cpp
@@ -65,7 +65,7 @@ bool file_exists(const std::string &filename)
static detail::BackendRegistrar<CLDeviceBackend> CLDeviceBackend_registrar(Target::CL);
CLDeviceBackend::CLDeviceBackend()
- : _context_count(0), _tuner(), _gemm_heuristics(), _allocator(nullptr), _tuner_file()
+ : _context_count(0), _tuner(), _gemm_heuristics(), _allocator(nullptr), _tuner_file(), _backend_type(CLBackendType::Native)
{
}
@@ -87,7 +87,7 @@ void CLDeviceBackend::set_kernel_tuning_mode(CLTunerMode tuning_mode)
void CLDeviceBackend::initialize_backend()
{
// Setup Scheduler
- CLScheduler::get().default_init(&_tuner, &_gemm_heuristics);
+ CLScheduler::get().default_init(&_tuner, &_gemm_heuristics, _backend_type);
// Create allocator with new context
_allocator = std::make_unique<CLBufferAllocator>(nullptr /* legacy path for CLCoreRuntimeContext */);
}
@@ -108,6 +108,7 @@ void CLDeviceBackend::setup_backend_context(GraphContext &ctx)
_context_count++;
if(_context_count == 1)
{
+ _backend_type = ctx.config().backend_type;
initialize_backend();
}