Expand description
Manzana: Safe Rust Interfaces for Apple Hardware
Manzana provides safe, pure Rust interfaces to Apple hardware subsystems for the Sovereign AI Stack. It enables on-premise, privacy-preserving machine learning workloads on macOS.
§Design Philosophy
- Iron Lotus Framework: Toyota Production System principles applied to systems programming
- Popperian Falsification: 100-point scientific rigor checklist
- Zero unsafe in public API: All FFI quarantined in internal modules
§Supported Hardware
| Hardware | Module | Mac Pro | Apple Silicon | Intel Mac |
|---|---|---|---|---|
| Afterburner FPGA | afterburner | Yes | No | No |
| Neural Engine | neural_engine | No | Yes | No |
| Metal GPU | metal | Yes | Yes | Yes |
| Secure Enclave | secure_enclave | T2/AS | Yes | T2 only |
§Quick Start
use manzana::afterburner::AfterburnerMonitor;
// Check if Afterburner is available
if AfterburnerMonitor::is_available() {
let monitor = AfterburnerMonitor::new().expect("just checked availability");
let stats = monitor.stats().expect("failed to get stats");
println!("Active streams: {}", stats.streams_active);
println!("Utilization: {:.1}%", stats.utilization_percent);
} else {
println!("Afterburner not available on this system");
}§Feature Flags
afterburner- Enable Afterburner FPGA support (Mac Pro 2019+)neural-engine- Enable Neural Engine support (Apple Silicon)metal- Enable Metal GPU computesecure-enclave- Enable Secure Enclave operationsfull- Enable all features
§Safety Guarantees
This crate uses #![forbid(unsafe_code)] at the library level. All FFI
code is quarantined in the internal ffi module, which is not exported.
§Error Handling
All operations that can fail return Result<T, Error>. The Error
type provides specific variants for different failure modes, enabling
programmatic error handling.
§Thread Safety
Hardware monitors are !Send and !Sync because the underlying Apple
frameworks (IOKit, CoreML) are not thread-safe. Create monitors on each
thread that needs them, or use synchronization primitives if sharing.
§Graceful Degradation
On unsupported hardware, monitor constructors return None rather than
panicking. This allows applications to gracefully fall back to alternative
implementations.
use manzana::afterburner::AfterburnerMonitor;
let stats = match AfterburnerMonitor::new() {
Some(monitor) => monitor.stats().ok(),
None => None, // Graceful fallback
};Re-exports§
pub use afterburner::AfterburnerMonitor;pub use afterburner::AfterburnerStats;pub use afterburner::ProResCodec;pub use error::Error;pub use error::Result;pub use error::Subsystem;pub use metal::CompiledShader;pub use metal::MetalBuffer;pub use metal::MetalCompute;pub use metal::MetalDevice;pub use neural_engine::AneCapabilities;pub use neural_engine::AneOp;pub use neural_engine::NeuralEngineSession;pub use neural_engine::Tensor;pub use secure_enclave::AccessControl;pub use secure_enclave::Algorithm;pub use secure_enclave::KeyConfig;pub use secure_enclave::PublicKey;pub use secure_enclave::SecureEnclaveSigner;pub use secure_enclave::Signature;pub use unified_memory::UmaBuffer;
Modules§
- afterburner
- Afterburner FPGA monitoring for Mac Pro (2019+).
- error
- Error types for Manzana.
- metal
- Metal GPU compute for macOS.
- neural_
engine - Apple Neural Engine (ANE) inference sessions.
- secure_
enclave - Secure Enclave cryptographic operations.
- unified_
memory - Unified Memory Architecture (UMA) buffer management.
Constants§
- VERSION
- Library version.
Functions§
- is_
acceleration_ available - Check if any Apple hardware acceleration is available.
- is_
macos - Check if we’re running on macOS.