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

Function createTranspose2

examples/transpose/run.cpp:81–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79)";
80
81inline KernelCode createTranspose2(const char *shaderTemplate,
82 const size_t M, const size_t N,
83 const size_t BM, const size_t BN,
84 const size_t TM, const size_t TN,
85 const Shape &workgroupSize = {256, 1, 1},
86 NumType precision = kf32) {
87 assert(BM % TM == 0);
88 assert(BN % TN == 0);
89 assert(M % BM == 0);
90 assert(N % BN == 0);
91 std::string codeString(shaderTemplate);
92 replaceAll(codeString, {{"{{workgroupSize}}", toString(workgroupSize)},
93 {"{{precision}}", toString(precision)},
94 {"{{M}}", toString(M)},
95 {"{{N}}", toString(N)},
96 {"{{BM}}", toString(BM)},
97 {"{{BN}}", toString(BN)},
98 {"{{TM}}", toString(TM)},
99 {"{{TN}}", toString(TN)}
100 });
101 std::string unrolledCode = codeString ;// loopUnrolling(codeString);
102 return {unrolledCode, workgroupSize};
103}
104
105void initData(size_t M, size_t N, std::unique_ptr<float[]> &inputPtr) {
106 std::mt19937 gen(314159);

Callers 1

selectTransposeFunction · 0.85

Calls 2

replaceAllFunction · 0.85
toStringFunction · 0.50

Tested by

no test coverage detected