telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 8 | #include <backends/cl/ClContextControl.hpp> |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 9 | |
| 10 | template<bool ProfilingEnabled> |
| 11 | struct ClContextControlFixtureBase |
| 12 | { |
Matteo Martincigh | 539b44d | 2018-10-01 09:26:39 +0100 | [diff] [blame] | 13 | static ClContextControlFixtureBase*& Instance() |
| 14 | { |
| 15 | static ClContextControlFixtureBase* s_Instance = nullptr; |
| 16 | return s_Instance; |
| 17 | } |
| 18 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 19 | // Initialising ClContextControl to ensure OpenCL is loaded correctly for each test case |
Matteo Martincigh | 539b44d | 2018-10-01 09:26:39 +0100 | [diff] [blame] | 20 | ClContextControlFixtureBase() |
| 21 | : m_ClContextControl(nullptr, ProfilingEnabled) |
| 22 | { |
| 23 | Instance() = this; |
| 24 | } |
| 25 | ~ClContextControlFixtureBase() |
| 26 | { |
| 27 | Instance() = nullptr; |
| 28 | } |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 29 | |
| 30 | armnn::ClContextControl m_ClContextControl; |
| 31 | }; |
| 32 | |
| 33 | using ClContextControlFixture = ClContextControlFixtureBase<false>; |
| 34 | using ClProfilingContextControlFixture = ClContextControlFixtureBase<true>; |