Crate simdop [−] [src]

A Library for Safe SIMD Operations

The simdop library provides SIMD functionality for building applications using fast operations on homogeneous vector types. It provides safety on a type-level using traits.

CPU identification and feature detection

In order to use a specific operations on a specific vector type, you have to provide proof that the operation is valid on your architecture. This is achieved by executing one or more detection functions, which return an Option<T> type. You need to retrieve the wrapped value, which provides access to the operations in the detected feature set in the form of trait implementations.

Vector representation and encoding

Since the number of elements in a vector is always a power of two, vectors are represented as a perfect binary tree, which encodes the length of the vector as a logarithm in the height of the tree. This makes structural modifications very easy, while providing strong type guarantees, e.g. when splitting or joining vectors.

To perform SIMD operation, the tree is flattened into an array, and restored afterwards. When combining vector operations, the compiler is able to perform "deforestation" optimisations on the data structures, elminating most of the structural overhead.

Modules

arch

CPU identification and feature detection, as well as trait implementations.

core

Core data structures and traits.

Traits

Abs

The Abs trait is used to specify absolute value computation functionality.

Add

The Add trait is used to specify element-wise addition functionality.

AddS

The AddS trait is used to specify element-wise saturated addition functionality.

CmpEq

The CmpEq trait is used to specify equality comparison funtionality.

CmpGt

The CmpGt trait is used to specify greater-than comparison funtionality.

CmpLt

The CmpLt trait is used to specify less-than comparison funtionality.

HAdd

The HAdd trait is used to specify horizontal addition functionality.

HSub

The HSub trait is used to specify horizontal subtraction functionality.

MAdd

The MAdd trait is used to specify multiply-add functionality.

Max

The Max trait is used to specify maximum comparison functionality.

Min

The Min trait is used to specify minimum comparison functionality.

Mulhi

The Mulhi trait is used to specify high element-wise multiplication functionality.

Mullo

The Mullo trait is used to specify low element-wise multiplication functionality.

PackS

The PackS trait is used to specify signed element narrowing functionality.

PackUS

The PackUS trait is used to specify unsigned element narrowing functionality.

Set1

The Set1 trait is used to specify broadcasting functionality.

Shli

The Shli trait is used to specify immediate bit-wise left shift functionality.

Shri

The Shri trait is used to specify immediate bit-wise right shift functionality.

Sign

The Sign trait is used to specify negation functionality.

Type Definitions

M16

A vector of 16 elements of type N.

M2

A vector of 2 elements of type N.

M32

A vector of 32 elements of type N.

M4

A vector of 4 elements of type N.

M8

A vector of 8 elements of type N.