summaryrefslogtreecommitdiff
path: root/nn/runtime/ExecutionPlan.h
diff options
context:
space:
mode:
authorMichael Butler <butlermichael@google.com>2018-02-15 18:50:07 -0800
committerMichael Butler <butlermichael@google.com>2018-02-23 14:13:17 -0800
commit57167f7ec8bfe682139a9a4d60cd8aa913899441 (patch)
treec64689da8d2cfd3cd976d518dc6cc811496cdd87 /nn/runtime/ExecutionPlan.h
parent8989a28d4678609b602784cfd7b4d8e79e076208 (diff)
downloadml-57167f7ec8bfe682139a9a4d60cd8aa913899441.tar.gz
Simplify lifetime management of ModelBuilder
ExecutionStep fully owns the ModelBuilder it contains, and only provides references to the subModel. This change simplifies the lifetime management to reflect the ownership, removing the unnecessary strong pointer behavior. Additionally, this CL removes the unnecessary virtual destructor in the ModelBuilder class, which was likely an artifact of a previous implementation. Test: mm Test: NeuralNetworksTest Test: VtsHalNeuralnetworksV1_0TargetTest Change-Id: I62571d9a61fd8bbc193586756267ad4ec8888e27
Diffstat (limited to 'nn/runtime/ExecutionPlan.h')
-rw-r--r--nn/runtime/ExecutionPlan.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/nn/runtime/ExecutionPlan.h b/nn/runtime/ExecutionPlan.h
index ae6cd021b..29467575d 100644
--- a/nn/runtime/ExecutionPlan.h
+++ b/nn/runtime/ExecutionPlan.h
@@ -21,6 +21,7 @@
#include "HalInterfaces.h"
#include "Memory.h"
+#include "ModelBuilder.h"
#include "NeuralNetworks.h"
#include "Utils.h"
@@ -34,7 +35,6 @@ class Device;
class ExecutionBuilder;
class ExecutionPlan;
class Memory;
-class ModelBuilder;
class StepExecutor;
class ExecutionStep {
@@ -46,7 +46,6 @@ public:
ExecutionStep(ExecutionPlan* plan,
uint32_t stepIndex,
- std::shared_ptr<ModelBuilder> model,
std::shared_ptr<Device> device);
int addOperation(int operationIndex, const ModelBuilder& fromModel);
int addOperand(uint32_t fromOperandIndex, uint32_t* toOperandIndex,
@@ -83,7 +82,7 @@ public:
// unchanged.
int finishSubModel(const ModelBuilder* fromModel, bool* hasOutputOfUnknownSize);
- std::shared_ptr<ModelBuilder> getSubModel() const { return mSubModel; }
+ const ModelBuilder* getSubModel() const { return &mSubModel; }
std::shared_ptr<Device> getDevice() const { return mDevice; }
// only available after calling finishSubModel()
@@ -103,7 +102,7 @@ private:
ExecutionPlan* mPlan;
uint32_t mIndex; // index of step within plan
- std::shared_ptr<ModelBuilder> mSubModel;
+ ModelBuilder mSubModel;
std::shared_ptr<Device> mDevice; // nullptr signifies CPU
sp<IPreparedModel> mPreparedSubModel; // not used for CPU