Lines Matching refs:controller

981 int ExecutionPlan::fallback(std::shared_ptr<Controller> controller,  in fallback()  argument
985 VLOG(EXECUTION) << "ExecutionPlan::fallback(" << SHOW_IF_DEBUG(controller << ", " << executor) in fallback()
986 << "): mFallbackNextStepIndex = " << controller->mFallbackNextStepIndex; in fallback()
988 if (controller->mFallbackNextStepIndex == Controller::kBadStepIndex) { in fallback()
993 if (controller->mNextStepIndex == Controller::kBadStepIndex) { in fallback()
998 controller->mNextStepIndex = controller->mFallbackNextStepIndex; in fallback()
999 return next(controller, executor); in fallback()
1048 std::shared_ptr<Controller> controller, SourceOperandIndex operandIndex) const { in getBuffer() argument
1049 const auto& sourceOperandToOffsetOfTemporary = controller->mSourceOperandToOffsetOfTemporary; in getBuffer()
1050 const auto& sourceOperandToInputIndex = controller->mSourceOperandToInputIndex; in getBuffer()
1051 const auto& sourceOperandToOutputIndex = controller->mSourceOperandToOutputIndex; in getBuffer()
1052 const auto& sourceOperandToConstantReference = controller->mSourceOperandToConstantReference; in getBuffer()
1056 const std::unique_ptr<MemoryAshmem>& memory = controller->mTemporaries; in getBuffer()
1060 const ModelArgumentInfo& info = controller->mExecutionBuilder->getInputInfo(it->second); in getBuffer()
1061 return getBufferFromModelArgumentInfo(info, controller->mExecutionBuilder); in getBuffer()
1064 const ModelArgumentInfo& info = controller->mExecutionBuilder->getOutputInfo(it->second); in getBuffer()
1065 return getBufferFromModelArgumentInfo(info, controller->mExecutionBuilder); in getBuffer()
1078 int ExecutionPlan::readConditionValue(std::shared_ptr<Controller> controller, in readConditionValue() argument
1080 std::optional<ExecutionPlan::Buffer> buffer = getBuffer(controller, operandIndex); in readConditionValue()
1092 int ExecutionPlan::next(std::shared_ptr<Controller> controller, in next() argument
1096 controller->mLastStepSyncFd = syncFdOfLastStep; in next()
1102 VLOG(EXECUTION) << "ExecutionPlan::next(" << SHOW_IF_DEBUG(controller << ", " << executor) in next()
1103 << "): mNextStepIndex = " << controller->mNextStepIndex; in next()
1105 if (controller->mNextStepIndex == Controller::kBadStepIndex) { in next()
1110 CHECK_EQ(controller->mNextStepIndex, 0u); // end in next()
1111 controller->mNextStepIndex = Controller::kBadStepIndex; in next()
1116 if (controller->mNextStepIndex == 0) { in next()
1119 *executor = std::make_shared<StepExecutor>(controller->mExecutionBuilder, in next()
1123 if (burstController != nullptr && controller->mBurstBuilder != nullptr) { in next()
1124 *burstController = controller->mBurstBuilder->getControllerAt(0); in next()
1126 controller->mFallbackNextStepIndex = 0; in next()
1127 controller->mNextStepIndex = 1; in next()
1131 CHECK_EQ(controller->mNextStepIndex, 1u); // end in next()
1132 controller->mNextStepIndex = Controller::kBadStepIndex; in next()
1136 return nextCompound(controller, executor, burstController); in next()
1139 int ExecutionPlan::nextCompound(std::shared_ptr<Controller> controller, in nextCompound() argument
1142 if (controller->mNextStepIndex == Controller::kBadStepIndex) { in nextCompound()
1147 if (controller->mNextStepIndex == compoundBody->mSteps.size()) { in nextCompound()
1148 controller->mNextStepIndex = Controller::kBadStepIndex; // end in nextCompound()
1152 const auto& logicalStep = compoundBody->mSteps[controller->mNextStepIndex]; in nextCompound()
1154 return nextCompound(step, controller, executor, burstController); in nextCompound()
1156 return nextCompound(step, controller, executor, burstController); in nextCompound()
1158 return nextCompound(step, controller, executor, burstController); in nextCompound()
1160 return nextCompound(step, controller, executor, burstController); in nextCompound()
1167 int ExecutionPlan::nextCompound(const ExecutionStep* step, std::shared_ptr<Controller> controller, in nextCompound() argument
1170 VLOG(EXECUTION) << "next: Step#" << controller->mNextStepIndex << ": execute on " in nextCompound()
1173 std::make_shared<StepExecutor>(controller->mExecutionBuilder, step->getStepModel(), in nextCompound()
1176 *executor, controller->mTemporaries.get(), in nextCompound()
1177 controller->mSourceOperandToOffsetOfTemporary, controller->mSourceOperandToInputIndex, in nextCompound()
1178 controller->mSourceOperandToOutputIndex, controller->mSourceOperandToConstantReference); in nextCompound()
1179 if (burstController != nullptr && controller->mBurstBuilder != nullptr) { in nextCompound()
1180 *burstController = controller->mBurstBuilder->getControllerAt(controller->mNextStepIndex); in nextCompound()
1183 controller->mFallbackNextStepIndex = controller->mNextStepIndex; in nextCompound()
1184 controller->mNextStepIndex++; in nextCompound()
1260 int ExecutionPlan::nextCompound(const IfStep* step, std::shared_ptr<Controller> controller, in nextCompound() argument
1266 NN_RETURN_IF_ERROR(controller->waitForLastStepSyncFence()); in nextCompound()
1268 NN_RETURN_IF_ERROR(readConditionValue(controller, step->conditionOperandIndex, &condValue)); in nextCompound()
1269 controller->mNextStepIndex = condValue ? step->thenStepIndex : step->elseStepIndex; in nextCompound()
1285 controller->setInput(step->outerInputOperands[i], branchInputOperands[i]); in nextCompound()
1294 controller->setOutput(step->outerOutputOperands[i], branchOutputOperands[i]); in nextCompound()
1296 return nextCompound(controller, executor, burstController); in nextCompound()
1299 int ExecutionPlan::nextCompound(const WhileStep* step, std::shared_ptr<Controller> controller, in nextCompound() argument
1302 WhileState& state = controller->mWhileState[controller->mNextStepIndex]; in nextCompound()
1307 controller->mNextStepIndex = step->condStepIndex; in nextCompound()
1322 controller->setInput((state.iteration == 0 || operandIsInputOnly) in nextCompound()
1329 return nextCompound(controller, executor, burstController); in nextCompound()
1334 controller->mExecutionBuilder->getLoopTimeoutDuration()); in nextCompound()
1345 NN_RETURN_IF_ERROR(controller->waitForLastStepSyncFence()); in nextCompound()
1347 NN_RETURN_IF_ERROR(readConditionValue(controller, step->condOutputOperand, &condValue)); in nextCompound()
1351 controller->mNextStepIndex = step->bodyStepIndex; in nextCompound()
1364 controller->setInput(step->condInputOperands[i], step->bodyInputOperands[i]); in nextCompound()
1369 CHECK_EQ(controller->mSourceOperandToInputIndex.count(outputOperand), 0u); in nextCompound()
1370 CHECK_EQ(controller->mSourceOperandToOutputIndex.count(outputOperand), 0u); in nextCompound()
1371 CHECK_EQ(controller->mSourceOperandToOffsetOfTemporary.count(outputOperand), 1u); in nextCompound()
1372 CHECK_EQ(controller->mSourceOperandToOffsetOfTemporary2.count(outputOperand), 1u); in nextCompound()
1374 std::swap(controller->mSourceOperandToOffsetOfTemporary[outputOperand], in nextCompound()
1375 controller->mSourceOperandToOffsetOfTemporary2[outputOperand]); in nextCompound()
1381 controller->mNextStepIndex = step->exitStepIndex; in nextCompound()
1392 std::optional<Buffer> outerBuffer = getBuffer(controller, outerOperand); in nextCompound()
1399 controller->mExecutionBuilder->getSourceOperand(outerOperand); in nextCompound()
1402 std::optional<Buffer> innerBuffer = getBuffer(controller, innerOperand); in nextCompound()
1417 return nextCompound(controller, executor, burstController); in nextCompound()
1420 int ExecutionPlan::nextCompound(const GotoStep* step, std::shared_ptr<Controller> controller, in nextCompound() argument
1424 controller->mNextStepIndex = step->gotoStepIndex; in nextCompound()
1425 return nextCompound(controller, executor, burstController); in nextCompound()