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

Method Run

driver/cpu/cpu_runner.cpp:342–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340#endif
341
342bool CPURunner::Run(Subgraph* sub_graph)
343{
344 std::vector<Node*>& seq_nodes = sub_graph->seq_nodes;
345
346#ifdef ENABLE_TIME_PROFILING
347 ProfRecord* prof = nullptr;
348
349 bool do_prof = false;
350
351 const char* prof_env = std::getenv("PROF_TIME");
352
353 if(prof_env && prof_env[0] == '1')
354 {
355 do_prof = true;
356
357 if(sub_graph->ExistAttr("PROF_TIME"))
358 prof = any_cast<ProfRecord*>(sub_graph->GetAttr("PROF_TIME"));
359 else
360 {
361 prof = new ProfTime(seq_nodes.size(), parse_node);
362 sub_graph->SetAttr("PROF_TIME", prof);
363 }
364 }
365
366#endif
367 bool ret = true;
368
369 sub_graph->Lock(); // sync with graph perf start/stop/get
370
371 GraphPerfStatBuf* p_perf_stat = nullptr;
372 int perf_record_idx = 0;
373
374 if(sub_graph->ExistAttr(ATTR_GRAPH_PERF_BUFFER))
375 {
376 GraphPerfStatBuf* stat = any_cast<GraphPerfStatBuf>(&sub_graph->GetAttr(ATTR_GRAPH_PERF_BUFFER));
377
378 if(stat->started)
379 {
380 p_perf_stat = stat;
381 }
382 }
383
384 for(unsigned int i = 0; i < seq_nodes.size(); i++)
385 {
386 Node* node = seq_nodes[i];
387
388 if(!node->ExistAttr(ATTR_NODE_OPS))
389 continue;
390
391 NodeOps* node_ops = any_cast<NodeOps*>(node->GetAttr(ATTR_NODE_OPS));
392
393 /* dynamic shape process */
394 if(node->IsDynamicShape() || node->InputReshaped())
395 {
396 int output_number = node->GetOutputNum();
397
398#if 0
399 /* free output tensor first */

Callers 8

test_new_operatorFunction · 0.45
test_new_operatorFunction · 0.45
test_new_operatorFunction · 0.45
test_mt_modeFunction · 0.45
test_st_modeFunction · 0.45
test_new_operatorFunction · 0.45
test_new_operatorFunction · 0.45
DevRunMethod · 0.45

Calls 15

free_tensor_memFunction · 0.85
get_tensor_memFunction · 0.85
set_tensor_memFunction · 0.85
get_tensor_mem_sizeFunction · 0.85
IsDynamicShapeMethod · 0.80
InputReshapedMethod · 0.80
GetOpMethod · 0.80
ReshapedMethod · 0.80
UpdateReshapeCountMethod · 0.80
GetNameMethod · 0.80
GetTotalSizeMethod · 0.80
GetQuantParamMethod · 0.80

Tested by 7

test_new_operatorFunction · 0.36
test_new_operatorFunction · 0.36
test_new_operatorFunction · 0.36
test_mt_modeFunction · 0.36
test_st_modeFunction · 0.36
test_new_operatorFunction · 0.36
test_new_operatorFunction · 0.36