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

Function init_declare

compiler/lib/KernelGen/GeneralIntrinsic/Typecvt.cpp:43–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42namespace {
43std::string init_declare(const std::string& src_dtype, const std::string& dst_dtype) {
44 std::string body_temp =
45 StringTemplate::StringTemplateArgs()
46 .add("simd_width",
47 (uint32_t)(16 / std::min<size_t>(Utils::get_dtype_size(src_dtype), Utils::get_dtype_size(dst_dtype))))
48 .render(R"(
49 float scale;
50 GI_FLOAT32_t vscale;
51 const size_t SIMD_WIDTH = ${simd_width};
52 )");
53 return body_temp;
54}
55
56std::string gen_scale(const std::string& src_dtype, const std::string& dst_dtype) {
57 std::string body_temp;

Callers 1

GetKernelBodyMethod · 0.70

Calls 4

StringTemplateArgsClass · 0.85
get_dtype_sizeFunction · 0.85
renderMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected