Skip to main content

Module simd

Module simd 

Source
Expand description

SIMD (Single Instruction, Multiple Data) optimization utilities.

This module provides SIMD optimization infrastructure:

  • Platform detection (AVX2, AVX-512, NEON, etc.)
  • Vectorization hints for the compiler
  • SIMD-friendly data layouts and alignment
  • Automatic vectorization checking
  • Performance benchmarking for SIMD operations

§Example

use tensorlogic_infer::{SimdCapabilities, SimdOptimizer, AlignedBuffer};

// Check SIMD capabilities
let caps = SimdCapabilities::detect();
println!("AVX2 supported: {}", caps.has_avx2());

// Create aligned buffer for SIMD operations
let buffer = AlignedBuffer::<f32>::new(1024);

// Optimize operations for SIMD
let optimizer = SimdOptimizer::new(caps);
let optimized_graph = optimizer.optimize(&graph)?;

Structs§

AlignedBuffer
Aligned buffer for SIMD operations.
SimdCapabilities
SIMD capabilities detection.
SimdOptimizationHints
SIMD optimization hints.

Enums§

CpuArchitecture
CPU architecture.
SimdError
SIMD optimization errors.
SimdInstructionSet
SIMD instruction set.

Functions§

alignment_offset
Get the alignment offset needed to align a pointer.
is_simd_aligned
Check if a pointer is aligned for SIMD operations.
vectorize_hint
Vectorization hint for the compiler.