Add GFNI affine parity generation for RAID polynomial

This commit is contained in:
Andrea Mazzoleni 2026-08-19 17:59:02 +02:00
parent b5d507fbe9
commit 17591ad932
13 changed files with 1523 additions and 142 deletions

View file

@ -90,7 +90,9 @@ Operating Modes and Polynomials
Uses Cauchy matrix generator with standard RAID polynomial 0x1d
(x^8 + x^4 + x^3 + x^2 + 1, decimal 285, 0x11d) and primitive generator
g = 2. Supports parities 1 to 6. Matches standard Linux RAID-6 (Anvin
method) for 2-parity arrays and ensures on-disk compatibility.
method) for 2-parity arrays and ensures on-disk compatibility. On CPUs
supporting Intel GFNI, generation and recovery are accelerated using
VGF2P8AFFINEQB with precomputed affine matrices for the RAID field.
RAID_MODE_VANDERMONDE_RAID (Mode = 1)
Legacy mode supporting up to 3 parities using standard polynomial 0x1d.
@ -99,12 +101,16 @@ Operating Modes and Polynomials
RAID_MODE_CAUCHY_AES (Mode = 2)
Uses Cauchy matrix with AES polynomial 0x1b (x^8 + x^4 + x^3 + x + 1,
0x11b) and primitive generator g = 3. Enables hardware acceleration via
Intel GFNI instructions (vgf2p8mulb) on supported CPUs (Ice Lake or newer).
Parity data is incompatible with standard 0x1d polynomial arrays.
0x11b) and primitive generator g = 3. On CPUs supporting Intel GFNI,
generation and recovery are accelerated directly using VGF2P8MULB.
This native GFNI multiplication is typically faster than the affine GFNI
implementation required by the standard RAID polynomial. Parity data is
incompatible with standard 0x11d polynomial arrays.
Both Cauchy modes use the same Extended Cauchy construction with coefficients
based on powers of their respective primitive generator.
based on powers of their respective primitive generator. GFNI acceleration
is available for both fields: the RAID field uses affine transformations,
while the AES field uses the native GFNI multiplication instruction.
Implementation Structure
@ -115,7 +121,7 @@ Implementation Structure
module.c Algorithm registration, CPU detection, and dynamic dispatch.
int.c Portable C fallback implementation (8/32/64-bit word loops).
tables.c Precomputed GF(2^8) log/exp, multiplication, Cauchy tables.
mktables.c Table generator script for GF(2^8) field matrices.
mktables.c Generator for GF(2^8), Cauchy, and GFNI affine tables.
internal.h Private header, assertion macros (BUG_ON), alignment helpers.
Platform-Specific Acceleration:
@ -123,7 +129,7 @@ Implementation Structure
ssse3.c x86 SSSE3 (128-bit pshufb nibble-split multiplication)
avx2.c x86 AVX2 (256-bit vectorization)
avx512.c x86 AVX-512BW (512-bit vectorization)
gfni.c x86 GFNI hardware Galois field vector multiplication
gfni.c x86 GFNI generation/recovery (RAID affine and AES multiply)
neon.c ARM NEON (128-bit SIMD vectorization)