xref: /aosp_15_r20/external/android-nn-driver/DriverOptions.hpp (revision 3e777be0405cee09af5d5785ff37f7cfb5bee59a)
1 //
2 // Copyright © 2017 Arm Ltd. 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);
22     DriverOptions(int argc, char** argv);
23     DriverOptions(DriverOptions&& other) = default;
24 
GetBackends() const25     const std::vector<armnn::BackendId>& GetBackends() const { return m_Backends; }
IsVerboseLoggingEnabled() const26     bool IsVerboseLoggingEnabled() const { return m_VerboseLogging; }
GetRequestInputsAndOutputsDumpDir() const27     const std::string& GetRequestInputsAndOutputsDumpDir() const { return m_RequestInputsAndOutputsDumpDir; }
GetServiceName() const28     const std::string& GetServiceName() const { return m_ServiceName; }
GetForcedUnsupportedOperations() const29     const std::set<unsigned int>& GetForcedUnsupportedOperations() const { return m_ForcedUnsupportedOperations; }
GetClTunedParametersFile() const30     const std::string& GetClTunedParametersFile() const { return m_ClTunedParametersFile; }
GetClMLGOTunedParametersFile() const31     const std::string& GetClMLGOTunedParametersFile() const { return m_ClMLGOTunedParametersFile; }
GetClTunedParametersMode() const32     armnn::IGpuAccTunedParameters::Mode GetClTunedParametersMode() const { return m_ClTunedParametersMode; }
GetClTuningLevel() const33     armnn::IGpuAccTunedParameters::TuningLevel GetClTuningLevel() const { return m_ClTuningLevel; }
IsGpuProfilingEnabled() const34     bool IsGpuProfilingEnabled() const { return m_EnableGpuProfiling; }
IsFastMathEnabled() const35     bool IsFastMathEnabled() const { return m_FastMathEnabled; }
GetFp16Enabled() const36     bool GetFp16Enabled() const { return m_fp16Enabled; }
SetBackends(const std::vector<armnn::BackendId> & backends)37     void SetBackends(const std::vector<armnn::BackendId>& backends) { m_Backends = backends; }
ShouldExit() const38     bool ShouldExit() const { return m_ShouldExit; }
GetExitCode() const39     int GetExitCode() const { return m_ExitCode; }
GetCachedNetworkFilePath() const40     const std::string& GetCachedNetworkFilePath() const { return m_CachedNetworkFilePath; }
SaveCachedNetwork() const41     bool SaveCachedNetwork() const { return m_SaveCachedNetwork; }
GetNumberOfThreads() const42     unsigned int GetNumberOfThreads() const { return m_NumberOfThreads; }
isAsyncModelExecutionEnabled() const43     bool isAsyncModelExecutionEnabled() const { return m_EnableAsyncModelExecution; };
getNoOfArmnnThreads() const44     unsigned int getNoOfArmnnThreads() const { return m_ArmnnNumberOfThreads; };
isImportEnabled() const45     bool isImportEnabled() const { return m_EnableImport; };
isExportEnabled() const46     bool isExportEnabled() const { return m_EnableExport; };
47 
48 private:
49     std::vector<armnn::BackendId> m_Backends;
50     bool m_VerboseLogging;
51     std::string m_RequestInputsAndOutputsDumpDir;
52     std::string m_ServiceName;
53     std::set<unsigned int> m_ForcedUnsupportedOperations;
54     std::string m_ClTunedParametersFile;
55     std::string m_ClMLGOTunedParametersFile;
56     armnn::IGpuAccTunedParameters::Mode m_ClTunedParametersMode;
57     armnn::IGpuAccTunedParameters::TuningLevel m_ClTuningLevel;
58     bool m_EnableGpuProfiling;
59     bool m_fp16Enabled;
60     bool m_FastMathEnabled;
61     bool m_ShouldExit;
62     int m_ExitCode;
63     std::string m_CachedNetworkFilePath;
64     bool m_SaveCachedNetwork;
65     unsigned int m_NumberOfThreads;
66     bool m_EnableAsyncModelExecution;
67     unsigned int m_ArmnnNumberOfThreads;
68     bool m_EnableImport;
69     bool m_EnableExport;
70 };
71 
72 } // namespace armnn_driver
73