Type Overview

Magetypes provides generic SIMD vector types parameterized by a backend token. Each type is written as f32x8<T> where T is a token type that determines the platform implementation. A function generic over T: F32x8Backend works on any backend that supports 8-lane f32 operations.

Available Types

Native x86-64 shapes

TypeElementsWidthNative Token
f32x4<T>4 x f32128-bitX64V2Token
f32x8<T>8 x f32256-bitX64V3Token
f32x16<T>16 x f32512-bitX64V4Token*
f64x2<T>2 x f64128-bitX64V2Token
f64x4<T>4 x f64256-bitX64V3Token
f64x8<T>8 x f64512-bitX64V4Token*
i8x16<T>16 x i8128-bitX64V2Token
i8x32<T>32 x i8256-bitX64V3Token
i16x8<T>8 x i16128-bitX64V2Token
i16x16<T>16 x i16256-bitX64V3Token
i32x4<T>4 x i32128-bitX64V2Token
i32x8<T>8 x i32256-bitX64V3Token
i32x16<T>16 x i32512-bitX64V4Token*
i64x2<T>2 x i64128-bitX64V2Token
i64x4<T>4 x i64256-bitX64V3Token
u8x16<T>16 x u8128-bitX64V2Token
u8x32<T>32 x u8256-bitX64V3Token
u16x8<T>8 x u16128-bitX64V2Token
u16x16<T>16 x u16256-bitX64V3Token
u32x4<T>4 x u32128-bitX64V2Token
u32x8<T>8 x u32256-bitX64V3Token
u64x2<T>2 x u64128-bitX64V2Token
u64x4<T>4 x u64256-bitX64V3Token

*Native 512-bit implementations require avx512. Logical 512-bit types also have polyfills under the default w512 feature. This table lists native implementations, not every supported token/shape combination.

AArch64 (NEON)

TypeElementsWidthToken
f32x4<T>4 x f32128-bitNeonToken
f64x2<T>2 x f64128-bitNeonToken
i8x16<T>16 x i8128-bitNeonToken
i16x8<T>8 x i16128-bitNeonToken
i32x4<T>4 x i32128-bitNeonToken
i64x2<T>2 x i64128-bitNeonToken
u8x16<T>16 x u8128-bitNeonToken
u16x8<T>8 x u16128-bitNeonToken
u32x4<T>4 x u32128-bitNeonToken
u64x2<T>2 x u64128-bitNeonToken

NEON registers are 128-bit. Wider types (f32x8<T>, etc.) are available as polyfills using pairs of NEON operations.

WASM (SIMD128)

TypeElementsWidthToken
f32x4<T>4 x f32128-bitWasm128Token
f64x2<T>2 x f64128-bitWasm128Token
i8x16<T>16 x i8128-bitWasm128Token
i16x8<T>8 x i16128-bitWasm128Token
i32x4<T>4 x i32128-bitWasm128Token
i64x2<T>2 x i64128-bitWasm128Token
u8x16<T>16 x u8128-bitWasm128Token
u16x8<T>8 x u16128-bitWasm128Token
u32x4<T>4 x u32128-bitWasm128Token
u64x2<T>2 x u64128-bitWasm128Token

Wider types are available as polyfills, same as ARM.

Using these types

Start with the complete generated gain kernel, then generic input types and const modes. The macro supplies each tier's feature context. A bare generic helper called from baseline code does not get that context merely from its token argument.

The vector values are Copy, Clone, Debug, Send, and Sync. Constructors require tokens. define(...) is optional shorthand for explicit generic types. See slice casting for why unrestricted Pod/Zeroable construction is not exposed.

Found an error or it needs a clarification? Open an issue on GitHub.
Substantiated corrections will be incorporated with attribution.