aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/CL/CLScheduler.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-08-14 12:52:53 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:54:54 +0000
commit72ccc440b5312160ede96f9c27c747965a5b08bf (patch)
tree7731c966205d24deb883206eb96cf0d34c6805f5 /arm_compute/runtime/CL/CLScheduler.h
parent766b70ce570b8f837e530213dcac752dde0182b3 (diff)
downloadComputeLibrary-72ccc440b5312160ede96f9c27c747965a5b08bf.tar.gz
COMPMID-1504: (Nightly) Segfaults on CL and android
Keeps a copy of context in Scheduler to avoid releasing KernelLibrary resources before Scheduler resourses leading to a segfault. Does not exactly revert COMPMID-1122 as it still tries to keep context in sync. Change-Id: I3deb6bc1725b80f65f51ebd34d536f612ef6dd86 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/144024 Reviewed-by: Michele DiGiorgio <michele.digiorgio@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/runtime/CL/CLScheduler.h')
-rw-r--r--arm_compute/runtime/CL/CLScheduler.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/arm_compute/runtime/CL/CLScheduler.h b/arm_compute/runtime/CL/CLScheduler.h
index 807d8bb448..663f78a56c 100644
--- a/arm_compute/runtime/CL/CLScheduler.h
+++ b/arm_compute/runtime/CL/CLScheduler.h
@@ -74,8 +74,7 @@ public:
* @param[in] cl_tuner (Optional) Pointer to OpenCL tuner (default=nullptr)
* Note: It is caller's responsibility to release the allocated memory for CLTuner
*/
- void init(cl::Context context, cl::CommandQueue queue,
- cl::Device device, ICLTuner *cl_tuner = nullptr)
+ void init(cl::Context context, cl::CommandQueue queue, cl::Device device, ICLTuner *cl_tuner = nullptr)
{
set_context(context);
_queue = std::move(queue);
@@ -91,7 +90,8 @@ public:
cl::Context &context()
{
ARM_COMPUTE_ERROR_ON(!_is_initialised);
- return CLKernelLibrary::get().context();
+ _context = CLKernelLibrary::get().context();
+ return _context;
}
/** Accessor for the associated CL command queue.
@@ -119,7 +119,8 @@ public:
*/
void set_context(cl::Context context)
{
- CLKernelLibrary::get().set_context(context);
+ _context = std::move(context);
+ CLKernelLibrary::get().set_context(_context);
}
/** Accessor to set the CL command queue to be used by the scheduler.
@@ -188,6 +189,7 @@ private:
/** Flag to ensure symbols initialisation is happening before Scheduler creation */
static std::once_flag _initialize_symbols;
+ cl::Context _context;
cl::CommandQueue _queue;
GPUTarget _target;
bool _is_initialised;