MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / do_execute

Method do_execute

src/opr/impl/custom_opnode.cpp:115–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115void CustomOpNode::do_execute(ExecEnv& env) {
116 auto runner = [this]() {
117 std::shared_ptr<SmallVector<DeviceTensorND>> inputs =
118 std::make_shared<SmallVector<DeviceTensorND>>();
119 std::shared_ptr<SmallVector<DeviceTensorND>> outputs =
120 std::make_shared<SmallVector<DeviceTensorND>>();
121 for (size_t i = 0; i < input_num(); i++) {
122 inputs->emplace_back(input(i)->dev_tensor());
123 }
124 for (size_t i = 0; i < output_num(); i++) {
125 outputs->emplace_back(output(i)->dev_tensor());
126 }
127
128 this->owner_graph()->event().signal_inplace<cg::event::BeforeKernel>(
129 this, m_comp_node);
130 m_comp_node.activate();
131 custom::dispatch_custom_op(m_op, m_param, inputs, outputs);
132 this->owner_graph()->event().signal_inplace<cg::event::AfterKernel>(
133 this, m_comp_node);
134 };
135 env.dispatch_on_comp_node(m_comp_node, runner);
136}
137
138void CustomOpNode::init_output_static_infer_desc() {
139 using namespace std::placeholders;

Callers

nothing calls this directly

Calls 6

dispatch_custom_opFunction · 0.85
emplace_backMethod · 0.80
dev_tensorMethod · 0.45
owner_graphMethod · 0.45
activateMethod · 0.45
dispatch_on_comp_nodeMethod · 0.45

Tested by

no test coverage detected