SLEEF Vectorized Math Librarylogo

Table of contents

Overview

SLEEF stands for SIMD Library for Evaluating Elementary Functions. It implements vectorized versions of all C99 real floating point math functions. It can utilize SIMD instructions of modern processors. SLEEF is designed to fully utilize SIMD computation by reducing the use of conditional branches and scatter/gather memory access. Our benchmarks show that the performance of SLEEF is comparable to that of the best commercial library. Unlike vendor-tuned libraries, SLEEF is portable : it can be easily ported to other architectures by writing a helper file, which is a thin abstraction layer of SIMD intrinsics. SLEEF is also designed to work with various operating systems and compilers. It also includes vectorized DFT subroutines.

The library contains subroutines for all C99 real FP math functions in double precision and single precision. Different accuracy of the results can be chosen for a subset of the elementary functions; for this subset there are versions with up to 1 ulp error (which is the maximum error, not the average) and versions with a few ulp error. Obviously, less accurate versions are faster. For non-finite inputs and outputs, the library should return the same results as libm as specified in the C99 standard. The library is rigorously tested if the evaluation error is within the designed limit. The library is tested against high-precision evaluation using the libmpfr library. Especially, we carefully checked the error of the trigonometric functions when the arguments are close to an integral multiple of π/2.

Supported environments

This library currently supports several SIMD architectures :



In addition to the SIMD implementation, Pure C (scalar) version is provided. For x86 architecture, the library provides dispatchers that automatically choose the best subroutines for the computer the library is run. The supported combinations of the architecture, operating system and compiler are shown in Table 1.1.

Table 1.1: Environment support matrix
GCC Clang Intel Compiler MSVC
x86 (64bit), Linux Supported Supported Supported(*1) N/A
x86 (32bit), Linux Supported(*2) Supported(*2) N/A
AArch64, Linux Supported Supported N/A N/A
AArch32, Linux Supported(*3) Supported(*3) N/A N/A
x86 (64bit), OS X Supported Supported N/A
x86 (64bit), Windows Supported(Cygwin)(*4) Supported(Cygwin)(*4) Supported(*5)
Generic Supported(*6) Supported(*6)

The supported compiler versions are as follows.



*1 FMA4 is not supported by Intel Compiler.

*2 SSE2 is required to run the scalar functions on 32-bit x86 architecture. x87 is not supported.

*3 NEON has only single precision support. The computation results are not in full accuracy since NEON is not IEEE 754-compliant.

*4 AVX functions are not supported for Cygwin, since AVX is not supported by Cygwin ABI.

*5 AVX512F is not supported by Visual Studio 2015.

*6 Generic architecture is supported through GCC/Clang vector extensions. IEEE 754-compliant 64-bit and 32-bit calculation is required.

All functions in the library are thread safe unless otherwise noted.

Credit

License

SLEEF is distributed under Boost Software License Version 1.0.

open source logo   Boost Software License is OSI-certified. See this page for more information about Boost Software License.

History

3.1 (Released on July 19, 2017)

3.0 (Released on Feb. 7, 2017)

2.120 (Released on Jan. 30, 2017)

2.110 (Released on Dec. 11, 2016)

Download sleef