Skip to content

Commit

Permalink
V3.73 (#374)
Browse files Browse the repository at this point in the history
* updating SEMVER to v3.73.1

* updating CI to build branch v3.73

* code hygiene for benchmarking

* adding dynamic range benchmarking

* code hygiene

* WIP: adding a home for parameterized fma function

* WIP: bfloat16 refinement
  • Loading branch information
Ravenwater authored Oct 22, 2023
1 parent da69f51 commit b9f7003
Show file tree
Hide file tree
Showing 51 changed files with 1,543 additions and 228 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ option(BUILD_LINEAR_ALGEBRA_DATA "Set to ON to build the data prep math
# benchmarking
option(BUILD_BENCHMARK_ERROR "Set to ON to build error benchmarks" OFF)
option(BUILD_BENCHMARK_ACCURACY "Set to ON to build accuracy benchmarks" OFF)
option(BUILD_BENCHMARK_RANGE "Set to ON to build dynamic range benchmarks" OFF)
option(BUILD_BENCHMARK_REPRODUCIBILITY "Set to ON to build reproducibility benchmarks" OFF)
option(BUILD_BENCHMARK_PERFORMANCE "Set to ON to build performance benchmarks" OFF)
option(BUILD_BENCHMARK_ENERGY "Set to ON to build energy efficiency benchmarks" OFF)
Expand Down Expand Up @@ -658,6 +659,7 @@ endif(BUILD_NUMERICS)
if(BUILD_BENCHMARKS)
set(BUILD_BENCHMARK_ERROR ON)
set(BUILD_BENCHMARK_ACCURACY ON)
set(BUILD_BENCHMARK_RANGE ON)
set(BUILD_BENCHMARK_REPRODUCIBILITY ON)
set(BUILD_BENCHMARK_ENERGY ON)
set(BUILD_BENCHMARK_PERFORMANCE ON)
Expand Down Expand Up @@ -833,6 +835,12 @@ add_subdirectory("benchmark/accuracy/blas")
add_subdirectory("benchmark/accuracy/quantization")
endif(BUILD_BENCHMARK_ACCURACY)

# range benchmarks
if(BUILD_BENCHMARK_RANGE)
add_subdirectory("benchmark/range/blas")
add_subdirectory("benchmark/range/arithmetic")
endif(BUILD_BENCHMARK_RANGE)

# reproducibility benchmarks
if(BUILD_BENCHMARK_REPRODUCIBILITY)
add_subdirectory("benchmark/reproducibility/blas")
Expand Down
22 changes: 6 additions & 16 deletions benchmark/accuracy/blas/dot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@
// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
#ifdef _MSC_VER
#pragma warning(disable : 4514) // warning C4514: 'std::complex<float>::complex': unreferenced inline function has been removed
#pragma warning(disable : 4571) // warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
#pragma warning(disable : 4625) // warning C4625: 'std::moneypunct<char,true>': copy constructor was implicitly defined as deleted
#pragma warning(disable : 4626) // warning C4626: 'std::codecvt_base': assignment operator was implicitly defined as deleted
#pragma warning(disable : 4710) // warning C4710: 'int swprintf_s(wchar_t *const ,const size_t,const wchar_t *const ,...)': function not inlined
#pragma warning(disable : 4774) // warning C4774: 'sprintf_s' : format string expected in argument 3 is not a string literal
#pragma warning(disable : 4820) // warning C4820: 'std::_Mpunct<_Elem>': '4' bytes padding added after data member 'std::_Mpunct<_Elem>::_Kseparator'
#pragma warning(disable : 5026) // warning C5026 : 'std::_Generic_error_category' : move constructor was implicitly defined as deleted
#pragma warning(disable : 5027) // warning C5027 : 'std::_Generic_error_category' : move assignment operator was implicitly defined as deleted
#endif
#include <universal/utility/directives.hpp>

// enable the following define to show the intermediate steps in the fused-dot product
// #define ALGORITHM_VERBOSE_OUTPUT
Expand All @@ -30,7 +20,7 @@
#include <universal/number/edecimal/edecimal.hpp>
#include <universal/blas/blas.hpp>

int main(int argc, char** argv)
int main()
try {
using namespace sw::universal;

Expand Down Expand Up @@ -63,16 +53,16 @@ catch (char const* msg) {
std::cerr << msg << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_arithmetic_exception& err) {
std::cerr << "Uncaught posit arithmetic exception: " << err.what() << std::endl;
catch (const sw::universal::universal_arithmetic_exception& err) {
std::cerr << "Uncaught universal arithmetic exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::quire_exception& err) {
std::cerr << "Uncaught quire exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_internal_exception& err) {
std::cerr << "Uncaught posit internal exception: " << err.what() << std::endl;
catch (const sw::universal::universal_internal_exception& err) {
std::cerr << "Uncaught universal internal exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::runtime_error& err) {
Expand Down
11 changes: 6 additions & 5 deletions benchmark/accuracy/blas/gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
#include <universal/utility/directives.hpp>

// enable the following define to show the intermediate steps in the fused-dot product
// #define ALGORITHM_VERBOSE_OUTPUT
Expand Down Expand Up @@ -37,7 +38,7 @@ sw::universal::occurrence<sw::universal::edecimal> sw::universal::edecimal::ops;

#endif

int main(int argc, char** argv)
int main()
try {
using namespace sw::universal::blas;

Expand All @@ -60,16 +61,16 @@ catch (char const* msg) {
std::cerr << msg << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_arithmetic_exception& err) {
std::cerr << "Uncaught posit arithmetic exception: " << err.what() << std::endl;
catch (const sw::universal::universal_arithmetic_exception& err) {
std::cerr << "Uncaught universal arithmetic exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::quire_exception& err) {
std::cerr << "Uncaught quire exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_internal_exception& err) {
std::cerr << "Uncaught posit internal exception: " << err.what() << std::endl;
catch (const sw::universal::universal_internal_exception& err) {
std::cerr << "Uncaught universal internal exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::runtime_error& err) {
Expand Down
13 changes: 7 additions & 6 deletions benchmark/accuracy/blas/matvec.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// matvec.cpp: accuracy/precision measurment of mixed-precision matrix-vector product
//
// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc.
// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
#include <universal/utility/directives.hpp>

// enable the following define to show the intermediate steps in the fused-dot product
// #define ALGORITHM_VERBOSE_OUTPUT
Expand Down Expand Up @@ -43,7 +44,7 @@ void catastrophicCancellationTest() {
}
}

int main(int argc, char** argv)
int main()
try {
catastrophicCancellationTest<float>();
catastrophicCancellationTest<double>();
Expand All @@ -55,16 +56,16 @@ catch (char const* msg) {
std::cerr << msg << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_arithmetic_exception& err) {
std::cerr << "Uncaught posit arithmetic exception: " << err.what() << std::endl;
catch (const sw::universal::universal_arithmetic_exception& err) {
std::cerr << "Uncaught universal arithmetic exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::quire_exception& err) {
std::cerr << "Uncaught quire exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_internal_exception& err) {
std::cerr << "Uncaught posit internal exception: " << err.what() << std::endl;
catch (const sw::universal::universal_internal_exception& err) {
std::cerr << "Uncaught universal internal exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::runtime_error& err) {
Expand Down
22 changes: 6 additions & 16 deletions benchmark/energy/blas/dot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@
// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
#ifdef _MSC_VER
#pragma warning(disable : 4514) // warning C4514: 'std::complex<float>::complex': unreferenced inline function has been removed
#pragma warning(disable : 4571) // warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
#pragma warning(disable : 4625) // warning C4625: 'std::moneypunct<char,true>': copy constructor was implicitly defined as deleted
#pragma warning(disable : 4626) // warning C4626: 'std::codecvt_base': assignment operator was implicitly defined as deleted
#pragma warning(disable : 4710) // warning C4710: 'int swprintf_s(wchar_t *const ,const size_t,const wchar_t *const ,...)': function not inlined
#pragma warning(disable : 4774) // warning C4774: 'sprintf_s' : format string expected in argument 3 is not a string literal
#pragma warning(disable : 4820) // warning C4820: 'std::_Mpunct<_Elem>': '4' bytes padding added after data member 'std::_Mpunct<_Elem>::_Kseparator'
#pragma warning(disable : 5026) // warning C5026 : 'std::_Generic_error_category' : move constructor was implicitly defined as deleted
#pragma warning(disable : 5027) // warning C5027 : 'std::_Generic_error_category' : move assignment operator was implicitly defined as deleted
#endif
#include <universal/utility/directives.hpp>

// enable the following define to show the intermediate steps in the fused-dot product
// #define ALGORITHM_VERBOSE_OUTPUT
Expand All @@ -30,7 +20,7 @@
#include <universal/number/edecimal/edecimal.hpp>
#include <universal/blas/blas.hpp>

int main(int argc, char** argv)
int main()
try {
using namespace sw::universal;

Expand Down Expand Up @@ -63,16 +53,16 @@ catch (char const* msg) {
std::cerr << msg << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_arithmetic_exception& err) {
std::cerr << "Uncaught posit arithmetic exception: " << err.what() << std::endl;
catch (const sw::universal::universal_arithmetic_exception& err) {
std::cerr << "Uncaught universal arithmetic exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::quire_exception& err) {
std::cerr << "Uncaught quire exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_internal_exception& err) {
std::cerr << "Uncaught posit internal exception: " << err.what() << std::endl;
catch (const sw::universal::universal_internal_exception& err) {
std::cerr << "Uncaught universal internal exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::runtime_error& err) {
Expand Down
11 changes: 6 additions & 5 deletions benchmark/energy/blas/gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
#include <universal/utility/directives.hpp>

// enable the following define to show the intermediate steps in the fused-dot product
// #define ALGORITHM_VERBOSE_OUTPUT
Expand Down Expand Up @@ -37,7 +38,7 @@ sw::universal::occurrence<sw::universal::edecimal> sw::universal::edecimal::ops;

#endif

int main(int argc, char** argv)
int main()
try {
using namespace sw::universal::blas;

Expand All @@ -60,16 +61,16 @@ catch (char const* msg) {
std::cerr << msg << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_arithmetic_exception& err) {
std::cerr << "Uncaught posit arithmetic exception: " << err.what() << std::endl;
catch (const sw::universal::universal_arithmetic_exception& err) {
std::cerr << "Uncaught universal arithmetic exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::quire_exception& err) {
std::cerr << "Uncaught quire exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_internal_exception& err) {
std::cerr << "Uncaught posit internal exception: " << err.what() << std::endl;
catch (const sw::universal::universal_internal_exception& err) {
std::cerr << "Uncaught universal internal exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::runtime_error& err) {
Expand Down
13 changes: 7 additions & 6 deletions benchmark/energy/blas/matvec.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// matvec.cpp: energy measurement of a mixed-precision matrix-vector product
//
// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc.
// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
#include <universal/utility/directives.hpp>

// enable the following define to show the intermediate steps in the fused-dot product
// #define ALGORITHM_VERBOSE_OUTPUT
Expand Down Expand Up @@ -43,7 +44,7 @@ void catastrophicCancellationTest() {
}
}

int main(int argc, char** argv)
int main()
try {
catastrophicCancellationTest<float>();
catastrophicCancellationTest<double>();
Expand All @@ -55,16 +56,16 @@ catch (char const* msg) {
std::cerr << msg << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_arithmetic_exception& err) {
std::cerr << "Uncaught posit arithmetic exception: " << err.what() << std::endl;
catch (const sw::universal::universal_arithmetic_exception& err) {
std::cerr << "Uncaught universal arithmetic exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::quire_exception& err) {
std::cerr << "Uncaught quire exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_internal_exception& err) {
std::cerr << "Uncaught posit internal exception: " << err.what() << std::endl;
catch (const sw::universal::universal_internal_exception& err) {
std::cerr << "Uncaught universal internal exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::runtime_error& err) {
Expand Down
11 changes: 6 additions & 5 deletions benchmark/error/blas/dot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ void TraceProducts(const sw::universal::blas::vector<Scalar>& x, const sw::unive
}
std::cout << "input range = [ " << minInput << ", " << maxInput << "]\n";
std::cout << "product range = [ " << minProduct << ", " << maxProduct << "]\n";
std::cout << sw::universal::symmetry_range<Scalar>() << '\n';
// std::cout << sw::universal::dynamic_range<Scalar>() << '\n'; // not that interesting in this context
std::cout << sw::universal::minmax_range<Scalar>() << '\n';
std::string infoStr = sw::universal::symmetry_range<Scalar>();
std::cout << infoStr << '\n';
infoStr = sw::universal::minmax_range<Scalar>();
std::cout << infoStr << '\n';
}

template<typename Scalar, bool verbose = true>
Expand All @@ -43,8 +44,8 @@ void DotProductError(const sw::universal::blas::vector<double>& x, double minx,
using namespace sw::universal;
std::cout << "\nScalar type : " << type_tag(Scalar()) << '\n';

auto minpos = double(std::numeric_limits<Scalar>::min());
auto maxpos = double(std::numeric_limits<Scalar>::max());
auto minpos = static_cast<double>(std::numeric_limits<Scalar>::min());
auto maxpos = static_cast<double>(std::numeric_limits<Scalar>::max());
auto maxxy = std::max(maxx, maxy);
auto focus{ 1.0 }, expand{ 1.0 };
if (maxxy*maxxy > maxpos) { // need to scale the vectors
Expand Down
2 changes: 1 addition & 1 deletion benchmark/error/sampling/sampling.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// sampling.cpp: error measurement of the approximation of a number system sampling real values
//
// Copyright (C) 2022-2022 Stillwater Supercomputing, Inc.
// Copyright (C) 2022-2023 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
#include <universal/utility/directives.hpp>
Expand Down
22 changes: 6 additions & 16 deletions benchmark/performance/blas/dot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@
// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc.
//
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
#ifdef _MSC_VER
#pragma warning(disable : 4514) // warning C4514: 'std::complex<float>::complex': unreferenced inline function has been removed
#pragma warning(disable : 4571) // warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
#pragma warning(disable : 4625) // warning C4625: 'std::moneypunct<char,true>': copy constructor was implicitly defined as deleted
#pragma warning(disable : 4626) // warning C4626: 'std::codecvt_base': assignment operator was implicitly defined as deleted
#pragma warning(disable : 4710) // warning C4710: 'int swprintf_s(wchar_t *const ,const size_t,const wchar_t *const ,...)': function not inlined
#pragma warning(disable : 4774) // warning C4774: 'sprintf_s' : format string expected in argument 3 is not a string literal
#pragma warning(disable : 4820) // warning C4820: 'std::_Mpunct<_Elem>': '4' bytes padding added after data member 'std::_Mpunct<_Elem>::_Kseparator'
#pragma warning(disable : 5026) // warning C5026 : 'std::_Generic_error_category' : move constructor was implicitly defined as deleted
#pragma warning(disable : 5027) // warning C5027 : 'std::_Generic_error_category' : move assignment operator was implicitly defined as deleted
#endif
#include <universal/utility/directives.hpp>

// enable the following define to show the intermediate steps in the fused-dot product
// #define ALGORITHM_VERBOSE_OUTPUT
Expand All @@ -30,7 +20,7 @@
#include <universal/number/edecimal/edecimal.hpp>
#include <universal/blas/blas.hpp>

int main(int argc, char** argv)
int main()
try {
using namespace sw::universal;

Expand Down Expand Up @@ -63,16 +53,16 @@ catch (char const* msg) {
std::cerr << "Caught exception: " << msg << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_arithmetic_exception& err) {
std::cerr << "Uncaught posit arithmetic exception: " << err.what() << std::endl;
catch (const sw::universal::universal_arithmetic_exception& err) {
std::cerr << "Uncaught universal arithmetic exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::quire_exception& err) {
std::cerr << "Uncaught quire exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const sw::universal::posit_internal_exception& err) {
std::cerr << "Uncaught posit internal exception: " << err.what() << std::endl;
catch (const sw::universal::universal_internal_exception& err) {
std::cerr << "Uncaught universal internal exception: " << err.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::runtime_error& err) {
Expand Down
Loading

0 comments on commit b9f7003

Please sign in to comment.