Class StrideDetector
Stride-based pattern detection for selecting optimal SIMD execution paths. All methods are aggressively inlined for minimal dispatch overhead.
public static class StrideDetector
- Inheritance
-
StrideDetector
- Inherited Members
Methods
CanSimdChunk<T>(int*, int*, int*, int)
Check if inner dimension is suitable for SIMD chunking. Returns true if both operands have inner stride of 1 (contiguous) or 0 (broadcast).
public static bool CanSimdChunk<T>(int* lhsStrides, int* rhsStrides, int* shape, int ndim) where T : unmanaged
Parameters
Returns
Type Parameters
T
Classify<T>(int*, int*, int*, int)
Classify the binary operation into an execution path based on stride analysis. Classification priority:
- SimdFull - both fully contiguous (fastest)
- SimdScalarRight/Left - one operand is scalar
- SimdChunk - inner dimension is contiguous/broadcast
- General - fallback for arbitrary strides
public static ExecutionPath Classify<T>(int* lhsStrides, int* rhsStrides, int* shape, int ndim) where T : unmanaged
Parameters
Returns
Type Parameters
T
IsContiguous(int*, int*, int)
Check if array is fully contiguous (C-order). An array is contiguous if strides match expected C-order values: strides[n-1] = 1, strides[i] = strides[i+1] * shape[i+1]
public static bool IsContiguous(int* strides, int* shape, int ndim)
Parameters
Returns
IsScalar(int*, int)
Check if array is a scalar (all strides are zero). A scalar is broadcast to any shape - each element accesses the same value.
public static bool IsScalar(int* strides, int ndim)