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

Function gen_write

compiler/lib/KernelGen/BareMetal/Reduce.cpp:59–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 return writer.str();
58}
59std::string gen_write(std::string mode, std::string acc, std::string size) {
60 std::stringstream writer;
61 if (mode == "MAX" || mode == "SUM" || mode == "MIN" || mode == "PRODUCT" ||
62 mode == "SUM_SQR") {
63 writer << acc;
64 } else if (mode == "MEAN") {
65 writer << acc << " / (" << size << ")";
66 } else {
67 CC_ABORT << "unknown reduce mode " << mode.c_str() << "\n";
68 }
69 return writer.str();
70}
71} // namespace
72
73bool ReduceKernel::IsAvailable(TContext* context) const {

Callers 1

GetKernelBodyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected