diff options
author | Ivan Shapovalov <intelfx@intelfx.name> | 2016-10-22 05:14:19 +0300 |
---|---|---|
committer | Ivan Shapovalov <intelfx@intelfx.name> | 2016-10-22 08:45:25 +0300 |
commit | b98af44fcf89b9946e1de438b1f5527e6bf28905 (patch) | |
tree | fbd5ec2ab1e418830b88e5de42279845911ea0da /src/routines/level2 | |
parent | 5d03d48f7aaf38d3b28bad612638d2d9db8ebee0 (diff) |
treewide: use C++ exceptions properly
Since the codebase is designed around proper C++ idioms such as RAII, it
makes sense to only use C++ exceptions internally instead of mixing
exceptions and error codes. The exceptions are now caught at top level
to preserve compatibility with the existing error code-based API.
Note that we deliberately do not catch C++ runtime errors (such as
`std::bad_alloc`) nor logic errors (aka failed assertions) because no
actual handling can ever happen for such errors.
However, in the C interface we do catch _all_ exceptions (...) and
convert them into a wild-card error code.
Diffstat (limited to 'src/routines/level2')
44 files changed, 545 insertions, 583 deletions
diff --git a/src/routines/level2/xgbmv.cpp b/src/routines/level2/xgbmv.cpp index ea4f001c..e80b9a96 100644 --- a/src/routines/level2/xgbmv.cpp +++ b/src/routines/level2/xgbmv.cpp @@ -29,13 +29,13 @@ Xgbmv<T>::Xgbmv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xgbmv<T>::DoGbmv(const Layout layout, const Transpose a_transpose, - const size_t m, const size_t n, const size_t kl, const size_t ku, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { +void Xgbmv<T>::DoGbmv(const Layout layout, const Transpose a_transpose, + const size_t m, const size_t n, const size_t kl, const size_t ku, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { // Reverses the upper and lower band count auto rotated = (layout == Layout::kRowMajor); @@ -46,13 +46,13 @@ StatusCode Xgbmv<T>::DoGbmv(const Layout layout, const Transpose a_transpose, // The specific hermitian matrix-accesses are implemented in the kernel guarded by the // ROUTINE_GBMV define. bool fast_kernels = false; - return MatVec(layout, a_transpose, - m, n, alpha, - a_buffer, a_offset, a_ld, - x_buffer, x_offset, x_inc, beta, - y_buffer, y_offset, y_inc, - fast_kernels, fast_kernels, - 0, false, kl_real, ku_real); + MatVec(layout, a_transpose, + m, n, alpha, + a_buffer, a_offset, a_ld, + x_buffer, x_offset, x_inc, beta, + y_buffer, y_offset, y_inc, + fast_kernels, fast_kernels, + 0, false, kl_real, ku_real); } // ================================================================================================= diff --git a/src/routines/level2/xgbmv.hpp b/src/routines/level2/xgbmv.hpp index 686ab642..e5f670ec 100644 --- a/src/routines/level2/xgbmv.hpp +++ b/src/routines/level2/xgbmv.hpp @@ -33,13 +33,13 @@ class Xgbmv: public Xgemv<T> { Xgbmv(Queue &queue, EventPointer event, const std::string &name = "GBMV"); // Templated-precision implementation of the routine - StatusCode DoGbmv(const Layout layout, const Transpose a_transpose, - const size_t m, const size_t n, const size_t kl, const size_t ku, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); + void DoGbmv(const Layout layout, const Transpose a_transpose, + const size_t m, const size_t n, const size_t kl, const size_t ku, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); }; // ================================================================================================= diff --git a/src/routines/level2/xgemv.cpp b/src/routines/level2/xgemv.cpp index 4e32ba41..97dcd8ef 100644 --- a/src/routines/level2/xgemv.cpp +++ b/src/routines/level2/xgemv.cpp @@ -33,41 +33,41 @@ Xgemv<T>::Xgemv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xgemv<T>::DoGemv(const Layout layout, const Transpose a_transpose, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { +void Xgemv<T>::DoGemv(const Layout layout, const Transpose a_transpose, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { // Performs the matrix-vector multiplication - return MatVec(layout, a_transpose, - m, n, alpha, - a_buffer, a_offset, a_ld, - x_buffer, x_offset, x_inc, beta, - y_buffer, y_offset, y_inc, - true, true, - 0, false, 0, 0); // N/A for this routine + MatVec(layout, a_transpose, + m, n, alpha, + a_buffer, a_offset, a_ld, + x_buffer, x_offset, x_inc, beta, + y_buffer, y_offset, y_inc, + true, true, + 0, false, 0, 0); // N/A for this routine } // ================================================================================================= // The generic implementation, also suited for other (non general) matrix-vector multiplications template <typename T> -StatusCode Xgemv<T>::MatVec(const Layout layout, const Transpose a_transpose, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - bool fast_kernel, bool fast_kernel_rot, - const size_t parameter, const bool packed, - const size_t kl, const size_t ku) { +void Xgemv<T>::MatVec(const Layout layout, const Transpose a_transpose, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + bool fast_kernel, bool fast_kernel_rot, + const size_t parameter, const bool packed, + const size_t kl, const size_t ku) { // Makes sure all dimensions are larger than zero - if (m == 0 || n == 0) { return StatusCode::kInvalidDimension; } + if (m == 0 || n == 0) { throw BLASError(StatusCode::kInvalidDimension); } // Computes whether or not the matrix has an alternative layout (row or column-major). auto a_altlayout = (layout == Layout::kRowMajor); @@ -91,14 +91,10 @@ StatusCode Xgemv<T>::MatVec(const Layout layout, const Transpose a_transpose, auto a_conjugate = (a_transpose == Transpose::kConjugate); // Tests the matrix and the vectors for validity - auto status = StatusCode::kSuccess; - if (packed) { status = TestMatrixAP(n, a_buffer, a_offset); } - else { status = TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld); } - if (ErrorIn(status)) { return status; } - status = TestVectorX(n_real, x_buffer, x_offset, x_inc); - if (ErrorIn(status)) { return status; } - status = TestVectorY(m_real, y_buffer, y_offset, y_inc); - if (ErrorIn(status)) { return status; } + if (packed) { TestMatrixAP(n, a_buffer, a_offset); } + else { TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld); } + TestVectorX(n_real, x_buffer, x_offset, x_inc); + TestVectorY(m_real, y_buffer, y_offset, y_inc); // Determines whether or not the fast-version can be used fast_kernel = fast_kernel && (a_offset == 0) && (a_rotated == 0) && (a_conjugate == 0) && @@ -127,39 +123,33 @@ StatusCode Xgemv<T>::MatVec(const Layout layout, const Transpose a_transpose, } // Retrieves the Xgemv kernel from the compiled binary - try { - const auto program = GetProgramFromCache(context_, PrecisionValue<T>(), routine_name_); - auto kernel = Kernel(program, kernel_name); - - // Sets the kernel arguments - kernel.SetArgument(0, static_cast<int>(m_real)); - kernel.SetArgument(1, static_cast<int>(n_real)); - kernel.SetArgument(2, GetRealArg(alpha)); - kernel.SetArgument(3, GetRealArg(beta)); - kernel.SetArgument(4, static_cast<int>(a_rotated)); - kernel.SetArgument(5, a_buffer()); - kernel.SetArgument(6, static_cast<int>(a_offset)); - kernel.SetArgument(7, static_cast<int>(a_ld)); - kernel.SetArgument(8, x_buffer()); - kernel.SetArgument(9, static_cast<int>(x_offset)); - kernel.SetArgument(10, static_cast<int>(x_inc)); - kernel.SetArgument(11, y_buffer()); - kernel.SetArgument(12, static_cast<int>(y_offset)); - kernel.SetArgument(13, static_cast<int>(y_inc)); - kernel.SetArgument(14, static_cast<int>(a_conjugate)); - kernel.SetArgument(15, static_cast<int>(parameter)); // extra parameter used for symm/herm - kernel.SetArgument(16, static_cast<int>(kl)); // only used for banded matrices - kernel.SetArgument(17, static_cast<int>(ku)); // only used for banded matrices - - // Launches the kernel - auto global = std::vector<size_t>{global_size}; - auto local = std::vector<size_t>{local_size}; - status = RunKernel(kernel, queue_, device_, global, local, event_); - if (ErrorIn(status)) { return status; } - - // Succesfully finished the computation - return StatusCode::kSuccess; - } catch (...) { return StatusCode::kInvalidKernel; } + const auto program = GetProgramFromCache(context_, PrecisionValue<T>(), routine_name_); + auto kernel = Kernel(program, kernel_name); + + // Sets the kernel arguments + kernel.SetArgument(0, static_cast<int>(m_real)); + kernel.SetArgument(1, static_cast<int>(n_real)); + kernel.SetArgument(2, GetRealArg(alpha)); + kernel.SetArgument(3, GetRealArg(beta)); + kernel.SetArgument(4, static_cast<int>(a_rotated)); + kernel.SetArgument(5, a_buffer()); + kernel.SetArgument(6, static_cast<int>(a_offset)); + kernel.SetArgument(7, static_cast<int>(a_ld)); + kernel.SetArgument(8, x_buffer()); + kernel.SetArgument(9, static_cast<int>(x_offset)); + kernel.SetArgument(10, static_cast<int>(x_inc)); + kernel.SetArgument(11, y_buffer()); + kernel.SetArgument(12, static_cast<int>(y_offset)); + kernel.SetArgument(13, static_cast<int>(y_inc)); + kernel.SetArgument(14, static_cast<int>(a_conjugate)); + kernel.SetArgument(15, static_cast<int>(parameter)); // extra parameter used for symm/herm + kernel.SetArgument(16, static_cast<int>(kl)); // only used for banded matrices + kernel.SetArgument(17, static_cast<int>(ku)); // only used for banded matrices + + // Launches the kernel + auto global = std::vector<size_t>{global_size}; + auto local = std::vector<size_t>{local_size}; + RunKernel(kernel, queue_, device_, global, local, event_); } // ================================================================================================= diff --git a/src/routines/level2/xgemv.hpp b/src/routines/level2/xgemv.hpp index e9afec8d..1e1fa726 100644 --- a/src/routines/level2/xgemv.hpp +++ b/src/routines/level2/xgemv.hpp @@ -28,25 +28,25 @@ class Xgemv: public Routine { Xgemv(Queue &queue, EventPointer event, const std::string &name = "GEMV"); // Templated-precision implementation of the routine - StatusCode DoGemv(const Layout layout, const Transpose a_transpose, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); + void DoGemv(const Layout layout, const Transpose a_transpose, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); // Generic version used also for other matrix-vector multiplications - StatusCode MatVec(const Layout layout, const Transpose a_transpose, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - bool fast_kernel, bool fast_kernel_rot, - const size_t parameter, const bool packed, - const size_t kl, const size_t ku); + void MatVec(const Layout layout, const Transpose a_transpose, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + bool fast_kernel, bool fast_kernel_rot, + const size_t parameter, const bool packed, + const size_t kl, const size_t ku); }; // ================================================================================================= diff --git a/src/routines/level2/xger.cpp b/src/routines/level2/xger.cpp index 29cffe0c..f22131bb 100644 --- a/src/routines/level2/xger.cpp +++ b/src/routines/level2/xger.cpp @@ -33,15 +33,15 @@ Xger<T>::Xger(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xger<T>::DoGer(const Layout layout, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { +void Xger<T>::DoGer(const Layout layout, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { // Makes sure all dimensions are larger than zero - if (m == 0 || n == 0) { return StatusCode::kInvalidDimension; } + if (m == 0 || n == 0) { throw BLASError(StatusCode::kInvalidDimension); } // Computes whether or not the matrix has an alternative layout (row or column-major). const auto a_is_rowmajor = (layout == Layout::kRowMajor); @@ -49,44 +49,35 @@ StatusCode Xger<T>::DoGer(const Layout layout, const auto a_two = (a_is_rowmajor) ? m : n; // Tests the matrix and the vectors for validity - auto status = TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld); - if (ErrorIn(status)) { return status; } - status = TestVectorX(m, x_buffer, x_offset, x_inc); - if (ErrorIn(status)) { return status; } - status = TestVectorY(n, y_buffer, y_offset, y_inc); - if (ErrorIn(status)) { return status; } + TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld); + TestVectorX(m, x_buffer, x_offset, x_inc); + TestVectorY(n, y_buffer, y_offset, y_inc); // Retrieves the kernel from the compiled binary - try { - const auto program = GetProgramFromCache(context_, PrecisionValue<T>(), routine_name_); - auto kernel = Kernel(program, "Xger"); - - // Sets the kernel arguments - kernel.SetArgument(0, static_cast<int>(a_one)); - kernel.SetArgument(1, static_cast<int>(a_two)); - kernel.SetArgument(2, GetRealArg(alpha)); - kernel.SetArgument(3, x_buffer()); - kernel.SetArgument(4, static_cast<int>(x_offset)); - kernel.SetArgument(5, static_cast<int>(x_inc)); - kernel.SetArgument(6, y_buffer()); - kernel.SetArgument(7, static_cast<int>(y_offset)); - kernel.SetArgument(8, static_cast<int>(y_inc)); - kernel.SetArgument(9, a_buffer()); - kernel.SetArgument(10, static_cast<int>(a_offset)); - kernel.SetArgument(11, static_cast<int>(a_ld)); - kernel.SetArgument(12, static_cast<int>(a_is_rowmajor)); - - // Launches the kernel - auto a_one_ceiled = Ceil(CeilDiv(a_one, db_["WPT"]), db_["WGS1"]); - auto a_two_ceiled = Ceil(CeilDiv(a_two, db_["WPT"]), db_["WGS2"]); - auto global = std::vector<size_t>{a_one_ceiled, a_two_ceiled}; - auto local = std::vector<size_t>{db_["WGS1"], db_["WGS2"]}; - status = RunKernel(kernel, queue_, device_, global, local, event_); - if (ErrorIn(status)) { return status; } - - // Succesfully finished the computation - return StatusCode::kSuccess; - } catch (...) { return StatusCode::kInvalidKernel; } + const auto program = GetProgramFromCache(context_, PrecisionValue<T>(), routine_name_); + auto kernel = Kernel(program, "Xger"); + + // Sets the kernel arguments + kernel.SetArgument(0, static_cast<int>(a_one)); + kernel.SetArgument(1, static_cast<int>(a_two)); + kernel.SetArgument(2, GetRealArg(alpha)); + kernel.SetArgument(3, x_buffer()); + kernel.SetArgument(4, static_cast<int>(x_offset)); + kernel.SetArgument(5, static_cast<int>(x_inc)); + kernel.SetArgument(6, y_buffer()); + kernel.SetArgument(7, static_cast<int>(y_offset)); + kernel.SetArgument(8, static_cast<int>(y_inc)); + kernel.SetArgument(9, a_buffer()); + kernel.SetArgument(10, static_cast<int>(a_offset)); + kernel.SetArgument(11, static_cast<int>(a_ld)); + kernel.SetArgument(12, static_cast<int>(a_is_rowmajor)); + + // Launches the kernel + auto a_one_ceiled = Ceil(CeilDiv(a_one, db_["WPT"]), db_["WGS1"]); + auto a_two_ceiled = Ceil(CeilDiv(a_two, db_["WPT"]), db_["WGS2"]); + auto global = std::vector<size_t>{a_one_ceiled, a_two_ceiled}; + auto local = std::vector<size_t>{db_["WGS1"], db_["WGS2"]}; + RunKernel(kernel, queue_, device_, global, local, event_); } // ================================================================================================= diff --git a/src/routines/level2/xger.hpp b/src/routines/level2/xger.hpp index 3c6abe44..fbbb07a1 100644 --- a/src/routines/level2/xger.hpp +++ b/src/routines/level2/xger.hpp @@ -28,12 +28,12 @@ class Xger: public Routine { Xger(Queue &queue, EventPointer event, const std::string &name = "GER"); // Templated-precision implementation of the routine - StatusCode DoGer(const Layout layout, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); + void DoGer(const Layout layout, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); }; // ================================================================================================= diff --git a/src/routines/level2/xgerc.cpp b/src/routines/level2/xgerc.cpp index d9feda97..4fa2e2a8 100644 --- a/src/routines/level2/xgerc.cpp +++ b/src/routines/level2/xgerc.cpp @@ -28,19 +28,19 @@ Xgerc<T>::Xgerc(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xgerc<T>::DoGerc(const Layout layout, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { +void Xgerc<T>::DoGerc(const Layout layout, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { // Regular Ger operation on complex data, plus conjugation in the kernel guarded by the // ROUTINE_GERC guard. - return DoGer(layout, m, n, alpha, - x_buffer, x_offset, x_inc, - y_buffer, y_offset, y_inc, - a_buffer, a_offset, a_ld); + DoGer(layout, m, n, alpha, + x_buffer, x_offset, x_inc, + y_buffer, y_offset, y_inc, + a_buffer, a_offset, a_ld); } // ================================================================================================= diff --git a/src/routines/level2/xgerc.hpp b/src/routines/level2/xgerc.hpp index f1d04dfd..2d61f2b7 100644 --- a/src/routines/level2/xgerc.hpp +++ b/src/routines/level2/xgerc.hpp @@ -31,12 +31,12 @@ class Xgerc: public Xger<T> { Xgerc(Queue &queue, EventPointer event, const std::string &name = "GERC"); // Templated-precision implementation of the routine - StatusCode DoGerc(const Layout layout, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); + void DoGerc(const Layout layout, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); }; // ================================================================================================= diff --git a/src/routines/level2/xgeru.cpp b/src/routines/level2/xgeru.cpp index da9e91c2..c77e69c5 100644 --- a/src/routines/level2/xgeru.cpp +++ b/src/routines/level2/xgeru.cpp @@ -28,18 +28,18 @@ Xgeru<T>::Xgeru(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xgeru<T>::DoGeru(const Layout layout, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { +void Xgeru<T>::DoGeru(const Layout layout, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { // Regular Ger operation on complex data - return DoGer(layout, m, n, alpha, - x_buffer, x_offset, x_inc, - y_buffer, y_offset, y_inc, - a_buffer, a_offset, a_ld); + DoGer(layout, m, n, alpha, + x_buffer, x_offset, x_inc, + y_buffer, y_offset, y_inc, + a_buffer, a_offset, a_ld); } // ================================================================================================= diff --git a/src/routines/level2/xgeru.hpp b/src/routines/level2/xgeru.hpp index fb50e917..4cae6b58 100644 --- a/src/routines/level2/xgeru.hpp +++ b/src/routines/level2/xgeru.hpp @@ -31,12 +31,12 @@ class Xgeru: public Xger<T> { Xgeru(Queue &queue, EventPointer event, const std::string &name = "GERU"); // Templated-precision implementation of the routine - StatusCode DoGeru(const Layout layout, - const size_t m, const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); + void DoGeru(const Layout layout, + const size_t m, const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); }; // ================================================================================================= diff --git a/src/routines/level2/xhbmv.cpp b/src/routines/level2/xhbmv.cpp index f6c0e3c4..c7c9ed9d 100644 --- a/src/routines/level2/xhbmv.cpp +++ b/src/routines/level2/xhbmv.cpp @@ -29,13 +29,13 @@ Xhbmv<T>::Xhbmv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xhbmv<T>::DoHbmv(const Layout layout, const Triangle triangle, - const size_t n, const size_t k, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { +void Xhbmv<T>::DoHbmv(const Layout layout, const Triangle triangle, + const size_t n, const size_t k, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { // The data is either in the upper or lower triangle size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -45,13 +45,13 @@ StatusCode Xhbmv<T>::DoHbmv(const Layout layout, const Triangle triangle, // The specific hermitian banded matrix-accesses are implemented in the kernel guarded by the // ROUTINE_HBMV define. bool fast_kernels = false; - return MatVec(layout, Transpose::kNo, - n, n, alpha, - a_buffer, a_offset, a_ld, - x_buffer, x_offset, x_inc, beta, - y_buffer, y_offset, y_inc, - fast_kernels, fast_kernels, - is_upper, false, k, 0); + MatVec(layout, Transpose::kNo, + n, n, alpha, + a_buffer, a_offset, a_ld, + x_buffer, x_offset, x_inc, beta, + y_buffer, y_offset, y_inc, + fast_kernels, fast_kernels, + is_upper, false, k, 0); } // ================================================================================================= diff --git a/src/routines/level2/xhbmv.hpp b/src/routines/level2/xhbmv.hpp index d668eb88..76d3c91e 100644 --- a/src/routines/level2/xhbmv.hpp +++ b/src/routines/level2/xhbmv.hpp @@ -33,13 +33,13 @@ class Xhbmv: public Xgemv<T> { Xhbmv(Queue &queue, EventPointer event, const std::string &name = "HBMV"); // Templated-precision implementation of the routine - StatusCode DoHbmv(const Layout layout, const Triangle triangle, - const size_t n, const size_t k, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); + void DoHbmv(const Layout layout, const Triangle triangle, + const size_t n, const size_t k, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); }; // ================================================================================================= diff --git a/src/routines/level2/xhemv.cpp b/src/routines/level2/xhemv.cpp index 2cbcf7b4..209ff654 100644 --- a/src/routines/level2/xhemv.cpp +++ b/src/routines/level2/xhemv.cpp @@ -29,13 +29,13 @@ Xhemv<T>::Xhemv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xhemv<T>::DoHemv(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { +void Xhemv<T>::DoHemv(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { // The data is either in the upper or lower triangle size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -45,13 +45,13 @@ StatusCode Xhemv<T>::DoHemv(const Layout layout, const Triangle triangle, // The specific hermitian matrix-accesses are implemented in the kernel guarded by the // ROUTINE_HEMV define. bool fast_kernels = false; - return MatVec(layout, Transpose::kNo, - n, n, alpha, - a_buffer, a_offset, a_ld, - x_buffer, x_offset, x_inc, beta, - y_buffer, y_offset, y_inc, - fast_kernels, fast_kernels, - is_upper, false, 0, 0); + MatVec(layout, Transpose::kNo, + n, n, alpha, + a_buffer, a_offset, a_ld, + x_buffer, x_offset, x_inc, beta, + y_buffer, y_offset, y_inc, + fast_kernels, fast_kernels, + is_upper, false, 0, 0); } // ================================================================================================= diff --git a/src/routines/level2/xhemv.hpp b/src/routines/level2/xhemv.hpp index 8e062fd3..20d2df22 100644 --- a/src/routines/level2/xhemv.hpp +++ b/src/routines/level2/xhemv.hpp @@ -33,13 +33,13 @@ class Xhemv: public Xgemv<T> { Xhemv(Queue &queue, EventPointer event, const std::string &name = "HEMV"); // Templated-precision implementation of the routine - StatusCode DoHemv(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); + void DoHemv(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); }; // ================================================================================================= diff --git a/src/routines/level2/xher.cpp b/src/routines/level2/xher.cpp index 6dd95938..4cf27702 100644 --- a/src/routines/level2/xher.cpp +++ b/src/routines/level2/xher.cpp @@ -41,15 +41,15 @@ template <> half Xher<half,half>::GetAlpha(const half alpha) { return alpha; } // The main routine template <typename T, typename U> -StatusCode Xher<T,U>::DoHer(const Layout layout, const Triangle triangle, - const size_t n, - const U alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const bool packed) { +void Xher<T,U>::DoHer(const Layout layout, const Triangle triangle, + const size_t n, + const U alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const bool packed) { // Makes sure the dimensions are larger than zero - if (n == 0) { return StatusCode::kInvalidDimension; } + if (n == 0) { throw BLASError(StatusCode::kInvalidDimension); } // The data is either in the upper or lower triangle const auto is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -57,47 +57,38 @@ StatusCode Xher<T,U>::DoHer(const Layout layout, const Triangle triangle, const auto is_rowmajor = (layout == Layout::kRowMajor); // Tests the matrix and the vectors for validity - auto status = StatusCode::kSuccess; - if (packed) { status = TestMatrixAP(n, a_buffer, a_offset); } - else { status = TestMatrixA(n, n, a_buffer, a_offset, a_ld); } - if (ErrorIn(status)) { return status; } - status = TestVectorX(n, x_buffer, x_offset, x_inc); - if (ErrorIn(status)) { return status; } + if (packed) { TestMatrixAP(n, a_buffer, a_offset); } + else { TestMatrixA(n, n, a_buffer, a_offset, a_ld); } + TestVectorX(n, x_buffer, x_offset, x_inc); // If alpha is zero an update is not required - if (alpha == U{0}) { return StatusCode::kSuccess; } + if (alpha == U{0}) { return; } // Creates a matching version of alpha const auto matching_alpha = GetAlpha(alpha); // Retrieves the kernel from the compiled binary - try { - const auto program = GetProgramFromCache(context_, PrecisionValue<T>(), routine_name_); - auto kernel = Kernel(program, "Xher"); - - // Sets the kernel arguments - kernel.SetArgument(0, static_cast<int>(n)); - kernel.SetArgument(1, GetRealArg(matching_alpha)); - kernel.SetArgument(2, x_buffer()); - kernel.SetArgument(3, static_cast<int>(x_offset)); - kernel.SetArgument(4, static_cast<int>(x_inc)); - kernel.SetArgument(5, a_buffer()); - kernel.SetArgument(6, static_cast<int>(a_offset)); - kernel.SetArgument(7, static_cast<int>(a_ld)); - kernel.SetArgument(8, static_cast<int>(is_upper)); - kernel.SetArgument(9, static_cast<int>(is_rowmajor)); - - // Launches the kernel - auto global_one = Ceil(CeilDiv(n, db_["WPT"]), db_["WGS1"]); - auto global_two = Ceil(CeilDiv(n, db_["WPT"]), db_["WGS2"]); - auto global = std::vector<size_t>{global_one, global_two}; - auto local = std::vector<size_t>{db_["WGS1"], db_["WGS2"]}; - status = RunKernel(kernel, queue_, device_, global, local, event_); - if (ErrorIn(status)) { return status; } - - // Succesfully finished the computation - return StatusCode::kSuccess; - } catch (...) { return StatusCode::kInvalidKernel; } + const auto program = GetProgramFromCache(context_, PrecisionValue<T>(), routine_name_); + auto kernel = Kernel(program, "Xher"); + + // Sets the kernel arguments + kernel.SetArgument(0, static_cast<int>(n)); + kernel.SetArgument(1, GetRealArg(matching_alpha)); + kernel.SetArgument(2, x_buffer()); + kernel.SetArgument(3, static_cast<int>(x_offset)); + kernel.SetArgument(4, static_cast<int>(x_inc)); + kernel.SetArgument(5, a_buffer()); + kernel.SetArgument(6, static_cast<int>(a_offset)); + kernel.SetArgument(7, static_cast<int>(a_ld)); + kernel.SetArgument(8, static_cast<int>(is_upper)); + kernel.SetArgument(9, static_cast<int>(is_rowmajor)); + + // Launches the kernel + auto global_one = Ceil(CeilDiv(n, db_["WPT"]), db_["WGS1"]); + auto global_two = Ceil(CeilDiv(n, db_["WPT"]), db_["WGS2"]); + auto global = std::vector<size_t>{global_one, global_two}; + auto local = std::vector<size_t>{db_["WGS1"], db_["WGS2"]}; + RunKernel(kernel, queue_, device_, global, local, event_); } // ================================================================================================= diff --git a/src/routines/level2/xher.hpp b/src/routines/level2/xher.hpp index 9ff6bf3f..70a30bda 100644 --- a/src/routines/level2/xher.hpp +++ b/src/routines/level2/xher.hpp @@ -31,12 +31,12 @@ class Xher: public Routine { T GetAlpha(const U alpha); // Templated-precision implementation of the routine - StatusCode DoHer(const Layout layout, const Triangle triangle, - const size_t n, - const U alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const bool packed = false); + void DoHer(const Layout layout, const Triangle triangle, + const size_t n, + const U alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const bool packed = false); }; // ================================================================================================= diff --git a/src/routines/level2/xher2.cpp b/src/routines/level2/xher2.cpp index 3d57a9b9..c93585de 100644 --- a/src/routines/level2/xher2.cpp +++ b/src/routines/level2/xher2.cpp @@ -32,16 +32,16 @@ Xher2<T>::Xher2(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xher2<T>::DoHer2(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const bool packed) { +void Xher2<T>::DoHer2(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const bool packed) { // Makes sure the dimensions are larger than zero - if (n == 0) { return StatusCode::kInvalidDimension; } + if (n == 0) { throw BLASError(StatusCode::kInvalidDimension); } // The data is either in the upper or lower triangle const auto is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -49,46 +49,36 @@ StatusCode Xher2<T>::DoHer2(const Layout layout, const Triangle triangle, const auto is_rowmajor = (layout == Layout::kRowMajor); // Tests the matrix and the vectors for validity - auto status = StatusCode::kSuccess; - if (packed) { status = TestMatrixAP(n, a_buffer, a_offset); } - else { status = TestMatrixA(n, n, a_buffer, a_offset, a_ld); } - if (ErrorIn(status)) { return status; } - status = TestVectorX(n, x_buffer, x_offset, x_inc); - if (ErrorIn(status)) { return status; } - status = TestVectorY(n, y_buffer, y_offset, y_inc); - if (ErrorIn(status)) { return status; } + if (packed) { TestMatrixAP(n, a_buffer, a_offset); } + else { TestMatrixA(n, n, a_buffer, a_offset, a_ld); } + TestVectorX(n, x_buffer, x_offset, x_inc); + TestVectorY(n, y_buffer, y_offset, y_inc); // Retrieves the kernel from the compiled binary - try { - const auto program = GetProgramFromCache(context_, PrecisionValue<T>(), routine_name_); - auto kernel = Kernel(program, "Xher2"); - - // Sets the kernel arguments - kernel.SetArgument(0, static_cast<int>(n)); - kernel.SetArgument(1, GetRealArg(alpha)); - kernel.SetArgument(2, x_buffer()); - kernel.SetArgument(3, static_cast<int>(x_offset)); - kernel.SetArgument(4, static_cast<int>(x_inc)); - kernel.SetArgument(5, y_buffer()); - kernel.SetArgument(6, static_cast<int>(y_offset)); - kernel.SetArgument(7, static_cast<int>(y_inc)); - kernel.SetArgument(8, a_buffer()); - kernel.SetArgument(9, static_cast<int>(a_offset)); - kernel.SetArgument(10, static_cast<int>(a_ld)); - kernel.SetArgument(11, static_cast<int>(is_upper)); - kernel.SetArgument(12, static_cast<int>(is_rowmajor)); - - // Launches the kernel - auto global_one = Ceil(CeilDiv(n, db_["WPT"]), db_["WGS1"]); - auto global_two = Ceil(CeilDiv(n, db_["WPT"]), db_["WGS2"]); - auto global = std::vector<size_t>{global_one, global_two}; - auto local = std::vector<size_t>{db_["WGS1"], db_["WGS2"]}; - status = RunKernel(kernel, queue_, device_, global, local, event_); - if (ErrorIn(status)) { return status; } - - // Succesfully finished the computation - return StatusCode::kSuccess; - } catch (...) { return StatusCode::kInvalidKernel; } + const auto program = GetProgramFromCache(context_, PrecisionValue<T>(), routine_name_); + auto kernel = Kernel(program, "Xher2"); + + // Sets the kernel arguments + kernel.SetArgument(0, static_cast<int>(n)); + kernel.SetArgument(1, GetRealArg(alpha)); + kernel.SetArgument(2, x_buffer()); + kernel.SetArgument(3, static_cast<int>(x_offset)); + kernel.SetArgument(4, static_cast<int>(x_inc)); + kernel.SetArgument(5, y_buffer()); + kernel.SetArgument(6, static_cast<int>(y_offset)); + kernel.SetArgument(7, static_cast<int>(y_inc)); + kernel.SetArgument(8, a_buffer()); + kernel.SetArgument(9, static_cast<int>(a_offset)); + kernel.SetArgument(10, static_cast<int>(a_ld)); + kernel.SetArgument(11, static_cast<int>(is_upper)); + kernel.SetArgument(12, static_cast<int>(is_rowmajor)); + + // Launches the kernel + auto global_one = Ceil(CeilDiv(n, db_["WPT"]), db_["WGS1"]); + auto global_two = Ceil(CeilDiv(n, db_["WPT"]), db_["WGS2"]); + auto global = std::vector<size_t>{global_one, global_two}; + auto local = std::vector<size_t>{db_["WGS1"], db_["WGS2"]}; + RunKernel(kernel, queue_, device_, global, local, event_); } // ================================================================================================= diff --git a/src/routines/level2/xher2.hpp b/src/routines/level2/xher2.hpp index 8c53c047..dcb2ecb7 100644 --- a/src/routines/level2/xher2.hpp +++ b/src/routines/level2/xher2.hpp @@ -28,13 +28,13 @@ class Xher2: public Routine { Xher2(Queue &queue, EventPointer event, const std::string &name = "HER2"); // Templated-precision implementation of the routine - StatusCode DoHer2(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const bool packed = false); + void DoHer2(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const bool packed = false); }; // ================================================================================================= diff --git a/src/routines/level2/xhpmv.cpp b/src/routines/level2/xhpmv.cpp index e6f82b34..70a0ab0d 100644 --- a/src/routines/level2/xhpmv.cpp +++ b/src/routines/level2/xhpmv.cpp @@ -29,13 +29,13 @@ Xhpmv<T>::Xhpmv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xhpmv<T>::DoHpmv(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &ap_buffer, const size_t ap_offset, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { +void Xhpmv<T>::DoHpmv(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &ap_buffer, const size_t ap_offset, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { // The data is either in the upper or lower triangle size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -45,13 +45,13 @@ StatusCode Xhpmv<T>::DoHpmv(const Layout layout, const Triangle triangle, // The specific hermitian packed matrix-accesses are implemented in the kernel guarded by the // ROUTINE_HPMV define. bool fast_kernels = false; - return MatVec(layout, Transpose::kNo, - n, n, alpha, - ap_buffer, ap_offset, n, - x_buffer, x_offset, x_inc, beta, - y_buffer, y_offset, y_inc, - fast_kernels, fast_kernels, - is_upper, true, 0, 0); + MatVec(layout, Transpose::kNo, + n, n, alpha, + ap_buffer, ap_offset, n, + x_buffer, x_offset, x_inc, beta, + y_buffer, y_offset, y_inc, + fast_kernels, fast_kernels, + is_upper, true, 0, 0); } // ================================================================================================= diff --git a/src/routines/level2/xhpmv.hpp b/src/routines/level2/xhpmv.hpp index b11192f9..13a6277c 100644 --- a/src/routines/level2/xhpmv.hpp +++ b/src/routines/level2/xhpmv.hpp @@ -33,13 +33,13 @@ class Xhpmv: public Xgemv<T> { Xhpmv(Queue &queue, EventPointer event, const std::string &name = "HPMV"); // Templated-precision implementation of the routine - StatusCode DoHpmv(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &ap_buffer, const size_t ap_offset, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); + void DoHpmv(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &ap_buffer, const size_t ap_offset, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); }; // ================================================================================================= diff --git a/src/routines/level2/xhpr.cpp b/src/routines/level2/xhpr.cpp index 225ebfe5..7e517c59 100644 --- a/src/routines/level2/xhpr.cpp +++ b/src/routines/level2/xhpr.cpp @@ -28,17 +28,17 @@ Xhpr<T,U>::Xhpr(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T, typename U> -StatusCode Xhpr<T,U>::DoHpr(const Layout layout, const Triangle triangle, - const size_t n, - const U alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &ap_buffer, const size_t ap_offset) { +void Xhpr<T,U>::DoHpr(const Layout layout, const Triangle triangle, + const size_t n, + const U alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &ap_buffer, const size_t ap_offset) { // Specific Xhpr functionality is implemented in the kernel using defines - return DoHer(layout, triangle, n, alpha, - x_buffer, x_offset, x_inc, - ap_buffer, ap_offset, n, - true); // packed matrix + DoHer(layout, triangle, n, alpha, + x_buffer, x_offset, x_inc, + ap_buffer, ap_offset, n, + true); // packed matrix } // ================================================================================================= diff --git a/src/routines/level2/xhpr.hpp b/src/routines/level2/xhpr.hpp index 37801c68..6ebc220e 100644 --- a/src/routines/level2/xhpr.hpp +++ b/src/routines/level2/xhpr.hpp @@ -31,11 +31,11 @@ class Xhpr: public Xher<T,U> { Xhpr(Queue &queue, EventPointer event, const std::string &name = "HPR"); // Templated-precision implementation of the routine - StatusCode DoHpr(const Layout layout, const Triangle triangle, - const size_t n, - const U alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &ap_buffer, const size_t ap_offset); + void DoHpr(const Layout layout, const Triangle triangle, + const size_t n, + const U alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &ap_buffer, const size_t ap_offset); }; // ================================================================================================= diff --git a/src/routines/level2/xhpr2.cpp b/src/routines/level2/xhpr2.cpp index 85f9d3f9..35daa365 100644 --- a/src/routines/level2/xhpr2.cpp +++ b/src/routines/level2/xhpr2.cpp @@ -28,19 +28,19 @@ Xhpr2<T>::Xhpr2(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xhpr2<T>::DoHpr2(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &ap_buffer, const size_t ap_offset) { +void Xhpr2<T>::DoHpr2(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &ap_buffer, const size_t ap_offset) { // Specific Xhpr2 functionality is implemented in the kernel using defines - return DoHer2(layout, triangle, n, alpha, - x_buffer, x_offset, x_inc, - y_buffer, y_offset, y_inc, - ap_buffer, ap_offset, n, - true); // packed matrix + DoHer2(layout, triangle, n, alpha, + x_buffer, x_offset, x_inc, + y_buffer, y_offset, y_inc, + ap_buffer, ap_offset, n, + true); // packed matrix } // ================================================================================================= diff --git a/src/routines/level2/xhpr2.hpp b/src/routines/level2/xhpr2.hpp index d66dce55..f344fd48 100644 --- a/src/routines/level2/xhpr2.hpp +++ b/src/routines/level2/xhpr2.hpp @@ -31,12 +31,12 @@ class Xhpr2: public Xher2<T> { Xhpr2(Queue &queue, EventPointer event, const std::string &name = "HPR2"); // Templated-precision implementation of the routine - StatusCode DoHpr2(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &ap_buffer, const size_t ap_offset); + void DoHpr2(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &ap_buffer, const size_t ap_offset); }; // ================================================================================================= diff --git a/src/routines/level2/xsbmv.cpp b/src/routines/level2/xsbmv.cpp index 28730899..e47430d1 100644 --- a/src/routines/level2/xsbmv.cpp +++ b/src/routines/level2/xsbmv.cpp @@ -29,13 +29,13 @@ Xsbmv<T>::Xsbmv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xsbmv<T>::DoSbmv(const Layout layout, const Triangle triangle, - const size_t n, const size_t k, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { +void Xsbmv<T>::DoSbmv(const Layout layout, const Triangle triangle, + const size_t n, const size_t k, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { // The data is either in the upper or lower triangle size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -45,13 +45,13 @@ StatusCode Xsbmv<T>::DoSbmv(const Layout layout, const Triangle triangle, // The specific symmetric banded matrix-accesses are implemented in the kernel guarded by the // ROUTINE_SBMV define. bool fast_kernels = false; - return MatVec(layout, Transpose::kNo, - n, n, alpha, - a_buffer, a_offset, a_ld, - x_buffer, x_offset, x_inc, beta, - y_buffer, y_offset, y_inc, - fast_kernels, fast_kernels, - is_upper, false, k, 0); + MatVec(layout, Transpose::kNo, + n, n, alpha, + a_buffer, a_offset, a_ld, + x_buffer, x_offset, x_inc, beta, + y_buffer, y_offset, y_inc, + fast_kernels, fast_kernels, + is_upper, false, k, 0); } // ================================================================================================= diff --git a/src/routines/level2/xsbmv.hpp b/src/routines/level2/xsbmv.hpp index 16c5e9a8..a4542f49 100644 --- a/src/routines/level2/xsbmv.hpp +++ b/src/routines/level2/xsbmv.hpp @@ -33,13 +33,13 @@ class Xsbmv: public Xgemv<T> { Xsbmv(Queue &queue, EventPointer event, const std::string &name = "SBMV"); // Templated-precision implementation of the routine - StatusCode DoSbmv(const Layout layout, const Triangle triangle, - const size_t n, const size_t k, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); + void DoSbmv(const Layout layout, const Triangle triangle, + const size_t n, const size_t k, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); }; // ================================================================================================= diff --git a/src/routines/level2/xspmv.cpp b/src/routines/level2/xspmv.cpp index f6651012..bf1a49e1 100644 --- a/src/routines/level2/xspmv.cpp +++ b/src/routines/level2/xspmv.cpp @@ -29,13 +29,13 @@ Xspmv<T>::Xspmv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xspmv<T>::DoSpmv(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &ap_buffer, const size_t ap_offset, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { +void Xspmv<T>::DoSpmv(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &ap_buffer, const size_t ap_offset, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { // The data is either in the upper or lower triangle size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -45,13 +45,13 @@ StatusCode Xspmv<T>::DoSpmv(const Layout layout, const Triangle triangle, // The specific symmetric packed matrix-accesses are implemented in the kernel guarded by the // ROUTINE_SPMV define. bool fast_kernels = false; - return MatVec(layout, Transpose::kNo, - n, n, alpha, - ap_buffer, ap_offset, n, - x_buffer, x_offset, x_inc, beta, - y_buffer, y_offset, y_inc, - fast_kernels, fast_kernels, - is_upper, true, 0, 0); + MatVec(layout, Transpose::kNo, + n, n, alpha, + ap_buffer, ap_offset, n, + x_buffer, x_offset, x_inc, beta, + y_buffer, y_offset, y_inc, + fast_kernels, fast_kernels, + is_upper, true, 0, 0); } // ================================================================================================= diff --git a/src/routines/level2/xspmv.hpp b/src/routines/level2/xspmv.hpp index a0c69b85..94caa4ac 100644 --- a/src/routines/level2/xspmv.hpp +++ b/src/routines/level2/xspmv.hpp @@ -33,13 +33,13 @@ class Xspmv: public Xgemv<T> { Xspmv(Queue &queue, EventPointer event, const std::string &name = "SPMV"); // Templated-precision implementation of the routine - StatusCode DoSpmv(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &ap_buffer, const size_t ap_offset, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); + void DoSpmv(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &ap_buffer, const size_t ap_offset, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); }; // ================================================================================================= diff --git a/src/routines/level2/xspr.cpp b/src/routines/level2/xspr.cpp index a75fe9c3..56791a7b 100644 --- a/src/routines/level2/xspr.cpp +++ b/src/routines/level2/xspr.cpp @@ -28,17 +28,17 @@ Xspr<T>::Xspr(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xspr<T>::DoSpr(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &ap_buffer, const size_t ap_offset) { +void Xspr<T>::DoSpr(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &ap_buffer, const size_t ap_offset) { // Specific Xspr functionality is implemented in the kernel using defines - return DoHer(layout, triangle, n, alpha, - x_buffer, x_offset, x_inc, - ap_buffer, ap_offset, n, - true); // packed matrix + DoHer(layout, triangle, n, alpha, + x_buffer, x_offset, x_inc, + ap_buffer, ap_offset, n, + true); // packed matrix } // ================================================================================================= diff --git a/src/routines/level2/xspr.hpp b/src/routines/level2/xspr.hpp index 6468c736..760a2ddb 100644 --- a/src/routines/level2/xspr.hpp +++ b/src/routines/level2/xspr.hpp @@ -31,11 +31,11 @@ class Xspr: public Xher<T,T> { Xspr(Queue &queue, EventPointer event, const std::string &name = "SPR"); // Templated-precision implementation of the routine - StatusCode DoSpr(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &ap_buffer, const size_t ap_offset); + void DoSpr(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &ap_buffer, const size_t ap_offset); }; // ================================================================================================= diff --git a/src/routines/level2/xspr2.cpp b/src/routines/level2/xspr2.cpp index c39a2eb4..8d0432c2 100644 --- a/src/routines/level2/xspr2.cpp +++ b/src/routines/level2/xspr2.cpp @@ -28,19 +28,19 @@ Xspr2<T>::Xspr2(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xspr2<T>::DoSpr2(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &ap_buffer, const size_t ap_offset) { +void Xspr2<T>::DoSpr2(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &ap_buffer, const size_t ap_offset) { // Specific Xspr2 functionality is implemented in the kernel using defines - return DoHer2(layout, triangle, n, alpha, - x_buffer, x_offset, x_inc, - y_buffer, y_offset, y_inc, - ap_buffer, ap_offset, n, - true); // packed matrix + DoHer2(layout, triangle, n, alpha, + x_buffer, x_offset, x_inc, + y_buffer, y_offset, y_inc, + ap_buffer, ap_offset, n, + true); // packed matrix } // ================================================================================================= diff --git a/src/routines/level2/xspr2.hpp b/src/routines/level2/xspr2.hpp index 693c56a1..9f03f768 100644 --- a/src/routines/level2/xspr2.hpp +++ b/src/routines/level2/xspr2.hpp @@ -31,12 +31,12 @@ class Xspr2: public Xher2<T> { Xspr2(Queue &queue, EventPointer event, const std::string &name = "SPR2"); // Templated-precision implementation of the routine - StatusCode DoSpr2(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &ap_buffer, const size_t ap_offset); + void DoSpr2(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &ap_buffer, const size_t ap_offset); }; // ================================================================================================= diff --git a/src/routines/level2/xsymv.cpp b/src/routines/level2/xsymv.cpp index 648d2a3e..86bb66b8 100644 --- a/src/routines/level2/xsymv.cpp +++ b/src/routines/level2/xsymv.cpp @@ -29,13 +29,13 @@ Xsymv<T>::Xsymv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xsymv<T>::DoSymv(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { +void Xsymv<T>::DoSymv(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc) { // The data is either in the upper or lower triangle size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -45,13 +45,13 @@ StatusCode Xsymv<T>::DoSymv(const Layout layout, const Triangle triangle, // The specific symmetric matrix-accesses are implemented in the kernel guarded by the // ROUTINE_SYMV define. bool fast_kernels = false; - return MatVec(layout, Transpose::kNo, - n, n, alpha, - a_buffer, a_offset, a_ld, - x_buffer, x_offset, x_inc, beta, - y_buffer, y_offset, y_inc, - fast_kernels, fast_kernels, - is_upper, false, 0, 0); + MatVec(layout, Transpose::kNo, + n, n, alpha, + a_buffer, a_offset, a_ld, + x_buffer, x_offset, x_inc, beta, + y_buffer, y_offset, y_inc, + fast_kernels, fast_kernels, + is_upper, false, 0, 0); } // ================================================================================================= diff --git a/src/routines/level2/xsymv.hpp b/src/routines/level2/xsymv.hpp index 67815f2f..3945802f 100644 --- a/src/routines/level2/xsymv.hpp +++ b/src/routines/level2/xsymv.hpp @@ -33,13 +33,13 @@ class Xsymv: public Xgemv<T> { Xsymv(Queue &queue, EventPointer event, const std::string &name = "SYMV"); // Templated-precision implementation of the routine - StatusCode DoSymv(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const T beta, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); + void DoSymv(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const T beta, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc); }; // ================================================================================================= diff --git a/src/routines/level2/xsyr.cpp b/src/routines/level2/xsyr.cpp index 758d8f8f..64c2dc74 100644 --- a/src/routines/level2/xsyr.cpp +++ b/src/routines/level2/xsyr.cpp @@ -28,16 +28,16 @@ Xsyr<T>::Xsyr(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xsyr<T>::DoSyr(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { +void Xsyr<T>::DoSyr(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { // Specific Xsyr functionality is implemented in the kernel using defines - return DoHer(layout, triangle, n, alpha, - x_buffer, x_offset, x_inc, - a_buffer, a_offset, a_ld); + DoHer(layout, triangle, n, alpha, + x_buffer, x_offset, x_inc, + a_buffer, a_offset, a_ld); } // ================================================================================================= diff --git a/src/routines/level2/xsyr.hpp b/src/routines/level2/xsyr.hpp index 20393454..a23ff80f 100644 --- a/src/routines/level2/xsyr.hpp +++ b/src/routines/level2/xsyr.hpp @@ -31,11 +31,11 @@ class Xsyr: public Xher<T,T> { Xsyr(Queue &queue, EventPointer event, const std::string &name = "SYR"); // Templated-precision implementation of the routine - StatusCode DoSyr(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); + void DoSyr(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); }; // ================================================================================================= diff --git a/src/routines/level2/xsyr2.cpp b/src/routines/level2/xsyr2.cpp index 6f43b219..38ca9d69 100644 --- a/src/routines/level2/xsyr2.cpp +++ b/src/routines/level2/xsyr2.cpp @@ -28,18 +28,18 @@ Xsyr2<T>::Xsyr2(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xsyr2<T>::DoSyr2(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { +void Xsyr2<T>::DoSyr2(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld) { // Specific Xsyr2 functionality is implemented in the kernel using defines - return DoHer2(layout, triangle, n, alpha, - x_buffer, x_offset, x_inc, - y_buffer, y_offset, y_inc, - a_buffer, a_offset, a_ld); + DoHer2(layout, triangle, n, alpha, + x_buffer, x_offset, x_inc, + y_buffer, y_offset, y_inc, + a_buffer, a_offset, a_ld); } // ================================================================================================= diff --git a/src/routines/level2/xsyr2.hpp b/src/routines/level2/xsyr2.hpp index 1a8dcbe8..5a8d8eb4 100644 --- a/src/routines/level2/xsyr2.hpp +++ b/src/routines/level2/xsyr2.hpp @@ -31,12 +31,12 @@ class Xsyr2: public Xher2<T> { Xsyr2(Queue &queue, EventPointer event, const std::string &name = "SYR2"); // Templated-precision implementation of the routine - StatusCode DoSyr2(const Layout layout, const Triangle triangle, - const size_t n, - const T alpha, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, - const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); + void DoSyr2(const Layout layout, const Triangle triangle, + const size_t n, + const T alpha, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc, + const Buffer<T> &y_buffer, const size_t y_offset, const size_t y_inc, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld); }; // ================================================================================================= diff --git a/src/routines/level2/xtbmv.cpp b/src/routines/level2/xtbmv.cpp index e315c544..f4a58ed2 100644 --- a/src/routines/level2/xtbmv.cpp +++ b/src/routines/level2/xtbmv.cpp @@ -29,17 +29,15 @@ Xtbmv<T>::Xtbmv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xtbmv<T>::DoTbmv(const Layout layout, const Triangle triangle, - const Transpose a_transpose, const Diagonal diagonal, - const size_t n, const size_t k, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc) { +void Xtbmv<T>::DoTbmv(const Layout layout, const Triangle triangle, + const Transpose a_transpose, const Diagonal diagonal, + const size_t n, const size_t k, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc) { // Creates a copy of X: a temporary scratch buffer auto scratch_buffer = Buffer<T>(context_, n*x_inc + x_offset); - try { - x_buffer.CopyTo(queue_, n*x_inc + x_offset, scratch_buffer); - } catch (...) { } // Continues: error-code is returned in MatVec + x_buffer.CopyTo(queue_, n*x_inc + x_offset, scratch_buffer); // The data is either in the upper or lower triangle size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -52,20 +50,22 @@ StatusCode Xtbmv<T>::DoTbmv(const Layout layout, const Triangle triangle, // The specific triangular banded matrix-accesses are implemented in the kernel guarded by the // ROUTINE_TBMV define. auto fast_kernels = false; - auto status = MatVec(layout, a_transpose, - n, n, static_cast<T>(1), - a_buffer, a_offset, a_ld, - scratch_buffer, x_offset, x_inc, static_cast<T>(0), - x_buffer, x_offset, x_inc, - fast_kernels, fast_kernels, - parameter, false, k, 0); - - // Returns the proper error code (renames vector Y to X) - switch(status) { - case StatusCode::kInvalidVectorY: return StatusCode::kInvalidVectorX; - case StatusCode::kInvalidIncrementY: return StatusCode::kInvalidIncrementX; - case StatusCode::kInsufficientMemoryY: return StatusCode::kInsufficientMemoryX; - default: return status; + try { + MatVec(layout, a_transpose, + n, n, static_cast<T>(1), + a_buffer, a_offset, a_ld, + scratch_buffer, x_offset, x_inc, static_cast<T>(0), + x_buffer, x_offset, x_inc, + fast_kernels, fast_kernels, + parameter, false, k, 0); + } catch (BLASError &e) { + // Returns the proper error code (renames vector Y to X) + switch (e.status()) { + case StatusCode::kInvalidVectorY: throw BLASError(StatusCode::kInvalidVectorX, e.details()); + case StatusCode::kInvalidIncrementY: throw BLASError(StatusCode::kInvalidIncrementX, e.details()); + case StatusCode::kInsufficientMemoryY: throw BLASError(StatusCode::kInsufficientMemoryX, e.details()); + default: throw; + } } } diff --git a/src/routines/level2/xtbmv.hpp b/src/routines/level2/xtbmv.hpp index 389e9705..abd12db6 100644 --- a/src/routines/level2/xtbmv.hpp +++ b/src/routines/level2/xtbmv.hpp @@ -35,11 +35,11 @@ class Xtbmv: public Xgemv<T> { Xtbmv(Queue &queue, EventPointer event, const std::string &name = "TBMV"); // Templated-precision implementation of the routine - StatusCode DoTbmv(const Layout layout, const Triangle triangle, - const Transpose a_transpose, const Diagonal diagonal, - const size_t n, const size_t k, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc); + void DoTbmv(const Layout layout, const Triangle triangle, + const Transpose a_transpose, const Diagonal diagonal, + const size_t n, const size_t k, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc); }; // ================================================================================================= diff --git a/src/routines/level2/xtpmv.cpp b/src/routines/level2/xtpmv.cpp index 46811089..c0d26699 100644 --- a/src/routines/level2/xtpmv.cpp +++ b/src/routines/level2/xtpmv.cpp @@ -29,17 +29,15 @@ Xtpmv<T>::Xtpmv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xtpmv<T>::DoTpmv(const Layout layout, const Triangle triangle, - const Transpose a_transpose, const Diagonal diagonal, - const size_t n, - const Buffer<T> &ap_buffer, const size_t ap_offset, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc) { +void Xtpmv<T>::DoTpmv(const Layout layout, const Triangle triangle, + const Transpose a_transpose, const Diagonal diagonal, + const size_t n, + const Buffer<T> &ap_buffer, const size_t ap_offset, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc) { // Creates a copy of X: a temporary scratch buffer auto scratch_buffer = Buffer<T>(context_, n*x_inc + x_offset); - try { - x_buffer.CopyTo(queue_, n*x_inc + x_offset, scratch_buffer); - } catch (...) { } // Continues: error-code is returned in MatVec + x_buffer.CopyTo(queue_, n*x_inc + x_offset, scratch_buffer); // The data is either in the upper or lower triangle size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -52,20 +50,22 @@ StatusCode Xtpmv<T>::DoTpmv(const Layout layout, const Triangle triangle, // The specific triangular packed matrix-accesses are implemented in the kernel guarded by the // ROUTINE_TPMV define. auto fast_kernels = false; - auto status = MatVec(layout, a_transpose, - n, n, static_cast<T>(1), - ap_buffer, ap_offset, n, - scratch_buffer, x_offset, x_inc, static_cast<T>(0), - x_buffer, x_offset, x_inc, - fast_kernels, fast_kernels, - parameter, true, 0, 0); - - // Returns the proper error code (renames vector Y to X) - switch(status) { - case StatusCode::kInvalidVectorY: return StatusCode::kInvalidVectorX; - case StatusCode::kInvalidIncrementY: return StatusCode::kInvalidIncrementX; - case StatusCode::kInsufficientMemoryY: return StatusCode::kInsufficientMemoryX; - default: return status; + try { + MatVec(layout, a_transpose, + n, n, static_cast<T>(1), + ap_buffer, ap_offset, n, + scratch_buffer, x_offset, x_inc, static_cast<T>(0), + x_buffer, x_offset, x_inc, + fast_kernels, fast_kernels, + parameter, true, 0, 0); + } catch (BLASError &e) { + // Returns the proper error code (renames vector Y to X) + switch (e.status()) { + case StatusCode::kInvalidVectorY: throw BLASError(StatusCode::kInvalidVectorX, e.details()); + case StatusCode::kInvalidIncrementY: throw BLASError(StatusCode::kInvalidIncrementX, e.details()); + case StatusCode::kInsufficientMemoryY: throw BLASError(StatusCode::kInsufficientMemoryX, e.details()); + default: throw; + } } } diff --git a/src/routines/level2/xtpmv.hpp b/src/routines/level2/xtpmv.hpp index 0e8cf1d2..5b3954e8 100644 --- a/src/routines/level2/xtpmv.hpp +++ b/src/routines/level2/xtpmv.hpp @@ -35,11 +35,11 @@ class Xtpmv: public Xgemv<T> { Xtpmv(Queue &queue, EventPointer event, const std::string &name = "TPMV"); // Templated-precision implementation of the routine - StatusCode DoTpmv(const Layout layout, const Triangle triangle, - const Transpose a_transpose, const Diagonal diagonal, - const size_t n, - const Buffer<T> &ap_buffer, const size_t ap_offset, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc); + void DoTpmv(const Layout layout, const Triangle triangle, + const Transpose a_transpose, const Diagonal diagonal, + const size_t n, + const Buffer<T> &ap_buffer, const size_t ap_offset, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc); }; // ================================================================================================= diff --git a/src/routines/level2/xtrmv.cpp b/src/routines/level2/xtrmv.cpp index d2f24252..5fff9b31 100644 --- a/src/routines/level2/xtrmv.cpp +++ b/src/routines/level2/xtrmv.cpp @@ -29,17 +29,15 @@ Xtrmv<T>::Xtrmv(Queue &queue, EventPointer event, const std::string &name): // The main routine template <typename T> -StatusCode Xtrmv<T>::DoTrmv(const Layout layout, const Triangle triangle, - const Transpose a_transpose, const Diagonal diagonal, - const size_t n, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc) { +void Xtrmv<T>::DoTrmv(const Layout layout, const Triangle triangle, + const Transpose a_transpose, const Diagonal diagonal, + const size_t n, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc) { // Creates a copy of X: a temporary scratch buffer auto scratch_buffer = Buffer<T>(context_, n*x_inc + x_offset); - try { - x_buffer.CopyTo(queue_, n*x_inc + x_offset, scratch_buffer); - } catch (...) { } // Continues: error-code is returned in MatVec + x_buffer.CopyTo(queue_, n*x_inc + x_offset, scratch_buffer); // The data is either in the upper or lower triangle size_t is_upper = ((triangle == Triangle::kUpper && layout != Layout::kRowMajor) || @@ -52,20 +50,22 @@ StatusCode Xtrmv<T>::DoTrmv(const Layout layout, const Triangle triangle, // The specific triangular matrix-accesses are implemented in the kernel guarded by the // ROUTINE_TRMV define. auto fast_kernels = false; - auto status = MatVec(layout, a_transpose, - n, n, static_cast<T>(1), - a_buffer, a_offset, a_ld, - scratch_buffer, x_offset, x_inc, static_cast<T>(0), - x_buffer, x_offset, x_inc, - fast_kernels, fast_kernels, - parameter, false, 0, 0); - - // Returns the proper error code (renames vector Y to X) - switch(status) { - case StatusCode::kInvalidVectorY: return StatusCode::kInvalidVectorX; - case StatusCode::kInvalidIncrementY: return StatusCode::kInvalidIncrementX; - case StatusCode::kInsufficientMemoryY: return StatusCode::kInsufficientMemoryX; - default: return status; + try { + MatVec(layout, a_transpose, + n, n, static_cast<T>(1), + a_buffer, a_offset, a_ld, + scratch_buffer, x_offset, x_inc, static_cast<T>(0), + x_buffer, x_offset, x_inc, + fast_kernels, fast_kernels, + parameter, false, 0, 0); + } catch (BLASError &e) { + // Returns the proper error code (renames vector Y to X) + switch (e.status()) { + case StatusCode::kInvalidVectorY: throw BLASError(StatusCode::kInvalidVectorX, e.details()); + case StatusCode::kInvalidIncrementY: throw BLASError(StatusCode::kInvalidIncrementX, e.details()); + case StatusCode::kInsufficientMemoryY: throw BLASError(StatusCode::kInsufficientMemoryX, e.details()); + default: throw; + } } } diff --git a/src/routines/level2/xtrmv.hpp b/src/routines/level2/xtrmv.hpp index 07dd7841..b028ee68 100644 --- a/src/routines/level2/xtrmv.hpp +++ b/src/routines/level2/xtrmv.hpp @@ -35,11 +35,11 @@ class Xtrmv: public Xgemv<T> { Xtrmv(Queue &queue, EventPointer event, const std::string &name = "TRMV"); // Templated-precision implementation of the routine - StatusCode DoTrmv(const Layout layout, const Triangle triangle, - const Transpose a_transpose, const Diagonal diagonal, - const size_t n, - const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, - const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc); + void DoTrmv(const Layout layout, const Triangle triangle, + const Transpose a_transpose, const Diagonal diagonal, + const size_t n, + const Buffer<T> &a_buffer, const size_t a_offset, const size_t a_ld, + const Buffer<T> &x_buffer, const size_t x_offset, const size_t x_inc); }; // ================================================================================================= |