aboutsummaryrefslogtreecommitdiff
path: root/tests/validate_examples
diff options
context:
space:
mode:
authorMirko leonardo Serra laban <mirko.serra@arm.com>2020-11-19 16:22:59 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2020-11-23 14:46:34 +0000
commitd828b46667459bdf93d409f5a1bc3afc19c81baf (patch)
treeb430ae90eb2e8d5fc141b3e1bc81257b02bf4bae /tests/validate_examples
parent40943df83026b66356f24e30f31f78c8b9e59c92 (diff)
downloadComputeLibrary-d828b46667459bdf93d409f5a1bc3afc19c81baf.tar.gz
Fix segfault at validate_cl_gemm
Fixes segfault when exiting the program. Change-Id: I20757f700842e6c1de9112d2915d539513434c6d Signed-off-by: Mirko leonardo Serra laban <mirko.serra@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4484 Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'tests/validate_examples')
-rw-r--r--tests/validate_examples/RunExample.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/validate_examples/RunExample.cpp b/tests/validate_examples/RunExample.cpp
index b6ff8832dd..aca4ddcc7c 100644
--- a/tests/validate_examples/RunExample.cpp
+++ b/tests/validate_examples/RunExample.cpp
@@ -28,6 +28,7 @@
#include "ValidateExample.h"
#include "arm_compute/runtime/Scheduler.h"
+#include "arm_compute/runtime/CL/CLHelpers.h"
#include "tests/AssetsLibrary.h"
#include "tests/Globals.h"
#include "tests/framework/Framework.h"
@@ -149,6 +150,15 @@ 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();
+ 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 +169,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