ArmNN
 24.02
ArmnnDriverImpl.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include "DriverOptions.hpp"
9 
10 #include <armnn/ArmNN.hpp>
11 
12 #include <nnapi/IPreparedModel.h>
13 #include <nnapi/Result.h>
14 #include <nnapi/TypeUtils.h>
15 #include <nnapi/Types.h>
16 #include <nnapi/Validation.h>
17 
18 using namespace android::nn;
19 
20 namespace armnn_driver
21 {
22 
24 {
25 public:
26  static GeneralResult<SharedPreparedModel> PrepareArmnnModel(
27  const armnn::IRuntimePtr& runtime,
28  const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
29  const DriverOptions& options,
30  const Model& model,
31  const std::vector<SharedHandle>& modelCacheHandle,
32  const std::vector<SharedHandle>& dataCacheHandle,
33  const CacheToken& token,
34  bool float32ToFloat16 = false,
35  Priority priority = Priority::MEDIUM);
36 
37  static GeneralResult<SharedPreparedModel> PrepareArmnnModelFromCache(
38  const armnn::IRuntimePtr& runtime,
39  const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
40  const DriverOptions& options,
41  const std::vector<SharedHandle>& modelCacheHandle,
42  const std::vector<SharedHandle>& dataCacheHandle,
43  const CacheToken& token,
44  bool float32ToFloat16 = false);
45 
46  static const Capabilities& GetCapabilities(const armnn::IRuntimePtr& runtime);
47 
48 private:
49  static bool ValidateSharedHandle(const SharedHandle& sharedHandle);
50  static bool ValidateDataCacheHandle(const std::vector<SharedHandle>& dataCacheHandle, const size_t dataSize);
51 };
52 
53 } // namespace armnn_driver
armnn_driver::ArmnnDriverImpl
Definition: ArmnnDriverImpl.hpp:23
armnn_driver
Helper classes.
Definition: ArmnnDevice.cpp:37
armnn::IRuntimePtr
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:41
armnn_driver::Model
::android::nn::Model Model
Helper classes.
Definition: ConversionUtils.hpp:45
armnn_driver::DriverOptions
Definition: DriverOptions.hpp:17
android::nn
Definition: support_library_service.cpp:10
ArmNN.hpp
armnn::IGpuAccTunedParametersPtr
std::shared_ptr< IGpuAccTunedParameters > IGpuAccTunedParametersPtr
The following API is replaced by the backend options API.
Definition: IRuntime.hpp:300
DriverOptions.hpp