| 31 | using namespace mlir; |
| 32 | |
| 33 | bool MatmulKernel::IsAvailable(TContext* context) const { |
| 34 | bool ok_dtype = context->getAttrOprand("operand:0").dtype == "f32" && |
| 35 | context->getAttrOprand("operand:1").dtype == "f32" && |
| 36 | context->getAttrOprand("operand:2").dtype == "f32"; |
| 37 | bool ok_mode = context->getAttrStr("format") == "DEFAULT" && |
| 38 | context->getAttrStr("compute_mode") == "DEFAULT"; |
| 39 | bool ok_shape = context->getAttrOprand("operand:1").shape.size() == 2 && |
| 40 | context->getAttrOprand("operand:0").shape.size() == 2; |
| 41 | bool ok_tran = context->getAttrBool("transposeA") == false && |
| 42 | context->getAttrBool("transposeB") == false; |
| 43 | |
| 44 | return ok_dtype && ok_mode && ok_shape && ok_tran; |
| 45 | } |
| 46 | |
| 47 | std::string MatmulKernel::GetKernelSymbol(TContext* context) const { |
| 48 | std::stringstream ss; |