MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / createMatmul

Function createMatmul

experimental/legacy/transformer/run.cpp:154–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154inline 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
174int main() {
175 printf("\033[2J\033[1;1H");

Callers 1

mainFunction · 0.85

Calls 2

replaceAllFunction · 0.85
toStringFunction · 0.50

Tested by

no test coverage detected