summaryrefslogtreecommitdiff
path: root/nn
diff options
context:
space:
mode:
authorSlava Shklyaev <slavash@google.com>2020-05-13 11:13:13 +0100
committerSlava Shklyaev <slavash@google.com>2020-05-13 12:09:24 +0000
commit5529caefe11203d99de92a718b830ea6d8ae39fb (patch)
treed82051f48d87bafbc2768f888eddca765870dd48 /nn
parent6a8e397336cb494c488951183cc2d591deb8fe13 (diff)
downloadml-5529caefe11203d99de92a718b830ea6d8ae39fb.tar.gz
Avoid compiling ExecutionPlan::SimpleBody multiple times
Bug: 153143917 Test: NNT_static 256 --gtest_filter=TrivialTest.AddTwoWithHardwareBufferInput Change-Id: I4c851cbae28a3bba48e5bbc842b1d880b555a8ed
Diffstat (limited to 'nn')
-rw-r--r--nn/runtime/ExecutionPlan.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/nn/runtime/ExecutionPlan.cpp b/nn/runtime/ExecutionPlan.cpp
index 0557f95d4..508b00611 100644
--- a/nn/runtime/ExecutionPlan.cpp
+++ b/nn/runtime/ExecutionPlan.cpp
@@ -607,6 +607,7 @@ void LogicalStep::dump() const {
int ExecutionPlan::CompoundBody::finish(const SourceModels* sourceModels,
int32_t executionPreference, int32_t priority,
const std::optional<Deadline>& deadline) {
+ CHECK(!mSuccessfulFinish);
CHECK(!deadline.has_value());
const ModelBuilder* mainModel = sourceModels->getModel(kMainModelInSourceModels);
@@ -700,6 +701,7 @@ void ExecutionPlan::CompoundBody::findControlFlowBoundaryConstants(
int ExecutionPlan::SimpleBody::finish(const SourceModels*, int32_t executionPreference,
int32_t priority, const std::optional<Deadline>& deadline) {
+ CHECK(!mSuccessfulFinish);
CHECK(mDevice != nullptr);
VLOG(COMPILATION) << "ExecutionPlan::SimpleBody::finish, compilation";
const int n = compile(*mDevice, *mModel, executionPreference, priority, deadline, *mCacheDir,
@@ -1637,7 +1639,7 @@ int ModelBuilder::partitionTheWorkInternal(uint32_t sourceModelIndex,
VLOG(COMPILATION) << "ModelBuilder::partitionTheWork: only one best device: "
<< bestDeviceIndex << " = " << devices[bestDeviceIndex]->getName();
plan->becomeSingleStep(devices[bestDeviceIndex], this);
- return plan->finish(preference, priority, deadline);
+ return ANEURALNETWORKS_NO_ERROR;
}
}