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

Method scn_do_execute

src/opr/impl/blas.cpp:133–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void MatrixMul::scn_do_execute() {
134 auto inp0 = input(0)->dev_tensor().as_megdnn(),
135 inp1 = input(1)->dev_tensor().as_megdnn(),
136 out = output(0)->dev_tensor().as_megdnn();
137 if ((inp0.layout.is_empty() || inp1.layout.is_empty())) {
138 if (!out.layout.is_empty()) {
139 if (!m_fill_opr) {
140 m_fill_opr = intl::get_megdnn_handle(comp_node())
141 ->create_operator<megdnn::Fill>();
142 }
143 m_fill_opr->param() = 0;
144 m_fill_opr->exec(out, {});
145 }
146 return;
147 }
148 auto transpose = [](TensorLayout& layout, bool& trans) {
149 if (!check_layout(layout, 0)) {
150 mgb_assert(check_layout(layout, 1));
151 std::swap(layout.shape[0], layout.shape[1]);
152 std::swap(layout.stride[0], layout.stride[1]);
153 trans ^= 1;
154 }
155 };
156 auto&& tparam = megdnn_opr()->param();
157 MGB_TRY {
158 transpose(inp0.layout, tparam.transposeA);
159 transpose(inp1.layout, tparam.transposeB);
160 megdnn_opr()->execution_policy() =
161 m_cadidate_execution_policies[get_mask_from_matmul(tparam)];
162 megdnn_opr()->exec(
163 inp0, inp1, out, intl::get_megdnn_workspace_from_var(output(1)));
164 }
165 MGB_FINALLY({ tparam = this->param(); });
166}
167

Callers

nothing calls this directly

Calls 11

comp_nodeFunction · 0.85
swapFunction · 0.85
get_mask_from_matmulFunction · 0.85
as_megdnnMethod · 0.80
transposeFunction · 0.50
scn_do_executeFunction · 0.50
dev_tensorMethod · 0.45
is_emptyMethod · 0.45
paramMethod · 0.45
execMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected