diff options
Diffstat (limited to 'test/routines')
-rw-r--r-- | test/routines/level1/xamax.hpp | 27 | ||||
-rw-r--r-- | test/routines/levelx/xcol2im.hpp | 3 | ||||
-rw-r--r-- | test/routines/levelx/xconvgemm.hpp | 3 | ||||
-rw-r--r-- | test/routines/levelx/xhad.hpp | 5 | ||||
-rw-r--r-- | test/routines/levelx/xim2col.hpp | 3 | ||||
-rw-r--r-- | test/routines/levelx/xinvert.hpp | 3 | ||||
-rw-r--r-- | test/routines/levelx/xomatcopy.hpp | 3 |
7 files changed, 30 insertions, 17 deletions
diff --git a/test/routines/level1/xamax.hpp b/test/routines/level1/xamax.hpp index 71c1a0ec..aa0f8e10 100644 --- a/test/routines/level1/xamax.hpp +++ b/test/routines/level1/xamax.hpp @@ -35,15 +35,15 @@ class TestXamax { kArgXInc, kArgXOffset, kArgImaxOffset}; } - static std::vector<std::string> BuffersIn() { return {kBufVecX, kBufScalar}; } - static std::vector<std::string> BuffersOut() { return {kBufScalar}; } + static std::vector<std::string> BuffersIn() { return {kBufVecX, kBufScalarUint}; } + static std::vector<std::string> BuffersOut() { return {kBufScalarUint}; } // Describes how to obtain the sizes of the buffers static size_t GetSizeX(const Arguments<T> &args) { return args.n * args.x_inc + args.x_offset; } static size_t GetSizeImax(const Arguments<T> &args) { - return (1 + args.imax_offset) * 2; // always a 4-byte integer, this is a hack for FP16 + return args.imax_offset + 1; } // Describes how to set the sizes of all the buffers @@ -73,13 +73,13 @@ class TestXamax { auto queue_plain = queue(); auto event = cl_event{}; auto status = Amax<T>(args.n, - buffers.scalar(), args.imax_offset, + buffers.scalar_uint(), args.imax_offset, buffers.x_vec(), args.x_offset, args.x_inc, &queue_plain, &event); if (status == StatusCode::kSuccess) { clWaitForEvents(1, &event); clReleaseEvent(event); } #elif CUDA_API auto status = Amax<T>(args.n, - buffers.scalar(), args.imax_offset, + buffers.scalar_uint(), args.imax_offset, buffers.x_vec(), args.x_offset, args.x_inc, queue.GetContext()(), queue.GetDevice()()); cuStreamSynchronize(queue()); @@ -93,7 +93,7 @@ class TestXamax { auto queue_plain = queue(); auto event = cl_event{}; auto status = clblasXamax<T>(args.n, - buffers.scalar, args.imax_offset, + buffers.scalar_uint, args.imax_offset, buffers.x_vec, args.x_offset, args.x_inc, 1, &queue_plain, 0, nullptr, &event); clWaitForEvents(1, &event); @@ -105,7 +105,7 @@ class TestXamax { #ifdef CLBLAST_REF_CBLAS static StatusCode RunReference2(const Arguments<T> &args, BuffersHost<T> &buffers_host, Queue &) { cblasXamax(args.n, - buffers_host.scalar, args.imax_offset, + buffers_host.scalar_uint, args.imax_offset, buffers_host.x_vec, args.x_offset, args.x_inc); return StatusCode::kSuccess; } @@ -115,7 +115,7 @@ class TestXamax { #ifdef CLBLAST_REF_CUBLAS static StatusCode RunReference3(const Arguments<T> &args, BuffersCUDA<T> &buffers, Queue &) { auto status = cublasXamax(reinterpret_cast<cublasHandle_t>(args.cublas_handle), args.n, - buffers.scalar, args.imax_offset, + buffers.scalar_uint, args.imax_offset, buffers.x_vec, args.x_offset, args.x_inc); if (status == CUBLAS_STATUS_SUCCESS) { return StatusCode::kSuccess; } else { return StatusCode::kUnknownError; } } @@ -123,8 +123,15 @@ class TestXamax { // Describes how to download the results of the computation (more importantly: which buffer) static std::vector<T> DownloadResult(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) { - std::vector<T> result(args.scalar_size, static_cast<T>(0)); - buffers.scalar.Read(queue, args.scalar_size, result); + std::vector<unsigned int> result_uint(args.scalar_size, 0); + buffers.scalar_uint.Read(queue, args.scalar_size, result_uint); + // The result is an integer. However, since the test infrastructure assumes results of + // type 'T' (float/double/float2/double2/half), we store the results into T instead. + // The values might then become meaningless, but a comparison for testing should still + // be valid to verify correctness. + auto result_as_T = static_cast<T>(result_uint[0]); + std::vector<T> result(args.scalar_size); + result[0] = result_as_T; return result; } diff --git a/test/routines/levelx/xcol2im.hpp b/test/routines/levelx/xcol2im.hpp index c740e4c7..cdac3493 100644 --- a/test/routines/levelx/xcol2im.hpp +++ b/test/routines/levelx/xcol2im.hpp @@ -201,7 +201,8 @@ StatusCode RunReference<half>(const Arguments<half> &args, BuffersHost<half> &bu auto a_buffer2 = HalfToFloatBuffer(buffers_host.a_mat); auto b_buffer2 = HalfToFloatBuffer(buffers_host.b_mat); auto dummy = std::vector<float>(0); - auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, dummy, dummy, dummy}; + auto dummy_uint = std::vector<unsigned int>(0); + auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, dummy, dummy, dummy, dummy_uint}; auto args2 = Arguments<float>(); args2.a_size = args.a_size; args2.b_size = args.b_size; args2.kernel_mode = args.kernel_mode; diff --git a/test/routines/levelx/xconvgemm.hpp b/test/routines/levelx/xconvgemm.hpp index 786bb733..9085d927 100644 --- a/test/routines/levelx/xconvgemm.hpp +++ b/test/routines/levelx/xconvgemm.hpp @@ -230,7 +230,8 @@ StatusCode RunReference<half>(const Arguments<half> &args, BuffersHost<half> &bu auto b_buffer2 = HalfToFloatBuffer(buffers_host.b_mat); auto c_buffer2 = HalfToFloatBuffer(buffers_host.c_mat); auto dummy = std::vector<float>(0); - auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, c_buffer2, dummy, dummy}; + auto dummy_uint = std::vector<unsigned int>(0); + auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, c_buffer2, dummy, dummy, dummy_uint}; auto args2 = Arguments<float>(); args2.a_size = args.a_size; args2.b_size = args.b_size; args2.c_size = args.c_size; args2.kernel_mode = args.kernel_mode; diff --git a/test/routines/levelx/xhad.hpp b/test/routines/levelx/xhad.hpp index 3e40de87..49629452 100644 --- a/test/routines/levelx/xhad.hpp +++ b/test/routines/levelx/xhad.hpp @@ -39,7 +39,8 @@ StatusCode RunReference<half>(const Arguments<half> &args, BuffersHost<half> &bu auto y_buffer2 = HalfToFloatBuffer(buffers_host.y_vec); auto c_buffer2 = HalfToFloatBuffer(buffers_host.c_mat); auto dummy = std::vector<float>(0); - auto buffers2 = BuffersHost<float>{x_buffer2, y_buffer2, dummy, dummy, c_buffer2, dummy, dummy}; + auto dummy_uint = std::vector<unsigned int>(0); + auto buffers2 = BuffersHost<float>{x_buffer2, y_buffer2, dummy, dummy, c_buffer2, dummy, dummy, dummy_uint}; auto args2 = Arguments<float>(); args2.x_size = args.x_size; args2.y_size = args.y_size; args2.c_size = args.c_size; args2.x_inc = args.x_inc; args2.y_inc = args.y_inc; args2.n = args.n; @@ -152,7 +153,7 @@ public: // Describes how to compute the indices of the result buffer static size_t ResultID1(const Arguments<T> &args) { return args.n; } static size_t ResultID2(const Arguments<T> &) { return 1; } // N/A for this routine - static size_t GetResultIndex(const Arguments<T> &args, const size_t id1, const size_t) { + static size_t GetResultIndex(const Arguments<T> &, const size_t id1, const size_t) { return id1; // * args.z_inc + args.z_offset; } diff --git a/test/routines/levelx/xim2col.hpp b/test/routines/levelx/xim2col.hpp index 2a5ebf8e..ab3b6a0f 100644 --- a/test/routines/levelx/xim2col.hpp +++ b/test/routines/levelx/xim2col.hpp @@ -200,7 +200,8 @@ StatusCode RunReference<half>(const Arguments<half> &args, BuffersHost<half> &bu auto a_buffer2 = HalfToFloatBuffer(buffers_host.a_mat); auto b_buffer2 = HalfToFloatBuffer(buffers_host.b_mat); auto dummy = std::vector<float>(0); - auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, dummy, dummy, dummy}; + auto dummy_uint = std::vector<unsigned int>(0); + auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, dummy, dummy, dummy, dummy_uint}; auto args2 = Arguments<float>(); args2.a_size = args.a_size; args2.b_size = args.b_size; args2.kernel_mode = args.kernel_mode; diff --git a/test/routines/levelx/xinvert.hpp b/test/routines/levelx/xinvert.hpp index 126856ac..54905de1 100644 --- a/test/routines/levelx/xinvert.hpp +++ b/test/routines/levelx/xinvert.hpp @@ -108,7 +108,8 @@ StatusCode RunReference<half>(const Arguments<half> &args, BuffersHost<half> &bu auto a_buffer2 = HalfToFloatBuffer(buffers_host.a_mat); auto b_buffer2 = HalfToFloatBuffer(buffers_host.b_mat); auto dummy = std::vector<float>(0); - auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, dummy, dummy, dummy}; + auto dummy_uint = std::vector<unsigned int>(0); + auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, dummy, dummy, dummy, dummy_uint}; auto args2 = Arguments<float>(); args2.a_size = args.a_size; args2.b_size = args.b_size; args2.a_ld = args.a_ld; args2.m = args.m; args2.n = args.n; diff --git a/test/routines/levelx/xomatcopy.hpp b/test/routines/levelx/xomatcopy.hpp index 4a93b29d..a4d98e79 100644 --- a/test/routines/levelx/xomatcopy.hpp +++ b/test/routines/levelx/xomatcopy.hpp @@ -59,7 +59,8 @@ StatusCode RunReference<half>(const Arguments<half> &args, BuffersHost<half> &bu auto a_buffer2 = HalfToFloatBuffer(buffers_host.a_mat); auto b_buffer2 = HalfToFloatBuffer(buffers_host.b_mat); auto dummy = std::vector<float>(0); - auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, dummy, dummy, dummy}; + auto dummy_uint = std::vector<unsigned int>(0); + auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, dummy, dummy, dummy, dummy_uint}; auto args2 = Arguments<float>(); args2.a_size = args.a_size; args2.b_size = args.b_size; args2.a_ld = args.a_ld; args2.b_ld = args.b_ld; args2.m = args.m; args2.n = args.n; |