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

Method do_regist

src/core/impl/graph/cg_impl_seq.cpp:517–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517void ComputingGraphImpl::ComputingSequence::do_regist() const {
518 // regist weights
519 auto& recorder = StaticMemRecorder::Instance();
520 if (recorder.valid() && recorder.weight_chunk_id() == 0) {
521 size_t addr_base = recorder.peak_mem_size();
522 size_t chunk_id = recorder.set_weight_chunk_id();
523 for (auto&& i : *(this->m_opr_seq)) {
524 auto op = i->output();
525 for (auto&& j : op) {
526 auto& mp = j->mem_plan();
527 if (mp.valid()) {
528 auto& mc = mp.chunk();
529 if (mp.valid() && mc.mem_alloc_status.is_from_owner_var()) {
530 auto size = mgb::get_aligned_power2(
531 mp.layout().span().dist_byte(),
532 j->comp_node().get_mem_addr_alignment());
533
534 recorder.regist_memory_chunk(
535 {chunk_id++, size, 0, this->m_opr_seq->size(),
536 addr_base, addr_base + size, 0, false,
537 mc.owner_var->name()});
538
539 addr_base += size;
540 }
541 }
542 }
543 }
544 recorder.set_sum_mem_size(addr_base);
545 recorder.dump_to_json();
546 }
547}
548#endif
549#endif
550AsyncExecutable& ComputingGraphImpl::ComputingSequence::wait() {

Callers

nothing calls this directly

Calls 14

is_from_owner_varMethod · 0.80
dist_byteMethod · 0.80
spanMethod · 0.80
regist_memory_chunkMethod · 0.80
set_sum_mem_sizeMethod · 0.80
dump_to_jsonMethod · 0.80
get_aligned_power2Function · 0.50
validMethod · 0.45
outputMethod · 0.45
layoutMethod · 0.45
comp_nodeMethod · 0.45

Tested by

no test coverage detected