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

Method IsAvailable

compiler/lib/KernelGen/BareMetal/BatchedMatmul.cpp:14–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

getAttrOprandMethod · 0.80
getAttrStrMethod · 0.80

Tested by

no test coverage detected