xref: /aosp_15_r20/external/armnn/shim/sl/canonical/DriverOptions.hpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <armnn/ArmNN.hpp>
9 
10 #include <set>
11 #include <string>
12 #include <vector>
13 
14 namespace armnn_driver
15 {
16 
17 class DriverOptions
18 {
19 public:
20     DriverOptions(armnn::Compute computeDevice, bool fp16Enabled = false);
21     DriverOptions(const std::vector<armnn::BackendId>& backends, bool fp16Enabled = false);
22     DriverOptions();
23     DriverOptions(DriverOptions&& other) = default;
24 
25 
GetBackends() const26     const std::vector<armnn::BackendId>& GetBackends() const { return m_Backends; }
IsVerboseLoggingEnabled() const27     bool IsVerboseLoggingEnabled() const { return m_VerboseLogging; }
GetRequestInputsAndOutputsDumpDir() const28     const std::string& GetRequestInputsAndOutputsDumpDir() const { return m_RequestInputsAndOutputsDumpDir; }
GetServiceName() const29     const std::string& GetServiceName() const { return m_ServiceName; }
GetForcedUnsupportedOperations() const30     const std::set<unsigned int>& GetForcedUnsupportedOperations() const { return m_ForcedUnsupportedOperations; }
GetClTunedParametersFile() const31     const std::string& GetClTunedParametersFile() const { return m_ClTunedParametersFile; }
GetClMLGOTunedParametersFile() const32     const std::string& GetClMLGOTunedParametersFile() const { return m_ClMLGOTunedParametersFile; }
GetClTunedParametersMode() const33     armnn::IGpuAccTunedParameters::Mode GetClTunedParametersMode() const { return m_ClTunedParametersMode; }
GetClTuningLevel() const34     armnn::IGpuAccTunedParameters::TuningLevel GetClTuningLevel() const { return m_ClTuningLevel; }
IsGpuProfilingEnabled() const35     bool IsGpuProfilingEnabled() const { return m_EnableGpuProfiling; }
IsFastMathEnabled() const36     bool IsFastMathEnabled() const { return m_FastMathEnabled; }
GetFp16Enabled() const37     bool GetFp16Enabled() const { return m_fp16Enabled; }
SetBackends(const std::vector<armnn::BackendId> & backends)38     void SetBackends(const std::vector<armnn::BackendId>& backends) { m_Backends = backends; }
ShouldExit() const39     bool ShouldExit() const { return m_ShouldExit; }
GetExitCode() const40     int GetExitCode() const { return m_ExitCode; }
GetCachedNetworkFilePath() const41     const std::string& GetCachedNetworkFilePath() const { return m_CachedNetworkFilePath; }
SaveCachedNetwork() const42     bool SaveCachedNetwork() const { return m_SaveCachedNetwork; }
GetNumberOfThreads() const43     unsigned int GetNumberOfThreads() const { return m_NumberOfThreads; }
isAsyncModelExecutionEnabled() const44     bool isAsyncModelExecutionEnabled() const { return m_EnableAsyncModelExecution; };
getNoOfArmnnThreads() const45     unsigned int getNoOfArmnnThreads() const { return m_ArmnnNumberOfThreads; };
46 
47 private:
48     std::vector<armnn::BackendId> m_Backends;
49     bool m_VerboseLogging;
50     std::string m_RequestInputsAndOutputsDumpDir;
51     std::string m_ServiceName;
52     std::set<unsigned int> m_ForcedUnsupportedOperations;
53     std::string m_ClTunedParametersFile;
54     std::string m_ClMLGOTunedParametersFile;
55     armnn::IGpuAccTunedParameters::Mode m_ClTunedParametersMode;
56     armnn::IGpuAccTunedParameters::TuningLevel m_ClTuningLevel;
57     bool m_EnableGpuProfiling;
58     bool m_fp16Enabled;
59     bool m_FastMathEnabled;
60     bool m_ShouldExit;
61     int m_ExitCode;
62     std::string m_CachedNetworkFilePath;
63     bool m_SaveCachedNetwork;
64     unsigned int m_NumberOfThreads;
65     bool m_EnableAsyncModelExecution;
66     unsigned int m_ArmnnNumberOfThreads;
67 };
68 
69 } // namespace armnn_driver
70