From 519ccbd27354280d4210db1c1fa8f239b1794b14 Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Sat, 14 Jan 2017 04:23:49 +0300 Subject: Tester: always fail on OpenCL and CLBlast internal errors These errors are self-evident and enough to fail the test even if there is no clBLAS reference to compare error codes with. --- test/correctness/tester.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'test/correctness/tester.cpp') diff --git a/test/correctness/tester.cpp b/test/correctness/tester.cpp index c449b09d..b1ca8122 100644 --- a/test/correctness/tester.cpp +++ b/test/correctness/tester.cpp @@ -248,8 +248,29 @@ template void Tester::TestErrorCodes(const StatusCode clblas_status, const StatusCode clblast_status, const Arguments &args) { + // Either an OpenCL or CLBlast internal error occurred, fail the test immediately + // NOTE: the OpenCL error codes grow downwards without any declared lower bound, hence the magic + // number. The last error code is atm around -70, but -500 is chosen to be on the safe side. + if (clblast_status != StatusCode::kSuccess && + (clblast_status > static_cast(-500) /* matches OpenCL errors (see above) */ || + clblast_status < StatusCode::kNotImplemented) /* matches CLBlast internal errors */) { + PrintTestResult(kErrorStatus); + ReportError({StatusCode::kSuccess, clblast_status, kStatusError, args}); + if (verbose_) { + fprintf(stdout, "\n"); + PrintErrorLog({{StatusCode::kSuccess, clblast_status, kStatusError, args}}); + fprintf(stdout, " "); + } + } + + // Routine is not implemented + else if (clblast_status == StatusCode::kNotImplemented) { + PrintTestResult(kSkippedCompilation); + ReportSkipped(); + } + // Cannot compare error codes against a library other than clBLAS - if (compare_cblas_) { + else if (compare_cblas_) { PrintTestResult(kUnsupportedReference); ReportSkipped(); } @@ -267,13 +288,6 @@ void Tester::TestErrorCodes(const StatusCode clblas_status, const StatusCod ReportSkipped(); } - // Could not compile the CLBlast kernel properly - else if (clblast_status == StatusCode::kOpenCLBuildProgramFailure || - clblast_status == StatusCode::kNotImplemented) { - PrintTestResult(kSkippedCompilation); - ReportSkipped(); - } - // Error occurred else { PrintTestResult(kErrorStatus); -- cgit v1.2.3 From 064ba4abd4d4c4d2dfeaa3b22e03d7c83a0d4acb Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Tue, 24 Jan 2017 02:01:08 +0300 Subject: treewide: silence type mismatch warnings in *printf() --- samples/sgemm.cpp | 2 +- test/correctness/tester.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'test/correctness/tester.cpp') diff --git a/samples/sgemm.cpp b/samples/sgemm.cpp index b05c390e..b960865b 100644 --- a/samples/sgemm.cpp +++ b/samples/sgemm.cpp @@ -106,7 +106,7 @@ int main() { auto time_ms = std::chrono::duration(elapsed_time).count(); // Example completed. See "clblast.h" for status codes (0 -> success). - printf("Completed SGEMM in %.3lf ms with status %d\n", time_ms, status); + printf("Completed SGEMM in %.3lf ms with status %d\n", time_ms, static_cast(status)); return 0; } diff --git a/test/correctness/tester.cpp b/test/correctness/tester.cpp index b1ca8122..efe49811 100644 --- a/test/correctness/tester.cpp +++ b/test/correctness/tester.cpp @@ -402,7 +402,9 @@ void Tester::PrintErrorLog(const std::vector &error_log) { fprintf(stdout, " Error rate %.1lf%%: ", entry.error_percentage); } else { - fprintf(stdout, " Status code %d (expected %d): ", entry.status_found, entry.status_expect); + fprintf(stdout, " Status code %d (expected %d): ", + static_cast(entry.status_found), + static_cast(entry.status_expect)); } fprintf(stdout, "%s\n", GetOptionsString(entry.args).c_str()); } -- cgit v1.2.3