-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bumping SEMVER to v3.74.1 * removing extraneous function * adding QSNR to the benchmarking * adding range reporting for the Scalar type * adding elastic integer traits to try to disambiguate type_tag (not entirely successful yet) * compilation fix for gcc and clang * streamlining elastic binary integer API test * renaming Adaptive to Elastic * expanding QSNR experiment to sample across multiple sets * generalizing qsnr as a service * adding is_subnormal() attribute method * specialized posit<16,2> engineering * redefining nibble markers to be 0-based * WIP: fast posit<16,2> addition * restructuring specialized posits test infrastructure * adding a posit oracle as a separate data type to be used to validate specialized posits * adding a arithmetic debug test * Implement specialized posit<16,2> addition (#403) * rearchitecting the regression test suite to have a universal number system check * cleaning up include file dependencies * bug fix in the argument order of ReportBinaryArithmeticError as called in the posit test suite * WIP: bug fixes for add/sub, not quite there yet * compilation fix for gcc and clang * WIP: fast posit<16,2> subtraction checks * Implement specialized posit<16,2> sub, mul, div (#404) Div is not working 100% yet * enabling the regression level 1 again in specialized posit<16,2> while we are RCAing the div on extreme regime values * bug fix and reporting improvement of posit randoms * WIP: cleaning up posit<16,1> and posit<16,2> * adding a math library to the posito oracle so we can use it to compare native implementations * WIP: building test infrastructure to RCA specialized posit implementations * WIP: RCAing specialized posit<16,2> divide operator * adding multiplication tests for specialized posits * WIP: code hygiene for old posit code * WIP: redoing the fast posit<16,2> arithmetic operators * restoring the multiplication operator algorithm * configuring a regression test for fast posit multiplication * configuring a regression test for fast posit addition * test name edit * configuring a regression test for fast posit division: not enabled yet * adding a regression suite for fast posit subtraction * code hygiene for old posit code * bug fix in fast posit<32,2> that code hygiene activities had introduced * WIP: fixed bugs in regime and exponent fields for fast posit<16,2>, rounding still buggy * bug fix of bitnplusone calculation in divround of posit<16,2> * code hygiene posit<32,2> * bug fix div operator for fast posit<16,2> * adding new posit attribute functions: maxprecision_max/min, this is the largest value of Regime 0, and the smallest value of Regime -1 * adding full regression results for reference --------- Co-authored-by: David Mallasén Quintana <[email protected]>
- Loading branch information
1 parent
408b099
commit 7af781f
Showing
171 changed files
with
11,435 additions
and
2,278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
file (GLOB SOURCES "./*.cpp") | ||
|
||
compile_all("true" "quantization" "Benchmarks/Error/QSNR" "${SOURCES}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// qsnr.cpp: Quantization Signal to Noise ratio for a sampling | ||
// | ||
// 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> | ||
|
||
#define INTEGER_THROW_ARITHMETIC_EXCEPTION 1 | ||
#include <universal/number/integer/integer.hpp> | ||
#define FIXPNT_THROW_ARITHMETIC_EXCEPTION 1 | ||
#include <universal/number/fixpnt/fixpnt.hpp> | ||
#define CFLOAT_THROW_ARITHMETIC_EXCEPTION 1 | ||
#include <universal/number/cfloat/cfloat.hpp> | ||
#define POSIT_THROW_ARITHMETIC_EXCEPTION 1 | ||
#include <universal/number/posit/posit.hpp> | ||
#define LNS_THROW_ARITHMETIC_EXCEPTION 1 | ||
#include <universal/number/lns/lns.hpp> | ||
|
||
#include <universal/blas/blas.hpp> | ||
#include <universal/quantization/qsnr.hpp> | ||
|
||
// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override | ||
#define MANUAL_TESTING 0 | ||
// REGRESSION_LEVEL_OVERRIDE is set by the cmake file to drive a specific regression intensity | ||
// It is the responsibility of the regression test to organize the tests in a quartile progression. | ||
//#undef REGRESSION_LEVEL_OVERRIDE | ||
#ifndef REGRESSION_LEVEL_OVERRIDE | ||
#undef REGRESSION_LEVEL_1 | ||
#undef REGRESSION_LEVEL_2 | ||
#undef REGRESSION_LEVEL_3 | ||
#undef REGRESSION_LEVEL_4 | ||
#define REGRESSION_LEVEL_1 1 | ||
#define REGRESSION_LEVEL_2 1 | ||
#define REGRESSION_LEVEL_3 1 | ||
#define REGRESSION_LEVEL_4 1 | ||
#endif | ||
|
||
int main() | ||
try { | ||
using namespace sw::universal; | ||
|
||
constexpr int nrExperiments = 10; | ||
std::map<std::string, blas::vector<double>> table; | ||
std::vector<std::string> arithmeticTypename = { | ||
"fixpnt<8,2>", | ||
"fixpnt<8,3>", | ||
"fixpnt<8,4>", | ||
"fixpnt<8,5>", | ||
"fp8e2m5", | ||
"fp8e3m4", | ||
"fp8e4m3", | ||
"fp8e5m2", | ||
"posit<8,0>", | ||
"posit<8,1>", | ||
"posit<8,2>", | ||
"posit<8,3>", | ||
"lns<8,2>", | ||
"lns<8,3>", | ||
"lns<8,4>", | ||
"lns<8,5>" | ||
}; | ||
|
||
for (int i = 0; i < nrExperiments; ++i) { | ||
constexpr unsigned N = 32; | ||
constexpr double mean = 0.0; | ||
constexpr double stddev = 1.0; | ||
auto data = sw::universal::blas::gaussian_random_vector<double>(N, mean, stddev); | ||
table["fixpnt<8,2>"].push_back(qsnr<fixpnt<8, 2>>(data)); | ||
table["fixpnt<8,3>"].push_back(qsnr<fixpnt<8, 3>>(data)); | ||
table["fixpnt<8,4>"].push_back(qsnr<fixpnt<8, 4>>(data)); | ||
table["fixpnt<8,5>"].push_back(qsnr<fixpnt<8, 5>>(data)); | ||
table["fp8e2m5"].push_back(qsnr<fp8e2m5>(data)); | ||
table["fp8e3m4"].push_back(qsnr<fp8e3m4>(data)); | ||
table["fp8e4m3"].push_back(qsnr<fp8e4m3>(data)); | ||
table["fp8e5m2"].push_back(qsnr<fp8e5m2>(data)); | ||
table["posit<8,0>"].push_back(qsnr<posit<8, 0>>(data)); | ||
table["posit<8,1>"].push_back(qsnr<posit<8, 1>>(data)); | ||
table["posit<8,2>"].push_back(qsnr<posit<8, 2>>(data)); | ||
table["posit<8,3>"].push_back(qsnr<posit<8, 3>>(data)); | ||
table["lns<8,2>"].push_back(qsnr<lns<8, 2>>(data)); | ||
table["lns<8,3>"].push_back(qsnr<lns<8, 3>>(data)); | ||
table["lns<8,4>"].push_back(qsnr<lns<8, 4>>(data)); | ||
table["lns<8,5>"].push_back(qsnr<lns<8, 5>>(data)); | ||
} | ||
|
||
for (auto tag : arithmeticTypename) { | ||
std::cout << std::setw(15) << tag << " : " << blas::quantiles(table[tag]) << '\n'; | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
} | ||
catch (char const* msg) { | ||
std::cerr << msg << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const sw::universal::universal_arithmetic_exception& err) { | ||
std::cerr << "Uncaught arithmetic exception: " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const sw::universal::universal_internal_exception& err) { | ||
std::cerr << "Uncaught internal exception: " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const std::runtime_error& err) { | ||
std::cerr << "Uncaught runtime exception: " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (...) { | ||
std::cerr << "Caught unknown exception" << std::endl; | ||
return EXIT_FAILURE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.