| 152 | } |
| 153 | |
| 154 | inline KernelCode createMatmul(const char *shaderTemplate, const size_t M, |
| 155 | const size_t K, const size_t N, |
| 156 | const Shape &workgroupSize = {256, 1, 1}, |
| 157 | NumType precision = kf32) { |
| 158 | std::string codeString(shaderTemplate); |
| 159 | replaceAll(codeString, "{{workgroupSize}}", toString(workgroupSize)); |
| 160 | replaceAll(codeString, "{{workgroupSizeX}}", |
| 161 | std::to_string(workgroupSize[0])); |
| 162 | replaceAll(codeString, "{{workgroupSizeY}}", |
| 163 | std::to_string(workgroupSize[1])); |
| 164 | replaceAll(codeString, "{{workgroupSizeZ}}", |
| 165 | std::to_string(workgroupSize[2])); |
| 166 | replaceAll(codeString, "{{precision}}", toString(precision)); |
| 167 | replaceAll(codeString, "{{M}}", std::to_string(M)); |
| 168 | replaceAll(codeString, "{{K}}", std::to_string(K)); |
| 169 | replaceAll(codeString, "{{N}}", std::to_string(N)); |
| 170 | // LOG(kDefLog, kInfo, "Shader code:\n%s\n", codeString.c_str()); |
| 171 | return KernelCode{codeString, workgroupSize}; |
| 172 | } |
| 173 | |
| 174 | int main() { |
| 175 | printf("\033[2J\033[1;1H"); |
no test coverage detected