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

Method executeCallBack

source/core/Pipeline.cpp:1225–1266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1223}
1224
1225ErrorCode Pipeline::executeCallBack(const TensorCallBackWithInfo& before, const TensorCallBackWithInfo& after) {
1226 _copyInputs();
1227 auto enterCode = _enterExecute();
1228 if (NO_ERROR != enterCode) {
1229 return enterCode;
1230 }
1231 auto& mBackend = mInfo.first.cache.first;
1232 auto& mBackupBackend = mInfo.first.cache.second;
1233 for (auto& info : mInfo.second) {
1234 if (info.type == Schedule::CONSTANT) {
1235 continue;
1236 }
1237 auto& buffer = info.executeBuffer;
1238 for (int cmdIndex=0; cmdIndex < buffer.command.size(); ++cmdIndex) {
1239 auto cmdP = buffer.command[cmdIndex];
1240 auto& cmd = *cmdP;
1241 if (nullptr == cmd.info.get()) {
1242 auto code = cmd.execution->onExecute(cmd.workInputs, cmd.workOutputs);
1243 if (NO_ERROR != code) {
1244 _exitExecute();
1245 return code;
1246 }
1247 continue;
1248 }
1249 auto run = before(cmd.workInputs, cmd.info.get());
1250 if (run) {
1251 auto code = cmd.execution->onExecute(cmd.workInputs, cmd.workOutputs);
1252 if (NO_ERROR != code) {
1253 _exitExecute();
1254 return code;
1255 }
1256 }
1257 auto stop = !(after(cmd.workOutputs, cmd.info.get()));
1258 if (stop) {
1259 _exitExecute();
1260 return CALL_BACK_STOP;
1261 }
1262 }
1263 }
1264 _exitExecute();
1265 return NO_ERROR;
1266}
1267
1268Pipeline::~Pipeline() {
1269 auto& bn = mInfo.first.cache.first;

Callers 1

runWithCallBackMethod · 0.80

Calls 3

sizeMethod · 0.45
getMethod · 0.45
onExecuteMethod · 0.45

Tested by

no test coverage detected