Expand description
Compute infrastructure integration (trueno 0.8.7+) Compute Infrastructure Integration (trueno 0.8.8+)
This module provides ML-specific wrappers around trueno’s compute primitives and simulation testing infrastructure.
§Features
- Backend Selection: Automatic CPU/GPU dispatch based on data size
- Jidoka Guards: NaN/Inf detection for training stability
- Reproducibility: Deterministic RNG for reproducible experiments
- Stress Testing: Performance validation infrastructure
§Toyota Way Principles
- Jidoka: Built-in quality - stop on defect (NaN/Inf detection)
- Poka-Yoke: Mistake-proofing via type-safe backend selection
- Heijunka: Leveled testing across compute backends
§Example
use aprender::compute::{TrainingGuard, select_backend, BackendCategory};
// Auto-select backend based on data size (100k+ → GPU, 1k+ → SimdParallel)
let data_size = 50_000;
let gpu_available = false;
let backend = select_backend(data_size, gpu_available);
assert_eq!(backend, BackendCategory::SimdParallel);
// Create training guard for NaN/Inf detection
let guard = TrainingGuard::new("gradient_update");
// Check weights after update (detects NaN/Inf)
let weights = vec![1.0f32, 2.0, 3.0];
assert!(guard.check_weights(&weights).is_ok());Structs§
- Backend
Selector - Poka-Yoke: Type-safe backend selection
- Backend
Tolerance - Backend-specific tolerance configuration
- Divergence
Guard - Guard for detecting cross-backend numerical divergence
- Experiment
Seed - Seed management for reproducible ML experiments
- Jidoka
Guard - Jidoka guard for simulation tests
- Matrix
- A 2D matrix with row-major storage
- Stress
Test Config - Stress test configuration for trueno operations
- Stress
Thresholds - Performance thresholds for stress testing
- Training
Guard - ML-specific training guard for numerical stability
- Vector
- High-performance vector with multi-backend support
Enums§
- Backend
- Backend execution target
- Backend
Category - Backend category for selection result
- Jidoka
Action - Jidoka action on condition trigger
- Jidoka
Condition - Jidoka condition that triggers stop
- Jidoka
Error - Jidoka error types
Functions§
- select_
backend - Select optimal backend for ML operation based on data size
- should_
use_ gpu - Check if GPU would be beneficial for this operation size
- should_
use_ parallel - Check if parallel execution would be beneficial