ArmNN
 24.08
ArmnnDriverImpl.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022, 2024 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  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The Shim and support library will be removed from Arm NN in 24.08", "24.08")
27  static GeneralResult<SharedPreparedModel> PrepareArmnnModel(
28  const armnn::IRuntimePtr& runtime,
29  const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
30  const DriverOptions& options,
31  const Model& model,
32  const std::vector<SharedHandle>& modelCacheHandle,
33  const std::vector<SharedHandle>& dataCacheHandle,
34  const CacheToken& token,
35  bool float32ToFloat16 = false,
36  Priority priority = Priority::MEDIUM);
37 
38  ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The Shim and support library will be removed from Arm NN in 24.08", "24.08")
39  static GeneralResult<SharedPreparedModel> PrepareArmnnModelFromCache(
40  const armnn::IRuntimePtr& runtime,
41  const armnn::IGpuAccTunedParametersPtr& clTunedParameters,
42  const DriverOptions& options,
43  const std::vector<SharedHandle>& modelCacheHandle,
44  const std::vector<SharedHandle>& dataCacheHandle,
45  const CacheToken& token,
46  bool float32ToFloat16 = false);
47 
48  static const Capabilities& GetCapabilities(const armnn::IRuntimePtr& runtime);
49 
50 private:
51  static bool ValidateSharedHandle(const SharedHandle& sharedHandle);
52  static bool ValidateDataCacheHandle(const std::vector<SharedHandle>& dataCacheHandle, const size_t dataSize);
53 };
54 
55 } // 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
ARMNN_DEPRECATED_MSG_REMOVAL_DATE
#define ARMNN_DEPRECATED_MSG_REMOVAL_DATE(message, removed_in_release)
Definition: Deprecated.hpp:44
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:301
DriverOptions.hpp