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

Method exec

dnn/src/fallback/relayout/opr_impl.cpp:463–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461} // anonymous namespace
462
463void RelayoutForwardImpl::exec(
464 _megdnn_tensor_in src0, _megdnn_tensor_out dst0, Handle* src_handle) {
465 check_cpu_handle(src_handle);
466 TensorND src = src0, dst = dst0;
467 check_layout_and_canonize(src.layout, dst.layout);
468
469 bool has_neg_stride = false;
470 for (size_t i = 0; i < src.layout.ndim; ++i) {
471 if (src.layout.stride[i] < 0) {
472 has_neg_stride = true;
473 break;
474 }
475 }
476 for (size_t i = 0; i < dst.layout.ndim; ++i) {
477 if (dst.layout.stride[i] < 0) {
478 has_neg_stride = true;
479 break;
480 }
481 }
482 if (has_neg_stride) {
483 NaiveRelayoutForwardImpl::do_exec(src, dst);
484 return;
485 }
486
487 bool is_bit4 = is_int4(src.layout);
488 bool allow_nocontig = !is_bit4;
489 relayout::TransposeParam trans_param;
490 bool trans =
491 relayout::is_transpose(src.layout, dst.layout, trans_param, allow_nocontig);
492 trans = check_dtype_support_transparam(trans, is_bit4, trans_param);
493 exec_after_preprocess(src, dst, trans ? &trans_param : nullptr);
494}
495
496void RelayoutForwardImpl::exec_after_preprocess(
497 const TensorND& src, const TensorND& dst, relayout::TransposeParam* transpose) {

Callers

nothing calls this directly

Calls 4

is_int4Function · 0.85
do_execFunction · 0.50

Tested by

no test coverage detected