Fast and accurate vector math in MtxVec

Direct replacements for Intel IPP and oneMKL VML

MtxVec’s Vector Math Library provides direct replacements for corresponding Intel IPP and Intel oneMKL VML functions. It evaluates operations such as sine, cosine, exponentials, logarithms, powers, square roots, and the normal distribution over arrays of single- or double-precision values.

Across 380 benchmark cases for 38 real-valued functions, MtxVec took 42% of Intel IPP’s average execution time, a 2.39× speedup. The vector math functions typically return results within 1 ULP of the high-precision reference.

Performance against Intel IPP VML

MtxVec provides AVX-512, AVX2, and SSE4.2 implementations. AVX2 and SSE4.2 cover both Win32 and Win64. AVX-512 covers Win64 only, so it contributes 76 cases, with 38 functions in two precisions.

The library is designed for balanced performance across AMD and Intel processors. The optimization process considered recent architectures from both vendors for each instruction set.

Average execution time for MtxVec and Intel IPP VML overall and by instruction set, precision, and Windows platform

Open the interactive chart and hover over a row or focus it with Tab to see the exact timings, ratio, and case count.

ISAAVX512764.1410.650.39x
ISAAVX215210.5322.810.46x
ISASSE4215226.0464.390.40x
PrecisionDouble19022.7446.700.49x
PrecisionSingle1908.1827.320.30x
PlatformWin6422812.5721.810.58x
PlatformWin3215219.7959.810.33x
Overall38015.4637.010.42x

Each benchmark cell represents one function, precision, platform, and instruction-set combination. The ratio divides the mean MtxVec time by the mean Intel IPP time. A time of 15.46 in the table is 1.546 ns per element. Single precision showed the larger of the two precision-level gains, at 30% of the reference time, or a 3.34× speedup.

How the functions were timed

The L1 benchmark repeatedly processes a 1,024-element block that fits in L1 cache. The branch-prediction benchmark streams successive blocks of varied inputs from L2, reducing the benefit of repeating the same input pattern. Both tests time corresponding functions at the same instruction-set tier. Intel IPP VML is the timing reference for this comparison.

Individual results depend on the function and instruction set. In the branch-prediction benchmark, double-precision Pow on Win64 AVX-512 used 8% of Intel IPP’s time, while double-precision ErfInv on Win64 SSE4.2 took 2.14× Intel IPP’s time.

Numerical accuracy

A ULP, or unit in the last place, is the spacing between adjacent floating-point values near the result. The figures below are maximum measured errors for double-precision Win64 AVX-512, using high-precision mpmath calculations as the reference.

Ceil0.000 ULP
Exp0.543 ULP
Pow0.550 ULP
ACos0.621 ULP
Sin0.750 ULP
Tan0.946 ULP
Erfc0.997 ULP

Complex-number vector math

MtxVec also provides vectorized complex-number functions. Separate measurements show speedups of around 5× for those functions. The table and chart above cover the real-valued functions.