GTestSuite: BLAS3 thresholds

Modify thresholds to reflect number of operations that
accumulate results into each output element. Different
limits are set for early return and special cases.

Constants are still subject to experimentation and change.

AMD-Internal: [CPUPL-4378]
Change-Id: I03cd8901e574f2e44e85ce8b0bc234e36edb4819
This commit is contained in:
Edward Smyth
2024-01-15 09:29:14 -05:00
parent ccf3910209
commit bcae225517
64 changed files with 999 additions and 289 deletions

View File

@@ -113,8 +113,19 @@ TEST_P(cgemmEVT, NaNInfCheck)
gtint_t ldb_inc = std::get<18>(GetParam());
gtint_t ldc_inc = std::get<19>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------

View File

@@ -77,7 +77,20 @@ TEST_P(cgemmAPI, FunctionalTest)
gtint_t ldb_inc = std::get<9>(GetParam());
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------

View File

@@ -102,7 +102,17 @@ TEST_P(DGEMMEVT, ExceptionValueTest)
gtint_t ldc_inc = std::get<19>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -490,4 +500,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(gtint_t(0)) // increment to the leading dim of c
),
::DGEMMEVMatPrint()
);
);

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -81,7 +81,18 @@ TEST_P(DGEMMTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//thresh = (15*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -96,8 +96,17 @@ TEST_P(DGEMMOvrUndr, OverflowUnderflow)
gtint_t bi = std::get<15>(GetParam());
gtint_t bj = std::get<16>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -476,4 +485,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(105) // bj
),
::DGEMMOUTestPrint()
);
);

View File

@@ -97,8 +97,20 @@ TEST_P(sgemmEVT, NaNInfCheck)
gtint_t lda_inc = std::get<17>(GetParam());
gtint_t ldb_inc = std::get<18>(GetParam());
gtint_t ldc_inc = std::get<19>(GetParam());
// Set the threshold for the errors:
float thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -81,7 +81,18 @@ TEST_P(SGemm, FunctionalTest)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//thresh = (24*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -106,7 +106,18 @@ TEST_P(ZGEMMEVT, NaNInfCheck)
gtint_t ldc_inc = std::get<19>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -80,7 +80,18 @@ TEST_P(ZGEMMAPI, FunctionalTest)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//thresh = (15*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -383,4 +394,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(gtint_t(0), gtint_t(500)) // increment to the leading dim of c
),
::ZGEMMPrint()
);
);

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -85,8 +85,19 @@ TEST_P(DGemmComputeTest, RandomData)
gtint_t ldc_inc = std::get<12>(GetParam());
// Set the threshold for the errors:
double intermediate = (double)m*n*k;
double thresh = 10*intermediate*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//thresh = (7*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -86,8 +86,18 @@ TEST_P(SGemmComputeTest, RandomData)
gtint_t ldc_inc = std::get<12>(GetParam());
// Set the threshold for the errors:
float intermediate = (float)m*n*k;
float thresh = 10*intermediate*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//thresh = (8*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -81,7 +81,18 @@ TEST_P(cgemmtTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 10*n*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemmt.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -85,7 +85,17 @@ TEST_P( dgemmtEVT, NaNInfCheck )
T cexval = std::get<13>(GetParam());
// Set the threshold for the errors:
double thresh = 10*n*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemmt.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -83,7 +83,17 @@ TEST_P(dgemmtAPI, FunctionalTest)
bool is_mem_test = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = 10*n*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemmt.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -81,7 +81,17 @@ TEST_P(sgemmtTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 10*n*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemmt.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.s
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -81,7 +81,18 @@ TEST_P(zgemmtTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = (std::max)(n,k)*testinghelpers::getEpsilon<T>();
// Check gtestsuite gemmt.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -83,7 +83,21 @@ TEST_P(chemmTest, RandomData)
gtint_t ldc_inc = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite hemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -83,7 +83,21 @@ TEST_P(zhemmTest, RandomData)
gtint_t ldc_inc = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite hemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -64,9 +64,9 @@ TEST_P(cher2kTest, RandomData)
char transa = std::get<2>(GetParam());
// denotes whether matrix b is n,c,t,h
char transb = std::get<3>(GetParam());
// matrix size m
gtint_t m = std::get<4>(GetParam());
// matrix size n
gtint_t n = std::get<4>(GetParam());
// matrix size k
gtint_t k = std::get<5>(GetParam());
// specifies alpha value
T alpha = std::get<6>(GetParam());
@@ -80,12 +80,22 @@ TEST_P(cher2kTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 2*m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite her2k.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) && (beta == 0.0f || beta == 1.0f))
thresh = 0.0;
else
thresh = (6*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_her2k<T>( storage, uplo, transa, transb, m, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
test_her2k<T>( storage, uplo, transa, transb, n, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
}
class cher2kTestPrint {
@@ -96,7 +106,7 @@ public:
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
char tsb = std::get<3>(str.param);
gtint_t m = std::get<4>(str.param);
gtint_t n = std::get<4>(str.param);
gtint_t k = std::get<5>(str.param);
scomplex alpha = std::get<6>(str.param);
float beta = std::get<7>(str.param);
@@ -113,7 +123,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa + tsb;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha.real > 0) ? std::to_string(int(alpha.real)) : ("m" + std::to_string(int(std::abs(alpha.real))));
alpha_str = alpha_str + "pi" + (( alpha.imag > 0) ? std::to_string(int(alpha.imag)) : ("m" + std::to_string(int(std::abs(alpha.imag)))));
@@ -140,8 +150,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n'), // transa
::testing::Values('n'), // transb
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values(scomplex{2.0, -1.0}, scomplex{-2.0, 3.0}), // alpha
::testing::Values(-3.0, 2.0), // beta
::testing::Values(gtint_t(0), gtint_t(5)), // increment to the leading dim of a

View File

@@ -47,7 +47,7 @@
the matrix multiplication
* @param[in] transb specifies the form of op( B ) to be used in
the matrix multiplication
* @param[in] m specifies the number of rows and cols of the matrix
* @param[in] n specifies the number of rows and cols of the matrix
op( A ) and rows of the matrix C and B
* @param[in] k specifies the number of columns of the matrix
op( B ) and the number of columns of the matrix C
@@ -65,20 +65,20 @@
*/
template<typename T, typename RT = typename testinghelpers::type_info<T>::real_type>
static void her2k_(char uplo, char transa, gtint_t m, gtint_t k, T* alpha,
static void her2k_(char uplo, char transa, gtint_t n, gtint_t k, T* alpha,
T* ap, gtint_t lda, T* bp, gtint_t ldb, RT* beta, T* cp, gtint_t ldc )
{
if constexpr (std::is_same<T, scomplex>::value)
cher2k_( &uplo, &transa, &m, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
cher2k_( &uplo, &transa, &n, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
else if constexpr (std::is_same<T, dcomplex>::value)
zher2k_( &uplo, &transa, &m, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
zher2k_( &uplo, &transa, &n, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
else
throw std::runtime_error("Error in testsuite/level3/her2k.h: Invalid typename in her2k_().");
}
template<typename T, typename RT = typename testinghelpers::type_info<T>::real_type>
static void cblas_her2k(char storage, char uplo, char transa,
gtint_t m, gtint_t k, T* alpha, T* ap, gtint_t lda,
gtint_t n, gtint_t k, T* alpha, T* ap, gtint_t lda,
T* bp, gtint_t ldb, RT* beta, T* cp, gtint_t ldc)
{
enum CBLAS_ORDER cblas_order;
@@ -90,16 +90,16 @@ static void cblas_her2k(char storage, char uplo, char transa,
testinghelpers::char_to_cblas_trans( transa, &cblas_transa );
if constexpr (std::is_same<T, scomplex>::value)
cblas_cher2k( cblas_order, cblas_uplo, cblas_transa, m, k, alpha, ap, lda, bp, ldb, *beta, cp, ldc );
cblas_cher2k( cblas_order, cblas_uplo, cblas_transa, n, k, alpha, ap, lda, bp, ldb, *beta, cp, ldc );
else if constexpr (std::is_same<T, dcomplex>::value)
cblas_zher2k( cblas_order, cblas_uplo, cblas_transa, m, k, alpha, ap, lda, bp, ldb, *beta, cp, ldc );
cblas_zher2k( cblas_order, cblas_uplo, cblas_transa, n, k, alpha, ap, lda, bp, ldb, *beta, cp, ldc );
else
throw std::runtime_error("Error in testsuite/level3/her2k.h: Invalid typename in cblas_her2k().");
}
template<typename T, typename RT = typename testinghelpers::type_info<T>::real_type>
static void typed_her2k(char storage, char uplo, char trnsa, char trnsb,
gtint_t m, gtint_t k, T* alpha, T* ap, gtint_t lda,
gtint_t n, gtint_t k, T* alpha, T* ap, gtint_t lda,
T* bp, gtint_t ldb, RT* beta, T* cp, gtint_t ldc)
{
trans_t transa, transb;
@@ -114,7 +114,7 @@ static void typed_her2k(char storage, char uplo, char trnsa, char trnsb,
rsa=rsb=rsc=1;
csa=csb=csc=1;
/* a = m x k b = k x n c = m x n */
/* a = n x k b = k x n c = n x n */
if( (storage == 'c') || (storage == 'C') ) {
csa = lda ;
csb = ldb ;
@@ -127,19 +127,19 @@ static void typed_her2k(char storage, char uplo, char trnsa, char trnsb,
}
if constexpr (std::is_same<T, float>::value)
bli_sher2k( blis_uplo, transa, transb, m, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
bli_sher2k( blis_uplo, transa, transb, n, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
else if constexpr (std::is_same<T, double>::value)
bli_dher2k( blis_uplo, transa, transb, m, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
bli_dher2k( blis_uplo, transa, transb, n, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
else if constexpr (std::is_same<T, scomplex>::value)
bli_cher2k( blis_uplo, transa, transb, m, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
bli_cher2k( blis_uplo, transa, transb, n, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
else if constexpr (std::is_same<T, dcomplex>::value)
bli_zher2k( blis_uplo, transa, transb, m, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
bli_zher2k( blis_uplo, transa, transb, n, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
else
throw std::runtime_error("Error in testsuite/level3/her2k.h: Invalid typename in typed_her2k().");
}
template<typename T, typename RT = typename testinghelpers::type_info<T>::real_type>
static void her2k( char storage, char uplo, char transa, char transb, gtint_t m, gtint_t k,
static void her2k( char storage, char uplo, char transa, char transb, gtint_t n, gtint_t k,
T* alpha, T* ap, gtint_t lda, T* bp, gtint_t ldb, RT* beta, T* cp, gtint_t ldc )
{
@@ -152,14 +152,14 @@ static void her2k( char storage, char uplo, char transa, char transb, gtint_t m,
#ifdef TEST_BLAS
if( storage == 'c' || storage == 'C' )
her2k_<T>( uplo, transa, m, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
her2k_<T>( uplo, transa, n, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
else
throw std::runtime_error("Error in testsuite/level3/her2k.h: BLAS interface cannot be tested for row-major order.");
#elif TEST_CBLAS
cblas_her2k<T>( storage, uplo, transa, m, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
cblas_her2k<T>( storage, uplo, transa, n, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
#elif TEST_BLIS_TYPED
typed_her2k<T>( storage, uplo, transa, transb, m, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
typed_her2k<T>( storage, uplo, transa, transb, n, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
#else
throw std::runtime_error("Error in testsuite/level3/her2k.h: No interfaces are set to be tested.");
#endif

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -42,23 +42,23 @@
template<typename T, typename RT = typename testinghelpers::type_info<T>::real_type>
void test_her2k( char storage, char uplo, char transa, char transb,
gtint_t m, gtint_t k, gtint_t lda_inc, gtint_t ldb_inc, gtint_t ldc_inc,
gtint_t n, gtint_t k, gtint_t lda_inc, gtint_t ldb_inc, gtint_t ldc_inc,
T alpha, RT beta, double thresh )
{
// Compute the leading dimensions of a, b, and c.
gtint_t lda = testinghelpers::get_leading_dimension( storage, transa, m, k, lda_inc );
gtint_t ldb = testinghelpers::get_leading_dimension( storage, transb, m, k, ldb_inc );
gtint_t ldc = testinghelpers::get_leading_dimension( storage, 'n', m, m, ldc_inc );
gtint_t lda = testinghelpers::get_leading_dimension( storage, transa, n, k, lda_inc );
gtint_t ldb = testinghelpers::get_leading_dimension( storage, transb, n, k, ldb_inc );
gtint_t ldc = testinghelpers::get_leading_dimension( storage, 'n', n, n, ldc_inc );
//----------------------------------------------------------
// Initialize matrics with random numbers
//----------------------------------------------------------
std::vector<T> a = testinghelpers::get_random_matrix<T>( -2, 8, storage, transa, m, k, lda );
std::vector<T> b = testinghelpers::get_random_matrix<T>( -5, 2, storage, transb, m, k, ldb );
std::vector<T> a = testinghelpers::get_random_matrix<T>( -2, 8, storage, transa, n, k, lda );
std::vector<T> b = testinghelpers::get_random_matrix<T>( -5, 2, storage, transb, n, k, ldb );
// Since matrix C, stored in c, is symmetric and we only use the upper or lower
// part in the computation of her2k and zero-out the rest to ensure
// that code operates as expected.
std::vector<T> c = testinghelpers::get_random_matrix<T>(-3, 5, storage, uplo, m, ldc );
std::vector<T> c = testinghelpers::get_random_matrix<T>(-3, 5, storage, uplo, n, ldc );
// Create a copy of c so that we can check reference results.
std::vector<T> c_ref(c);
@@ -66,17 +66,17 @@ void test_her2k( char storage, char uplo, char transa, char transb,
//----------------------------------------------------------
// Call BLIS function
//----------------------------------------------------------
her2k<T>( storage, uplo, transa, transb, m, k, &alpha, a.data(), lda,
her2k<T>( storage, uplo, transa, transb, n, k, &alpha, a.data(), lda,
b.data(), ldb, &beta, c.data(), ldc );
//----------------------------------------------------------
// Call reference implementation.
//----------------------------------------------------------
testinghelpers::ref_her2k<T>( storage, uplo, transa, transb, m, k, &alpha,
testinghelpers::ref_her2k<T>( storage, uplo, transa, transb, n, k, &alpha,
a.data(), lda, b.data(), ldb, beta, c_ref.data(), ldc );
//----------------------------------------------------------
// check component-wise error.
//----------------------------------------------------------
computediff<T>( storage, m, m, c.data(), c_ref.data(), ldc, thresh );
computediff<T>( storage, n, n, c.data(), c_ref.data(), ldc, thresh );
}

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -64,9 +64,9 @@ TEST_P(zher2kTest, RandomData)
char transa = std::get<2>(GetParam());
// denotes whether matrix b is n,c,t,h
char transb = std::get<3>(GetParam());
// matrix size m
gtint_t m = std::get<4>(GetParam());
// matrix size n
gtint_t n = std::get<4>(GetParam());
// matrix size k
gtint_t k = std::get<5>(GetParam());
// specifies alpha value
T alpha = std::get<6>(GetParam());
@@ -80,12 +80,22 @@ TEST_P(zher2kTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 2*m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite her2k.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) && (beta == 0.0 || beta == 1.0))
thresh = 0.0;
else
thresh = (6*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_her2k<T>( storage, uplo, transa, transb, m, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
test_her2k<T>( storage, uplo, transa, transb, n, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
}
class zher2kTestPrint {
@@ -96,7 +106,7 @@ public:
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
char tsb = std::get<3>(str.param);
gtint_t m = std::get<4>(str.param);
gtint_t n = std::get<4>(str.param);
gtint_t k = std::get<5>(str.param);
dcomplex alpha = std::get<6>(str.param);
double beta = std::get<7>(str.param);
@@ -113,7 +123,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa + tsb;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha.real > 0) ? std::to_string(int(alpha.real)) : ("m" + std::to_string(int(std::abs(alpha.real))));
alpha_str = alpha_str + "pi" + (( alpha.imag > 0) ? std::to_string(int(alpha.imag)) : ("m" + std::to_string(int(std::abs(alpha.imag)))));
@@ -140,8 +150,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n'), // transa
::testing::Values('n'), // transb
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values(dcomplex{2.0, -1.0}, dcomplex{-2.0, 3.0}), // alpha
::testing::Values(4.0, -1.0), // beta
::testing::Values(gtint_t(0), gtint_t(3)), // increment to the leading dim of a

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -60,8 +60,8 @@ TEST_P(cherkTest, RandomData)
char uplo = std::get<1>(GetParam());
// denotes whether matrix a is n,c,t,h
char transa = std::get<2>(GetParam());
// matrix size m
gtint_t m = std::get<3>(GetParam());
// matrix size n
gtint_t n = std::get<3>(GetParam());
// matrix size k
gtint_t k = std::get<4>(GetParam());
// specifies alpha value
@@ -75,12 +75,22 @@ TEST_P(cherkTest, RandomData)
gtint_t ldc_inc = std::get<8>(GetParam());
// Set the threshold for the errors:
double thresh = m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite herk.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == 0.0f || k == 0) && (beta == 0.0f || beta == 1.0f))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_herk<T>( storage, uplo, transa, m, k, lda_inc, ldc_inc, alpha, beta, thresh );
test_herk<T>( storage, uplo, transa, n, k, lda_inc, ldc_inc, alpha, beta, thresh );
}
class cherkTestPrint {
@@ -90,7 +100,7 @@ public:
char sfm = std::get<0>(str.param);
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
gtint_t m = std::get<3>(str.param);
gtint_t n = std::get<3>(str.param);
gtint_t k = std::get<4>(str.param);
float alpha = std::get<5>(str.param);
float beta = std::get<6>(str.param);
@@ -106,7 +116,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha > 0) ? std::to_string(int(alpha)) : "m" + std::to_string(int(std::abs(alpha)));
str_name = str_name + "_a" + alpha_str;
@@ -130,8 +140,8 @@ INSTANTIATE_TEST_SUITE_P(
), // storage format
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n','c'), // transa
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values(-2.0, 3.0), // alpha
::testing::Values(4.0, -1.0), // beta
::testing::Values(gtint_t(0), gtint_t(2)), // increment to the leading dim of a

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -41,39 +41,39 @@
#include <algorithm>
template<typename T, typename RT = typename testinghelpers::type_info<T>::real_type>
void test_herk( char storage, char uplo, char transa, gtint_t m, gtint_t k,
void test_herk( char storage, char uplo, char transa, gtint_t n, gtint_t k,
gtint_t lda_inc, gtint_t ldc_inc, RT alpha, RT beta, double thresh )
{
// Compute the leading dimensions of a, b, and c.
gtint_t lda = testinghelpers::get_leading_dimension( storage, transa, m, k, lda_inc );
gtint_t ldc = testinghelpers::get_leading_dimension( storage, 'n', m, m, ldc_inc );
gtint_t lda = testinghelpers::get_leading_dimension( storage, transa, n, k, lda_inc );
gtint_t ldc = testinghelpers::get_leading_dimension( storage, 'n', n, n, ldc_inc );
//----------------------------------------------------------
// Initialize matrics with random integer numbers.
//----------------------------------------------------------
std::vector<T> a = testinghelpers::get_random_matrix<T>( -5, 2, storage, transa, m, k, lda );
std::vector<T> a = testinghelpers::get_random_matrix<T>( -5, 2, storage, transa, n, k, lda );
// Since matrix C, stored in c, is symmetric, we only use the upper or lower
// part in the computation of herk and zero-out the rest to ensure
// that code operates as expected.
std::vector<T> c = testinghelpers::get_random_matrix<T>( -8, 12, storage, uplo, m, ldc );
std::vector<T> c = testinghelpers::get_random_matrix<T>( -8, 12, storage, uplo, n, ldc );
// Create a copy of c so that we can check reference results.
std::vector<T> c_ref(c);
//----------------------------------------------------------
// Call BLIS function
//----------------------------------------------------------
herk<T>( storage, uplo, transa, m, k, &alpha, a.data(), lda,
herk<T>( storage, uplo, transa, n, k, &alpha, a.data(), lda,
&beta, c.data(), ldc );
//----------------------------------------------------------
// Call reference implementation.
//----------------------------------------------------------
testinghelpers::ref_herk<T>( storage, uplo, transa, m, k, alpha,
testinghelpers::ref_herk<T>( storage, uplo, transa, n, k, alpha,
a.data(), lda, beta, c_ref.data(), ldc );
//----------------------------------------------------------
// check component-wise error.
//----------------------------------------------------------
computediff<T>( storage, m, m, c.data(), c_ref.data(), ldc, thresh );
computediff<T>( storage, n, n, c.data(), c_ref.data(), ldc, thresh );
}

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -60,8 +60,8 @@ TEST_P(zherkTest, RandomData)
char uplo = std::get<1>(GetParam());
// denotes whether matrix a is n,c,t,h
char transa = std::get<2>(GetParam());
// matrix size m
gtint_t m = std::get<3>(GetParam());
// matrix size n
gtint_t n = std::get<3>(GetParam());
// matrix size k
gtint_t k = std::get<4>(GetParam());
// specifies alpha value
@@ -75,12 +75,22 @@ TEST_P(zherkTest, RandomData)
gtint_t ldc_inc = std::get<8>(GetParam());
// Set the threshold for the errors:
double thresh = m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite herk.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == 0.0 || k == 0) && (beta == 0.0 || beta == 1.0))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_herk<T>( storage, uplo, transa, m, k, lda_inc, ldc_inc, alpha, beta, thresh );
test_herk<T>( storage, uplo, transa, n, k, lda_inc, ldc_inc, alpha, beta, thresh );
}
class zherkTestPrint {
@@ -90,7 +100,7 @@ public:
char sfm = std::get<0>(str.param);
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
gtint_t m = std::get<3>(str.param);
gtint_t n = std::get<3>(str.param);
gtint_t k = std::get<4>(str.param);
double alpha = std::get<5>(str.param);
double beta = std::get<6>(str.param);
@@ -106,7 +116,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha > 0) ? std::to_string(int(alpha)) : "m" + std::to_string(int(std::abs(alpha)));
str_name = str_name + "_a" + alpha_str;
@@ -130,8 +140,8 @@ INSTANTIATE_TEST_SUITE_P(
), // storage format
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n','c'), // transa
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values(2.0, -1.0), // alpha
::testing::Values(-3.0, 2.0), // beta
::testing::Values(gtint_t(0), gtint_t(4)), // increment to the leading dim of a

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -83,7 +83,21 @@ TEST_P(csymmTest, RandomData)
gtint_t ldc_inc = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite symm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -83,7 +83,20 @@ TEST_P(dsymmTest, RandomData)
gtint_t ldc_inc = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = 30*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite symm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -83,7 +83,20 @@ TEST_P(ssymmTest, RandomData)
gtint_t ldc_inc = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = 8*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite symm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -83,7 +83,21 @@ TEST_P(zsymmTest, RandomData)
gtint_t ldc_inc = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite symm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -63,9 +63,9 @@ TEST_P(csyr2kTest, RandomData)
char transa = std::get<2>(GetParam());
// denotes whether matrix b is n,c,t,h
char transb = std::get<3>(GetParam());
// matrix size m
gtint_t m = std::get<4>(GetParam());
// matrix size n
gtint_t n = std::get<4>(GetParam());
// matrix size k
gtint_t k = std::get<5>(GetParam());
// specifies alpha value
T alpha = std::get<6>(GetParam());
@@ -79,12 +79,23 @@ TEST_P(csyr2kTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite syr2k.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (6*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_syr2k<T>( storage, uplo, transa, transb, m, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
test_syr2k<T>( storage, uplo, transa, transb, n, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
}
class csyr2kTestPrint {
@@ -95,7 +106,7 @@ public:
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
char tsb = std::get<3>(str.param);
gtint_t m = std::get<4>(str.param);
gtint_t n = std::get<4>(str.param);
gtint_t k = std::get<5>(str.param);
scomplex alpha = std::get<6>(str.param);
scomplex beta = std::get<7>(str.param);
@@ -112,7 +123,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa + tsb;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha.real > 0) ? std::to_string(int(alpha.real)) : ("m" + std::to_string(int(std::abs(alpha.real))));
alpha_str = alpha_str + "pi" + (( alpha.imag > 0) ? std::to_string(int(alpha.imag)) : ("m" + std::to_string(int(std::abs(alpha.imag)))));
@@ -140,8 +151,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n'), // transa
::testing::Values('n'), // transb
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values(scomplex{2.0, -1.0}, scomplex{-2.0, 3.0}), // alpha
::testing::Values(scomplex{-3.0, 2.0}, scomplex{4.0, -1.0}), // beta
::testing::Values(gtint_t(0), gtint_t(2)), // increment to the leading dim of a

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -63,9 +63,9 @@ TEST_P(dsyr2kTest, RandomData)
char transa = std::get<2>(GetParam());
// denotes whether matrix b is n,c,t,h
char transb = std::get<3>(GetParam());
// matrix size m
gtint_t m = std::get<4>(GetParam());
// matrix size n
gtint_t n = std::get<4>(GetParam());
// matrix size k
gtint_t k = std::get<5>(GetParam());
// specifies alpha value
T alpha = std::get<6>(GetParam());
@@ -79,12 +79,22 @@ TEST_P(dsyr2kTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite syr2k.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (6*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_syr2k<T>( storage, uplo, transa, transb, m, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
test_syr2k<T>( storage, uplo, transa, transb, n, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
}
class dsyr2kTestPrint {
@@ -95,7 +105,7 @@ public:
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
char tsb = std::get<3>(str.param);
gtint_t m = std::get<4>(str.param);
gtint_t n = std::get<4>(str.param);
gtint_t k = std::get<5>(str.param);
double alpha = std::get<6>(str.param);
double beta = std::get<7>(str.param);
@@ -112,7 +122,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa + tsb;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha > 0) ? std::to_string(int(alpha)) : "m" + std::to_string(int(std::abs(alpha)));
str_name = str_name + "_a" + alpha_str;
@@ -138,8 +148,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n'), // transa
::testing::Values('n'), // transb
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values( 1.0, -2.0), // alpha
::testing::Values(-1.0, 1.0), // beta
::testing::Values(gtint_t(0), gtint_t(4)), // increment to the leading dim of a

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -63,9 +63,9 @@ TEST_P(ssyr2kTest, RandomData)
char transa = std::get<2>(GetParam());
// denotes whether matrix b is n,c,t,h
char transb = std::get<3>(GetParam());
// matrix size m
gtint_t m = std::get<4>(GetParam());
// matrix size n
gtint_t n = std::get<4>(GetParam());
// matrix size k
gtint_t k = std::get<5>(GetParam());
// specifies alpha value
T alpha = std::get<6>(GetParam());
@@ -79,12 +79,22 @@ TEST_P(ssyr2kTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = 10*m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite syr2k.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (6*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_syr2k<T>( storage, uplo, transa, transb, m, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
test_syr2k<T>( storage, uplo, transa, transb, n, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
}
class ssyr2kTestPrint {
@@ -95,7 +105,7 @@ public:
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
char tsb = std::get<3>(str.param);
gtint_t m = std::get<4>(str.param);
gtint_t n = std::get<4>(str.param);
gtint_t k = std::get<5>(str.param);
float alpha = std::get<6>(str.param);
float beta = std::get<7>(str.param);
@@ -112,7 +122,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa + tsb;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha > 0) ? std::to_string(int(alpha)) : "m" + std::to_string(int(std::abs(alpha)));
str_name = str_name + "_a" + alpha_str;
@@ -138,8 +148,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n'), // transa
::testing::Values('n'), // transb
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values( 1.0, -2.0), // alpha
::testing::Values(-1.0, 1.0), // beta
::testing::Values(gtint_t(0), gtint_t(7)), // increment to the leading dim of a

View File

@@ -47,7 +47,7 @@
the matrix multiplication
* @param[in] transb specifies the form of op( B ) to be used in
the matrix multiplication
* @param[in] m specifies the number of rows and cols of the matrix
* @param[in] n specifies the number of rows and cols of the matrix
op( A ) and rows of the matrix C and B
* @param[in] k specifies the number of columns of the matrix
op( B ) and the number of columns of the matrix C
@@ -65,24 +65,24 @@
*/
template<typename T>
static void syr2k_(char uplo, char transa, gtint_t m, gtint_t k, T* alpha,
static void syr2k_(char uplo, char transa, gtint_t n, gtint_t k, T* alpha,
T* ap, gtint_t lda, T* bp, gtint_t ldb, T* beta, T* cp, gtint_t ldc )
{
if constexpr (std::is_same<T, float>::value)
ssyr2k_( &uplo, &transa, &m, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
ssyr2k_( &uplo, &transa, &n, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
else if constexpr (std::is_same<T, double>::value)
dsyr2k_( &uplo, &transa, &m, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
dsyr2k_( &uplo, &transa, &n, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
else if constexpr (std::is_same<T, scomplex>::value)
csyr2k_( &uplo, &transa, &m, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
csyr2k_( &uplo, &transa, &n, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
else if constexpr (std::is_same<T, dcomplex>::value)
zsyr2k_( &uplo, &transa, &m, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
zsyr2k_( &uplo, &transa, &n, &k, alpha, ap, &lda, bp, &ldb, beta, cp, &ldc );
else
throw std::runtime_error("Error in testsuite/level3/syr2k.h: Invalid typename in syr2k_().");
}
template<typename T>
static void cblas_syr2k(char storage, char uplo, char transa,
gtint_t m, gtint_t k, T* alpha, T* ap, gtint_t lda,
gtint_t n, gtint_t k, T* alpha, T* ap, gtint_t lda,
T* bp, gtint_t ldb, T* beta, T* cp, gtint_t ldc)
{
enum CBLAS_ORDER cblas_order;
@@ -94,20 +94,20 @@ static void cblas_syr2k(char storage, char uplo, char transa,
testinghelpers::char_to_cblas_trans( transa, &cblas_transa );
if constexpr (std::is_same<T, float>::value)
cblas_ssyr2k( cblas_order, cblas_uplo, cblas_transa, m, k, *alpha, ap, lda, bp, ldb, *beta, cp, ldc );
cblas_ssyr2k( cblas_order, cblas_uplo, cblas_transa, n, k, *alpha, ap, lda, bp, ldb, *beta, cp, ldc );
else if constexpr (std::is_same<T, double>::value)
cblas_dsyr2k( cblas_order, cblas_uplo, cblas_transa, m, k, *alpha, ap, lda, bp, ldb, *beta, cp, ldc );
cblas_dsyr2k( cblas_order, cblas_uplo, cblas_transa, n, k, *alpha, ap, lda, bp, ldb, *beta, cp, ldc );
else if constexpr (std::is_same<T, scomplex>::value)
cblas_csyr2k( cblas_order, cblas_uplo, cblas_transa, m, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
cblas_csyr2k( cblas_order, cblas_uplo, cblas_transa, n, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
else if constexpr (std::is_same<T, dcomplex>::value)
cblas_zsyr2k( cblas_order, cblas_uplo, cblas_transa, m, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
cblas_zsyr2k( cblas_order, cblas_uplo, cblas_transa, n, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
else
throw std::runtime_error("Error in testsuite/level3/syr2k.h: Invalid typename in cblas_syr2k().");
}
template<typename T>
static void typed_syr2k(char storage, char uplo, char trnsa, char trnsb,
gtint_t m, gtint_t k, T* alpha, T* ap, gtint_t lda,
gtint_t n, gtint_t k, T* alpha, T* ap, gtint_t lda,
T* bp, gtint_t ldb, T* beta, T* cp, gtint_t ldc)
{
trans_t transa, transb;
@@ -122,7 +122,7 @@ static void typed_syr2k(char storage, char uplo, char trnsa, char trnsb,
rsa=rsb=rsc=1;
csa=csb=csc=1;
/* a = m x k b = k x n c = m x n */
/* a = n x k b = k x n c = n x n */
if( (storage == 'c') || (storage == 'C') ) {
csa = lda ;
csb = ldb ;
@@ -135,19 +135,19 @@ static void typed_syr2k(char storage, char uplo, char trnsa, char trnsb,
}
if constexpr (std::is_same<T, float>::value)
bli_ssyr2k( blis_uplo, transa, transb, m, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
bli_ssyr2k( blis_uplo, transa, transb, n, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
else if constexpr (std::is_same<T, double>::value)
bli_dsyr2k( blis_uplo, transa, transb, m, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
bli_dsyr2k( blis_uplo, transa, transb, n, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
else if constexpr (std::is_same<T, scomplex>::value)
bli_csyr2k( blis_uplo, transa, transb, m, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
bli_csyr2k( blis_uplo, transa, transb, n, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
else if constexpr (std::is_same<T, dcomplex>::value)
bli_zsyr2k( blis_uplo, transa, transb, m, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
bli_zsyr2k( blis_uplo, transa, transb, n, k, alpha, ap, rsa, csa, bp, rsb, csb, beta, cp, rsc, csc );
else
throw std::runtime_error("Error in testsuite/level3/syr2k.h: Invalid typename in typed_syr2k().");
}
template<typename T>
static void syr2k( char storage, char uplo, char transa, char transb, gtint_t m, gtint_t k,
static void syr2k( char storage, char uplo, char transa, char transb, gtint_t n, gtint_t k,
T* alpha, T* ap, gtint_t lda, T* bp, gtint_t ldb, T* beta, T* cp, gtint_t ldc )
{
@@ -160,14 +160,14 @@ static void syr2k( char storage, char uplo, char transa, char transb, gtint_t m,
#ifdef TEST_BLAS
if( storage == 'c' || storage == 'C' )
syr2k_<T>( uplo, transa, m, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
syr2k_<T>( uplo, transa, n, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
else
throw std::runtime_error("Error in testsuite/level3/syr2k.h: BLAS interface cannot be tested for row-major order.");
#elif TEST_CBLAS
cblas_syr2k<T>( storage, uplo, transa, m, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
cblas_syr2k<T>( storage, uplo, transa, n, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
#elif TEST_BLIS_TYPED
typed_syr2k<T>( storage, uplo, transa, transb, m, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
typed_syr2k<T>( storage, uplo, transa, transb, n, k, alpha, ap, lda, bp, ldb, beta, cp, ldc );
#else
throw std::runtime_error("Error in testsuite/level3/syr2k.h: No interfaces are set to be tested.");
#endif

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -41,24 +41,24 @@
#include <algorithm>
template<typename T>
void test_syr2k( char storage, char uplo, char transa, char transb, gtint_t m,
void test_syr2k( char storage, char uplo, char transa, char transb, gtint_t n,
gtint_t k, gtint_t lda_inc, gtint_t ldb_inc, gtint_t ldc_inc, T alpha,
T beta, double thresh )
{
// Compute the leading dimensions of a, b, and c.
gtint_t lda = testinghelpers::get_leading_dimension( storage, transa, m, k, lda_inc );
gtint_t ldb = testinghelpers::get_leading_dimension( storage, transb, m, k, ldb_inc );
gtint_t ldc = testinghelpers::get_leading_dimension( storage, 'n', m, m, ldc_inc );
gtint_t lda = testinghelpers::get_leading_dimension( storage, transa, n, k, lda_inc );
gtint_t ldb = testinghelpers::get_leading_dimension( storage, transb, n, k, ldb_inc );
gtint_t ldc = testinghelpers::get_leading_dimension( storage, 'n', n, n, ldc_inc );
//----------------------------------------------------------
// Initialize matrics with random integer numbers.
//----------------------------------------------------------
std::vector<T> a = testinghelpers::get_random_matrix<T>( -2, 8, storage, transa, m, k, lda );
std::vector<T> b = testinghelpers::get_random_matrix<T>( -5, 2, storage, transb, m, k, ldb );
std::vector<T> a = testinghelpers::get_random_matrix<T>( -2, 8, storage, transa, n, k, lda );
std::vector<T> b = testinghelpers::get_random_matrix<T>( -5, 2, storage, transb, n, k, ldb );
// Since matrix C, stored in c, is symmetric and we only use the upper or lower
// part in the computation of her2k and zero-out the rest to ensure
// that code operates as expected.
std::vector<T> c = testinghelpers::get_random_matrix<T>(-3, 5, storage, uplo, m, ldc );
std::vector<T> c = testinghelpers::get_random_matrix<T>(-3, 5, storage, uplo, n, ldc );
// Create a copy of c so that we can check reference results.
std::vector<T> c_ref(c);
@@ -66,17 +66,17 @@ void test_syr2k( char storage, char uplo, char transa, char transb, gtint_t m,
//----------------------------------------------------------
// Call BLIS function
//----------------------------------------------------------
syr2k<T>( storage, uplo, transa, transb, m, k, &alpha, a.data(), lda,
syr2k<T>( storage, uplo, transa, transb, n, k, &alpha, a.data(), lda,
b.data(), ldb, &beta, c.data(), ldc );
//----------------------------------------------------------
// Call reference implementation.
//----------------------------------------------------------
testinghelpers::ref_syr2k<T>( storage, uplo, transa, transb, m, k, alpha,
testinghelpers::ref_syr2k<T>( storage, uplo, transa, transb, n, k, alpha,
a.data(), lda, b.data(), ldb, beta, c_ref.data(), ldc );
//----------------------------------------------------------
// check component-wise error.
//----------------------------------------------------------
computediff<T>( storage, m, m, c.data(), c_ref.data(), ldc, thresh );
computediff<T>( storage, n, n, c.data(), c_ref.data(), ldc, thresh );
}

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -63,9 +63,9 @@ TEST_P(zsyr2kTest, RandomData)
char transa = std::get<2>(GetParam());
// denotes whether matrix b is n,c,t,h
char transb = std::get<3>(GetParam());
// matrix size m
gtint_t m = std::get<4>(GetParam());
// matrix size n
gtint_t n = std::get<4>(GetParam());
// matrix size k
gtint_t k = std::get<5>(GetParam());
// specifies alpha value
T alpha = std::get<6>(GetParam());
@@ -79,12 +79,23 @@ TEST_P(zsyr2kTest, RandomData)
gtint_t ldc_inc = std::get<10>(GetParam());
// Set the threshold for the errors:
double thresh = m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite syr2k.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (6*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_syr2k<T>( storage, uplo, transa, transb, m, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
test_syr2k<T>( storage, uplo, transa, transb, n, k, lda_inc, ldb_inc, ldc_inc, alpha, beta, thresh );
}
class zsyr2kTestPrint {
@@ -95,7 +106,7 @@ public:
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
char tsb = std::get<3>(str.param);
gtint_t m = std::get<4>(str.param);
gtint_t n = std::get<4>(str.param);
gtint_t k = std::get<5>(str.param);
dcomplex alpha = std::get<6>(str.param);
dcomplex beta = std::get<7>(str.param);
@@ -112,7 +123,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa + tsb;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha.real > 0) ? std::to_string(int(alpha.real)) : ("m" + std::to_string(int(std::abs(alpha.real))));
alpha_str = alpha_str + "pi" + (( alpha.imag > 0) ? std::to_string(int(alpha.imag)) : ("m" + std::to_string(int(std::abs(alpha.imag)))));
@@ -140,8 +151,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n'), // transa
::testing::Values('n'), // transb
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values(dcomplex{2.0, -1.0}, dcomplex{-2.0, 3.0}), // alpha
::testing::Values(dcomplex{-3.0, 2.0}, dcomplex{4.0, -1.0}), // beta
::testing::Values(gtint_t(0), gtint_t(2)), // increment to the leading dim of a

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -59,8 +59,8 @@ TEST_P(csyrkTest, RandomData)
char uplo = std::get<1>(GetParam());
// denotes whether matrix a is n,c,t,h
char transa = std::get<2>(GetParam());
// matrix size m
gtint_t m = std::get<3>(GetParam());
// matrix size n
gtint_t n = std::get<3>(GetParam());
// matrix size k
gtint_t k = std::get<4>(GetParam());
// specifies alpha value
@@ -74,12 +74,23 @@ TEST_P(csyrkTest, RandomData)
gtint_t ldc_inc = std::get<8>(GetParam());
// Set the threshold for the errors:
double thresh = m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite syrk.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_syrk<T>( storage, uplo, transa, m, k, lda_inc, ldc_inc, alpha, beta, thresh );
test_syrk<T>( storage, uplo, transa, n, k, lda_inc, ldc_inc, alpha, beta, thresh );
}
class csyrkTestPrint {
@@ -89,7 +100,7 @@ public:
char sfm = std::get<0>(str.param);
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
gtint_t m = std::get<3>(str.param);
gtint_t n = std::get<3>(str.param);
gtint_t k = std::get<4>(str.param);
scomplex alpha = std::get<5>(str.param);
scomplex beta = std::get<6>(str.param);
@@ -105,7 +116,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha.real > 0) ? std::to_string(int(alpha.real)) : ("m" + std::to_string(int(std::abs(alpha.real))));
alpha_str = alpha_str + "pi" + (( alpha.imag > 0) ? std::to_string(int(alpha.imag)) : ("m" + std::to_string(int(std::abs(alpha.imag)))));
@@ -131,7 +142,7 @@ INSTANTIATE_TEST_SUITE_P(
), // storage format
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n','t'), // transa
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values(scomplex{2.0, -1.0}, scomplex{-2.0, 3.0}), // alpha
::testing::Values(scomplex{-3.0, 2.0}, scomplex{4.0, -1.0}), // beta

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -59,8 +59,8 @@ TEST_P(dsyrkTest, RandomData)
char uplo = std::get<1>(GetParam());
// denotes whether matrix a is n,c,t,h
char transa = std::get<2>(GetParam());
// matrix size m
gtint_t m = std::get<3>(GetParam());
// matrix size n
gtint_t n = std::get<3>(GetParam());
// matrix size k
gtint_t k = std::get<4>(GetParam());
// specifies alpha value
@@ -74,12 +74,22 @@ TEST_P(dsyrkTest, RandomData)
gtint_t ldc_inc = std::get<8>(GetParam());
// Set the threshold for the errors:
double thresh = m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite syrk.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_syrk<T>( storage, uplo, transa, m, k, lda_inc, ldc_inc, alpha, beta, thresh );
test_syrk<T>( storage, uplo, transa, n, k, lda_inc, ldc_inc, alpha, beta, thresh );
}
class dsyrkTestPrint {
@@ -89,7 +99,7 @@ public:
char sfm = std::get<0>(str.param);
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
gtint_t m = std::get<3>(str.param);
gtint_t n = std::get<3>(str.param);
gtint_t k = std::get<4>(str.param);
double alpha = std::get<5>(str.param);
double beta = std::get<6>(str.param);
@@ -105,7 +115,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha > 0) ? std::to_string(int(alpha)) : "m" + std::to_string(int(std::abs(alpha)));
str_name = str_name + "_a" + alpha_str;
@@ -129,7 +139,7 @@ INSTANTIATE_TEST_SUITE_P(
), // storage format
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n','t','c'), // transa
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values( 1.0, -2.0), // alpha
::testing::Values(-1.0, 1.0), // beta

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -59,8 +59,8 @@ TEST_P(ssyrkTest, RandomData)
char uplo = std::get<1>(GetParam());
// denotes whether matrix a is n,c,t,h
char transa = std::get<2>(GetParam());
// matrix size m
gtint_t m = std::get<3>(GetParam());
// matrix size n
gtint_t n = std::get<3>(GetParam());
// matrix size k
gtint_t k = std::get<4>(GetParam());
// specifies alpha value
@@ -74,12 +74,22 @@ TEST_P(ssyrkTest, RandomData)
gtint_t ldc_inc = std::get<8>(GetParam());
// Set the threshold for the errors:
double thresh = m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite syrk.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_syrk<T>( storage, uplo, transa, m, k, lda_inc, ldc_inc, alpha, beta, thresh );
test_syrk<T>( storage, uplo, transa, n, k, lda_inc, ldc_inc, alpha, beta, thresh );
}
class ssyrkTestPrint {
@@ -89,7 +99,7 @@ public:
char sfm = std::get<0>(str.param);
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
gtint_t m = std::get<3>(str.param);
gtint_t n = std::get<3>(str.param);
gtint_t k = std::get<4>(str.param);
float alpha = std::get<5>(str.param);
float beta = std::get<6>(str.param);
@@ -105,7 +115,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha > 0) ? std::to_string(int(alpha)) : "m" + std::to_string(int(std::abs(alpha)));
str_name = str_name + "_a" + alpha_str;
@@ -129,7 +139,7 @@ INSTANTIATE_TEST_SUITE_P(
), // storage format
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n','t','c'), // transa
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values( 1.0, -2.0), // alpha
::testing::Values(-1.0, 1.0), // beta

View File

@@ -60,24 +60,24 @@
*/
template<typename T>
static void syrk_(char uplo, char transa, gtint_t m, gtint_t k, T* alpha,
static void syrk_(char uplo, char transa, gtint_t n, gtint_t k, T* alpha,
T* ap, gtint_t lda, T* beta, T* cp, gtint_t ldc )
{
if constexpr (std::is_same<T, float>::value)
ssyrk_( &uplo, &transa, &m, &k, alpha, ap, &lda, beta, cp, &ldc );
ssyrk_( &uplo, &transa, &n, &k, alpha, ap, &lda, beta, cp, &ldc );
else if constexpr (std::is_same<T, double>::value)
dsyrk_( &uplo, &transa, &m, &k, alpha, ap, &lda, beta, cp, &ldc );
dsyrk_( &uplo, &transa, &n, &k, alpha, ap, &lda, beta, cp, &ldc );
else if constexpr (std::is_same<T, scomplex>::value)
csyrk_( &uplo, &transa, &m, &k, alpha, ap, &lda, beta, cp, &ldc );
csyrk_( &uplo, &transa, &n, &k, alpha, ap, &lda, beta, cp, &ldc );
else if constexpr (std::is_same<T, dcomplex>::value)
zsyrk_( &uplo, &transa, &m, &k, alpha, ap, &lda, beta, cp, &ldc );
zsyrk_( &uplo, &transa, &n, &k, alpha, ap, &lda, beta, cp, &ldc );
else
throw std::runtime_error("Error in testsuite/level3/syrk.h: Invalid typename in syrk_().");
}
template<typename T>
static void cblas_syrk(char storage, char uplo, char trnsa,
gtint_t m, gtint_t k, T* alpha, T* ap, gtint_t lda,
gtint_t n, gtint_t k, T* alpha, T* ap, gtint_t lda,
T* beta, T* cp, gtint_t ldc)
{
enum CBLAS_ORDER cblas_order;
@@ -89,20 +89,20 @@ static void cblas_syrk(char storage, char uplo, char trnsa,
testinghelpers::char_to_cblas_trans( trnsa, &cblas_transa );
if constexpr (std::is_same<T, float>::value)
cblas_ssyrk( cblas_order, cblas_uplo, cblas_transa, m, k, *alpha, ap, lda, *beta, cp, ldc );
cblas_ssyrk( cblas_order, cblas_uplo, cblas_transa, n, k, *alpha, ap, lda, *beta, cp, ldc );
else if constexpr (std::is_same<T, double>::value)
cblas_dsyrk( cblas_order, cblas_uplo, cblas_transa, m, k, *alpha, ap, lda, *beta, cp, ldc );
cblas_dsyrk( cblas_order, cblas_uplo, cblas_transa, n, k, *alpha, ap, lda, *beta, cp, ldc );
else if constexpr (std::is_same<T, scomplex>::value)
cblas_csyrk( cblas_order, cblas_uplo, cblas_transa, m, k, alpha, ap, lda, beta, cp, ldc );
cblas_csyrk( cblas_order, cblas_uplo, cblas_transa, n, k, alpha, ap, lda, beta, cp, ldc );
else if constexpr (std::is_same<T, dcomplex>::value)
cblas_zsyrk( cblas_order, cblas_uplo, cblas_transa, m, k, alpha, ap, lda, beta, cp, ldc );
cblas_zsyrk( cblas_order, cblas_uplo, cblas_transa, n, k, alpha, ap, lda, beta, cp, ldc );
else
throw std::runtime_error("Error in testsuite/level3/syrk.h: Invalid typename in cblas_syrk().");
}
template<typename T>
static void typed_syrk(char storage, char uplo, char trnsa,
gtint_t m, gtint_t k, T* alpha, T* ap, gtint_t lda,
gtint_t n, gtint_t k, T* alpha, T* ap, gtint_t lda,
T* beta, T* cp, gtint_t ldc)
{
trans_t transa;
@@ -115,7 +115,7 @@ static void typed_syrk(char storage, char uplo, char trnsa,
rsa=rsc=1;
csa=csc=1;
/* a = m x k c = m x m */
/* a = n x k c = n x n */
if( (storage == 'c') || (storage == 'C') ) {
csa = lda ;
csc = ldc ;
@@ -126,19 +126,19 @@ static void typed_syrk(char storage, char uplo, char trnsa,
}
if constexpr (std::is_same<T, float>::value)
bli_ssyrk( blis_uplo, transa, m, k, alpha, ap, rsa, csa, beta, cp, rsc, csc );
bli_ssyrk( blis_uplo, transa, n, k, alpha, ap, rsa, csa, beta, cp, rsc, csc );
else if constexpr (std::is_same<T, double>::value)
bli_dsyrk( blis_uplo, transa, m, k, alpha, ap, rsa, csa, beta, cp, rsc, csc );
bli_dsyrk( blis_uplo, transa, n, k, alpha, ap, rsa, csa, beta, cp, rsc, csc );
else if constexpr (std::is_same<T, scomplex>::value)
bli_csyrk( blis_uplo, transa, m, k, alpha, ap, rsa, csa, beta, cp, rsc, csc );
bli_csyrk( blis_uplo, transa, n, k, alpha, ap, rsa, csa, beta, cp, rsc, csc );
else if constexpr (std::is_same<T, dcomplex>::value)
bli_zsyrk( blis_uplo, transa, m, k, alpha, ap, rsa, csa, beta, cp, rsc, csc );
bli_zsyrk( blis_uplo, transa, n, k, alpha, ap, rsa, csa, beta, cp, rsc, csc );
else
throw std::runtime_error("Error in testsuite/level3/syrk.h: Invalid typename in typed_syrk().");
}
template<typename T>
static void syrk( char storage, char uplo, char transa, gtint_t m, gtint_t k,
static void syrk( char storage, char uplo, char transa, gtint_t n, gtint_t k,
T* alpha, T* ap, gtint_t lda, T* beta, T* cp, gtint_t ldc )
{
@@ -150,13 +150,13 @@ static void syrk( char storage, char uplo, char transa, gtint_t m, gtint_t k,
#ifdef TEST_BLAS
if( storage == 'c' || storage == 'C' )
syrk_<T>( uplo, transa, m, k, alpha, ap, lda, beta, cp, ldc );
syrk_<T>( uplo, transa, n, k, alpha, ap, lda, beta, cp, ldc );
else
throw std::runtime_error("Error in testsuite/level3/syrk.h: BLAS interface cannot be tested for row-major order.");
#elif TEST_CBLAS
cblas_syrk<T>( storage, uplo, transa, m, k, alpha, ap, lda, beta, cp, ldc );
cblas_syrk<T>( storage, uplo, transa, n, k, alpha, ap, lda, beta, cp, ldc );
#elif TEST_BLIS_TYPED
typed_syrk<T>( storage, uplo, transa, m, k, alpha, ap, lda, beta, cp, ldc );
typed_syrk<T>( storage, uplo, transa, n, k, alpha, ap, lda, beta, cp, ldc );
#else
throw std::runtime_error("Error in testsuite/level3/syrk.h: No interfaces are set to be tested.");
#endif

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -41,36 +41,36 @@
#include <algorithm>
template<typename T>
void test_syrk( char storage, char uplo, char transa, gtint_t m, gtint_t k,
void test_syrk( char storage, char uplo, char transa, gtint_t n, gtint_t k,
gtint_t lda_inc, gtint_t ldc_inc, T alpha, T beta, double thresh )
{
// Compute the leading dimensions of a, b, and c.
gtint_t lda = testinghelpers::get_leading_dimension( storage, transa, m, k, lda_inc );
gtint_t ldc = testinghelpers::get_leading_dimension( storage, 'n', m, m, ldc_inc );
gtint_t lda = testinghelpers::get_leading_dimension( storage, transa, n, k, lda_inc );
gtint_t ldc = testinghelpers::get_leading_dimension( storage, 'n', n, n, ldc_inc );
//----------------------------------------------------------
// Initialize matrics with random integer numbers.
//----------------------------------------------------------
std::vector<T> a = testinghelpers::get_random_matrix<T>( -2, 8, storage, transa, m, k, lda );
std::vector<T> a = testinghelpers::get_random_matrix<T>( -2, 8, storage, transa, n, k, lda );
// Since matrix C, stored in c, is symmetric, we only use the upper or lower
// part in the computation of syrk and zero-out the rest to ensure
// that code operates as expected.
std::vector<T> c = testinghelpers::get_random_matrix<T>( -3, 5, storage, uplo, m, ldc );
std::vector<T> c = testinghelpers::get_random_matrix<T>( -3, 5, storage, uplo, n, ldc );
// Create a copy of c so that we can check reference results.
std::vector<T> c_ref(c);
//----------------------------------------------------------
// Call BLIS function
//----------------------------------------------------------
syrk<T>( storage, uplo, transa, m, k, &alpha, a.data(), lda,
syrk<T>( storage, uplo, transa, n, k, &alpha, a.data(), lda,
&beta, c.data(), ldc );
//----------------------------------------------------------
// Call reference implementation.
//----------------------------------------------------------
testinghelpers::ref_syrk<T>( storage, uplo, transa, m, k, alpha,
testinghelpers::ref_syrk<T>( storage, uplo, transa, n, k, alpha,
a.data(), lda, beta, c_ref.data(), ldc );
//----------------------------------------------------------
// check component-wise error.
//----------------------------------------------------------
computediff<T>( storage, m, m, c.data(), c_ref.data(), ldc, thresh );
computediff<T>( storage, n, n, c.data(), c_ref.data(), ldc, thresh );
}

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -59,8 +59,8 @@ TEST_P(zsyrkTest, RandomData)
char uplo = std::get<1>(GetParam());
// denotes whether matrix a is n,c,t,h
char transa = std::get<2>(GetParam());
// matrix size m
gtint_t m = std::get<3>(GetParam());
// matrix size n
gtint_t n = std::get<3>(GetParam());
// matrix size k
gtint_t k = std::get<4>(GetParam());
// specifies alpha value
@@ -74,12 +74,23 @@ TEST_P(zsyrkTest, RandomData)
gtint_t ldc_inc = std::get<8>(GetParam());
// Set the threshold for the errors:
double thresh = m*k*testinghelpers::getEpsilon<T>();
// Check gtestsuite syrk.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
//----------------------------------------------------------
test_syrk<T>( storage, uplo, transa, m, k, lda_inc, ldc_inc, alpha, beta, thresh );
test_syrk<T>( storage, uplo, transa, n, k, lda_inc, ldc_inc, alpha, beta, thresh );
}
class zsyrkTestPrint {
@@ -89,7 +100,7 @@ public:
char sfm = std::get<0>(str.param);
char uplo = std::get<1>(str.param);
char tsa = std::get<2>(str.param);
gtint_t m = std::get<3>(str.param);
gtint_t n = std::get<3>(str.param);
gtint_t k = std::get<4>(str.param);
dcomplex alpha = std::get<5>(str.param);
dcomplex beta = std::get<6>(str.param);
@@ -105,7 +116,7 @@ public:
str_name = str_name + "_" + sfm+sfm+sfm;
str_name = str_name + "_" + uplo;
str_name = str_name + "_" + tsa;
str_name = str_name + "_" + std::to_string(m);
str_name = str_name + "_" + std::to_string(n);
str_name = str_name + "_" + std::to_string(k);
std::string alpha_str = ( alpha.real > 0) ? std::to_string(int(alpha.real)) : ("m" + std::to_string(int(std::abs(alpha.real))));
alpha_str = alpha_str + "pi" + (( alpha.imag > 0) ? std::to_string(int(alpha.imag)) : ("m" + std::to_string(int(std::abs(alpha.imag)))));
@@ -131,7 +142,7 @@ INSTANTIATE_TEST_SUITE_P(
), // storage format
::testing::Values('u','l'), // u:upper, l:lower
::testing::Values('n','t'), // transa
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
::testing::Range(gtint_t(10), gtint_t(31), 10), // k
::testing::Values(dcomplex{2.0, -1.0}, dcomplex{-2.0, 3.0}), // alpha
::testing::Values(dcomplex{-3.0, 2.0}, dcomplex{4.0, -1.0}), // beta

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -78,7 +78,18 @@ TEST_P(ctrmmTest, RandomData)
gtint_t ldb_inc = std::get<9>(GetParam());
// Set the threshold for the errors:
double thresh = m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite trmm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -78,7 +78,17 @@ TEST_P(dtrmmTest, RandomData)
gtint_t ldb_inc = std::get<9>(GetParam());
// Set the threshold for the errors:
double thresh = m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite trmm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -78,7 +78,17 @@ TEST_P(strmmTest, RandomData)
gtint_t ldb_inc = std::get<9>(GetParam());
// Set the threshold for the errors:
double thresh = 20*m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite trmm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -78,7 +78,18 @@ TEST_P(ztrmmTest, RandomData)
gtint_t ldb_inc = std::get<9>(GetParam());
// Set the threshold for the errors:
double thresh = m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite trmm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -88,7 +88,21 @@ TEST_P(ctrmm3Test, RandomData)
gtint_t ldc_inc = std::get<12>(GetParam());
// Set the threshold for the errors:
double thresh = m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite trmm3.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -88,7 +88,20 @@ TEST_P(dtrmm3Test, RandomData)
gtint_t ldc_inc = std::get<12>(GetParam());
// Set the threshold for the errors:
double thresh = m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite trmm3.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -88,7 +88,20 @@ TEST_P(strmm3Test, RandomData)
gtint_t ldc_inc = std::get<12>(GetParam());
// Set the threshold for the errors:
double thresh = m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite trmm3.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -88,7 +88,21 @@ TEST_P(ztrmm3Test, RandomData)
gtint_t ldc_inc = std::get<12>(GetParam());
// Set the threshold for the errors:
double thresh = m*n*testinghelpers::getEpsilon<T>();
// Check gtestsuite trmm3.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() &&
(beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -85,7 +85,18 @@ TEST_P(ctrsmEVT, NaNInfCheck)
EVT_TYPE b_init = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = (std::max)(m, n)*testinghelpers::getEpsilon<T>();
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -200,4 +211,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(NO_EVT) // EVT test for B
),
::ctrsmEVTPrint()
);
);

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -78,7 +78,18 @@ TEST_P(ctrsmAPI, FunctionalTest)
gtint_t ldb_inc = std::get<9>(GetParam());
// Set the threshold for the errors:
double thresh = 1.5*(std::max)(m, n)*testinghelpers::getEpsilon<T>();
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -220,4 +231,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(gtint_t(0), gtint_t(93)) // increment to the leading dim of b
),
::ctrsmPrint()
);
);

View File

@@ -85,7 +85,17 @@ TEST_P(dtrsmEVTTest, Unit_Tester)
EVT_TYPE b_init = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = (std::max)(m, n)*testinghelpers::getEpsilon<T>();
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -161,4 +171,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(NO_EVT, NaN, INF, NaN_INF) // EVT test for B
),
::dtrsmEVTTestPrint()
);
);

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023-24, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -78,7 +78,17 @@ TEST_P(dtrsmTest, Accuracy_test)
gtint_t ldb_inc = std::get<9>(GetParam());
// Set the threshold for the errors:
double thresh = 1.5*(std::max)(m, n)*testinghelpers::getEpsilon<T>();
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -85,7 +85,17 @@ TEST_P(strsmEVT, NaNInfCheck)
EVT_TYPE b_init = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = (std::max)(m, n)*testinghelpers::getEpsilon<T>();
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -191,4 +201,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(NO_EVT) // EVT test for B
),
::strsmEVTPrint()
);
);

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -78,7 +78,17 @@ TEST_P(strsmAPI, FunctionalTest)
gtint_t ldb_inc = std::get<9>(GetParam());
// Set the threshold for the errors:
double thresh = 1.5*(std::max)(m, n)*testinghelpers::getEpsilon<T>();
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -222,4 +232,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(gtint_t(0), gtint_t(39)) // increment to the leading dim of b
),
::strsmPrint()
);
);

View File

@@ -85,7 +85,18 @@ TEST_P(ztrsmEVT, NaNInfCheck)
EVT_TYPE b_init = std::get<11>(GetParam());
// Set the threshold for the errors:
double thresh = (std::max)(m, n)*testinghelpers::getEpsilon<T>();
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -200,4 +211,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(NO_EVT) // EVT test for B
),
::ztrsmEVTPrint()
);
);

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -78,7 +78,18 @@ TEST_P(ztrsmAPI, FunctionalTest)
gtint_t ldb_inc = std::get<9>(GetParam());
// Set the threshold for the errors:
double thresh = 1.5*(std::max)(m, n)*testinghelpers::getEpsilon<T>();
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
if ( side == 'l' || side == 'L' )
thresh = 3*m*testinghelpers::getEpsilon<T>();
else
thresh = 3*n*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters
@@ -220,4 +231,4 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(gtint_t(0), gtint_t(23)) // increment to the leading dim of b
),
::ztrsmPrint()
);
);

View File

@@ -573,8 +573,20 @@ TEST_P(dgemmSmallUkernel, gemm_small)
}
// reset to default signal handler
testinghelpers::ProtectedBuffer::stop_signal_handler();
// Set the threshold for the errors:
double thresh = 10 * (std::max)(n,(std::max)(k,m)) * testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) && (beta == testinghelpers::ZERO<T>() ||
beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//thresh = (4*k+1)*testinghelpers::getEpsilon<T>();
// call reference implementation
testinghelpers::ref_gemm<T>( storage, 'n', 'n', m, n, k, alpha,
@@ -612,7 +624,19 @@ TEST_P(dgemmSmallUkernel, gemm_small)
);
// Set the threshold for the errors:
double thresh = 10 * (std::max)(n,(std::max)(k,m)) * testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) && (beta == testinghelpers::ZERO<T>() ||
beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//thresh = (4*k+1)*testinghelpers::getEpsilon<T>();
// call reference implementation
testinghelpers::ref_gemm<T>( storage, 'n', 'n', m, n, k, alpha,
a.data(), lda, b.data(), ldb, beta, c_ref.data(), ldc);

View File

@@ -207,7 +207,20 @@ static void test_gemmnat_ukr(
// storage of all matrices A, B and C.
// since A is col-storage, A' will be row-storage
}
double thresh = 10 * ((std::max)(k,gtint_t(1))) * testinghelpers::getEpsilon<T>();
// Set the threshold for the errors:
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) && (beta == testinghelpers::ZERO<T>() ||
beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
// call reference implementation
testinghelpers::ref_gemm<T>( storage, transa, transb, m, n, k, alpha,
buf_a, lda, buf_b, ldb, beta, (T*)buf_cref, ldc);
@@ -324,7 +337,17 @@ static void test_gemmk1_ukr( FT ukr_fp, gtint_t m, gtint_t n, gtint_t k, char st
testinghelpers::ProtectedBuffer::stop_signal_handler();
// Set the threshold for the errors:
double thresh = 10 * (std::max)(n,(std::max)(k,m)) * testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) && (beta == testinghelpers::ZERO<T>() ||
beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
// call reference implementation
testinghelpers::ref_gemm<T>( storage, 'n', 'n', m, n, k, alpha,
@@ -551,7 +574,17 @@ static void test_gemmsup_ukr( FT ukr_fp, char trnsa, char trnsb, gtint_t m, gtin
testinghelpers::ProtectedBuffer::stop_signal_handler();
// Set the threshold for the errors:
double thresh = 10 * ((std::max)(k,gtint_t(1))) * testinghelpers::getEpsilon<T>();
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) && (beta == testinghelpers::ZERO<T>() ||
beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
// call reference implementation
testinghelpers::ref_gemm<T>( storage, trnsa, trnsb, m, n, k, alpha,

View File

@@ -61,7 +61,22 @@ TEST_P(zgemmUkrSUP, FunctionalTest)
char transa = std::get<7>(GetParam()); // transa
char transb = std::get<8>(GetParam()); // transb
bool is_memory_test = std::get<9>(GetParam()); // is_memory_test
double thresh = 30 * ((std::max)(k,gtint_t(10))) * testinghelpers::getEpsilon<T>(); // Set the threshold for the errors
// Set the threshold for the errors:
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) && (beta == testinghelpers::ZERO<T>() ||
beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//thresh = (63*k+1)*testinghelpers::getEpsilon<T>();
test_complex_gemmsup_ukr(storageC, transa, transb, m, n, k, alpha, beta, thresh, kern_ptr, is_memory_test);
}// end of function
@@ -993,7 +1008,21 @@ TEST_P(zgemmUkrNat, MicroKernelTest)
gtint_t n = std::get<5>(GetParam()); // n
zgemm_ukr_ft kern_ptr = std::get<6>(GetParam()); // pointer to the gemm kernel
bool is_memory_test = std::get<7>(GetParam()); // is_memory_test
double thresh = 10 * ((std::max)(k,gtint_t(1))) * testinghelpers::getEpsilon<T>(); // Set the threshold for the errors
// Set the threshold for the errors:
// Check gtestsuite gemm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0)
thresh = 0.0;
else if ((alpha == testinghelpers::ZERO<T>() || k == 0) && (beta == testinghelpers::ZERO<T>() ||
beta == testinghelpers::ONE<T>()))
thresh = 0.0;
else
thresh = (3*k+1)*testinghelpers::getEpsilon<T>();
//thresh = (4*k+1)*testinghelpers::getEpsilon<T>();
test_gemmnat_ukr(storage, m, n, k, alpha, beta, thresh, kern_ptr, is_memory_test);
}// end of function

View File

@@ -69,7 +69,17 @@ TEST_P(ctrsmUkrSmall, AccuracyCheck)
gtint_t ldb = std::get<9>(GetParam());
bool is_memory_test = std::get<10>(GetParam());
double thresh = 2 * (std::max)((std::max)(m, n), gtint_t(3)) * testinghelpers::getEpsilon<T>();
// Set the threshold for the errors:
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
thresh = 3*m*testinghelpers::getEpsilon<T>();
test_trsm_small_ukr<T, trsm_small_ker_ft>( ukr_fp, side, uploa, diaga, transa, m, n, alpha, lda, ldb, thresh, is_memory_test, BLIS_SCOMPLEX);
}

View File

@@ -81,8 +81,17 @@ TEST_P(DTRSMUkrTest, native_kernel)
gtint_t ldc = std::get<8>(GetParam());
bool is_memory_test = std::get<9>(GetParam());
double thresh = 2 * m * testinghelpers::getEpsilon<T>();
test_trsm_ukr<T, dgemmtrsm_ukr_ft>( ukr_fp, storage, uploa, diaga, m, n, k, alpha, ldc, thresh, is_memory_test);
// Set the threshold for the errors:
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
thresh = 3*m*testinghelpers::getEpsilon<T>();
test_trsm_ukr<T, dgemmtrsm_ukr_ft>( ukr_fp, storage, uploa, diaga, m, n, k, alpha, ldc, thresh, is_memory_test );
}
TEST_P(DTRSMSmallUkrTest, small_kernel)
@@ -100,7 +109,16 @@ TEST_P(DTRSMSmallUkrTest, small_kernel)
gtint_t ldb = std::get<9>(GetParam());
bool is_memory_test = std::get<10>(GetParam());
double thresh = 2 * (std::max)((std::max)(m, n), gtint_t(3)) * testinghelpers::getEpsilon<T>();
// Set the threshold for the errors:
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
thresh = 3*m*testinghelpers::getEpsilon<T>();
test_trsm_small_ukr<T, trsm_small_ker_ft>( ukr_fp, side, uploa, diaga, transa, m, n, alpha, lda, ldb, thresh, is_memory_test, BLIS_DOUBLE);
}

View File

@@ -81,7 +81,16 @@ TEST_P(strsmUkrNat, AccuracyCheck)
gtint_t ldc = std::get<8>(GetParam());
bool is_memory_test = std::get<9>(GetParam());
double thresh = 2 * (std::max)((std::max)(m, n), gtint_t(3)) * testinghelpers::getEpsilon<T>();
// Set the threshold for the errors:
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
thresh = 3*m*testinghelpers::getEpsilon<T>();
test_trsm_ukr<T, sgemmtrsm_ukr_ft>( ukr_fp, storage, uploa, diaga, m, n, k, alpha, ldc, thresh, is_memory_test);
}
@@ -100,7 +109,16 @@ TEST_P(strsmUkrSmall, AccuracyCheck)
gtint_t ldb = std::get<9>(GetParam());
bool is_memory_test = std::get<10>(GetParam());
double thresh = 2 * (std::max)((std::max)(m, n), gtint_t(3)) * testinghelpers::getEpsilon<T>();
// Set the threshold for the errors:
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
thresh = 3*m*testinghelpers::getEpsilon<T>();
test_trsm_small_ukr<T, trsm_small_ker_ft>( ukr_fp, side, uploa, diaga, transa, m, n, alpha, lda, ldb, thresh, is_memory_test, BLIS_FLOAT);
}

View File

@@ -81,7 +81,17 @@ TEST_P(ztrsmUkrNat, AccuracyCheck)
gtint_t ldc = std::get<8>(GetParam());
bool is_memory_test = std::get<9>(GetParam());
double thresh = 2 * (std::max)((std::max)(m, n), gtint_t(3)) * testinghelpers::getEpsilon<T>();
// Set the threshold for the errors:
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
thresh = 3*m*testinghelpers::getEpsilon<T>();
test_trsm_ukr<T, zgemmtrsm_ukr_ft>( ukr_fp, storage, uploa, diaga, m, n, k, alpha, ldc, thresh, is_memory_test);
}
@@ -100,7 +110,17 @@ TEST_P(ztrsmUkrSmall, AccuracyCheck)
gtint_t ldb = std::get<9>(GetParam());
bool is_memory_test = std::get<10>(GetParam());
double thresh = 2 * (std::max)((std::max)(m, n), gtint_t(3)) * testinghelpers::getEpsilon<T>();
// Set the threshold for the errors:
// Check gtestsuite trsm.h or netlib source code for reminder of the
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
thresh = 3*m*testinghelpers::getEpsilon<T>();
test_trsm_small_ukr<T, trsm_small_ker_ft>( ukr_fp, side, uploa, diaga, transa, m, n, alpha, lda, ldb, thresh, is_memory_test, BLIS_DCOMPLEX);
}