ArmNN
 22.02
ClContextControl.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include "armnn/IRuntime.hpp"
8 
9 #include <arm_compute/runtime/CL/CLTuner.h>
10 #include <arm_compute/runtime/CL/CLGEMMHeuristicsHandle.h>
11 
12 namespace armnn
13 {
14 
15 // ARM Compute OpenCL context control.
17 {
18 public:
19 
20  ClContextControl(arm_compute::CLTuner* = nullptr,
21  arm_compute::CLGEMMHeuristicsHandle* = nullptr,
22  bool profilingEnabled = false);
23 
24  virtual ~ClContextControl();
25 
26  void LoadOpenClRuntime();
27 
28  // Users should call this (after freeing all of the cl::Context objects they use)
29  // to release the cached memory used by the compute library.
30  void UnloadOpenClRuntime();
31 
32  // Clear the CL cache, without losing the tuned parameter settings.
33  void ClearClCache();
34 
35 private:
36 
37  void DoLoadOpenClRuntime(bool updateTunedParameters);
38 
39  arm_compute::CLTuner* m_Tuner;
40  arm_compute::CLGEMMHeuristicsHandle* m_HeuristicsHandle;
41 
42  bool m_ProfilingEnabled;
43 };
44 
46 {
47 public:
49 
50  virtual void Load(const char* filename);
51  virtual void Save(const char* filename) const;
52 
55 
56  arm_compute::CLTuner m_Tuner;
57  arm_compute::CLGEMMHeuristicsHandle m_HeuristicsHandle;
58 };
59 
60 } // namespace armnn
ClContextControl(arm_compute::CLTuner *=nullptr, arm_compute::CLGEMMHeuristicsHandle *=nullptr, bool profilingEnabled=false)
Copyright (c) 2021 ARM Limited and Contributors.
arm_compute::CLTuner m_Tuner
Manages a set of GpuAcc parameters which have been tuned for maximum performance. ...
Definition: IRuntime.hpp:306
arm_compute::CLGEMMHeuristicsHandle m_HeuristicsHandle