| 131 | } |
| 132 | |
| 133 | void 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 |
nothing calls this directly
no test coverage detected