Skip to content

Commit

Permalink
Merge pull request #252 from stillwater-sc/cfloat_v4
Browse files Browse the repository at this point in the history
fixpnt support for C++20
  • Loading branch information
Ravenwater committed Oct 15, 2021
2 parents 1b5e014 + 86f8c8f commit 8cd0e24
Show file tree
Hide file tree
Showing 71 changed files with 1,274 additions and 1,464 deletions.
206 changes: 106 additions & 100 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if(NOT DEFINED UNIVERSAL_VERSION_MAJOR)
set(UNIVERSAL_VERSION_MAJOR 3)
endif()
if(NOT DEFINED UNIVERSAL_VERSION_MINOR)
set(UNIVERSAL_VERSION_MINOR 42)
set(UNIVERSAL_VERSION_MINOR 43)
endif()
if(NOT DEFINED UNIVERSAL_VERSION_PATCH)
set(UNIVERSAL_VERSION_PATCH 1)
Expand Down Expand Up @@ -77,9 +77,9 @@ option(USE_AVX2 "Build code with AVX2 ISA support"
option(BUILD_ALL "Set to ON to build all components" OFF)
# or subsets of the components
option(BUILD_DEMONSTRATION "Set to ON to build all demonstration components" ON)
option(BUILD_NUMERICAL_CHECKS "Set to ON to build all the numerical components" OFF)
option(BUILD_NUMERICS "Set to ON to build all the numeric components" OFF)
option(BUILD_BENCHMARKS "Set to ON to build all the benchmark components" OFF)
option(BUILD_REGRESSION_SUITES "Set to ON to build all the regression suites" OFF)
option(BUILD_NUMBER_SYSTEMS "Set to ON to build all the number systems" OFF)
option(BUILD_MIXEDPRECISION_SDK "Set to ON to build the mixed-precision SDK" OFF)

# or, build individual components
Expand All @@ -90,12 +90,12 @@ option(BUILD_EDUCATION "Set to ON to build educational example
option(BUILD_APPLICATIONS "Set to ON to build application examples" OFF)

# numerical and special math functions
option(BUILD_NUMERICAL_CHALLENGES "Set to ON to build numerical challenge programs" OFF)
option(BUILD_NUMERICAL_UTILS "Set to ON to build numerical utilities" OFF)
option(BUILD_FPBENCH "Set to ON to build fpbench benchmarks" OFF)
option(BUILD_FUNCTIONS "Set to ON to build special functions programs" OFF)
option(BUILD_NUMERIC_CHALLENGES "Set to ON to build numerical challenge programs" OFF)
option(BUILD_NUMERIC_UTILS "Set to ON to build numerical utilities" OFF)
option(BUILD_NUMERIC_FPBENCH "Set to ON to build fpbench benchmarks" OFF)
option(BUILD_NUMERIC_FUNCTIONS "Set to ON to build special functions programs" OFF)
# reproducible IEEE-754
option(BUILD_IEEE_FLOAT_QUIRES "Set to ON to build reproducible IEEE floats" OFF)
option(BUILD_NUMERIC_IEEE_QUIRES "Set to ON to build reproducible IEEE floats" OFF)


# C API library and test programs
Expand All @@ -104,25 +104,25 @@ option(BUILD_C_API_SHIM_LIB "Set to ON to build C API shim library"
option(BUILD_C_API_LIB_PIC "Set to ON to compile C API library with -fPIC" OFF)

# number systems and their verification suites
option(BUILD_ARITHMETIC_CLASSES "Set to ON to build arithmetic class tests" OFF)
option(BUILD_NATIVE_TYPES "Set to ON to build native type tests" OFF)
option(BUILD_INTEGERS "Set to ON to build integer tests" OFF)
option(BUILD_DECIMALS "Set to ON to build decimal tests" OFF)
option(BUILD_FIXPNTS "Set to ON to build fixed-point tests" OFF)
option(BUILD_CFLOATS "Set to ON to build cfloat tests" OFF)
option(BUILD_AREALS "Set to ON to build areal tests" OFF)
option(BUILD_UNUM_TYPE_1 "Set to ON to build unum Type 1 tests" OFF)
option(BUILD_UNUM_TYPE_2 "Set to ON to build unum Type 2 tests" OFF)
option(BUILD_POSITS "Set to ON to build unum Type 3 posit tests" OFF)
option(BUILD_VALIDS "Set to ON to build unum Type 3 valid tests" OFF)
option(BUILD_REALS "Set to ON to build real tests" OFF)
option(BUILD_LNS "Set to ON to build LNS tests" OFF)
option(BUILD_NUMBER_ARITHMETIC_CLASSES "Set to ON to build arithmetic class tests" OFF)
option(BUILD_NUMBER_NATIVE_TYPES "Set to ON to build native type tests" OFF)
option(BUILD_NUMBER_INTEGERS "Set to ON to build integer tests" OFF)
option(BUILD_NUMBER_DECIMALS "Set to ON to build decimal tests" OFF)
option(BUILD_NUMBER_FIXPNTS "Set to ON to build fixed-point tests" OFF)
option(BUILD_NUMBER_CFLOATS "Set to ON to build cfloat tests" OFF)
option(BUILD_NUMBER_AREALS "Set to ON to build areal tests" OFF)
option(BUILD_NUMBER_UNUM_TYPE_1 "Set to ON to build unum Type 1 tests" OFF)
option(BUILD_NUMBER_UNUM_TYPE_2 "Set to ON to build unum Type 2 tests" OFF)
option(BUILD_NUMBER_POSITS "Set to ON to build unum Type 3 posit tests" OFF)
option(BUILD_NUMBER_VALIDS "Set to ON to build unum Type 3 valid tests" OFF)
option(BUILD_NUMBER_REALS "Set to ON to build real tests" OFF)
option(BUILD_NUMBER_LNS "Set to ON to build LNS tests" OFF)
# conversion test suites
option(BUILD_CONVERSIONS "Set to ON to build conversion test suites" OFF)
option(BUILD_NUMBER_CONVERSIONS "Set to ON to build conversion test suites" OFF)

# Basic Linear Algebra tests
option(BUILD_BLAS "Set to ON to build the BLAS tests" OFF)
option(BUILD_VMATH "Set to ON to build the BLAS vector math lib" OFF)
option(BUILD_LINEAR_ALGEBRA_BLAS "Set to ON to build the BLAS tests" OFF)
option(BUILD_LINEAR_ALGEBRA_VMATH "Set to ON to build the BLAS vector math lib" OFF)

# benchmarking
option(BUILD_BENCHMARK_PERFORMANCE "Set to ON to build performance benchmarks" OFF)
Expand Down Expand Up @@ -206,15 +206,24 @@ endif()
# enable the regression testing level of the build
if(BUILD_REGRESSION_SANITY OR BUILD_REGRESSION_LEVEL_1)
add_definitions(-D REGRESSION_LEVEL_OVERRIDE)
add_definitions(-D REGRESSION_LEVEL_1)
add_definitions(-D REGRESSION_LEVEL_1=1)
add_definitions(-D REGRESSION_LEVEL_2=0)
add_definitions(-D REGRESSION_LEVEL_3=0)
add_definitions(-D REGRESSION_LEVEL_4=0)
endif(BUILD_REGRESSION_SANITY OR BUILD_REGRESSION_LEVEL_1)
if(BUILD_REGRESSION_LEVEL_2)
add_definitions(-D REGRESSION_LEVEL_OVERRIDE)
add_definitions(-D REGRESSION_LEVEL_2)
add_definitions(-D REGRESSION_LEVEL_1=1)
add_definitions(-D REGRESSION_LEVEL_2=1)
add_definitions(-D REGRESSION_LEVEL_3=0)
add_definitions(-D REGRESSION_LEVEL_4=0)
endif(BUILD_REGRESSION_LEVEL_2)
if(BUILD_REGRESSION_LEVEL_3)
add_definitions(-D REGRESSION_LEVEL_OVERRIDE)
add_definitions(-D REGRESSION_LEVEL_3)
add_definitions(-D REGRESSION_LEVEL_1=1)
add_definitions(-D REGRESSION_LEVEL_2=1)
add_definitions(-D REGRESSION_LEVEL_3=1)
add_definitions(-D REGRESSION_LEVEL_4=0)
endif(BUILD_REGRESSION_LEVEL_3)
if(BUILD_REGRESSION_STRESS OR BUILD_REGRESSION_LEVEL_4)
add_definitions(-D REGRESSION_LEVEL_OVERRIDE)
Expand Down Expand Up @@ -253,7 +262,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR MINGW OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
#set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O3 -DNDEBUG")
#set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} -g3 -pthread")

#set(EXTRA_CXX_FLAGS "-std=c++20") # isn't this done by CMAKE_CXX_STANDARD?
elseif(MSVC)
# Streaming SIMD Extension (SSE) ISA
if (USE_SSE3)
Expand All @@ -276,8 +284,8 @@ elseif(MSVC)

# include code quality flags
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} /MP")
add_definitions(-D _CRT_SECURE_NO_WARNINGS)
add_definitions(-D _SCL_SECURE_NO_WARNINGS)
# add_definitions(-D _CRT_SECURE_NO_WARNINGS)
# add_definitions(-D _SCL_SECURE_NO_WARNINGS)

# specific flags for debug and release builds

Expand Down Expand Up @@ -345,7 +353,7 @@ elseif(MSVC)
# The Spectre-mitigated libraries for Visual Studio 2017 and later can be downloaded
# in the Visual Studio Installer. They're found in the Individual Components tab under
# Compilers, build tools, and runtimes, and have "Libs for Spectre" in the name.
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Qspectre")
# set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /Qspectre")
# /Qspectre is very noise, so do not include it for debug builds
# set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} /Qspectre")

Expand Down Expand Up @@ -530,22 +538,19 @@ install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/${project_library_target_name}
if(BUILD_ALL)
# set the grouped components to build (will trigger builds when tested)
set(BUILD_DEMONSTRATION ON)
set(BUILD_NUMERICAL_CHECKS ON)
set(BUILD_NUMERICS ON)
set(BUILD_BENCHMARKS ON)
set(BUILD_REGRESSION_SUITES ON)
set(BUILD_NUMBER_SYSTEMS ON)
set(BUILD_MIXEDPRECISION_SDK ON)

# build the BLAS test/verification suites
set(BUILD_BLAS ON)
set(BUILD_VMATH ON)
set(BUILD_LINEAR_ALGEBRA_BLAS ON)
set(BUILD_LINEAR_ALGEBRA_VMATH ON)

# build the C API library
set(BUILD_C_API_PURE_LIB ON)
set(BUILD_C_API_SHIM_LIB ON)

# build IEEE float/double quire capability
set(BUILD_IEEE_FLOAT_QUIRES ON)

# build the HW validation environment
set(BUILD_VALIDATION_HW ON)
endif(BUILD_ALL)
Expand All @@ -555,15 +560,15 @@ if(BUILD_DEMONSTRATION)
set(BUILD_EDUCATION ON)
set(BUILD_APPLICATIONS ON)
set(BUILD_CMD_LINE_TOOLS ON)

set(BUILD_PLAYGROUND ON)
endif(BUILD_DEMONSTRATION)

if(BUILD_NUMERICAL_CHECKS)
set(BUILD_NUMERICAL_CHALLENGES ON)
set(BUILD_NUMERICAL_UTILS ON)
set(BUILD_FUNCTIONS ON)
endif(BUILD_NUMERICAL_CHECKS)
if(BUILD_NUMERICS)
set(BUILD_NUMERIC_CHALLENGES ON)
set(BUILD_NUMERIC_UTILS ON)
set(BUILD_NUMERIC_FUNCTIONS ON)
set(BUILD_NUMERIC_IEEE_QUIRES ON)
endif(BUILD_NUMERICS)

if(BUILD_BENCHMARKS)
# build the benchmark suites
Expand All @@ -572,25 +577,25 @@ if(BUILD_BENCHMARKS)
set(BUILD_BENCHMARK_ENERGY ON)
endif(BUILD_BENCHMARKS)

if(BUILD_REGRESSION_SUITES)
if(BUILD_NUMBER_SYSTEMS)
# build the different test/verification suites for each number system
set(BUILD_ARITHMETIC_CLASSES ON)
set(BUILD_NATIVE_TYPES ON)
set(BUILD_REALS ON)
set(BUILD_INTEGERS ON)
set(BUILD_DECIMALS ON)
set(BUILD_FIXPNTS ON)
set(BUILD_CFLOATS ON)
set(BUILD_AREALS ON)
set(BUILD_UNUM_TYPE_1 ON)
set(BUILD_UNUM_TYPE_2 ON)
set(BUILD_POSITS ON)
set(BUILD_VALIDS ON)
set(BUILD_LNS ON)
set(BUILD_NUMBER_ARITHMETIC_CLASSES ON)
set(BUILD_NUMBER_NATIVE_TYPES ON)
set(BUILD_NUMBER_REALS ON)
set(BUILD_NUMBER_INTEGERS ON)
set(BUILD_NUMBER_DECIMALS ON)
set(BUILD_NUMBER_FIXPNTS ON)
set(BUILD_NUMBER_CFLOATS ON)
set(BUILD_NUMBER_AREALS ON)
set(BUILD_NUMBER_UNUM_TYPE_1 ON)
set(BUILD_NUMBER_UNUM_TYPE_2 ON)
set(BUILD_NUMBER_POSITS ON)
set(BUILD_NUMBER_VALIDS ON)
set(BUILD_NUMBER_LNS ON)

# build the conversion test suites
set(BUILD_CONVERSIONS ON)
endif(BUILD_REGRESSION_SUITES)
set(BUILD_NUMBER_CONVERSIONS ON)
endif(BUILD_NUMBER_SYSTEMS)

if(BUILD_MIXEDPRECISION_SDK)
set(BUILD_MIXEDPRECISION_ROOTS ON)
Expand All @@ -602,74 +607,74 @@ if(BUILD_MIXEDPRECISION_SDK)
endif(BUILD_MIXEDPRECISION_SDK)

# Build the tests for the underlying storage classes
if(BUILD_ARITHMETIC_CLASSES)
if(BUILD_NUMBER_ARITHMETIC_CLASSES)
add_subdirectory("tests/bitblock")
add_subdirectory("tests/value")
add_subdirectory("tests/blockbinary")
add_subdirectory("tests/blockfraction")
add_subdirectory("tests/blocktriple")
endif(BUILD_ARITHMETIC_CLASSES)
endif(BUILD_NUMBER_ARITHMETIC_CLASSES)

if(BUILD_NATIVE_TYPES)
if(BUILD_NUMBER_NATIVE_TYPES)
add_subdirectory("tests/native")
endif(BUILD_NATIVE_TYPES)
endif(BUILD_NUMBER_NATIVE_TYPES)

# Arbitrary integers tests
if(BUILD_INTEGERS)
if(BUILD_NUMBER_INTEGERS)
add_subdirectory("tests/integer")
add_subdirectory("tests/adaptiveint")
endif(BUILD_INTEGERS)
endif(BUILD_NUMBER_INTEGERS)

if(BUILD_DECIMALS)
if(BUILD_NUMBER_DECIMALS)
add_subdirectory("tests/decimal")
endif(BUILD_DECIMALS)
endif(BUILD_NUMBER_DECIMALS)

# Arbitrary fixed-point tests
if(BUILD_FIXPNTS)
if(BUILD_NUMBER_FIXPNTS)
add_subdirectory("tests/fixpnt")
endif(BUILD_FIXPNTS)
endif(BUILD_NUMBER_FIXPNTS)

# Arbitrary reals tests
if(BUILD_REALS)
if(BUILD_NUMBER_REALS)
add_subdirectory("tests/adaptivefloat")
endif(BUILD_REALS)
endif(BUILD_NUMBER_REALS)

if(BUILD_LNS)
if(BUILD_NUMBER_LNS)
add_subdirectory("tests/lns")
endif(BUILD_LNS)
endif(BUILD_NUMBER_LNS)

if(BUILD_UNUM_TYPE_1)
if(BUILD_NUMBER_UNUM_TYPE_1)
add_subdirectory("tests/unum")
endif(BUILD_UNUM_TYPE_1)
endif(BUILD_NUMBER_UNUM_TYPE_1)

if(BUILD_UNUM_TYPE_2)
if(BUILD_NUMBER_UNUM_TYPE_2)
add_subdirectory("tests/unum2")
endif(BUILD_UNUM_TYPE_2)
endif(BUILD_NUMBER_UNUM_TYPE_2)

if(BUILD_POSITS)
if(BUILD_NUMBER_POSITS)
add_subdirectory("tests/posit")
add_subdirectory("tests/posit/specialized")
add_subdirectory("tests/adaptiveposit")
endif(BUILD_POSITS)
endif(BUILD_NUMBER_POSITS)

if(BUILD_VALIDS)
if(BUILD_NUMBER_VALIDS)
add_subdirectory("tests/valid")
endif(BUILD_VALIDS)
endif(BUILD_NUMBER_VALIDS)

# reals with an uncertainty bit
if(BUILD_AREALS)
if(BUILD_NUMBER_AREALS)
add_subdirectory("tests/areal")
endif(BUILD_AREALS)
endif(BUILD_NUMBER_AREALS)

# cfloats
if(BUILD_CFLOATS)
if(BUILD_NUMBER_CFLOATS)
add_subdirectory("tests/cfloat")
endif(BUILD_CFLOATS)
endif(BUILD_NUMBER_CFLOATS)

# conversion tests suites
if(BUILD_CONVERSION_TESTS)
if(BUILD_NUMBER_CONVERSIONS)
add_subdirectory("tests/conversions")
endif(BUILD_CONVERSION_TESTS)
endif(BUILD_NUMBER_CONVERSIONS)


if(BUILD_MIXEDPRECISION_ROOTS)
Expand Down Expand Up @@ -754,24 +759,23 @@ add_subdirectory("applications/weather")
endif(BUILD_APPLICATIONS)

# numerical benchmarks and challenge problems
if(BUILD_NUMERICAL_CHALLENGES)
if(BUILD_NUMERIC_CHALLENGES)
add_subdirectory("tests/numerical/properties")
endif(BUILD_NUMERICAL_CHALLENGES)
if(BUILD_NUMERICAL_UTILS)
endif(BUILD_NUMERIC_CHALLENGES)
if(BUILD_NUMERIC_UTILS)
add_subdirectory("tests/numerical/utils")
endif(BUILD_NUMERICAL_UTILS)
if(BUILD_FPBENCH)
endif(BUILD_NUMERIC_UTILS)
if(BUILD_NUMERIC_FPBENCH)
add_subdirectory("tests/numerical/fpbench")
endif(BUILD_FPBENCH)
endif(BUILD_NUMERIC_FPBENCH)
if(BUILD_NUMERIC_FUNCTIONS)
add_subdirectory("tests/functions")
endif(BUILD_NUMERIC_FUNCTIONS)

if(BUILD_VALIDATION_HW)
add_subdirectory("validation/hw")
endif(BUILD_VALIDATION_HW)

if(BUILD_FUNCTIONS)
add_subdirectory("tests/functions")
endif(BUILD_FUNCTIONS)

if(BUILD_PLAYGROUND)
add_subdirectory("playground")
endif(BUILD_PLAYGROUND)
Expand All @@ -793,10 +797,12 @@ add_subdirectory("tests/float")
endif(BUILD_IEEE_FLOAT_QUIRES)

# Basic Linear Algebra library
if(BUILD_BLAS)
if(BUILD_LINEAR_ALGEBRA_BLAS)
add_subdirectory("tests/blas")
endif(BUILD_LINEAR_ALGEBRA_BLAS)
if(BUILD_LINEAR_ALGEBRA_VMATH)
add_subdirectory("tests/vmath")
endif(BUILD_BLAS)
endif(BUILD_LINEAR_ALGEBRA_VMATH)

####
# Configuration summary
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ RUN cmake -DBUILD_ALL=ON .. && make
# the command 'make test' is run as part of the CI test pipeline of the release container

# add a command that when you run the container without a command, it produces something meaningful
CMD ["echo", "Universal Numbers Library Builder Version 3.41.1"]
CMD ["echo", "Universal Numbers Library Builder Version 3.43.1"]


# RELEASE stage
Expand Down Expand Up @@ -110,4 +110,4 @@ WORKDIR /home/stillwater/universal/build

# the command 'make test' is run as part of the CI test pipeline of this release container

CMD ["echo", "Universal Numbers Library Version 3.41.1"]
CMD ["echo", "Universal Numbers Library Version 3.43.1"]
Loading

0 comments on commit 8cd0e24

Please sign in to comment.