summaryrefslogtreecommitdiffstats
path: root/README
blob: 60a0b632321269364eeb5d2a107c84ecc8e1ba07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[From the wiki at <https://bitbucket.org/eschnett/vecmathlib/wiki/Home>:]

Vecmathlib provides efficient, accurate, tunable, and most importantly
vectorizable math functions such as sqrt, sin, or atan.

The library is implemented in C++, and intended to be called on SIMD
vectors, e.g. those provided by SSE, AVX, or available in Power7 and
Blue Gene architectures. The same algorithms should also work
efficiently on accelerators such as GPUs. Even without vectorization,
vecmathlib's algorithms are efficient on standard CPUs.



Implementation

Vecmathlib consists of three parts:

1. vecmathlib's algorithms, i.e. the implementations of various math
   functions (e.g. sqrt)
2. SIMD vector classes, wrapping e.g. SSE or AVX vectors
3. a test harness

The algorithms themselves are written in a generic way. They assume an
IEEE floating point layout (consisting of sign bit, exponent, and
mantissa), but work for arbitrary precision and vector sizes. For
example, there is a routine vml_sqrt() that calculates a square root
via an iterative scheme based on Newton's root finding algorithm.
Although not available yet, there can be different implementations
with different performance characteristics for certain math functions.

The SIMD vector classes wrap architecture-specific SIMD capabilities;
for example, there is an implementation of a class realvec<double,4>
based on Intel's AVX instruction set. These classes either provide
math operations and math functions themselves, or implement them via
calls to the generic algorithms. This way, vecmathlib can provide
efficient implementations for all hardware architectures.

It goes without saying that vecmathlib can also be used for scalar
types, e.g. plain float or double, thus providing math functions for
architectures where they are otherwise not available.



Things To Do

Vecmathlib is not finished. Contributions are welcome! There are
several areas where it can be improved:

1. make test harness more systematic, improve coverage
2. research and implement improved algorithms for certain math
   functions
3. implement vector classes for additional hardware architectures
4. make code more portable -- currently works with GCC 4.7, should
   also support pother versions or compilers
5. review C++ class hierarchy, improve design, reduce redundancy
6. measure performance, compare to system library
7. provide "vector" implementation of math functions by calculating
   them element-wise via libc's scalar functions
8. handle inf, nan, negative zero, rounding modes, and everything else
   required for IEEE compliance (if -ffast-math is not used)
OpenPOWER on IntegriCloud