GTestSuite: Misc changes

- Correct matsize and NumericalComparison functions for
  tests with first matrix dimension <= 0.
- BLAS1:
  - Fix for BLAS vs CBLAS differences in amaxv IIT_ERS tests.
  - Threshold adjustments in ddotxf and zaxpy.
  - Break axpyv and scalv into separate executables for
    each data type.
- BLAS2:
  - Threshold adjustments in symv and hemv.
  - Break ger into separate executables for each data type.
- UKR:
  - Break gemm and trsm ukr test into separate executables
    for each data type.
  - Threshold adjustments in daxpyf
  - Disable {z,c}trsm ukr tests when BLIS_INT_ELEMENT_TYPE
    is used, as matrix generator is not currently suitable
    for this.

AMD-Internal: [CPUPL-4500]
Change-Id: I1d9e7acc11025f1478b8b511c14def5517ef0ae6
This commit is contained in:
Edward Smyth
2024-09-18 07:44:12 -04:00
parent 4da1ad2cd9
commit 6330ac6a52
44 changed files with 129 additions and 79 deletions

View File

@@ -143,7 +143,7 @@ gtint_t matsize( char storage, char trans, gtint_t m, gtint_t n, gtint_t ldm )
km = chktrans( trans ) ? n : m ;
lm = chktrans( trans ) ? m : n ;
}
if ( m <= 0 || n <= 0 || ldm <= 0 || ldm < lm )
if ( ldm <= 0 || ldm < lm )
return 0;
else
return (km*ldm);

View File

@@ -447,7 +447,7 @@ void computediff(std::string var_name, char storage, gtint_t m, gtint_t n, T *bl
// so we use binary comparison to verify that are exactly the same as the reference.
// Since to get create the data we use a copy to initialize the reference results, those
// elements are expected to identical.
for (i = m; i < ld; i++)
for (i = (std::max)(m,0); i < ld; i++)
{
ASSERT_PRED_FORMAT4(NumericalComparison<T>, var_name, blis_sol[i + j*ld], ref_sol[i + j*ld], comp_helper) << "This element is expected to not be modified.";
}
@@ -470,7 +470,7 @@ void computediff(std::string var_name, char storage, gtint_t m, gtint_t n, T *bl
// so we use binary comparison to verify that are exactly the same as the reference.
// Since to get create the data we use a copy to initialize the reference results, those
// elements are expected to identical.
for (j = n; j < ld; j++)
for (j = (std::max)(n,0); j < ld; j++)
{
ASSERT_PRED_FORMAT4(NumericalComparison<T>, var_name, blis_sol[i*ld + j], ref_sol[i*ld + j], comp_helper) << "This element is expected to not be modified.";
}
@@ -506,7 +506,7 @@ void computediff(std::string var_name, char storage, gtint_t m, gtint_t n, T *bl
// Since to get create the data we use a copy to initialize the reference results, those
// elements are expected to identical.
comp_helper.binary_comparison = true;
for (i = m; i < ld; i++)
for (i = (std::max)(m,0); i < ld; i++)
{
ASSERT_PRED_FORMAT4(NumericalComparison<T>, var_name, blis_sol[i + j*ld], ref_sol[i + j*ld], comp_helper) << "This element is expected to not be modified.";
}
@@ -532,7 +532,7 @@ void computediff(std::string var_name, char storage, gtint_t m, gtint_t n, T *bl
// Since to get create the data we use a copy to initialize the reference results, those
// elements are expected to identical.
comp_helper.binary_comparison = true;
for (j = n; j < ld; j++)
for (j = (std::max)(n,0); j < ld; j++)
{
ASSERT_PRED_FORMAT4(NumericalComparison<T>, var_name, blis_sol[i*ld + j], ref_sol[i*ld + j], comp_helper) << "This element is expected to not be modified.";
}

View File

@@ -1,4 +1,4 @@
/*
/*
BLIS
An object-based framework for developing high-performance BLAS-like
@@ -139,14 +139,21 @@ static gtint_t amaxv(gtint_t n, T* x, gtint_t incx)
}
#endif
#ifdef TEST_BLAS
#ifdef TEST_BLAS_LIKE
// Since we would be comparing against CBLAS which is 0-based and BLAS
// which is 1-based, we need decrement the result of BLAS call by 1.
return ( amaxv_<T>(n, x, incx) - 1 );
#elif TEST_BLAS_BLIS_IMPL
// Since we would be comparing against CBLAS which is 0-based and BLAS
// which is 1-based, we need decrement the result of BLAS call by 1.
return ( amaxv_blis_impl<T>(n, x, incx) - 1 );
// Exception is IIT tests which return 0 in both BLAS and CBLAS.
#ifdef TEST_BLAS
gtint_t idx = amaxv_<T>(n, x, incx);
#elif TEST_BLAS_BLIS_IMPL
gtint_t idx = amaxv_blis_impl<T>(n, x, incx);
#endif
if ( n < 1 || incx <= 0 )
return idx;
else
return idx - 1;
#elif TEST_CBLAS
return cblas_amaxv<T>(n, x, incx);
#elif TEST_BLIS_TYPED

View File

@@ -61,7 +61,8 @@ using namespace testinghelpers::IIT;
3. When n == 1.
The index returned in this case is expected to be 1(BLAS)
or 0(CBLAS).
or 0(CBLAS), but we handle all comparisons as if from CBLAS
with the conversion occurring in the amaxv.h header file.
*/
// n < 1, with non-unit stride
@@ -150,11 +151,7 @@ TYPED_TEST(amaxvIIT_ERS, n_eq_one_unitStride)
idx = amaxv<T>( n, nullptr, unit_inc );
// Computing the difference.
#ifdef TEST_BLAS_LIKE
computediff<gtint_t>( "idx", idx, gtint_t(1) );
#else
computediff<gtint_t>( "idx", idx, gtint_t(0) );
#endif
// Test with all arguments correct except for the value we are choosing to test.
// Initialize vectors with random numbers.
@@ -164,11 +161,7 @@ TYPED_TEST(amaxvIIT_ERS, n_eq_one_unitStride)
idx = amaxv<T>( n, x.data(), unit_inc );
// Computing the difference.
#ifdef TEST_BLAS_LIKE
computediff<gtint_t>( "idx", idx, gtint_t(1) );
#else
computediff<gtint_t>( "idx", idx, gtint_t(0) );
#endif
}
@@ -183,11 +176,7 @@ TYPED_TEST(amaxvIIT_ERS, n_eq_one_nonUnitStrides)
idx = amaxv<T>( n, nullptr, inc );
// Computing the difference.
#ifdef TEST_BLAS_LIKE
computediff<gtint_t>( "idx", idx, gtint_t(1) );
#else
computediff<gtint_t>( "idx", idx, gtint_t(0) );
#endif
// Test with all arguments correct except for the value we are choosing to test.
// Initialize vectors with random numbers.
@@ -197,11 +186,7 @@ TYPED_TEST(amaxvIIT_ERS, n_eq_one_nonUnitStrides)
idx = amaxv<T>( n, x.data(), inc );
// Computing the difference.
#ifdef TEST_BLAS_LIKE
computediff<gtint_t>( "idx", idx, gtint_t(1) );
#else
computediff<gtint_t>( "idx", idx, gtint_t(0) );
#endif
}
#endif

View File

@@ -34,7 +34,7 @@
#include <gtest/gtest.h>
#include "common/testing_helpers.h"
#include "axpyv.h"
#include "level1/axpyv/axpyv.h"
#include "inc/check_error.h"
#include "common/wrong_inputs_helpers.h"

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_axpyv.h"
#include "level1/axpyv/test_axpyv.h"
class caxpyvGeneric :
public ::testing::TestWithParam<std::tuple<char,

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_axpyv.h"
#include "level1/axpyv/test_axpyv.h"
class daxpyvEVT :
public ::testing::TestWithParam<std::tuple<char, // transpose

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_axpyv.h"
#include "level1/axpyv/test_axpyv.h"
class daxpyvGeneric :
public ::testing::TestWithParam<std::tuple<char,

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_axpyv.h"
#include "level1/axpyv/test_axpyv.h"
class saxpyvEVT :
public ::testing::TestWithParam<std::tuple<char, // transpose

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_axpyv.h"
#include "level1/axpyv/test_axpyv.h"
class saxpyvGeneric :
public ::testing::TestWithParam<std::tuple<char, // conjx

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_axpyv.h"
#include "level1/axpyv/test_axpyv.h"
class zaxpyvEVT :
public ::testing::TestWithParam<std::tuple<char, // transpose

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_axpyv.h"
#include "level1/axpyv/test_axpyv.h"
class zaxpyvGeneric :
public ::testing::TestWithParam<std::tuple<char, // conjx
@@ -64,8 +64,14 @@ TEST_P( zaxpyvGeneric, API )
// Check gtestsuite axpyv.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.
// With small adjustment applied for complex data.
double thresh;
// Threshold adjustment
#ifdef BLIS_INT_ELEMENT_TYPE
double adj = 1.02;
#else
double adj = 1.0;
#endif
if (n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>())
@@ -73,7 +79,7 @@ TEST_P( zaxpyvGeneric, API )
else if (alpha == testinghelpers::ONE<T>())
thresh = testinghelpers::getEpsilon<T>();
else
thresh = 2*testinghelpers::getEpsilon<T>();
thresh = adj*2*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call generic test body using those parameters

View File

@@ -81,6 +81,7 @@ TEST_P( ddotxfGeneric, API )
// functionality from which we estimate operation count per element
// of output, and hence the multipler for epsilon.
double thresh;
// Threshold adjustment
if (m == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>())
@@ -92,16 +93,32 @@ TEST_P( ddotxfGeneric, API )
if (beta == testinghelpers::ZERO<T>())
thresh = (m)*testinghelpers::getEpsilon<T>();
else if (beta == testinghelpers::ONE<T>())
thresh = (m+1)*testinghelpers::getEpsilon<T>();
{
#ifdef BLIS_INT_ELEMENT_TYPE
double adj = 1.0;
#else
double adj = 3.9;
#endif
thresh = adj*(m+1)*testinghelpers::getEpsilon<T>();
}
else
thresh = (m+2)*testinghelpers::getEpsilon<T>();
else
if (beta == testinghelpers::ZERO<T>())
thresh = (2*m)*testinghelpers::getEpsilon<T>();
else if (beta == testinghelpers::ONE<T>())
thresh = (2*m+1)*testinghelpers::getEpsilon<T>();
{
#ifdef BLIS_INT_ELEMENT_TYPE
double adj = 1.0;
#else
double adj = 5.2;
#endif
thresh = adj*(2*m+1)*testinghelpers::getEpsilon<T>();
}
else
{
thresh = (2*m+2)*testinghelpers::getEpsilon<T>();
}
//----------------------------------------------------------
// Call generic test body using those parameters

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
#include "common/wrong_inputs_helpers.h"
#include "common/testing_helpers.h"
#include "inc/check_error.h"

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
class cscalvGeneric :
public ::testing::TestWithParam<std::tuple<char, // conj_alpha

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
class csscalvGeneric :
public ::testing::TestWithParam<std::tuple<char, // conj_alpha

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
class dscalvEVT :
public ::testing::TestWithParam<std::tuple<char, // conj_alpha

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
class dscalvGeneric :
public ::testing::TestWithParam<std::tuple<char,

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
class sscalvGeneric :
public ::testing::TestWithParam<std::tuple<char,

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
class zdscalvEVT :
public ::testing::TestWithParam<std::tuple<char, // conj_alpha

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
class zdscalvGeneric :
public ::testing::TestWithParam<std::tuple<char, // conj_alpha

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
class zscalvEVT :
public ::testing::TestWithParam<std::tuple<char, // conj_alpha

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_scalv.h"
#include "level1/scalv/test_scalv.h"
class zscalvGeneric :
public ::testing::TestWithParam<std::tuple<char, // conj_alpha

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_ger.h"
#include "level2/ger/test_ger.h"
#include "common/wrong_inputs_helpers.h"
#include "common/testing_helpers.h"
#include "inc/check_error.h"

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_ger.h"
#include "level2/ger/test_ger.h"
using T = scomplex;
using RT = testinghelpers::type_info<T>::real_type;

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_ger.h"
#include "level2/ger/test_ger.h"
class cgerGeneric :
public ::testing::TestWithParam<std::tuple<char,

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_ger.h"
#include "level2/ger/test_ger.h"
using T = double;
static T NaN = std::numeric_limits<T>::quiet_NaN();

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_ger.h"
#include "level2/ger/test_ger.h"
class dgerGeneric :
public ::testing::TestWithParam<std::tuple<char,

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_ger.h"
#include "level2/ger/test_ger.h"
using T = float;
static T NaN = std::numeric_limits<T>::quiet_NaN();

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_ger.h"
#include "level2/ger/test_ger.h"
class sgerGeneric :
public ::testing::TestWithParam<std::tuple<char, // storage

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_ger.h"
#include "level2/ger/test_ger.h"
using T = dcomplex;
using RT = testinghelpers::type_info<T>::real_type;

View File

@@ -33,7 +33,7 @@
*/
#include <gtest/gtest.h>
#include "test_ger.h"
#include "level2/ger/test_ger.h"
class zgerGeneric :
public ::testing::TestWithParam<std::tuple<char,

View File

@@ -81,8 +81,13 @@ TEST_P( zhemvGeneric, API )
// Check gtestsuite hemv.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;
// With adjustment applied for complex data.
double thresh;
#ifdef BLIS_INT_ELEMENT_TYPE
double adj = 1.0;
#else
double adj = 2.4;
#endif
if (n == 0)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>() && (beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
@@ -90,7 +95,7 @@ TEST_P( zhemvGeneric, API )
else if (alpha == testinghelpers::ZERO<T>())
thresh = testinghelpers::getEpsilon<T>();
else
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
thresh = adj*(3*n+1)*testinghelpers::getEpsilon<T>();
//----------------------------------------------------------
// Call test body using these parameters

View File

@@ -83,9 +83,9 @@ TEST_P( dsymvGeneric, API )
// of output, and hence the multipler for epsilon.
double thresh;
#ifdef BLIS_INT_ELEMENT_TYPE
double adj = 1.0;
double adj = 1.4;
#else
double adj = 1.3;
double adj = 1.7;
#ifdef REF_IS_MKL
adj = 1.4;
#endif

View File

@@ -83,9 +83,9 @@ TEST_P( ssymvGeneric, API )
// of output, and hence the multipler for epsilon.
double thresh;
#ifdef BLIS_INT_ELEMENT_TYPE
double adj = 1.0;
double adj = 3.4;
#else
double adj = 1.1;
double adj = 2.0;
#ifdef REF_IS_MKL
adj = 1.4;
#endif

View File

@@ -89,16 +89,32 @@ TEST_P( daxpyfGeneric, UKR )
// Check gtestsuite axpyf.h (no netlib version) 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)
thresh = 0.0;
else if (alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else if (alpha == testinghelpers::ONE<T>())
thresh = (2*b_fuse)*testinghelpers::getEpsilon<T>();
{
// Threshold adjustment
#ifdef BLIS_INT_ELEMENT_TYPE
double adj = 1.0;
#else
double adj = 4.0;
#endif
thresh = adj*(2*b_fuse)*testinghelpers::getEpsilon<T>();
}
else
thresh = (3*b_fuse)*testinghelpers::getEpsilon<T>();
{
// Threshold adjustment
#ifdef BLIS_INT_ELEMENT_TYPE
double adj = 2.0;
#else
double adj = 4.7;
#endif
thresh = adj*(3*b_fuse)*testinghelpers::getEpsilon<T>();
}
//----------------------------------------------------------
// Call generic test body using those parameters

View File

@@ -35,7 +35,7 @@
#include <gtest/gtest.h>
#include "blis.h"
#include "common/testing_helpers.h"
#include "test_complex_gemm_ukr.h"
#include "ukr/gemm/test_complex_gemm_ukr.h"
/*******************************************************/
/* SUP Kernel testing */

View File

@@ -35,7 +35,7 @@
#include <gtest/gtest.h>
#include "blis.h"
#include "common/testing_helpers.h"
#include "test_gemm_ukr.h"
#include "ukr/gemm/test_gemm_ukr.h"
/*******************************************************/
/* SUP Kernel testing */

View File

@@ -35,7 +35,7 @@
#include <gtest/gtest.h>
#include "blis.h"
#include "common/testing_helpers.h"
#include "test_gemm_ukr.h"
#include "ukr/gemm/test_gemm_ukr.h"
/*******************************************************/
/* SUP Kernel testing */

View File

@@ -35,7 +35,7 @@
#include <gtest/gtest.h>
#include "blis.h"
#include "common/testing_helpers.h"
#include "test_complex_gemm_ukr.h"
#include "ukr/gemm/test_complex_gemm_ukr.h"
/*******************************************************/
/* SUP Kernel testing */

View File

@@ -35,7 +35,7 @@
#include <gtest/gtest.h>
#include "common/testing_helpers.h"
#include "level3/ref_gemm.h"
#include "test_trsm_ukr.h"
#include "ukr/trsm/test_trsm_ukr.h"
#include "level3/trsm/test_trsm.h"
class ctrsmGenericSmall :
@@ -53,6 +53,8 @@ class ctrsmGenericSmall :
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ctrsmGenericSmall);
#ifndef BLIS_INT_ELEMENT_TYPE
TEST_P( ctrsmGenericSmall, UKR )
{
using T = scomplex;
@@ -107,3 +109,5 @@ INSTANTIATE_TEST_SUITE_P (
);
#endif
#endif
#endif // ifndef BLIS_INT_ELEMENT_TYPE

View File

@@ -35,7 +35,7 @@
#include <gtest/gtest.h>
#include "common/testing_helpers.h"
#include "level3/ref_gemm.h"
#include "test_trsm_ukr.h"
#include "ukr/trsm/test_trsm_ukr.h"
#include "level3/trsm/test_trsm.h"
class dtrsmGenericNat :

View File

@@ -35,7 +35,7 @@
#include <gtest/gtest.h>
#include "common/testing_helpers.h"
#include "level3/ref_gemm.h"
#include "test_trsm_ukr.h"
#include "ukr/trsm/test_trsm_ukr.h"
#include "level3/trsm/test_trsm.h"
class strsmGenericNat :

View File

@@ -35,7 +35,7 @@
#include <gtest/gtest.h>
#include "common/testing_helpers.h"
#include "level3/ref_gemm.h"
#include "test_trsm_ukr.h"
#include "ukr/trsm/test_trsm_ukr.h"
#include "level3/trsm/test_trsm.h"
class ztrsmGenericNat :
@@ -66,6 +66,8 @@ class ztrsmGenericSmall :
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ztrsmGenericNat);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ztrsmGenericSmall);
#ifndef BLIS_INT_ELEMENT_TYPE
TEST_P( ztrsmGenericNat, UKR )
{
using T = dcomplex;
@@ -86,10 +88,16 @@ TEST_P( ztrsmGenericNat, UKR )
// of output, and hence the multipler for epsilon.
// No adjustment applied yet for complex data.
double thresh;
// Threshold adjustment
#ifdef BLIS_INT_ELEMENT_TYPE
double adj = 1.0;
#else
double adj = 1.6;
#endif
if (m == 0 || n == 0 || alpha == testinghelpers::ZERO<T>())
thresh = 0.0;
else
thresh = 3*m*testinghelpers::getEpsilon<T>();
thresh = adj*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);
}
@@ -260,3 +268,5 @@ INSTANTIATE_TEST_SUITE_P (
);
#endif
#endif
#endif // ifndef BLIS_INT_ELEMENT_TYPE