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

Method Init

executor/lib/graph_task.cpp:629–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

627}
628
629void SubgraphTask::Init(GraphTask* graph_tsk)
630{
631 graph_task = graph_tsk;
632 Graph* graph = graph_task->GetGraph();
633 const ExecAttr* p_exec_attr = graph_task->GetExecAttr();
634
635 exec_priority = p_exec_attr->priority;
636
637 // check if it is a global output task
638 for(auto e : sub_graph->output_nodes)
639 {
640 for(auto m : graph->output_nodes)
641 {
642 if(e == m)
643 {
644 is_output_task = true;
645 break;
646 }
647 }
648 }
649
650 saved_input_wait_count_ = 0;
651
652 // for input nodes, calculate the input_wait_mask
653 for(Node* node : sub_graph->input_nodes)
654 {
655 std::uint64_t mask = 0;
656
657 for(unsigned int i = 0; i < node->GetInputNum(); i++)
658 {
659 NodePort* port = node->GetInputPort(i);
660 Tensor* tensor = port->tensor;
661
662 if(tensor->GetType() == kVarTensor)
663 {
664 /* check if parent is in the same graph or not */
665 Node* parent = tensor->producer->owner;
666 bool parent_in_graph = false;
667
668 for(unsigned int i = 0; i < sub_graph->seq_nodes.size(); i++)
669 {
670 if(parent == sub_graph->seq_nodes[i])
671 {
672 parent_in_graph = true;
673 break;
674 }
675 }
676
677 if(!parent_in_graph)
678 mask |= 1 << port->port_index;
679 }
680 }
681
682 if(mask)
683 {
684 SetNodeInputWaitMask(node, mask);
685 CreateNodeInputWaitCounter(node);
686 auto p_counter = GetNodeInputWaitCounter(node);

Callers 2

LoadDeviceMethod · 0.45
PrerunMethod · 0.45

Calls 8

GetInputPortMethod · 0.80
GetGraphMethod · 0.45
GetExecAttrMethod · 0.45
GetInputNumMethod · 0.45
GetTypeMethod · 0.45
sizeMethod · 0.45
SetAttrMethod · 0.45
GetAttrMethod · 0.45

Tested by

no test coverage detected