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

Method IsAvailable

compiler/lib/CodeGen/Matmul.cpp:33–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31using namespace mlir;
32
33bool 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
47std::string MatmulKernel::GetKernelSymbol(TContext* context) const {
48 std::stringstream ss;

Callers 4

gen_kenrelsMethod · 0.45
instantiateMethod · 0.45
gen_kernelFunction · 0.45
call_kernelFunction · 0.45

Calls 3

getAttrOprandMethod · 0.80
getAttrStrMethod · 0.80
getAttrBoolMethod · 0.80

Tested by 2

gen_kernelFunction · 0.36
call_kernelFunction · 0.36