Repository navigation
v2.0.0 – Re-Engineered Cross-Architecture SIMD for C & C++
Pre-releaseSummary
We are proud to announce the official release of MIPP v2.0.0!
MIPPv2 is a ground-up architectural overhaul of the library. Originally designed as a fixed-width C++ template library for x86 and ARM, MIPP has been completely re-engineered into a declarative, generator-driven SIMD engine supporting modern vector architectures (x86 SSE/AVX/AVX-512, ARM NEON/SVE, and RISC-V Vector 1.0) through three distinct programming dialects.
What's New in MIPPv2
1. Unique Tri-Dialect API
MIPPv2 breaks free from the single-dialect constraint and offers three first-class interfaces depending on your codebase requirements:
- Pure C99 API (
<mipp.h>): Explicit type suffixes (e.g.,mipp_add_float32(a, b)). Designed for pure C codebases, embedded systems, Linux kernel modules, and foreign function interfaces (Pythonctypes/CFFI, Rust FFI). - C++ Functional Template API (
<mipp.hpp>): Type-parameterized functions under namespacemipp::(e.g.,mipp::add<float>(a, b)). - C++ Expressive Object API (
<mipp_obj.hpp>): Full arithmetic (+,-,*,/), bitwise, and relational operator overloading viamipp::Rvd<T, LMUL>andmipp::Rvm<T, LMUL>with zero abstraction overhead.
2. Deterministic 4-Tier Fallback Engine (100% Functional Completeness)
Unlike libraries that fail at compile time when an instruction is missing on an older architecture or unsupported data type, MIPPv2 guarantees that every single function compiles and executes across all 10 supported data types and all ISAs:
- Level 0 (Native Optimal): 1-to-1 mapping to native hardware intrinsics (
_mm256_add_ps,vaddq_f32,__riscv_vfadd_vf_f32m1). - Level 1 (Specific ISA Emulation): Emulates missing functionality using instructions within the same ISA (e.g., integer multiplication via shifts/shuffles on early SSE).
- Level 2 (Generic Portable Emulation): Composes operations using portable MIPP primitives (e.g., polynomial approximations for
sin/cos/exp, or logical blends). - Level 3 (Transparent Scalar Loop): Graceful element-wise fallback ensuring execution continuity.
3. Expanded Modern Architecture Support
- x86 / x86-64: SSE (all variants up to SSE4.2), AVX, AVX2 + FMA, and AVX-512 (F, BW, DQ).
- ARM: NEON (ARMv7, ARMv8-A) and fixed-width SVE.
-
RISC-V: RVV 1.0 (fixed compile-time VLEN
$\ge 128\text{ bits}$ ). - Universal Scalar: Compile-time configurable vector width fallback target.
4. Generalized Length Multiplier (LMUL $\in {1, 2, 4, 8}$ )
Scale your vector operations beyond single registers:
- Hardware Grouping: Directly maps to native register groups on RVV 1.0 (e.g.,
vfloat32m2_t,vfloat32m4_t). - Software Grouping: Recursively unrolled binary structures on fixed-width ISAs (x86, ARM) that compilers vectorize cleanly without abstraction penalty.
5. First-Class Masking Semantics
Standardized masking modes available across all vector routines:
unmasked: Standard unconditional vector execution.mask: Blends computed results with inactive elements of the destination register.maskz: Zeroes out inactive lanes.masks: Preserves inactive lanes from an explicit source vector.
6. Lightweight, Fast Compilation & Header-Only
- Requires only C99 or C++11 upwards (unlike modern alternatives requiring C++17 or C++20).
- No heavy template metaprogramming bottlenecks—ensuring near-instantaneous project build times.
- Header-only: no static or shared runtime libraries to compile or link.
Quick 5-Minute Example
Vectorizing an array addition with tail-loop handling using the C++ Object API:
#include <iostream>
#include <vector>
#include <mipp_obj.hpp>
void vector_add(const float* a, const float* b, float* c, size_t size) {
constexpr int N = mipp::N<float>(); // Elements per SIMD register
size_t vec_limit = size - (size % N);
// 1. Vector Main Loop (Chunk of N floats)
for (size_t i = 0; i < vec_limit; i += N) {
mipp::Rvd<float> va(&a[i]);
mipp::Rvd<float> vb(&b[i]);
mipp::Rvd<float> vc = va + vb;
vc.store(&c[i]);
}
// 2. Tail Loop (Reliquat)
for (size_t i = vec_limit; i < size; ++i) {
c[i] = a[i] + b[i];
}
}Or using the pure C99 interface:
#include <mipp.h>
void vector_add_c(const float* a, const float* b, float* c, size_t size) {
const int N = MIPP_N_FLOAT32;
size_t vec_limit = size - (size % N);
for (size_t i = 0; i < vec_limit; i += N) {
rvd_float32_t va = mipp_load_float32(&a[i]);
rvd_float32_t vb = mipp_load_float32(&b[i]);
rvd_float32_t vc = mipp_add_float32(va, vb);
mipp_store_float32(&c[i], vc);
}
for (size_t i = vec_limit; i < size; ++i) {
c[i] = a[i] + b[i];
}
}Getting Started & Assets
MIPP is ready to drop into your project without any Python dependencies:
- Download the standalone pre-generated header archives attached below:
- Extract the include/ folder into your project's include path.
- Compile with your target vectorization flags (e.g., -mavx2 -mfma, -march=armv8-a+simd, or -march=rv64gcv).
📖 Full Documentation: Check out our brand new documentation site for architectural deep dives, comparison benchmarks against Highway/xsimd/Eve, and the complete API reference!