| 79 | )"; |
| 80 | |
| 81 | inline 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 | |
| 105 | void initData(size_t M, size_t N, std::unique_ptr<float[]> &inputPtr) { |
| 106 | std::mt19937 gen(314159); |
no test coverage detected