diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2016-10-22 15:05:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-22 15:05:12 +0200 |
commit | 280698d0767219e174b12e51e8e42b228bbf28e9 (patch) | |
tree | 25db4d2d360cc161ca7d8e563c847faf08a745a0 /src/routines/levelx/xomatcopy.cpp | |
parent | 9b596820d2dd833648706bff505b459c58f45b4b (diff) | |
parent | 56f300607b1d0b81ab3269894fda5a066c46cdeb (diff) |
Merge pull request #117 from intelfx/exceptions
Convert to use C++ exceptions internally
Diffstat (limited to 'src/routines/levelx/xomatcopy.cpp')
-rw-r--r-- | src/routines/levelx/xomatcopy.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/routines/levelx/xomatcopy.cpp b/src/routines/levelx/xomatcopy.cpp index af9080af..875ca7d2 100644 --- a/src/routines/levelx/xomatcopy.cpp +++ b/src/routines/levelx/xomatcopy.cpp @@ -22,27 +22,26 @@ namespace clblast { // Constructor: forwards to base class constructor template <typename T> Xomatcopy<T>::Xomatcopy(Queue &queue, EventPointer event, const std::string &name): - Routine(queue, event, name, {"Copy","Pad","Transpose","Padtranspose"}, PrecisionValue<T>()) { - source_string_ = + Routine(queue, event, name, {"Copy","Pad","Transpose","Padtranspose"}, PrecisionValue<T>(), {}, { #include "../../kernels/level3/level3.opencl" #include "../../kernels/level3/copy_fast.opencl" #include "../../kernels/level3/copy_pad.opencl" #include "../../kernels/level3/transpose_fast.opencl" #include "../../kernels/level3/transpose_pad.opencl" - ; + }) { } // ================================================================================================= // The main routine template <typename T> -StatusCode Xomatcopy<T>::DoOmatcopy(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> &b_buffer, const size_t b_offset, const size_t b_ld) { +void Xomatcopy<T>::DoOmatcopy(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> &b_buffer, const size_t b_offset, const size_t b_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); } // Determines whether to transpose the matrix A const auto transpose = (a_transpose != Transpose::kNo); @@ -63,22 +62,17 @@ StatusCode Xomatcopy<T>::DoOmatcopy(const Layout layout, const Transpose a_trans // Also tests that the leading dimensions of: // matrix A cannot be less than N when rotated, or less than M when not-rotated // matrix B cannot be less than M when rotated, or less than N when not-rotated - auto status = TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld); - if (ErrorIn(status)) { return status; } - status = TestMatrixB(b_one, b_two, b_buffer, b_offset, b_ld); - if (ErrorIn(status)) { return status; } + TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld); + TestMatrixB(b_one, b_two, b_buffer, b_offset, b_ld); // Loads the program from the database const auto program = GetProgramFromCache(context_, PrecisionValue<T>(), routine_name_); auto emptyEventList = std::vector<Event>(); - status = PadCopyTransposeMatrix(queue_, device_, db_, event_, emptyEventList, - a_one, a_two, a_ld, a_offset, a_buffer, - b_one, b_two, b_ld, b_offset, b_buffer, - alpha, program, false, transpose, conjugate); - if (ErrorIn(status)) { return status; } - - return StatusCode::kSuccess; + PadCopyTransposeMatrix(queue_, device_, db_, event_, emptyEventList, + a_one, a_two, a_ld, a_offset, a_buffer, + b_one, b_two, b_ld, b_offset, b_buffer, + alpha, program, false, transpose, conjugate); } // ================================================================================================= |