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

Method on_var_produced

src/plugin/impl/var_sanity_check.cpp:100–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void VarSanityCheck::DebugLog::on_var_produced(
101 VarSanityCheck* checker, VarNode* var, ChecksumResult checksum) {
102 if (!m_enable)
103 return;
104
105 mgb_log("var %s: addr=%p checksum=%s", cg::dump_var_info({var}).c_str(),
106 var->dev_tensor().raw_ptr(), str(checksum).c_str());
107
108 if (m_readcnt) {
109 auto checksum = checker->calc_checksum(m_var);
110 mgb_log("recheck var%zu after var%zu finished: addr=%p checksum=%s",
111 m_var->id(), var->id(), m_var->dev_tensor().raw_ptr(),
112 str(checksum).c_str());
113 ChecksumResult checksum_expect;
114 {
115 MGB_LOCK_GUARD(m_checker->m_id2chksum_mtx);
116 checksum_expect = m_checker->m_var2chksum.at(m_var);
117 }
118 if (checksum != checksum_expect) {
119 var->owner_graph()->current_comp_seq()->to_json()->writeto_fpath(
120 "/tmp/mgb-graph-sanity-check-failed.json");
121 mgb_throw(
122 cg::OperatorNodeExcExtraInfo::ExcMaker{m_var->owner_opr()}
123 .make<VarSanityCheck::Error>,
124 "error in recheck");
125 }
126 }
127 if (var == m_var) {
128 mgb_assert(!m_readcnt);
129 m_readcnt = m_readcnt_init;
130 }
131}
132
133void VarSanityCheck::DebugLog::on_var_received(VarNode* var) {
134 if (var == m_var) {

Callers

nothing calls this directly

Calls 15

strFunction · 0.85
calc_checksumMethod · 0.80
raw_ptrMethod · 0.45
dev_tensorMethod · 0.45
idMethod · 0.45
atMethod · 0.45
writeto_fpathMethod · 0.45
to_jsonMethod · 0.45
current_comp_seqMethod · 0.45
owner_graphMethod · 0.45
owner_oprMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected