Table of Contents

Class SimdThresholds

Namespace
NumSharp.Backends.Kernels
Assembly
NumSharp.dll

Minimum element counts for SIMD to be beneficial. Below these thresholds, the overhead of SIMD setup may exceed the benefits. Based on Vector256 (32 bytes) width.

public static class SimdThresholds
Inheritance
SimdThresholds
Inherited Members

Fields

Byte

Minimum elements for byte (32 per Vector256).

public const int Byte = 64

Field Value

int

Double

Minimum elements for Double (4 per Vector256) - conservative.

public const int Double = 512

Field Value

int

Int16

Minimum elements for Int16/UInt16 (16 per Vector256).

public const int Int16 = 64

Field Value

int

Int32

Minimum elements for Int32/UInt32/Single (8 per Vector256).

public const int Int32 = 96

Field Value

int

Int64

Minimum elements for Int64/UInt64/Double (4 per Vector256).

public const int Int64 = 256

Field Value

int

MemoryBound

Size above which memory bandwidth dominates and SIMD speedup diminishes. At very large sizes, we're limited by memory bandwidth, not compute.

public const int MemoryBound = 10000000

Field Value

int

Single

Minimum elements for Single (8 per Vector256).

public const int Single = 96

Field Value

int

Methods

GetThreshold(NPTypeCode)

Get the minimum threshold for a given NPTypeCode.

public static int GetThreshold(NPTypeCode typeCode)

Parameters

typeCode NPTypeCode

Returns

int

ShouldUseSIMD(NPTypeCode, int)

Returns true if the array size is above the SIMD threshold for the given type.

public static bool ShouldUseSIMD(NPTypeCode typeCode, int size)

Parameters

typeCode NPTypeCode
size int

Returns

bool