14 #include <BufferTracker.h>
15 #include <CpuExecutor.h>
16 #include <nnapi/IExecution.h>
17 #include <nnapi/IPreparedModel.h>
18 #include <nnapi/Result.h>
19 #include <nnapi/Types.h>
32 ::android::nn::MeasureTiming::NO;
39 public std::enable_shared_from_this<ArmnnPreparedModel>
45 const std::string& requestInputsAndOutputsDumpDir,
46 const bool gpuProfilingEnabled,
47 Priority priority = Priority::MEDIUM);
51 const std::string& requestInputsAndOutputsDumpDir,
52 const bool gpuProfilingEnabled,
53 Priority priority = Priority::MEDIUM,
54 const bool prepareModelFromCache =
false);
58 ExecutionResult<std::pair<std::vector<OutputShape>, Timing>>
execute(
59 const Request& request,
60 MeasureTiming measureTiming,
61 const OptionalTimePoint& deadline,
62 const OptionalDuration& loopTimeoutDuration,
63 const std::vector<android::nn::TokenValuePair>& hints,
64 const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix)
const override;
66 GeneralResult<std::pair<SyncFence, ExecuteFencedInfoCallback>>
executeFenced(
67 const Request& request,
68 const std::vector<SyncFence>& waitFor,
69 MeasureTiming measureTiming,
70 const OptionalTimePoint& deadline,
71 const OptionalDuration& loopTimeoutDuration,
72 const OptionalDuration& timeoutDurationAfterFence,
73 const std::vector<android::nn::TokenValuePair>& hints,
74 const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix)
const override;
77 const Request& request,
78 MeasureTiming measureTiming,
79 const OptionalDuration& loopTimeoutDuration,
80 const std::vector<android::nn::TokenValuePair>& hints,
81 const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix)
const override;
89 std::shared_ptr<std::vector<android::nn::RunTimePoolInfo>>& pMemPools,
93 const bool pointerMemory =
false)
const;
105 const Request& request,
106 const std::vector<android::nn::RunTimePoolInfo>& memPools)
const;
110 std::vector<OutputShape> &outputShapes,
111 const Request& request,
112 const std::vector<android::nn::RunTimePoolInfo>& memPools)
const;
116 std::vector<android::nn::RunTimePoolInfo>& memPools,
117 const Request& request,
118 const bool pointerMemory =
false)
const;
120 template <
typename TensorBindingCollection>
121 void DumpTensorsIfRequired(
char const* tensorNamePrefix,
const TensorBindingCollection& tensorBindings)
const;
128 const std::string& m_RequestInputsAndOutputsDumpDir;
129 const bool m_GpuProfilingEnabled;
130 Priority m_ModelPriority;
131 const bool m_PrepareFromCache;