aboutsummaryrefslogtreecommitdiff
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/benchmark_examples/RunExample.cpp12
-rw-r--r--tests/main.cpp2
-rw-r--r--tests/validate_examples/RunExample.cpp7
3 files changed, 18 insertions, 3 deletions
diff --git a/tests/benchmark_examples/RunExample.cpp b/tests/benchmark_examples/RunExample.cpp
index e5dfe74d0e..a23d91e9de 100644
--- a/tests/benchmark_examples/RunExample.cpp
+++ b/tests/benchmark_examples/RunExample.cpp
@@ -128,7 +128,17 @@ int run_example(int argc, char **argv, std::unique_ptr<Example> example)
CLGEMMHeuristicsHandle gemm_h;
if(opencl_is_available())
{
- auto ctx_dev_err = create_opencl_context_and_device();
+ CLBackendType backend_type = CLBackendType::Native;
+ for(auto &arg : example_args->value())
+ {
+ if(arg.find("--target=clvk") != std::string::npos)
+ {
+ backend_type = CLBackendType::Clvk;
+ break;
+ }
+ }
+
+ auto ctx_dev_err = create_opencl_context_and_device(backend_type);
ARM_COMPUTE_ERROR_ON_MSG(std::get<2>(ctx_dev_err) != CL_SUCCESS, "Failed to create OpenCL context");
CLScheduler::get()
.default_init_with_context(std::get<1>(ctx_dev_err), std::get<0>(ctx_dev_err), nullptr, &gemm_h);
diff --git a/tests/main.cpp b/tests/main.cpp
index cecd89bdb7..308338e781 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -183,7 +183,7 @@ int main(int argc, char **argv)
CLGEMMHeuristicsHandle gemm_heuristics;
if(opencl_is_available())
{
- auto ctx_dev_err = create_opencl_context_and_device();
+ auto ctx_dev_err = create_opencl_context_and_device(CLBackendType::Native);
ARM_COMPUTE_ERROR_ON_MSG(std::get<2>(ctx_dev_err) != CL_SUCCESS, "Failed to create OpenCL context");
gemm_heuristics.reload_from_file(mlgo_file->value());
CLScheduler::get().default_init_with_context(std::get<1>(ctx_dev_err), std::get<0>(ctx_dev_err), &cl_tuner, &gemm_heuristics);
diff --git a/tests/validate_examples/RunExample.cpp b/tests/validate_examples/RunExample.cpp
index 8ba3c2b295..70cc8f1609 100644
--- a/tests/validate_examples/RunExample.cpp
+++ b/tests/validate_examples/RunExample.cpp
@@ -150,7 +150,12 @@ int run_example(int argc, char **argv, std::unique_ptr<ValidateExample> example)
#ifdef ARM_COMPUTE_CL
if(opencl_is_available())
{
- auto ctx_dev_err = create_opencl_context_and_device();
+ CLBackendType backend_type = CLBackendType::Native;
+ if(options.target->value() == Target::CLVK)
+ {
+ backend_type = CLBackendType::Clvk;
+ }
+ auto ctx_dev_err = create_opencl_context_and_device(backend_type);
ARM_COMPUTE_ERROR_ON_MSG(std::get<2>(ctx_dev_err) != CL_SUCCESS, "Failed to create OpenCL context");
CLScheduler::get().default_init_with_context(std::get<1>(ctx_dev_err), std::get<0>(ctx_dev_err), nullptr);
}