From 5529caefe11203d99de92a718b830ea6d8ae39fb Mon Sep 17 00:00:00 2001 From: Slava Shklyaev Date: Wed, 13 May 2020 11:13:13 +0100 Subject: Avoid compiling ExecutionPlan::SimpleBody multiple times Bug: 153143917 Test: NNT_static 256 --gtest_filter=TrivialTest.AddTwoWithHardwareBufferInput Change-Id: I4c851cbae28a3bba48e5bbc842b1d880b555a8ed --- nn/runtime/ExecutionPlan.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nn') 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) { + 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) { + 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; } } -- cgit v1.2.3