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

Function runTestWithCheck

examples/matmul/run.cpp:867–886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

865
866template<class precision=float>
867void runTestWithCheck(int version, size_t M, size_t K, size_t N,
868 bool transposedInput, int kTestSize, NumType numtype) {
869 std::unique_ptr<precision[]> inputPtr = std::make_unique<precision[]>(M * K);
870 std::unique_ptr<precision[]> weightsPtr = std::make_unique<precision[]>(N * K);
871 std::unique_ptr<precision[]> outputPtr = std::make_unique<precision[]>(M * N);
872
873 initData(M, K, N, inputPtr, weightsPtr);
874 if (transposedInput) {
875 std::unique_ptr<precision[]> transposedWeightPtr = std::make_unique<precision[]>(K * N);
876 transpose(weightsPtr.get(), transposedWeightPtr.get(), N, K);
877 runTest(version, M, K, N, inputPtr, transposedWeightPtr, outputPtr, numtype);
878 } else {
879 runTest(version, M, K, N, inputPtr, weightsPtr, outputPtr, numtype);
880 }
881
882 if (kTestSize <= 1) {
883 // Check result with CPU reference implementation for tiny/small tests
884 checkCPU(M, K, N, inputPtr, weightsPtr, outputPtr);
885 }
886}
887
888const std::string versionToStr(int version){
889 switch (version) {

Callers

nothing calls this directly

Calls 4

transposeFunction · 0.85
checkCPUFunction · 0.85
initDataFunction · 0.70
runTestFunction · 0.70

Tested by

no test coverage detected