From afe8852eaae20fbdd3f38e9cac63a9162251d90b Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Fri, 17 Jun 2016 11:29:07 +0200 Subject: Moved the test-for-valid-buffers function from the Routine class to separate functions in a separate file --- src/routines/level1/xamax.cc | 4 ++-- src/routines/level1/xasum.cc | 4 ++-- src/routines/level1/xaxpy.cc | 4 ++-- src/routines/level1/xcopy.cc | 4 ++-- src/routines/level1/xdot.cc | 6 +++--- src/routines/level1/xnrm2.cc | 4 ++-- src/routines/level1/xscal.cc | 2 +- src/routines/level1/xswap.cc | 4 ++-- src/routines/level2/xgemv.cc | 8 ++++---- src/routines/level2/xger.cc | 6 +++--- src/routines/level2/xher.cc | 6 +++--- src/routines/level2/xher2.cc | 8 ++++---- src/routines/level3/xgemm.cc | 6 +++--- src/routines/level3/xhemm.cc | 2 +- src/routines/level3/xher2k.cc | 6 +++--- src/routines/level3/xherk.cc | 4 ++-- src/routines/level3/xsymm.cc | 2 +- src/routines/level3/xsyr2k.cc | 6 +++--- src/routines/level3/xsyrk.cc | 4 ++-- src/routines/level3/xtrmm.cc | 2 +- src/routines/levelx/xomatcopy.cc | 4 ++-- 21 files changed, 48 insertions(+), 48 deletions(-) (limited to 'src/routines') diff --git a/src/routines/level1/xamax.cc b/src/routines/level1/xamax.cc index 335e59bc..9a7d2173 100644 --- a/src/routines/level1/xamax.cc +++ b/src/routines/level1/xamax.cc @@ -49,9 +49,9 @@ StatusCode Xamax::DoAmax(const size_t n, if (n == 0) { return StatusCode::kInvalidDimension; } // Tests the vectors for validity - auto status = TestVectorX(n, x_buffer, x_offset, x_inc, sizeof(T)); + auto status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } - status = TestVectorIndex(1, imax_buffer, imax_offset, sizeof(unsigned int)); + status = TestVectorIndex(1, imax_buffer, imax_offset); if (ErrorIn(status)) { return status; } // Retrieves the Xamax kernels from the compiled binary diff --git a/src/routines/level1/xasum.cc b/src/routines/level1/xasum.cc index e04f7064..3dcaa80a 100644 --- a/src/routines/level1/xasum.cc +++ b/src/routines/level1/xasum.cc @@ -49,9 +49,9 @@ StatusCode Xasum::DoAsum(const size_t n, if (n == 0) { return StatusCode::kInvalidDimension; } // Tests the vectors for validity - auto status = TestVectorX(n, x_buffer, x_offset, x_inc, sizeof(T)); + auto status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } - status = TestVectorDot(1, asum_buffer, asum_offset, sizeof(T)); + status = TestVectorScalar(1, asum_buffer, asum_offset); if (ErrorIn(status)) { return status; } // Retrieves the Xasum kernels from the compiled binary diff --git a/src/routines/level1/xaxpy.cc b/src/routines/level1/xaxpy.cc index 66aa2336..b57001f9 100644 --- a/src/routines/level1/xaxpy.cc +++ b/src/routines/level1/xaxpy.cc @@ -50,9 +50,9 @@ StatusCode Xaxpy::DoAxpy(const size_t n, const T alpha, if (n == 0) { return StatusCode::kInvalidDimension; } // Tests the vectors for validity - auto status = TestVectorX(n, x_buffer, x_offset, x_inc, sizeof(T)); + auto status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } - status = TestVectorY(n, y_buffer, y_offset, y_inc, sizeof(T)); + status = TestVectorY(n, y_buffer, y_offset, y_inc); if (ErrorIn(status)) { return status; } // Determines whether or not the fast-version can be used diff --git a/src/routines/level1/xcopy.cc b/src/routines/level1/xcopy.cc index ff8f5999..273e87a6 100644 --- a/src/routines/level1/xcopy.cc +++ b/src/routines/level1/xcopy.cc @@ -50,9 +50,9 @@ StatusCode Xcopy::DoCopy(const size_t n, if (n == 0) { return StatusCode::kInvalidDimension; } // Tests the vectors for validity - auto status = TestVectorX(n, x_buffer, x_offset, x_inc, sizeof(T)); + auto status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } - status = TestVectorY(n, y_buffer, y_offset, y_inc, sizeof(T)); + status = TestVectorY(n, y_buffer, y_offset, y_inc); if (ErrorIn(status)) { return status; } // Determines whether or not the fast-version can be used diff --git a/src/routines/level1/xdot.cc b/src/routines/level1/xdot.cc index db6a369e..25eccadf 100644 --- a/src/routines/level1/xdot.cc +++ b/src/routines/level1/xdot.cc @@ -51,11 +51,11 @@ StatusCode Xdot::DoDot(const size_t n, if (n == 0) { return StatusCode::kInvalidDimension; } // Tests the vectors for validity - auto status = TestVectorX(n, x_buffer, x_offset, x_inc, sizeof(T)); + auto status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } - status = TestVectorY(n, y_buffer, y_offset, y_inc, sizeof(T)); + status = TestVectorY(n, y_buffer, y_offset, y_inc); if (ErrorIn(status)) { return status; } - status = TestVectorDot(1, dot_buffer, dot_offset, sizeof(T)); + status = TestVectorScalar(1, dot_buffer, dot_offset); if (ErrorIn(status)) { return status; } // Retrieves the Xdot kernels from the compiled binary diff --git a/src/routines/level1/xnrm2.cc b/src/routines/level1/xnrm2.cc index 14f7f6aa..eca283f8 100644 --- a/src/routines/level1/xnrm2.cc +++ b/src/routines/level1/xnrm2.cc @@ -49,9 +49,9 @@ StatusCode Xnrm2::DoNrm2(const size_t n, if (n == 0) { return StatusCode::kInvalidDimension; } // Tests the vectors for validity - auto status = TestVectorX(n, x_buffer, x_offset, x_inc, sizeof(T)); + auto status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } - status = TestVectorDot(1, nrm2_buffer, nrm2_offset, sizeof(T)); + status = TestVectorScalar(1, nrm2_buffer, nrm2_offset); if (ErrorIn(status)) { return status; } // Retrieves the Xnrm2 kernels from the compiled binary diff --git a/src/routines/level1/xscal.cc b/src/routines/level1/xscal.cc index 1207acfa..0ce211b6 100644 --- a/src/routines/level1/xscal.cc +++ b/src/routines/level1/xscal.cc @@ -49,7 +49,7 @@ StatusCode Xscal::DoScal(const size_t n, const T alpha, if (n == 0) { return StatusCode::kInvalidDimension; } // Tests the vector for validity - auto status = TestVectorX(n, x_buffer, x_offset, x_inc, sizeof(T)); + auto status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } // Determines whether or not the fast-version can be used diff --git a/src/routines/level1/xswap.cc b/src/routines/level1/xswap.cc index 8844abff..773d78b5 100644 --- a/src/routines/level1/xswap.cc +++ b/src/routines/level1/xswap.cc @@ -50,9 +50,9 @@ StatusCode Xswap::DoSwap(const size_t n, if (n == 0) { return StatusCode::kInvalidDimension; } // Tests the vectors for validity - auto status = TestVectorX(n, x_buffer, x_offset, x_inc, sizeof(T)); + auto status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } - status = TestVectorY(n, y_buffer, y_offset, y_inc, sizeof(T)); + status = TestVectorY(n, y_buffer, y_offset, y_inc); if (ErrorIn(status)) { return status; } // Determines whether or not the fast-version can be used diff --git a/src/routines/level2/xgemv.cc b/src/routines/level2/xgemv.cc index 71839e96..18e61f28 100644 --- a/src/routines/level2/xgemv.cc +++ b/src/routines/level2/xgemv.cc @@ -101,12 +101,12 @@ StatusCode Xgemv::MatVec(const Layout layout, const Transpose a_transpose, // Tests the matrix and the vectors for validity auto status = StatusCode::kSuccess; - if (packed) { status = TestMatrixAP(n, a_buffer, a_offset, sizeof(T)); } - else { status = TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld, sizeof(T)); } + 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, sizeof(T)); + 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, sizeof(T)); + status = TestVectorY(m_real, y_buffer, y_offset, y_inc); if (ErrorIn(status)) { return status; } // Determines whether or not the fast-version can be used diff --git a/src/routines/level2/xger.cc b/src/routines/level2/xger.cc index d1f98990..7d6fb091 100644 --- a/src/routines/level2/xger.cc +++ b/src/routines/level2/xger.cc @@ -58,11 +58,11 @@ StatusCode Xger::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, sizeof(T)); + 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, sizeof(T)); + status = TestVectorX(m, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } - status = TestVectorY(n, y_buffer, y_offset, y_inc, sizeof(T)); + status = TestVectorY(n, y_buffer, y_offset, y_inc); if (ErrorIn(status)) { return status; } // Upload the scalar argument as a constant buffer to the device (needed for half-precision) diff --git a/src/routines/level2/xher.cc b/src/routines/level2/xher.cc index 73e7a47d..3d5c0baf 100644 --- a/src/routines/level2/xher.cc +++ b/src/routines/level2/xher.cc @@ -67,10 +67,10 @@ StatusCode Xher::DoHer(const Layout layout, const Triangle triangle, // Tests the matrix and the vectors for validity auto status = StatusCode::kSuccess; - if (packed) { status = TestMatrixAP(n, a_buffer, a_offset, sizeof(T)); } - else { status = TestMatrixA(n, n, a_buffer, a_offset, a_ld, sizeof(T)); } + 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, sizeof(T)); + status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } // If alpha is zero an update is not required diff --git a/src/routines/level2/xher2.cc b/src/routines/level2/xher2.cc index a73dde52..a7362410 100644 --- a/src/routines/level2/xher2.cc +++ b/src/routines/level2/xher2.cc @@ -59,12 +59,12 @@ StatusCode Xher2::DoHer2(const Layout layout, const Triangle triangle, // Tests the matrix and the vectors for validity auto status = StatusCode::kSuccess; - if (packed) { status = TestMatrixAP(n, a_buffer, a_offset, sizeof(T)); } - else { status = TestMatrixA(n, n, a_buffer, a_offset, a_ld, sizeof(T)); } + 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, sizeof(T)); + status = TestVectorX(n, x_buffer, x_offset, x_inc); if (ErrorIn(status)) { return status; } - status = TestVectorY(n, y_buffer, y_offset, y_inc, sizeof(T)); + status = TestVectorY(n, y_buffer, y_offset, y_inc); if (ErrorIn(status)) { return status; } // Upload the scalar argument as a constant buffer to the device (needed for half-precision) diff --git a/src/routines/level3/xgemm.cc b/src/routines/level3/xgemm.cc index 42d5f19e..713bed8f 100644 --- a/src/routines/level3/xgemm.cc +++ b/src/routines/level3/xgemm.cc @@ -96,11 +96,11 @@ StatusCode Xgemm::DoGemm(const Layout layout, // matrix A cannot be less than K when rotated, or less than M when not-rotated // matrix B cannot be less than N when rotated, or less than K when not-rotated // matrix C cannot be less than N when rotated, or less than M when not-rotated - auto status = TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld, sizeof(T)); + 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, sizeof(T)); + status = TestMatrixB(b_one, b_two, b_buffer, b_offset, b_ld); if (ErrorIn(status)) { return status; } - status = TestMatrixC(c_one, c_two, c_buffer, c_offset, c_ld, sizeof(T)); + status = TestMatrixC(c_one, c_two, c_buffer, c_offset, c_ld); if (ErrorIn(status)) { return status; } // Calculates the ceiled versions of m, n, and k diff --git a/src/routines/level3/xhemm.cc b/src/routines/level3/xhemm.cc index d2fbf36e..a6e853e9 100644 --- a/src/routines/level3/xhemm.cc +++ b/src/routines/level3/xhemm.cc @@ -45,7 +45,7 @@ StatusCode Xhemm::DoHemm(const Layout layout, const Side side, const Triangle auto k = (side == Side::kLeft) ? m : n; // Checks for validity of the squared A matrix - auto status = TestMatrixA(k, k, a_buffer, a_offset, a_ld, sizeof(T)); + auto status = TestMatrixA(k, k, a_buffer, a_offset, a_ld); if (ErrorIn(status)) { return status; } // Determines which kernel to run based on the layout (the Xgemm kernel assumes column-major as diff --git a/src/routines/level3/xher2k.cc b/src/routines/level3/xher2k.cc index 5ec1f8cd..c891c202 100644 --- a/src/routines/level3/xher2k.cc +++ b/src/routines/level3/xher2k.cc @@ -76,11 +76,11 @@ StatusCode Xher2k::DoHer2k(const Layout layout, const Triangle triangle, co // matrix A cannot be less than N when rotated, or less than K when not-rotated // matrix B cannot be less than N when rotated, or less than K when not-rotated // matrix C cannot be less than N - auto status = TestMatrixA(ab_one, ab_two, a_buffer, a_offset, a_ld, sizeof(T)); + auto status = TestMatrixA(ab_one, ab_two, a_buffer, a_offset, a_ld); if (ErrorIn(status)) { return status; } - status = TestMatrixB(ab_one, ab_two, b_buffer, b_offset, b_ld, sizeof(T)); + status = TestMatrixB(ab_one, ab_two, b_buffer, b_offset, b_ld); if (ErrorIn(status)) { return status; } - status = TestMatrixC(n, n, c_buffer, c_offset, c_ld, sizeof(T)); + status = TestMatrixC(n, n, c_buffer, c_offset, c_ld); if (ErrorIn(status)) { return status; } // Calculates the ceiled versions of n and k diff --git a/src/routines/level3/xherk.cc b/src/routines/level3/xherk.cc index df97a94f..9d64af95 100644 --- a/src/routines/level3/xherk.cc +++ b/src/routines/level3/xherk.cc @@ -75,9 +75,9 @@ StatusCode Xherk::DoHerk(const Layout layout, const Triangle triangle, cons // space. Also tests that the leading dimensions of: // matrix A cannot be less than N when rotated, or less than K when not-rotated // matrix C cannot be less than N - auto status = TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld, sizeof(T)); + auto status = TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld); if (ErrorIn(status)) { return status; } - status = TestMatrixC(n, n, c_buffer, c_offset, c_ld, sizeof(T)); + status = TestMatrixC(n, n, c_buffer, c_offset, c_ld); if (ErrorIn(status)) { return status; } // Calculates the ceiled versions of n and k diff --git a/src/routines/level3/xsymm.cc b/src/routines/level3/xsymm.cc index d88d4653..379e2908 100644 --- a/src/routines/level3/xsymm.cc +++ b/src/routines/level3/xsymm.cc @@ -45,7 +45,7 @@ StatusCode Xsymm::DoSymm(const Layout layout, const Side side, const Triangle auto k = (side == Side::kLeft) ? m : n; // Checks for validity of the squared A matrix - auto status = TestMatrixA(k, k, a_buffer, a_offset, a_ld, sizeof(T)); + auto status = TestMatrixA(k, k, a_buffer, a_offset, a_ld); if (ErrorIn(status)) { return status; } // Determines which kernel to run based on the layout (the Xgemm kernel assumes column-major as diff --git a/src/routines/level3/xsyr2k.cc b/src/routines/level3/xsyr2k.cc index dd7d19fe..886d1e16 100644 --- a/src/routines/level3/xsyr2k.cc +++ b/src/routines/level3/xsyr2k.cc @@ -75,11 +75,11 @@ StatusCode Xsyr2k::DoSyr2k(const Layout layout, const Triangle triangle, cons // matrix A cannot be less than N when rotated, or less than K when not-rotated // matrix B cannot be less than N when rotated, or less than K when not-rotated // matrix C cannot be less than N - auto status = TestMatrixA(ab_one, ab_two, a_buffer, a_offset, a_ld, sizeof(T)); + auto status = TestMatrixA(ab_one, ab_two, a_buffer, a_offset, a_ld); if (ErrorIn(status)) { return status; } - status = TestMatrixB(ab_one, ab_two, b_buffer, b_offset, b_ld, sizeof(T)); + status = TestMatrixB(ab_one, ab_two, b_buffer, b_offset, b_ld); if (ErrorIn(status)) { return status; } - status = TestMatrixC(n, n, c_buffer, c_offset, c_ld, sizeof(T)); + status = TestMatrixC(n, n, c_buffer, c_offset, c_ld); if (ErrorIn(status)) { return status; } // Calculates the ceiled versions of n and k diff --git a/src/routines/level3/xsyrk.cc b/src/routines/level3/xsyrk.cc index b5817b82..000347f3 100644 --- a/src/routines/level3/xsyrk.cc +++ b/src/routines/level3/xsyrk.cc @@ -73,9 +73,9 @@ StatusCode Xsyrk::DoSyrk(const Layout layout, const Triangle triangle, const // space. Also tests that the leading dimensions of: // matrix A cannot be less than N when rotated, or less than K when not-rotated // matrix C cannot be less than N - auto status = TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld, sizeof(T)); + auto status = TestMatrixA(a_one, a_two, a_buffer, a_offset, a_ld); if (ErrorIn(status)) { return status; } - status = TestMatrixC(n, n, c_buffer, c_offset, c_ld, sizeof(T)); + status = TestMatrixC(n, n, c_buffer, c_offset, c_ld); if (ErrorIn(status)) { return status; } // Calculates the ceiled versions of n and k diff --git a/src/routines/level3/xtrmm.cc b/src/routines/level3/xtrmm.cc index 27ecb4ed..c62305aa 100644 --- a/src/routines/level3/xtrmm.cc +++ b/src/routines/level3/xtrmm.cc @@ -44,7 +44,7 @@ StatusCode Xtrmm::DoTrmm(const Layout layout, const Side side, const Triangle auto k = (side == Side::kLeft) ? m : n; // Checks for validity of the triangular A matrix - auto status = TestMatrixA(k, k, a_buffer, a_offset, a_ld, sizeof(T)); + auto status = TestMatrixA(k, k, a_buffer, a_offset, a_ld); if (ErrorIn(status)) { return status; } // Determines which kernel to run based on the layout (the Xgemm kernel assumes column-major as diff --git a/src/routines/levelx/xomatcopy.cc b/src/routines/levelx/xomatcopy.cc index 77fc445f..dcc4e52a 100644 --- a/src/routines/levelx/xomatcopy.cc +++ b/src/routines/levelx/xomatcopy.cc @@ -72,9 +72,9 @@ StatusCode Xomatcopy::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, sizeof(T)); + 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, sizeof(T)); + status = TestMatrixB(b_one, b_two, b_buffer, b_offset, b_ld); if (ErrorIn(status)) { return status; } // Loads the program from the database -- cgit v1.2.3