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

Method exec

dnn/test/common/task_record_check.h:195–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193
194template <typename Opr, typename Proxy>
195void TaskRecordChecker<Opr, Proxy>::exec(TensorLayoutArray layouts) {
196 auto opr_cur = this->opr();
197 opr_cur->param() = m_param;
198
199 m_proxy.deduce_layout(opr_cur, layouts);
200 for (size_t i = 0; i < layouts.size(); ++i) {
201 if (layouts[i].dtype == dtype::Byte()) {
202 layouts[i] = TensorLayout(layouts[i], dtype::Int8());
203 }
204 }
205
206 // allocate input
207 m_tensors_truth = alloc_tensors(m_handle.get(), layouts, 0);
208 m_tensors_first = alloc_tensors(m_handle.get(), layouts, 0);
209 m_tensors_second = alloc_tensors(m_handle.get(), layouts, 0);
210
211 init_host_values();
212
213 copy_tensors(*m_tensors_first, *m_tensors_truth);
214 copy_tensors(*m_tensors_second, *m_tensors_truth);
215
216 m_dispatcher->enable_execute_inplace();
217 m_proxy.exec(opr_cur, *m_tensors_truth);
218
219 m_dispatcher->clear_task();
220 m_dispatcher->disable_execute_inplace();
221 //! record the task
222 m_proxy.exec(opr_cur, *m_tensors_first);
223 m_dispatcher->run_task();
224
225 //! if check record2, the opr should be free
226 // free_opr();
227 check_tensors(*m_tensors_truth, *m_tensors_first);
228
229 //! change the src and out ptr and run again
230 change_tensor_ptr(m_tensors_first, m_tensors_second, m_recovery_ptrs);
231 m_dispatcher->run_task();
232 check_tensors(*m_tensors_truth, *m_tensors_second);
233
234 m_dispatcher->clear_task();
235 recovery_tensor_ptr(m_tensors_first, m_recovery_ptrs);
236 m_recovery_ptrs.clear();
237}
238
239template <typename Opr, typename Proxy>
240void TaskRecordChecker<Opr, Proxy>::init_host_values() {

Callers

nothing calls this directly

Calls 12

oprMethod · 0.95
TensorLayoutClass · 0.85
copy_tensorsFunction · 0.85
clear_taskMethod · 0.80
run_taskMethod · 0.80
paramMethod · 0.45
deduce_layoutMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected