primal-barracuda 0.4.0

barraCuda — BARrier-free Rust Abstracted Cross-platform Unified Dimensional Algebra. Vendor-agnostic GPU compute via WGSL.
Documentation
// SPDX-License-Identifier: AGPL-3.0-or-later
//! Core device type — minimal enum for routing and capability modules.
//!
//! Extracted from unified.rs to avoid circular dependencies. The full `Device`
//! API (info, `select_for_workload`, etc.) lives in `unified.rs`.

use std::fmt;

/// Unified device abstraction — hardware type only.
///
/// Full construction and capability logic lives in `unified` and `capabilities`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Device {
    /// CPU execution (pure Rust)
    CPU,

    /// GPU execution (WGSL via wgpu)
    GPU,

    /// NPU execution (Akida neuromorphic)
    NPU,

    /// TPU execution (Tensor Processing Unit)
    TPU,

    /// Sovereign GPU execution (WGSL → coralReef → native SASS/GFX → DRM).
    ///
    /// Bypasses wgpu/Vulkan/Metal entirely. Requires the `sovereign-dispatch`
    /// feature and a coralReef-compatible GPU (NVIDIA SM70+, AMD RDNA2+).
    Sovereign,

    /// Automatic selection based on workload
    Auto,
}

impl fmt::Display for Device {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::CPU => write!(f, "CPU"),
            Self::GPU => write!(f, "GPU"),
            Self::NPU => write!(f, "NPU"),
            Self::TPU => write!(f, "TPU"),
            Self::Sovereign => write!(f, "Sovereign"),
            Self::Auto => write!(f, "Auto"),
        }
    }
}