aboutsummaryrefslogtreecommitdiff
path: root/tests/validate_examples/RunExample.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validate_examples/RunExample.cpp')
-rw-r--r--tests/validate_examples/RunExample.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/tests/validate_examples/RunExample.cpp b/tests/validate_examples/RunExample.cpp
index 998d5013a8..36bf587551 100644
--- a/tests/validate_examples/RunExample.cpp
+++ b/tests/validate_examples/RunExample.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 ARM Limited.
+ * Copyright (c) 2018-2021, 2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,7 +27,9 @@
#include "utils/Utils.cpp"
#include "ValidateExample.h"
+#include "arm_compute/runtime/CL/CLHelpers.h"
#include "arm_compute/runtime/Scheduler.h"
+#include "arm_compute/core/Version.h"
#include "tests/AssetsLibrary.h"
#include "tests/Globals.h"
#include "tests/framework/Framework.h"
@@ -39,9 +41,6 @@
#ifdef ARM_COMPUTE_CL
#include "arm_compute/runtime/CL/CLScheduler.h"
#endif /* ARM_COMPUTE_CL */
-#ifdef ARM_COMPUTE_GC
-#include "arm_compute/runtime/GLES_COMPUTE/GCScheduler.h"
-#endif /* ARM_COMPUTE_GC */
#include <libgen.h>
@@ -138,8 +137,8 @@ int run_example(int argc, char **argv, std::unique_ptr<ValidateExample> example)
g_example_argv.emplace_back(const_cast<char *>(arg.c_str())); // NOLINT
}
- library = support::cpp14::make_unique<AssetsLibrary>("." /* Only using random values */, seed->value());
- fixed_library = support::cpp14::make_unique<AssetsLibrary>(".", fixed_seed);
+ library = std::make_unique<AssetsLibrary>("." /* Only using random values */, seed->value());
+ fixed_library = std::make_unique<AssetsLibrary>(".", fixed_seed);
if(options.log_level->value() > framework::LogLevel::NONE)
{
@@ -149,6 +148,24 @@ int run_example(int argc, char **argv, std::unique_ptr<ValidateExample> example)
}
}
+#ifdef ARM_COMPUTE_CL
+ if(opencl_is_available())
+ {
+ 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);
+ }
+#endif /* ARM_COMPUTE_CL */
+
if(options.log_level->value() >= framework::LogLevel::CONFIG)
{
for(auto &p : printers)
@@ -159,10 +176,6 @@ int run_example(int argc, char **argv, std::unique_ptr<ValidateExample> example)
#ifdef ARM_COMPUTE_CL
if(opencl_is_available())
{
- if(!CLScheduler::get().is_initialised())
- {
- CLScheduler::get().default_init();
- }
p->print_entry("CL_DEVICE_VERSION", CLKernelLibrary::get().get_device_version());
}
else