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

Method GetKernelSymbol

compiler/lib/KernelGen/BareMetal/FusedElemwiseKernel.cpp:293–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293std::string FusedElmwiseKernel::GetKernelSymbol(TContext* context) const {
294 size_t nr_operands = context->getAttrInt("nr_operands");
295 auto dst_operand =
296 context->getAttrOprand("operand:" + std::to_string(nr_operands - 1));
297 std::stringstream ss;
298 ss << "kernel_naive_fused_elementwise";
299 auto mode_size = context->getAttrInt("modes:size");
300 for (int i = 0; i < mode_size; i++) {
301 auto modes = Utils::split_string(
302 context->getAttrStr("modes:" + std::to_string(i)), ',');
303 size_t modes_size = modes.size();
304 auto mode = modes[modes_size - 2];
305 ss << "_" << mode;
306 }
307 for (size_t i = 0; i < nr_operands; i++) {
308 auto operand = context->getAttrOprand("operand:" + std::to_string(i));
309 auto tensor_type = GetOperandTensorType(dst_operand, operand);
310 ss << "_tensortype" << tensor_type;
311 }
312 ss << "_" << SymbolHelper::gen_io_str(context);
313 return ss.str();
314}
315
316std::string FusedElmwiseKernel::GetKernelBody(TContext* context) const {
317 size_t nr_operands = context->getAttrInt("nr_operands");

Callers

nothing calls this directly

Calls 5

split_stringFunction · 0.85
GetOperandTensorTypeFunction · 0.85
getAttrOprandMethod · 0.80
getAttrStrMethod · 0.80
to_stringFunction · 0.50

Tested by

no test coverage detected