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

Method GenKernelCall

compiler/lib/KernelGen/Arm/ArmCommon/InternalKernel.cpp:43–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43std::string MatmulInternal::GenKernelCall(TContext* ctx) {
44 auto dtype = ctx->getAttrStr("dtype");
45 if (Utils::is_float_dtype(dtype)) {
46 return R"((const float* A, size_t LDA, const float* B, size_t LDB, float* C,
47 size_t LDC, size_t M, size_t N, size_t K, const float* bias_ptr, void* workspace))";
48 } else if (Utils::is_float_dtype(dtype, 16)) {
49 return R"((const __fp16* A, size_t LDA, const __fp16* B, size_t LDB, __fp16* C,
50 size_t LDC, size_t M, size_t N, size_t K, const __fp16* bias_ptr, void* workspace))";
51 } else if (Utils::is_quant_dtype(dtype, 8)) {
52 std::string last_dtype = "si8";
53 if (ctx->haveAttr("last_dtype")) {
54 last_dtype = ctx->getAttrStr("last_dtype");
55 }
56 if (Utils::is_int_dtype(last_dtype, 32)) {
57 return R"((const int8_t* A, size_t LDA, const int8_t* B, size_t LDB, int* C,
58 size_t LDC, size_t M, size_t N, size_t K, const int32_t* bias_ptr, void* workspace, float scale, float temp_scale, float dst_scale_inv))";
59 } else {
60 return R"((const int8_t* A, size_t LDA, const int8_t* B, size_t LDB, int8_t* C,
61 size_t LDC, size_t M, size_t N, size_t K, const int32_t* bias_ptr, void* workspace, float scale, float temp_scale, float dst_scale_inv))";
62 }
63 } else if (dtype == "8832") {
64 return R"((const int8_t* A, size_t LDA, const int8_t* B, size_t LDB, int32_t* C,
65 size_t LDC, size_t M, size_t N, size_t K, const int32_t* bias_ptr, void* workspace, float scale, float temp_scale, float dst_scale_inv))";
66 } else {
67 CC_ABORT << "not support dtype " << dtype << "\n";
68 }
69 return "";
70}
71
72std::string MatmulInternal::GenPackACall(TContext* ctx) {
73 auto dtype = ctx->getAttrStr("dtype");

Callers

nothing calls this directly

Calls 5

is_float_dtypeFunction · 0.85
is_quant_dtypeFunction · 0.85
is_int_dtypeFunction · 0.85
getAttrStrMethod · 0.80
haveAttrMethod · 0.80

Tested by

no test coverage detected