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

Method SwapIn

src/core/impl/graph/swap/swap_opr.cpp:153–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151
152MGB_DYN_TYPE_OBJ_FINAL_IMPL(SwapIn);
153SwapIn::SwapIn(
154 ComputingGraph& graph, const SymbolVarArray inputs,
155 const std::shared_ptr<HostTensorND>& host_data,
156 const OperatorNodeConfig& config)
157 : Super{&graph, config, "swap-in", {inputs[0].node()}}, m_host_data{host_data} {
158 // inputs[0] is the swap_out_var, and the following inputs are
159 // dependency vars
160 auto out_cn = inputs[0].node()->comp_node();
161
162 if (config.has_comp_node_set())
163 out_cn = config.get_single_comp_node();
164 mgb_assert(out_cn.valid(), "can not get output comp node");
165 add_output(None)->dtype(host_data->dtype());
166
167 add_equivalence_component<ScalarHash<void*>>(host_data.get());
168
169 this->comp_node(out_cn);
170 for (auto& x : inputs)
171 add_input({x.node()});
172}
173
174void SwapIn::scn_do_execute() {
175 auto&& od = output(0)->dev_tensor();

Callers

nothing calls this directly

Calls 7

has_comp_node_setMethod · 0.80
get_single_comp_nodeMethod · 0.80
nodeMethod · 0.45
comp_nodeMethod · 0.45
validMethod · 0.45
dtypeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected