diff options
author | Ivan Shapovalov <intelfx@intelfx.name> | 2017-01-14 04:23:49 +0300 |
---|---|---|
committer | Ivan Shapovalov <intelfx@intelfx.name> | 2017-01-24 02:55:09 +0300 |
commit | 519ccbd27354280d4210db1c1fa8f239b1794b14 (patch) | |
tree | cc0e14263e0e08d9b4fb9ebe004f99f6ece396c8 | |
parent | 1b8e81633357004767747893cf3e179ed4f53dcc (diff) |
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.
-rw-r--r-- | test/correctness/tester.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
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 <typename T, typename U> void Tester<T,U>::TestErrorCodes(const StatusCode clblas_status, const StatusCode clblast_status, const Arguments<U> &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<StatusCode>(-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<T,U>::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); |