MCPcopy Create free account
hub / github.com/OAID/Tengine / PrerunTask

Method PrerunTask

executor/lib/generic_dev_executor.cpp:225–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225bool GenericDevExecutor::PrerunTask(SubgraphTask* task)
226{
227 if(DevGetStatus() != kDevNormal)
228 return false;
229
230 if(task->graph_handle == nullptr)
231 task->graph_handle = DevCreateGraphHandle(task->sub_graph);
232
233 if(task->graph_handle == nullptr || !OptimizeGraph(task))
234 return false;
235
236 GraphTask* graph_task = task->graph_task;
237 GraphExecutor* executor = graph_task->GetGraphExecutor();
238
239 int optimize_only = 0;
240
241 executor->GetGraphAttr("optimize_only", &optimize_only, sizeof(int));
242
243 if(optimize_only)
244 return true;
245
246 unsigned int mem_size;
247
248 if(DevGetMemorySize(task->graph_handle, mem_size))
249 {
250 void* mem_addr = std::malloc(mem_size);
251
252 DevSetMemory(task->graph_handle, mem_addr);
253 }
254
255 if(!DevPrerun(task->graph_handle))
256 return false;
257
258 task->SetStatus(EXEC_STATUS_WAIT);
259
260 InsertQueue(kWaitQueue, task);
261
262 return true;
263}
264
265bool GenericDevExecutor::SchedTask(SubgraphTask* task)
266{

Callers

nothing calls this directly

Calls 3

GetGraphExecutorMethod · 0.80
SetStatusMethod · 0.80
GetGraphAttrMethod · 0.45

Tested by

no test coverage detected