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

Method IsAvailable

compiler/lib/KernelGen/BareMetal/ElemwiseMultiType.cpp:55–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53} // namespace
54
55bool ElemwiseMultiTypeKernel::IsAvailable(TContext* context) const {
56 auto mode = context->getAttrStr("mode");
57 auto nr_operands = context->getAttrInt("nr_operands");
58 bool nr_operands_ok = nr_operands == 2 || nr_operands == 3;
59 bool mode_ok_unary = nr_operands == 2 && mode == "QRELU";
60 bool mode_ok_binary =
61 nr_operands == 3 && (mode == "QADD" || mode == "QFUSE_ADD_RELU");
62 return nr_operands_ok && (mode_ok_unary || mode_ok_binary);
63}
64
65std::string ElemwiseMultiTypeKernel::GetKernelSymbol(TContext* context) const {
66 std::stringstream ss;

Callers

nothing calls this directly

Calls 1

getAttrStrMethod · 0.80

Tested by

no test coverage detected