Skip to content

Why MIPPv2: Architecture & Technical Relevance

MIPPv2 provides portable, zero-overhead SIMD computing across x86, ARM, and RISC-V targets through an offline code generation pipeline, a deterministic fallback engine, and three APIs (C, C++ Functional, C++ Object) sharing the same implementation.


1. Motivation & Philosophy

Several mature SIMD wrappers exist today (see the comparison below), and MIPP does not try to replace them. Its place is the one it has had since MIPPv1, in 2016: a wrapper born in an academic setting, made for teaching and research as much as for production code.

  • Made to be read. Opening a function shows the instructions it runs. The API Explorer shows, for a function, a datatype and a target, the code that is compiled and what it is built from.
  • For beginners and experts. The same library serves a first SIMD loop (a + b on two mipp::Vd) and fine control over masking, register groups and targets.
  • Made to follow the hardware. Supporting a new SIMD extension means describing it, not rewriting the library (Adding an ISA).
  • Not bound to one language. The registry of the functions (names, prototypes, datatypes, mask variants) does not depend on a language: the generator writes each API from it. MIPPv2 generates C and C++ today; another language would be an extension to the generator.
  • Open source. MIPP is released under the MIT license, and will remain so.

MIPPv2 was written with the help of generative AI, in a way its design keeps under control: see Generative AI in MIPPv2.


2. Key Architectural Principles

MIPPv2 architecture: three APIs (C, C++ Functional, C++ Object) share one implementation that picks, per function, datatype and target, the first available level among L0 native, L1 dedicated emulation, L2 generic emulation and L3 scalar fallback; targets SSE, AVX, AVX-512, NEON, SVE, RVV and Scalar

2.1. Three APIs

Three complementary interfaces mapping to the same inlined instructions:

  • C API (<mipp.h>, C11): Explicit type-suffixed functions (mipp_add_float32) for pure C codebases and embedded targets.
  • C++ Functional API (<mipp.hpp>, C++11): Overloaded functions under namespace mipp:: (mipp::add(a, b)), with datatype and LMUL deduced from the register types.
  • C++ Object API (<mipp_obj.hpp>, C++11): Register classes (mipp::Vd, mipp::Vm) with complete operator overloading.

2.2. Deterministic 4-Level Fallback Hierarchy

Every function compiles on every target, for all its data types, and uses the best available level: Level 0 (Native Hardware), Level 1 (Dedicated Emulation), Level 2 (Generic Emulation) or Level 3 (Scalar Fallback). A few functions are not implemented yet in two configurations (ARMv7 NEON, RVV without 64-bit elements): they compile but stop at run time. See Implementation Levels and its known limitations.

2.3. Generalized Length Multiplier (LMUL)

Uniform vector register grouping (\(\text{LMUL} \in \{1, 2, 4, 8\}\)), plus half-vectors (d2, \(\text{LMUL} = 1/2\)):

  • Hardware (RVV 1.0): Native vector register grouping (vfloat32m2_t, vfloat32m4_t) and fractional registers (vfloat32mf2_t).
  • Software (x86, ARM): Binary register pairs unrolled at compile time.
  • Scalar target: Flat arrays of \(N \times \text{LMUL}\) elements.

See Vector Types & LMUL.

2.4. Explicit 4-Variant Masking Model

Standardized execution semantics across all operations:

  • Unmasked (U, no suffix): Unconditional vector computation.
  • Merge-Masked (M, _maskm): Inactive elements keep the first operand: \(\text{res}_i = \begin{cases} f(a_i, b_i) & \text{if } m_i = 1 \\ a_i & \text{if } m_i = 0 \end{cases}\)
  • Zero-Masked (Z, _maskz): Zeroes inactive elements: \(\text{res}_i = \begin{cases} f(a_i, b_i) & \text{if } m_i = 1 \\ 0 & \text{if } m_i = 0 \end{cases}\)
  • Source-Masked (S, _masks): Inactive elements take the values of a source vector: \(\text{res}_i = \begin{cases} f(a_i, b_i) & \text{if } m_i = 1 \\ \text{src}_i & \text{if } m_i = 0 \end{cases}\)

See Masking Semantics for the complete reference.


3. Comparison with Existing SIMD Solutions

Choosing the right SIMD library depends on language requirements, compilation constraints, and portability goals. The tables below reflect the state of each project as of October 2026. To port a program written for MIPPv1, see Migrating from MIPPv1.

Features

MIPPv2 MIPPv1 Highway xsimd Eve nSIMD Vc VCL std::simd Raw intrinsics Auto-vectorization
C API ✓ <mipp.h> — — — — ✓ nsimd.h — — — ◐ Vendor-specific n/a
C++ operator overloading ✓ Vd ✓ Reg ◐ Not on SVE / RVV ✓ batch ✓ wide ✓ pack ✓ Vector ✓ Vec… ✓ simd — n/a
Complete fallback ✓ Levels 0–3 (exceptions) — Ad hoc ✓ EMU128 / SCALAR ◐ Opt-in emulated ✓ emulated_ ABI ✓ CPU emulation ✓ Scalar implementation ◐ x86 only, down to SSE2 ✓ Mandated by ISO — Compile error — Silent scalar code
RISC-V Vector 1.0 ◐ Fixed-width — ✓ Scalable & fixed ◐ Fixed-width ◐ Fixed-width, unreleased — — — ◐ Fixed-width, WIP ◐ Built-ins, VLA / fixed ◐ Unpredictable
ARM SVE ◐ Fixed-width — ✓ Scalable & fixed ◐ Fixed-width ◐ Fixed-width ✓ Scalable & fixed — — ◐ Fixed-width, WIP ◐ ACLE, VLA / fixed ◐ Unpredictable
Generalized LMUL (\(1,2,4,8\)) ✓ Plus half-vectors — ◐ RVV only (kPow2) — — — — — — — RVV only —
Dispatch Static Static Static & dynamic Static & dynamic Static Static & dynamic Static Static Manual dynamic Static Static Manual dynamic Static Dynamic via target_clones
Minimum standard C11 / C++11 C++11 C++17 C++17 C++20 C89 / C++98 C++11 C++17 C++26 C99 / C++11 C99 / C++11
Compile-time cost Low Flat inlines Medium Deep templates High Templates Medium Very high High Macros Medium to high Low Inline headers High Templates Very low None
Generated assembly Explicit Explicit Explicit Explicit Explicit Explicit Explicit Explicit Explicit Explicit Heuristic
Implementation Generated Python Handwritten C++ Handwritten Templates Handwritten Templates Handwritten C++20 Generated Python + macros Handwritten Templates Handwritten Classes Handwritten Templates Manual Compiler

✓ Supported  ·  ◐ Partial  ·  — Not supported

Project Status

Project Latest release License Stars Commits / year Contributors Last commit
MIPPv2 v2.5.0 2026-11-30 MIT Stars Commits per year Contributors Last commit
MIPPv1 Untagged master, 2026-04-15 MIT Stars Commits per year Contributors Last commit
Highway 1.4.0 2026-04-23 Apache-2.0 / BSD-3-Clause Stars Commits per year Contributors Last commit
xsimd 14.3.0 2026-07-15 BSD-3-Clause Stars Commits per year Contributors Last commit
Eve v2023.02.15 2023-02-15 BSL-1.0 Stars Commits per year Contributors Last commit
nSIMD v3.0.1 2021-10-19 MIT Stars Commits per year Contributors Last commit
Vc 1.4.5 2024-06-06, maintenance mode BSD-3-Clause Stars Commits per year Contributors Last commit
VCL v2.02.03 2026-04-14 Apache-2.0 Stars Commits per year Contributors Last commit
std::simd C++26 P1928R15, 2024 Compiler / standard library n/a n/a n/a n/a

Key Differentiators for MIPPv2

  1. Dual-Ecosystem (C & Modern C++): Most modern wrappers require C++17/C++20, while nSIMD relies on heavy macro preprocessing. MIPPv2 has a C11 API next to its two C++11 APIs (§2.1).
  2. Expressive Syntax without Portability Sacrifices: While Google Highway restricts operator overloading to fixed-width targets to accommodate sizeless SVE / RVV vectors, MIPPv2 retains natural operator expressions (va + vb) across all fixed-width targets.
  3. Deterministic 4-Level Fallback Guarantee: Missing CPU instructions never cause compilation failures: every function compiles on every target, for every datatype it supports (§2.2).
  4. Pragmatic Fixed-Width Design (RVV & SVE): Targeting compile-time vector widths (-mrvv-vector-bits / -msve-vector-bits) preserves compile-time constants (MIPP_N_FLOAT32, ...) and straightforward struct layouts. The price is one binary per vector width (below).
  5. Predictable Assembly vs. Auto-Vectorization: Compiler auto-vectorization (-O3) is fragile and can silently de-vectorize loops upon subtle code changes. MIPP guarantees explicit, deterministic SIMD instructions.
  6. Automated Offline Code Generation: Shifting metaprogramming offline into a Python engine (generator/) yields three major engineering benefits:
    • Fine-Grained Modular Headers: Programmatic synthesis enables headers restricted to one function, one masking variant and one LMUL (e.g. <mipp/obj/fun/m/m2/add.hpp>). Including only what is needed makes compilation 2× to 4× faster than with the umbrella header (see Headers & Compile Time).
    • Declarative Single Source of Truth: Opcode mappings, fallbacks, unit tests, and documentation are generated from central JSON registries, enabling rapid maintenance and eliminating documentation drift.
    • Fast Builds with Zero Indirection: Replaces deep C++ template instantiations and macro bloat with flat, strongly typed inlines where IDEs jump directly to native intrinsics.

When Highway Is a Better Fit

MIPPv2 is not the best choice for every project. Google Highway, the most complete of the libraries above, is ahead on points that can decide the choice:

  1. Dynamic Dispatch: Highway compiles a function for several targets and picks the best one at run time (HWY_DYNAMIC_DISPATCH): a single binary runs AVX-512 code where the CPU has it and SSE code elsewhere. MIPPv2 targets one ISA per compilation: a program distributed as a binary has to be built once per target and choose the right build itself.
  2. Scalable Vectors: On SVE and RVV, Highway also supports sizeless vectors: the same binary uses the full vector length of any hardware. A MIPPv2 binary is tied to the width chosen at compile time.
  3. More Architectures: Highway also covers PowerPC (VSX), IBM Z, WebAssembly and LoongArch.
  4. Maturity: Highway is used in production by large projects (JPEG XL, Chromium, NumPy's sort), has a stable API, many contributors, and ready-made algorithms (sorting, dot products, matrix-vector products). MIPPv2 is younger: its API can still change between versions.

Highway is the better fit for binaries shipped to unknown machines, for a single binary that uses the full width of SVE or RVV hardware, and for the architectures above. MIPPv2 fits code compiled for known machines (HPC, research), C code bases, and projects that value readable SIMD code, explicit implementation levels and register groups on every ISA.