From bf50c4e53e1815d4b376f35b5be5c747cd857414 Mon Sep 17 00:00:00 2001 From: Tarmo Räntilä Date: Mon, 9 Dec 2019 22:13:52 +0200 Subject: Reduce TestMatrix calls for xgemmbatched. Replace the looped test by a single one with the maximal found offset. --- src/utilities/buffer_test.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/utilities/buffer_test.hpp') diff --git a/src/utilities/buffer_test.hpp b/src/utilities/buffer_test.hpp index fd071434..9cecce97 100644 --- a/src/utilities/buffer_test.hpp +++ b/src/utilities/buffer_test.hpp @@ -15,6 +15,9 @@ #ifndef CLBLAST_BUFFER_TEST_H_ #define CLBLAST_BUFFER_TEST_H_ +#include +#include + #include "utilities/utilities.hpp" namespace clblast { @@ -104,6 +107,32 @@ void TestVectorIndex(const size_t n, const Buffer &buffer, const size_t offse } catch (const Error &e) { throw BLASError(StatusCode::kInvalidVectorScalar, e.what()); } } +// ================================================================================================= + +// Tests matrix 'A' for validity in a batched setting +template +void TestBatchedMatrixA(const size_t one, const size_t two, const Buffer& buffer, + const std::vector &offsets, const size_t ld, const bool test_lead_dim = true) { + const auto max_offset = *std::max_element(offsets.begin(), offsets.end()); + TestMatrixA(one, two, buffer, max_offset, ld, test_lead_dim); +} + +// Tests matrix 'B' for validity in a batched setting +template +void TestBatchedMatrixB(const size_t one, const size_t two, const Buffer& buffer, + const std::vector& offsets, const size_t ld, const bool test_lead_dim = true) { + const auto max_offset = *std::max_element(offsets.begin(), offsets.end()); + TestMatrixB(one, two, buffer, max_offset, ld, test_lead_dim); +} + +// Tests matrix 'C' for validity in a batched setting +template +void TestBatchedMatrixC(const size_t one, const size_t two, const Buffer& buffer, + const std::vector& offsets, const size_t ld) { + const auto max_offset = *std::max_element(offsets.begin(), offsets.end()); + TestMatrixC(one, two, buffer, max_offset, ld); +} + // ================================================================================================= } // namespace clblast -- cgit v1.2.3