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

Method IsAvailable

compiler/lib/KernelGen/BareMetal/ConvBackDataKernel.cpp:85–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83} // namespace
84
85bool ConvBackDataGeneral::IsAvailable(TContext* ctx) const {
86 bool param_mode_ok = (ctx->getAttrStr("format") == "NCHW" ||
87 ctx->getAttrStr("format") == "NCHW44") &&
88 ctx->getAttrStr("mode") == "CROSS_CORRELATION";
89 bool type_float_ok = ctx->getAttrInt("nr_operands") == 3 &&
90 ((ctx->getAttrOprand("operand:0").dtype == "f32" &&
91 ctx->getAttrOprand("operand:1").dtype == "f32" &&
92 ctx->getAttrOprand("operand:2").dtype == "f32"));
93 bool type_qint_ok =
94 ctx->getAttrInt("nr_operands") == 3 &&
95 (Utils::is_quant_dtype(ctx->getAttrOprand("operand:0").dtype, 8) &&
96 Utils::is_quant_dtype(ctx->getAttrOprand("operand:1").dtype, 8) &&
97 Utils::is_quant_dtype(ctx->getAttrOprand("operand:2").dtype, 8));
98
99 return param_mode_ok && (type_float_ok || type_qint_ok);
100}
101
102std::string ConvBackDataGeneral::GetKernelSymbol(TContext* ctx) const {
103 std::stringstream extra_ss;

Callers

nothing calls this directly

Calls 3

is_quant_dtypeFunction · 0.85
getAttrStrMethod · 0.80
getAttrOprandMethod · 0.80

Tested by

no test coverage detected