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

Method IsAvailable

compiler/lib/KernelGen/AutoBareMetal/ElemwiseKernel.cpp:14–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace AutoBareMetal;
13
14bool ElmwiseKernel::IsAvailable(TContext* context) const {
15 auto auto_kern = codegen::GenCode(KernelPack::KernType::ElemwiseKernel);
16 auto mode = context->getAttrStr("mode");
17 auto nr_operands = context->getAttrInt("nr_operands");
18 bool nr_operands_ok = nr_operands == 2;
19 bool mode_ok_unary = mode == "RELU";
20 bool mode_ok_binary = false;
21 bool mode_ok_other = false;
22 bool mode_kern_ok = auto_kern->IsAvailable(context);
23 return nr_operands_ok && (mode_ok_unary || mode_ok_binary || mode_ok_other) &&
24 mode_kern_ok;
25}
26
27std::string ElmwiseKernel::GetKernelSymbol(TContext* context) const {
28 std::stringstream ss;

Callers

nothing calls this directly

Calls 1

getAttrStrMethod · 0.80

Tested by

no test coverage detected