_|_|_| _|_|_| _|_|_| _|_|_| _| _|
_| _| _| _| _| _| _|_| _|_|
_|_|_| _|_|_| _| _|_| _| _| _|
_| _| _| _| _| _| _|
_| _| _| _|_|_| _|_|_| _| _|This library provides a vectorized implementation of two probabilistic rounding modes:
- Up-Down Rounding Mode: Add +/- 1 ulp with equal probabilities (1/2). Do not preserve exact operations.
- Stochastic Rounding: As described in Fasi and Mikaitis: Algorithms for Stochastically Rounded Elementary Arithmetic Operations, extended here to support the FMA operator.
The library leverages the Highway library, a high-performance C++ library for portable vector instructions across platforms. It uses dynamic dispatch to efficiently execute functions across different architectures.
The library is available in three interfaces:
- Array Interface: Supports probabilistic rounding (PR) on contiguous arrays, providing a simple and flexible interface.
- Dynamic Interface: Provides an interface for single vector instructions with dynamic dispatch to automatically select the best implementation for the target architecture.
- Static Interface: Provides an interface for single vector instructions with static dispatch, delivering optimal performance by bypassing architecture selection. This mode is not portable across architectures.
This combination of features makes the library versatile for scientific computing, numerical analysis, and high-performance applications requiring probabilistic rounding.
Linux x86-64 binaries are attached to each GitHub release. Choose the highest architecture level supported by every machine that will run the static-dispatch library and the LLVM major version used by your LLVM IR pipeline:
| Architecture component | Minimum CPU features |
|---|---|
x86-64 |
Baseline x86-64 |
x86-64-v2 |
SSE3, SSSE3, SSE4.1, SSE4.2, and POPCNT |
x86-64-v3 |
AVX, AVX2, BMI1/2, F16C, FMA, and related features |
x86-64-v4 |
AVX-512 foundation and the standard v4 extensions |
For example, set the desired release and LLVM versions and install the baseline package under /usr/local:
VERSION=X.Y.Z
LLVM_MAJOR=18
curl -LO "https://github.com/verificarlo/prism/releases/download/v${VERSION}/prism-${VERSION}-linux-x86-64-llvm${LLVM_MAJOR}.tar.gz"
sudo tar -C /usr/local --strip-components=1 -xzf "prism-${VERSION}-linux-x86-64-llvm${LLVM_MAJOR}.tar.gz"
sudo ldconfigEach release also includes SHA256SUMS. Archives are built on Ubuntu 22.04 for LLVM 17, 18, 19, and 20. They contain shared and static libraries, public headers, and generated LLVM IR files; select the matching llvmN archive when consuming those IR files. Package documentation and build metadata are installed under share/doc/prism. The dynamic-dispatch library selects a supported vector target at runtime; the static-dispatch library requires the CPU level named by the archive.
The default build requests -march=native and falls back to -mtune=native when the compiler does not support it. Pass --with-arch to build the static-dispatch library for a specific CPU level.
./autogen.sh
./configure
# ./configure --with-arch=x86-64-v3
make
make installbazel test tests:allThe library has only been tested on X86-64 architectures for the moment.