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>
46 const std::string& requestInputsAndOutputsDumpDir,
47 const bool gpuProfilingEnabled,
48 Priority priority = Priority::MEDIUM);
53 const std::string& requestInputsAndOutputsDumpDir,
54 const bool gpuProfilingEnabled,
55 Priority priority = Priority::MEDIUM,
56 const bool prepareModelFromCache =
false);
60 ExecutionResult<std::pair<std::vector<OutputShape>, Timing>>
execute(
61 const Request& request,
62 MeasureTiming measureTiming,
63 const OptionalTimePoint& deadline,
64 const OptionalDuration& loopTimeoutDuration,
65 const std::vector<android::nn::TokenValuePair>& hints,
66 const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix)
const override;
68 GeneralResult<std::pair<SyncFence, ExecuteFencedInfoCallback>>
executeFenced(
69 const Request& request,
70 const std::vector<SyncFence>& waitFor,
71 MeasureTiming measureTiming,
72 const OptionalTimePoint& deadline,
73 const OptionalDuration& loopTimeoutDuration,
74 const OptionalDuration& timeoutDurationAfterFence,
75 const std::vector<android::nn::TokenValuePair>& hints,
76 const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix)
const override;
79 const Request& request,
80 MeasureTiming measureTiming,
81 const OptionalDuration& loopTimeoutDuration,
82 const std::vector<android::nn::TokenValuePair>& hints,
83 const std::vector<android::nn::ExtensionNameAndPrefix>& extensionNameToPrefix)
const override;
91 std::shared_ptr<std::vector<android::nn::RunTimePoolInfo>>& pMemPools,
95 const bool pointerMemory =
false)
const;
107 const Request& request,
108 const std::vector<android::nn::RunTimePoolInfo>& memPools)
const;
112 std::vector<OutputShape> &outputShapes,
113 const Request& request,
114 const std::vector<android::nn::RunTimePoolInfo>& memPools)
const;
118 std::vector<android::nn::RunTimePoolInfo>& memPools,
119 const Request& request,
120 const bool pointerMemory =
false)
const;
122 template <
typename TensorBindingCollection>
123 void DumpTensorsIfRequired(
char const* tensorNamePrefix,
const TensorBindingCollection& tensorBindings)
const;
130 const std::string& m_RequestInputsAndOutputsDumpDir;
131 const bool m_GpuProfilingEnabled;
132 Priority m_ModelPriority;
133 const bool m_PrepareFromCache;