| 292 | } |
| 293 | |
| 294 | SymbolVarArray cg::find_h2d(const SymbolVarArray& dest) { |
| 295 | mgb_assert(!dest.empty()); |
| 296 | SymbolVarArray h2d; |
| 297 | auto on_opr = [&](OperatorNodeBase* opr) { |
| 298 | if (opr->same_type<opr::Host2DeviceCopy>()) { |
| 299 | h2d.emplace_back(opr->output(0)); |
| 300 | } |
| 301 | }; |
| 302 | |
| 303 | // check that they belong to the same graph |
| 304 | mgb_assert(dest[0].node()); |
| 305 | auto og = dest[0].node()->owner_graph(); |
| 306 | for (auto i : dest) { |
| 307 | mgb_assert(i.node() && i.node()->owner_graph() == og); |
| 308 | } |
| 309 | |
| 310 | auto dest_with_extra_deps = get_dest_vars_with_extra_deps(dest); |
| 311 | |
| 312 | gopt::SubGraph graph{dest_with_extra_deps}; |
| 313 | graph.iter([&](OperatorNodeBase* opr) { on_opr(opr); }); |
| 314 | |
| 315 | return h2d; |
| 316 | } |
| 317 | |
| 318 | OperatorNodeBase* cg::get_opr_root_source_opr(OperatorNodeBase* opr) { |
| 319 | auto&& attr = opr->node_prop().attribute(); |
nothing calls this directly
no test coverage detected