Crate trueno

Crate trueno 

Source
Expand description

Trueno: Multi-Target High-Performance Compute Library

Trueno (Spanish: “thunder”) provides unified, high-performance compute primitives across three execution targets:

  1. CPU SIMD - x86 (SSE2/AVX/AVX2/AVX-512), ARM (NEON), WASM (SIMD128)
  2. GPU - Vulkan/Metal/DX12/WebGPU via wgpu
  3. WebAssembly - Portable SIMD128 for browser/edge deployment

§Design Principles

  • Write once, optimize everywhere: Single algorithm, multiple backends
  • Runtime dispatch: Auto-select best implementation based on CPU features
  • Zero unsafe in public API: Safety via type system, unsafe isolated in backends
  • Benchmarked performance: Every optimization must prove ≥10% speedup
  • Extreme TDD: >90% test coverage, mutation testing, property-based tests

§Quick Start

use trueno::Vector;

let a = Vector::from_slice(&[1.0, 2.0, 3.0, 4.0]);
let b = Vector::from_slice(&[5.0, 6.0, 7.0, 8.0]);

// Auto-selects best backend (AVX2/GPU/WASM)
let result = a.add(&b).unwrap();
assert_eq!(result.as_slice(), &[6.0, 8.0, 10.0, 12.0]);

Re-exports§

pub use eigen::SymmetricEigen;
pub use error::Result;
pub use error::TruenoError;
pub use hash::hash_bytes;
pub use hash::hash_key;
pub use hash::hash_keys_batch;
pub use hash::hash_keys_batch_with_backend;
pub use matrix::Matrix;
pub use vector::Vector;

Modules§

backends
Backend implementations for different SIMD instruction sets
chaos
Chaos Engineering Configuration
eigen
Eigendecomposition for symmetric matrices
error
Error types for Trueno operations
hash
SIMD-optimized hash functions for key-value store operations.
matrix
Matrix operations for Trueno
vector
Vector type with multi-backend support

Enums§

Backend
Backend execution target
OpComplexity
Operation complexity for GPU dispatch eligibility
OperationType
Operation type for SIMD backend selection

Functions§

select_backend_for_operation
Select the optimal backend for a specific operation type
select_best_available_backend
Select the best available backend for the current platform