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

Function gen_binary

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

Source from the content-addressed store, hash-verified

35}
36
37std::string gen_binary(std::string mode) {
38 if (mode == "QADD") {
39 return "int8_t out_val = fp32_to_int8((scale_0 * val_0 + scale_1 * "
40 "val_1) * scale_div);";
41 } else if (mode == "QFUSE_ADD_RELU") {
42 return R"(
43 float val0 = scale_0 * val_0;
44 float val1 = scale_1 * val_1;
45 int8_t out_val = fp32_to_int8( ((val0 + val1) > 0? (val0 + val1):0) * scale_div);
46 )";
47 } else {
48 CC_ABORT << "not support mode " << mode.c_str() << "\n";
49 }
50 return "";
51}
52
53} // namespace
54

Callers 1

GetKernelBodyMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected