1 // 2 // Copyright © 2017 Arm Ltd. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 #pragma once 6 7 #include <armnn/backends/IBackendContext.hpp> 8 #include <unordered_set> 9 #include <mutex> 10 11 #include <arm_compute/runtime/CL/CLTuner.h> 12 13 namespace armnn 14 { 15 16 class ClBackendContext : public IBackendContext 17 { 18 public: 19 ClBackendContext(const IRuntime::CreationOptions& options); 20 21 bool BeforeLoadNetwork(NetworkId networkId) override; 22 bool AfterLoadNetwork(NetworkId networkId) override; 23 24 bool BeforeUnloadNetwork(NetworkId networkId) override; 25 bool AfterUnloadNetwork(NetworkId networkId) override; 26 27 ~ClBackendContext() override; 28 29 private: 30 std::mutex m_Mutex; 31 struct ClContextControlWrapper; 32 std::unique_ptr<ClContextControlWrapper> m_ClContextControlWrapper; 33 34 std::unordered_set<NetworkId> m_NetworkIds; 35 36 std::unique_ptr<arm_compute::CLTuner> m_Tuner; 37 std::string m_TuningFile; 38 }; 39 40 } // namespace armnn