#include <ArmnnDriver.hpp>
|
| ArmnnDriver (DriverOptions options) |
|
const std::string & | getName () const override |
|
const std::string & | getVersionString () const override |
|
Version | getFeatureLevel () const override |
|
DeviceType | getType () const override |
|
const std::vector< Extension > & | getSupportedExtensions () const override |
|
const Capabilities & | getCapabilities () const override |
|
std::pair< uint32_t, uint32_t > | getNumberOfCacheFilesNeeded () const override |
|
GeneralResult< void > | wait () const override |
|
GeneralResult< std::vector< bool > > | getSupportedOperations (const Model &model) const override |
|
GeneralResult< SharedPreparedModel > | prepareModel (const Model &model, ExecutionPreference preference, Priority priority, OptionalTimePoint deadline, const std::vector< SharedHandle > &modelCache, const std::vector< SharedHandle > &dataCache, const CacheToken &token, const std::vector< android::nn::TokenValuePair > &hints, const std::vector< android::nn::ExtensionNameAndPrefix > &extensionNameToPrefix) const override |
|
GeneralResult< SharedPreparedModel > | prepareModelFromCache (OptionalTimePoint deadline, const std::vector< SharedHandle > &modelCache, const std::vector< SharedHandle > &dataCache, const CacheToken &token) const override |
|
GeneralResult< SharedBuffer > | allocate (const BufferDesc &, const std::vector< SharedPreparedModel > &, const std::vector< BufferRole > &, const std::vector< BufferRole > &) const override |
|
Definition at line 31 of file ArmnnDriver.hpp.
◆ ArmnnDriver()
Definition at line 36 of file ArmnnDriver.hpp.
40 VLOG(DRIVER) <<
"ArmnnDriver::ArmnnDriver()";
41 m_Device = std::unique_ptr<ArmnnDevice>(
new ArmnnDevice(std::move(options)));
45 VLOG(DRIVER) <<
"ArmnnDevice failed to initialise: " << ex.
what();
49 VLOG(DRIVER) <<
"ArmnnDevice failed to initialise with an unknown error";
References Exception::what().
◆ allocate()
GeneralResult<SharedBuffer> allocate |
( |
const BufferDesc & |
, |
|
|
const std::vector< SharedPreparedModel > & |
, |
|
|
const std::vector< BufferRole > & |
, |
|
|
const std::vector< BufferRole > & |
|
|
) |
| const |
|
inlineoverride |
Definition at line 252 of file ArmnnDriver.hpp.
257 VLOG(DRIVER) <<
"ArmnnDriver::allocate()";
258 return NN_ERROR(ErrorStatus::INVALID_ARGUMENT) <<
"ArmnnDriver::allocate -- does not support allocate.";
◆ getCapabilities()
const Capabilities& getCapabilities |
( |
| ) |
const |
|
inlineoverride |
◆ getFeatureLevel()
Version getFeatureLevel |
( |
| ) |
const |
|
inlineoverride |
Definition at line 69 of file ArmnnDriver.hpp.
71 VLOG(DRIVER) <<
"ArmnnDriver::getFeatureLevel()";
72 return kVersionFeatureLevel6;
◆ getName()
const std::string& getName |
( |
| ) |
const |
|
inlineoverride |
Definition at line 55 of file ArmnnDriver.hpp.
57 VLOG(DRIVER) <<
"ArmnnDriver::getName()";
58 static const std::string name =
"arm-armnn-sl";
◆ getNumberOfCacheFilesNeeded()
std::pair<uint32_t, uint32_t> getNumberOfCacheFilesNeeded |
( |
| ) |
const |
|
inlineoverride |
Definition at line 94 of file ArmnnDriver.hpp.
96 VLOG(DRIVER) <<
"ArmnnDriver::getNumberOfCacheFilesNeeded()";
97 unsigned int numberOfCachedModelFiles = 0;
98 for (
auto& backend : m_Device->m_Options.GetBackends())
101 VLOG(DRIVER) <<
"ArmnnDriver::getNumberOfCacheFilesNeeded() = "
102 << std::to_string(numberOfCachedModelFiles);
104 return std::make_pair(numberOfCachedModelFiles, 1ul);
References armnn::GetNumberOfCacheFiles().
◆ getSupportedExtensions()
const std::vector<Extension>& getSupportedExtensions |
( |
| ) |
const |
|
inlineoverride |
Definition at line 81 of file ArmnnDriver.hpp.
83 VLOG(DRIVER) <<
"ArmnnDriver::getSupportedExtensions()";
84 static const std::vector<Extension> extensions = {};
◆ getSupportedOperations()
GeneralResult<std::vector<bool> > getSupportedOperations |
( |
const Model & |
model | ) |
const |
|
inlineoverride |
Definition at line 113 of file ArmnnDriver.hpp.
115 VLOG(DRIVER) <<
"ArmnnDriver::getSupportedOperations()";
116 if (m_Device.get() ==
nullptr)
118 return NN_ERROR(ErrorStatus::DEVICE_UNAVAILABLE) <<
"Device Unavailable!";
121 std::stringstream ss;
122 ss <<
"ArmnnDriverImpl::getSupportedOperations()";
123 std::string fileName;
124 std::string timestamp;
125 if (!m_Device->m_Options.GetRequestInputsAndOutputsDumpDir().empty())
128 << m_Device->m_Options.GetRequestInputsAndOutputsDumpDir()
131 <<
"_getSupportedOperations.txt";
133 VLOG(DRIVER) << ss.str().c_str();
135 if (!m_Device->m_Options.GetRequestInputsAndOutputsDumpDir().empty())
138 std::ofstream fileStream;
139 fileStream.open(fileName, std::ofstream::out | std::ofstream::trunc);
140 if (fileStream.good())
142 fileStream << timestamp << std::endl;
143 fileStream << timestamp << std::endl;
148 std::vector<bool> result;
149 if (!m_Device->m_Runtime)
151 return NN_ERROR(ErrorStatus::DEVICE_UNAVAILABLE) <<
"Device Unavailable!";
155 if (
const auto result = validate(model); !result.ok())
157 return NN_ERROR(ErrorStatus::INVALID_ARGUMENT) <<
"Invalid Model!";
163 m_Device->m_Options.GetForcedUnsupportedOperations());
168 return NN_ERROR(ErrorStatus::GENERAL_FAILURE) <<
"Conversion Error!";
173 result.reserve(model.main.operations.size());
174 for (uint32_t operationIdx = 0; operationIdx < model.main.operations.size(); ++operationIdx)
176 bool operationSupported = modelConverter.IsOperationSupported(operationIdx);
177 result.push_back(operationSupported);
References ModelToINetworkTransformer::GetConversionResult(), ModelToINetworkTransformer::IsOperationSupported(), armnn_driver::Success, and armnn_driver::UnsupportedFeature.
◆ getType()
DeviceType getType |
( |
| ) |
const |
|
inlineoverride |
Definition at line 75 of file ArmnnDriver.hpp.
77 VLOG(DRIVER) <<
"ArmnnDriver::getType()";
78 return DeviceType::CPU;
◆ getVersionString()
const std::string& getVersionString |
( |
| ) |
const |
|
inlineoverride |
◆ prepareModel()
GeneralResult<SharedPreparedModel> prepareModel |
( |
const Model & |
model, |
|
|
ExecutionPreference |
preference, |
|
|
Priority |
priority, |
|
|
OptionalTimePoint |
deadline, |
|
|
const std::vector< SharedHandle > & |
modelCache, |
|
|
const std::vector< SharedHandle > & |
dataCache, |
|
|
const CacheToken & |
token, |
|
|
const std::vector< android::nn::TokenValuePair > & |
hints, |
|
|
const std::vector< android::nn::ExtensionNameAndPrefix > & |
extensionNameToPrefix |
|
) |
| const |
|
inlineoverride |
Definition at line 183 of file ArmnnDriver.hpp.
193 VLOG(DRIVER) <<
"ArmnnDriver::prepareModel()";
195 if (m_Device.get() ==
nullptr)
197 return NN_ERROR(ErrorStatus::DEVICE_UNAVAILABLE) <<
"Device Unavailable!";
200 if (
const auto result = validate(model); !result.ok()) {
201 return NN_ERROR(ErrorStatus::INVALID_ARGUMENT) <<
"Invalid Model: " << result.error();
203 if (
const auto result = validate(preference); !result.ok()) {
204 return NN_ERROR(ErrorStatus::INVALID_ARGUMENT)
205 <<
"Invalid ExecutionPreference: " << result.error();
207 if (
const auto result = validate(priority); !result.ok()) {
208 return NN_ERROR(ErrorStatus::INVALID_ARGUMENT) <<
"Invalid Priority: " << result.error();
212 if (hasDeadlinePassed(deadline)) {
213 return NN_ERROR(ErrorStatus::MISSED_DEADLINE_PERSISTENT);
217 m_Device->m_ClTunedParameters,
223 model.relaxComputationFloat32toFloat16 && m_Device->m_Options.GetFp16Enabled(),
References ArmnnDriverImpl::PrepareArmnnModel().
◆ prepareModelFromCache()
GeneralResult<SharedPreparedModel> prepareModelFromCache |
( |
OptionalTimePoint |
deadline, |
|
|
const std::vector< SharedHandle > & |
modelCache, |
|
|
const std::vector< SharedHandle > & |
dataCache, |
|
|
const CacheToken & |
token |
|
) |
| const |
|
inlineoverride |
Definition at line 227 of file ArmnnDriver.hpp.
232 VLOG(DRIVER) <<
"ArmnnDriver::prepareModelFromCache()";
233 if (m_Device.get() ==
nullptr)
235 return NN_ERROR(ErrorStatus::DEVICE_UNAVAILABLE) <<
"Device Unavailable!";
238 if (hasDeadlinePassed(deadline)) {
239 return NN_ERROR(ErrorStatus::MISSED_DEADLINE_PERSISTENT);
244 m_Device->m_ClTunedParameters,
249 m_Device->m_Options.GetFp16Enabled());
References ArmnnDriverImpl::PrepareArmnnModelFromCache().
◆ wait()
GeneralResult<void> wait |
( |
| ) |
const |
|
inlineoverride |
Definition at line 107 of file ArmnnDriver.hpp.
109 VLOG(DRIVER) <<
"ArmnnDriver::wait()";
The documentation for this class was generated from the following file: