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

Function createMatmul2

examples/matmul/run.cpp:126–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124)";
125
126inline KernelCode createMatmul2(const char *shaderTemplate, const size_t M,
127 const size_t K, const size_t N,
128 const Shape &workgroupSize = {256, 1, 1},
129 NumType precision = kf32) {
130 std::string codeString(shaderTemplate);
131 replaceAll(codeString,
132 {{"{{workgroupSize}}", toString(workgroupSize)},
133 {"{{precision}}", toString(precision)},
134 {"{{M}}", toString(M)},
135 {"{{K}}", toString(K)},
136 {"{{N}}", toString(N)},
137 {"{{tileSize}}",
138 toString(static_cast<size_t>(sqrt(workgroupSize[0])))}});
139 return {codeString, workgroupSize, precision};
140}
141
142/* 1D block-tiling
143 *

Callers 1

selectMatmulFunction · 0.85

Calls 2

replaceAllFunction · 0.85
toStringFunction · 0.50

Tested by

no test coverage detected