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

Method IsAvailable

compiler/lib/KernelGen/BareMetal/MatrixMul.cpp:13–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11using namespace BareMetal;
12
13bool MatrixMulKernel::IsAvailable(TContext* context) const {
14 bool ok_dtype = context->getAttrOprand("operand:0").dtype == "f32" &&
15 context->getAttrOprand("operand:1").dtype == "f32" &&
16 context->getAttrOprand("operand:2").dtype == "f32";
17 bool ok_fp16 = context->getAttrOprand("operand:0").dtype == "f16" &&
18 context->getAttrOprand("operand:1").dtype == "f16" &&
19 context->getAttrOprand("operand:2").dtype == "f16";
20 bool ok_mode = context->getAttrStr("format") == "DEFAULT" &&
21 context->getAttrStr("compute_mode") == "DEFAULT";
22 return (ok_dtype || ok_fp16) && ok_mode;
23}
24
25//! kernel gen
26std::string MatrixMulKernel::GetKernelSymbol(TContext* context) const {

Callers

nothing calls this directly

Calls 2

getAttrOprandMethod · 0.80
getAttrStrMethod · 0.80

Tested by

no test coverage detected