MCPcopy Create free account
hub / github.com/alibaba/MNN / execute

Method execute

source/core/Pipeline.cpp:1160–1204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1158 }
1159}
1160ErrorCode Pipeline::execute() {
1161 _copyInputs();
1162 auto enterCode = _enterExecute();
1163 if (NO_ERROR != enterCode) {
1164 return enterCode;
1165 }
1166 auto& mBackend = mInfo.first.cache.first;
1167 auto& mBackupBackend = mInfo.first.cache.second;
1168 for (auto& info : mInfo.second) {
1169 if (info.type == Schedule::CONSTANT) {
1170 continue;
1171 }
1172 auto& buffer = info.executeBuffer;
1173 for (int cmdIndex=0; cmdIndex<buffer.command.size(); ++cmdIndex) {
1174 auto& cmd = *buffer.command[cmdIndex];
1175#ifdef MNN_PIPELINE_DEBUG
1176 if (info.op->name() != nullptr) {
1177 std::string groupOfInput = "input group: [";
1178 for (int v=0; v<cmd.workInputs.size(); ++v) {
1179 groupOfInput = groupOfInput + " " + std::to_string(TensorUtils::getDescribe(cmd.workInputs[v])->group) + " ";
1180 }
1181 groupOfInput += "]";
1182 std::string deviceOfInput = "input: [";
1183 for (int v=0; v<cmd.workInputs.size(); ++v) {
1184 deviceOfInput = deviceOfInput + " " + std::to_string(cmd.workInputs[v]->deviceId()) + " ";
1185 }
1186 deviceOfInput += "]";
1187 std::string deviceOfOutput = "output: [";
1188 for (int v=0; v<cmd.workOutputs.size(); ++v) {
1189 deviceOfOutput = deviceOfOutput + " " + std::to_string(cmd.workOutputs[v]->deviceId()) + " ";
1190 }
1191 deviceOfOutput += "]";
1192 MNN_PRINT("Group: %d, %s - %d, type=%s, inputs: %s, devices: %s - %s\n", cmd.group, info.op->name()->c_str(), cmdIndex, EnumNameOpType(cmd.op->type()), groupOfInput.c_str(), deviceOfInput.c_str(), deviceOfOutput.c_str());
1193 }
1194#endif
1195 auto code = cmd.execution->onExecute(cmd.workInputs, cmd.workOutputs);
1196 if (NO_ERROR != code) {
1197 _exitExecute();
1198 return code;
1199 }
1200 }
1201 }
1202 _exitExecute();
1203 return NO_ERROR;
1204}
1205ErrorCode Pipeline::_enterExecute() {
1206 auto& mBackend = mInfo.first.cache.first;
1207 auto& mBackupBackend = mInfo.first.cache.second;

Callers 3

onCreateMethod · 0.45
onClickMethod · 0.45
runMethod · 0.45

Calls 7

EnumNameOpTypeFunction · 0.85
to_stringFunction · 0.50
sizeMethod · 0.45
nameMethod · 0.45
c_strMethod · 0.45
typeMethod · 0.45
onExecuteMethod · 0.45

Tested by

no test coverage detected