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

Method exec

compiler/test/kernel/common/src/checker.cpp:289–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287
288template <typename Opr>
289void Checker<Opr>::exec(TensorLayoutArray all_layouts) {
290 using CCProxy = CCOprProxy<Opr>;
291 auto dnn_handle = Runner<Opr>::get_dnn_handle();
292 auto opr = dnn_handle->template create_operator<Opr>();
293 opr->param() = m_param;
294 if (!m_run_cc_only)
295 m_dnn_proxy.deduce_layout(opr.get(), all_layouts);
296
297 auto tensor_array_storage = dnn_alloc_tensors(dnn_handle, all_layouts, 0);
298 auto tensor_array_naive_storage = dnn_alloc_tensors(dnn_handle, all_layouts, 0);
299 auto tensor_array_dnn = *tensor_array_naive_storage;
300 auto tensor_array = *tensor_array_storage;
301#if !MEGCC_TEST_GEN
302 Runner<Opr>::init_tensor(tensor_array_dnn, m_rng);
303 dnn_copy_tensors(tensor_array, tensor_array_dnn);
304#endif
305 //! test mode
306 CCProxy cc_proxy;
307 std::unordered_map<std::string, CCAttr> proxy_attr;
308 fix_addition_attr_map<Opr>(proxy_attr, m_dnn_proxy, tensor_array_dnn);
309 cc_proxy.exec(
310 opr.get(), tensor_array, m_arch, {}, m_kernel_symbol, proxy_attr,
311 m_run_cc_dynamic);
312#if !MEGCC_TEST_GEN
313 //! run dnn
314 if (m_before_exec_callback) {
315 m_before_exec_callback(opr.get(), tensor_array_dnn);
316 }
317 if (!m_run_cc_only) {
318 m_dnn_proxy.exec(opr.get(), tensor_array_dnn);
319 if (m_output_canonizer) {
320 m_output_canonizer(tensor_array);
321 m_output_canonizer(tensor_array_dnn);
322 }
323 check_tensors(
324 tensor_array_dnn, tensor_array, m_epsilon, m_max_avg_error,
325 m_max_avg_biased_error);
326 }
327#endif
328}
329namespace megcc {
330namespace test {
331

Callers 10

TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45

Calls 2

deduce_layoutMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected