Lines Matching refs:step
220 void addRole(const ExecutionStep& step, uint32_t operandIndex, IOType type, in addRole() argument
222 SourceOperandIndex source = {step.getSourceModelIndex(), operandIndex}; in addRole()
223 mRoles[source].emplace(step.getIndex(), type, stepIOIndex); in addRole()
632 if (const ExecutionStep* step = logicalStep->tryExecutionStep()) { in findModelOutputsThatAreDownstreamInputs() local
633 for (const auto& output : step->getOutputsAsStepModelInputs()) { in findModelOutputsThatAreDownstreamInputs()
634 SourceOperandIndex sourceOperandIndex(step->getSourceModelIndex(), output.first); in findModelOutputsThatAreDownstreamInputs()
655 if (const ExecutionStep* step = logicalStep->tryExecutionStep()) { in findTempsAsStepModelOutputs() local
656 for (const auto& input : step->getTempsAsStepModelInputs()) { in findTempsAsStepModelOutputs()
657 SourceOperandIndex sourceOperandIndex(step->getSourceModelIndex(), input.first); in findTempsAsStepModelOutputs()
660 } else if (const IfStep* step = logicalStep->tryIfStep()) { in findTempsAsStepModelOutputs() local
661 recordAsOutputIfTemporary(step->conditionOperandIndex); in findTempsAsStepModelOutputs()
662 for (const SourceOperandIndex& sourceOperandIndex : step->outerInputOperands) { in findTempsAsStepModelOutputs()
665 } else if (const WhileStep* step = logicalStep->tryWhileStep()) { in findTempsAsStepModelOutputs() local
666 for (const SourceOperandIndex& sourceOperandIndex : step->outerInputOperands) { in findTempsAsStepModelOutputs()
846 std::ostream& operator<<(std::ostream& os, const IfStep& step) { in operator <<() argument
847 return os << "Step#" << step.index << ": if " << toString(step.conditionOperandIndex) in operator <<()
848 << " then=" << step.thenStepIndex << " else=" << step.elseStepIndex; in operator <<()
851 std::ostream& operator<<(std::ostream& os, const WhileStep& step) { in operator <<() argument
852 return os << "Step#" << step.index << ": while cond=" << step.condStepIndex in operator <<()
853 << " body=" << step.bodyStepIndex << " exit=" << step.exitStepIndex; in operator <<()
856 std::ostream& operator<<(std::ostream& os, const GotoStep& step) { in operator <<() argument
857 return os << "Step#" << step.index << ": goto " << step.gotoStepIndex; in operator <<()
862 if (const IfStep* step = tryIfStep()) { in dump() local
863 VLOG(COMPILATION) << *step; in dump()
864 } else if (const WhileStep* step = tryWhileStep()) { in dump() local
865 VLOG(COMPILATION) << *step; in dump()
866 } else if (const GotoStep* step = tryGotoStep()) { in dump() local
867 VLOG(COMPILATION) << *step; in dump()
895 if (ExecutionStep* step = logicalStep->tryExecutionStep()) { in finish() local
897 int n = step->finishStepModel(mainModel, &stepHasDynamicTemporaries, in finish()
901 if (step->getDevice()->getFeatureLevel() < kHalVersionV1_2ToApi.featureLevel) { in finish()
908 << "ExecutionPlan::CompoundBody::finish -- step#" << step->getIndex() in finish()
910 << step->getDevice()->getName(); in finish()
921 } else if (IfStep* step = logicalStep->tryIfStep()) { in finish() local
923 CHECK(!containsUnknownSize(step->outerInputOperands)); in finish()
924 CHECK(!containsUnknownSize(step->outerOutputOperands)); in finish()
926 CHECK(!containsUnknownSize(step->thenBranchInputOperands)); in finish()
927 CHECK(!containsUnknownSize(step->thenBranchOutputOperands)); in finish()
928 CHECK(!containsUnknownSize(step->elseBranchInputOperands)); in finish()
929 CHECK(!containsUnknownSize(step->elseBranchOutputOperands)); in finish()
930 } else if (WhileStep* step = logicalStep->tryWhileStep()) { in finish() local
932 CHECK(!containsUnknownSize(step->outerInputOperands)); in finish()
933 CHECK(!containsUnknownSize(step->outerOutputOperands)); in finish()
934 CHECK(!containsUnknownSize(step->condInputOperands)); in finish()
936 CHECK(!containsUnknownSize(step->bodyInputOperands)); in finish()
937 CHECK(!containsUnknownSize(step->bodyOutputOperands)); in finish()
992 if (const IfStep* step = logicalStep->tryIfStep()) { in findControlFlowBoundaryConstants() local
993 handleBoundaryConstants(step->conditionOperandIndex); in findControlFlowBoundaryConstants()
994 for (const auto& sourceOperandIndex : step->outerInputOperands) { in findControlFlowBoundaryConstants()
997 } else if (const WhileStep* step = logicalStep->tryWhileStep()) { in findControlFlowBoundaryConstants() local
998 for (const auto& sourceOperandIndex : step->outerInputOperands) { in findControlFlowBoundaryConstants()
1008 if (const ExecutionStep* step = logicalStep->tryExecutionStep()) { in findMemoryStepRoles() local
1009 const auto& stepModelInputs = step->getStepModelInputs(); in findMemoryStepRoles()
1012 analyzer.addRole(*step, sourceIndex, IOType::INPUT, i); in findMemoryStepRoles()
1014 const auto& stepModelOutputs = step->getStepModelOutputs(); in findMemoryStepRoles()
1017 analyzer.addRole(*step, sourceIndex, IOType::OUTPUT, i); in findMemoryStepRoles()
1019 } else if (const IfStep* step = logicalStep->tryIfStep()) { in findMemoryStepRoles() local
1024 CHECK_EQ(step->thenBranchInputOperands.size(), step->outerInputOperands.size()); in findMemoryStepRoles()
1025 CHECK_EQ(step->elseBranchInputOperands.size(), step->outerInputOperands.size()); in findMemoryStepRoles()
1026 for (uint32_t i = 0; i < step->outerInputOperands.size(); i++) { in findMemoryStepRoles()
1027 analyzer.setUsedBy(step->outerInputOperands[i], in findMemoryStepRoles()
1028 step->thenBranchInputOperands[i]); in findMemoryStepRoles()
1029 analyzer.setUsedBy(step->outerInputOperands[i], in findMemoryStepRoles()
1030 step->elseBranchInputOperands[i]); in findMemoryStepRoles()
1034 CHECK_EQ(step->thenBranchOutputOperands.size(), step->outerOutputOperands.size()); in findMemoryStepRoles()
1035 CHECK_EQ(step->elseBranchOutputOperands.size(), step->outerOutputOperands.size()); in findMemoryStepRoles()
1036 for (uint32_t i = 0; i < step->outerOutputOperands.size(); i++) { in findMemoryStepRoles()
1037 analyzer.setUsedBy(step->outerOutputOperands[i], in findMemoryStepRoles()
1038 step->thenBranchOutputOperands[i]); in findMemoryStepRoles()
1039 analyzer.setUsedBy(step->outerOutputOperands[i], in findMemoryStepRoles()
1040 step->elseBranchOutputOperands[i]); in findMemoryStepRoles()
1042 } else if (const WhileStep* step = logicalStep->tryWhileStep()) { in findMemoryStepRoles() local
1067 CHECK_EQ(step->condInputOperands.size(), step->outerInputOperands.size()); in findMemoryStepRoles()
1068 for (uint32_t i = 0; i < step->outerInputOperands.size(); i++) { in findMemoryStepRoles()
1069 analyzer.setUsedBy(step->outerInputOperands[i], step->condInputOperands[i]); in findMemoryStepRoles()
1074 CHECK_GE(step->condInputOperands.size(), step->bodyOutputOperands.size()); in findMemoryStepRoles()
1075 for (uint32_t i = 0; i < step->bodyOutputOperands.size(); i++) { in findMemoryStepRoles()
1076 analyzer.setUsedBy(step->bodyOutputOperands[i], step->condInputOperands[i]); in findMemoryStepRoles()
1080 CHECK_EQ(step->bodyInputOperands.size(), step->condInputOperands.size()); in findMemoryStepRoles()
1081 for (uint32_t i = 0; i < step->bodyInputOperands.size(); i++) { in findMemoryStepRoles()
1082 analyzer.setUsedBy(step->condInputOperands[i], step->bodyInputOperands[i]); in findMemoryStepRoles()
1278 if (const ExecutionStep* step = logicalStep->tryExecutionStep()) { in makeController() local
1293 for (const auto& output : step->getTempsAsStepModelOutputs()) { in makeController()
1294 mapTemporary(SourceOperandIndex(step->getSourceModelIndex(), output.first), in makeController()
1297 } else if (const IfStep* step = logicalStep->tryIfStep()) { in makeController() local
1316 for (const auto& sourceOperandIndex : step->outerOutputOperands) { in makeController()
1319 } else if (const WhileStep* step = logicalStep->tryWhileStep()) { in makeController() local
1333 for (const auto& sourceOperandIndex : step->outerOutputOperands) { in makeController()
1339 for (const auto& sourceOperandIndex : step->bodyOutputOperands) { in makeController()
1348 mapTemporary(step->condOutputOperand, &sourceOperandToLocationOfTemporary, in makeController()
1543 if (const IfStep* step = logicalStep->tryIfStep()) { in nextCompound() local
1544 return nextCompound(step, controller, executor, burstController, mainModelOutputShapes); in nextCompound()
1545 } else if (const WhileStep* step = logicalStep->tryWhileStep()) { in nextCompound() local
1546 return nextCompound(step, controller, executor, burstController, mainModelOutputShapes); in nextCompound()
1547 } else if (const GotoStep* step = logicalStep->tryGotoStep()) { in nextCompound() local
1548 return nextCompound(step, controller, executor, burstController, mainModelOutputShapes); in nextCompound()
1549 } else if (const ExecutionStep* step = logicalStep->tryExecutionStep()) { in nextCompound() local
1550 return nextCompound(step, controller, executor, burstController, mainModelOutputShapes); in nextCompound()
1557 int ExecutionPlan::nextCompound(const ExecutionStep* step, std::shared_ptr<Controller> controller, in nextCompound() argument
1562 << step->getDevice()->getName(); in nextCompound()
1564 NN_RETURN_IF_ERROR(controller->mDynamicTemporaries.allocate(step->getIndex())); in nextCompound()
1567 *executor = std::make_shared<StepExecutor>(controller->mExecutionBuilder, step->getStepModel(), in nextCompound()
1568 step->getDevice(), step->getPreparedStepModel(), in nextCompound()
1569 /*reusable=*/false, step, in nextCompound()
1572 step->mapInputsAndOutputs( in nextCompound()
1661 int ExecutionPlan::nextCompound(const IfStep* step, std::shared_ptr<Controller> controller, in nextCompound() argument
1665 VLOG(EXECUTION) << "next: " << *step; in nextCompound()
1670 NN_RETURN_IF_ERROR(readConditionValue(controller, step->conditionOperandIndex, &condValue)); in nextCompound()
1671 controller->mNextStepIndex = condValue ? step->thenStepIndex : step->elseStepIndex; in nextCompound()
1673 condValue ? step->thenBranchInputOperands : step->elseBranchInputOperands; in nextCompound()
1675 condValue ? step->thenBranchOutputOperands : step->elseBranchOutputOperands; in nextCompound()
1676 CHECK_EQ(branchInputOperands.size(), step->outerInputOperands.size()); in nextCompound()
1677 CHECK_EQ(branchOutputOperands.size(), step->outerOutputOperands.size()); in nextCompound()
1678 for (uint32_t i = 0, n = step->outerInputOperands.size(); i < n; ++i) { in nextCompound()
1687 controller->setInput(step->outerInputOperands[i], branchInputOperands[i]); in nextCompound()
1689 for (uint32_t i = 0, n = step->outerOutputOperands.size(); i < n; ++i) { in nextCompound()
1696 controller->setOutput(step->outerOutputOperands[i], branchOutputOperands[i]); in nextCompound()
1704 int ExecutionPlan::nextCompound(const WhileStep* step, std::shared_ptr<Controller> controller, in nextCompound() argument
1711 VLOG(EXECUTION) << "next: " << *step << ": iteration " << state.iteration in nextCompound()
1713 controller->mNextStepIndex = step->condStepIndex; in nextCompound()
1723 uint32_t loopBodyOutputCount = step->bodyOutputOperands.size(); in nextCompound()
1724 CHECK_EQ(step->condInputOperands.size(), step->outerInputOperands.size()); in nextCompound()
1725 CHECK_GE(step->condInputOperands.size(), loopBodyOutputCount); in nextCompound()
1726 for (uint32_t i = 0, n = step->condInputOperands.size(); i < n; ++i) { in nextCompound()
1729 ? step->outerInputOperands[i] in nextCompound()
1730 : step->bodyOutputOperands[i], in nextCompound()
1731 step->condInputOperands[i]); in nextCompound()
1753 NN_RETURN_IF_ERROR(readConditionValue(controller, step->condOutputOperand, &condValue)); in nextCompound()
1755 VLOG(EXECUTION) << "next: " << *step << ": iteration " << state.iteration in nextCompound()
1757 controller->mNextStepIndex = step->bodyStepIndex; in nextCompound()
1764 CHECK_GE(step->bodyInputOperands.size(), step->bodyOutputOperands.size()); in nextCompound()
1765 CHECK_EQ(step->bodyInputOperands.size(), step->outerInputOperands.size()); in nextCompound()
1766 CHECK_EQ(step->bodyInputOperands.size(), step->condInputOperands.size()); in nextCompound()
1767 CHECK_GE(step->bodyOutputOperands.size(), step->outerOutputOperands.size()); in nextCompound()
1769 for (uint32_t i = 0, n = step->bodyInputOperands.size(); i < n; ++i) { in nextCompound()
1770 controller->setInput(step->condInputOperands[i], step->bodyInputOperands[i]); in nextCompound()
1773 for (const SourceOperandIndex& outputOperand : step->bodyOutputOperands) { in nextCompound()
1785 VLOG(EXECUTION) << "next: " << *step << ": iteration " << state.iteration in nextCompound()
1787 controller->mNextStepIndex = step->exitStepIndex; in nextCompound()
1791 CHECK_LE(step->outerOutputOperands.size(), step->bodyOutputOperands.size()); in nextCompound()
1792 for (uint32_t i = 0, n = step->outerOutputOperands.size(); i < n; ++i) { in nextCompound()
1796 const SourceOperandIndex& innerOperand = step->condInputOperands[i]; in nextCompound()
1797 const SourceOperandIndex& outerOperand = step->outerOutputOperands[i]; in nextCompound()
1826 int ExecutionPlan::nextCompound(const GotoStep* step, std::shared_ptr<Controller> controller, in nextCompound() argument
1830 VLOG(EXECUTION) << "next: " << *step; in nextCompound()
1831 controller->mNextStepIndex = step->gotoStepIndex; in nextCompound()
1856 auto step = std::make_shared<LogicalStep>(std::in_place_type<ExecutionStep>, this, in createNewExecutionStep() local
1858 compound()->mSteps.push_back(step); in createNewExecutionStep()
1859 return step->executionStep(); in createNewExecutionStep()
1864 auto step = std::make_shared<LogicalStep>(std::in_place_type<IfStep>); in createNewIfStep() local
1865 step->ifStep()->index = compound()->mSteps.size(); in createNewIfStep()
1866 compound()->mSteps.push_back(step); in createNewIfStep()
1867 return step->ifStep(); in createNewIfStep()
1872 auto step = std::make_shared<LogicalStep>(std::in_place_type<WhileStep>); in createNewWhileStep() local
1873 step->whileStep()->index = compound()->mSteps.size(); in createNewWhileStep()
1874 compound()->mSteps.push_back(step); in createNewWhileStep()
1875 return step->whileStep(); in createNewWhileStep()
1880 auto step = std::make_shared<LogicalStep>(std::in_place_type<GotoStep>); in createNewGotoStep() local
1881 step->gotoStep()->index = compound()->mSteps.size(); in createNewGotoStep()
1882 compound()->mSteps.push_back(step); in createNewGotoStep()
1883 return step->gotoStep(); in createNewGotoStep()
1970 const ExecutionStep* step = logicalStep->tryExecutionStep(); in hasStepModelWithNoInputsOrNoOutputs() local
1971 return step != nullptr && step->hasNoInputsOrNoOutputs(); in hasStepModelWithNoInputsOrNoOutputs()
1984 for (const auto& step : mSteps) { in dump() local
1985 step->dump(); in dump()
2033 const auto* step = mSteps[stepIndex]->executionStep(); in forEachStepRoleOfSourceOperand() local
2034 callback(step->getPreparedStepModel().get(), type, ioIndex); in forEachStepRoleOfSourceOperand()
2069 if (const ExecutionStep* step = logicalStep->tryExecutionStep()) { in forEachDynamicTemporary() local
2070 const uint32_t stepIndex = step->getIndex(); in forEachDynamicTemporary()
2071 const uint32_t sourceModelIndex = step->getSourceModelIndex(); in forEachDynamicTemporary()
2072 for (const auto& entry : step->getTempsAsStepModelOutputs()) { in forEachDynamicTemporary()
2202 ExecutionStep* step = in partitionTheWorkInternal() local
2207 int n = step->addOperation(operationIndex); in partitionTheWorkInternal()