synor/crates/synor-compute/src/error.rs
Gulshan Yadav 4c36ddbdc2 feat(compute): add Phase 11 Synor Compute L2 heterogeneous compute layer
- Add synor-compute crate for heterogeneous compute orchestration
- Implement processor abstraction for CPU/GPU/TPU/NPU/LPU/FPGA/DSP
- Add device registry with cross-vendor capability tracking
- Implement task scheduler with work stealing and load balancing
- Add energy-aware and latency-aware balancing strategies
- Create spot market for compute resources with order matching
- Add memory manager with tensor handles and cross-device transfers
- Support processor capability profiles (H100, TPU v5p, Groq LPU, etc.)
- Implement priority work queues with task decomposition

Processor types supported:
- CPU (x86-64 AVX512, ARM64 SVE, RISC-V Vector)
- GPU (NVIDIA CUDA, AMD ROCm, Intel OneAPI, Apple Metal)
- TPU (v2-v5p, Edge TPU)
- NPU (Apple Neural Engine, Qualcomm Hexagon, Intel VPU)
- LPU (Groq Language Processing Unit)
- FPGA (Xilinx, Intel Altera)
- DSP (TI, Analog Devices)
- WebGPU and WASM runtimes
2026-01-11 13:53:57 +05:30

92 lines
2.4 KiB
Rust

//! Error types for Synor Compute.
use crate::{JobId, NodeId, ProcessorId, ProcessorType};
use thiserror::Error;
/// Compute errors.
#[derive(Debug, Error)]
pub enum ComputeError {
/// Job not found.
#[error("Job not found: {0}")]
JobNotFound(JobId),
/// Node not found.
#[error("Node not found: {0}")]
NodeNotFound(NodeId),
/// Processor not found.
#[error("Processor not found: {0}")]
ProcessorNotFound(ProcessorId),
/// No suitable processor for operation.
#[error("No suitable processor for operation: {0}")]
NoSuitableProcessor(String),
/// Insufficient resources.
#[error("Insufficient resources: {0}")]
InsufficientResources(String),
/// Task execution failed.
#[error("Task execution failed: {0}")]
TaskExecutionFailed(String),
/// Scheduling failed.
#[error("Scheduling failed: {0}")]
SchedulingFailed(String),
/// Memory allocation failed.
#[error("Memory allocation failed: {0}")]
MemoryAllocationFailed(String),
/// Data transfer failed.
#[error("Data transfer failed: {0}")]
DataTransferFailed(String),
/// Processor type not supported.
#[error("Processor type not supported: {0:?}")]
ProcessorTypeNotSupported(ProcessorType),
/// Operation not supported on processor.
#[error("Operation not supported on {0:?}: {1}")]
OperationNotSupported(ProcessorType, String),
/// Timeout.
#[error("Operation timed out after {0}ms")]
Timeout(u64),
/// Budget exceeded.
#[error("Budget exceeded: required {required}, available {available}")]
BudgetExceeded { required: u64, available: u64 },
/// Node already registered.
#[error("Node already registered: {0}")]
NodeAlreadyRegistered(NodeId),
/// Invalid configuration.
#[error("Invalid configuration: {0}")]
InvalidConfiguration(String),
/// Serialization error.
#[error("Serialization error: {0}")]
Serialization(String),
/// Network error.
#[error("Network error: {0}")]
Network(String),
/// Internal error.
#[error("Internal error: {0}")]
Internal(String),
}
impl From<bincode::Error> for ComputeError {
fn from(err: bincode::Error) -> Self {
ComputeError::Serialization(err.to_string())
}
}
impl From<serde_json::Error> for ComputeError {
fn from(err: serde_json::Error) -> Self {
ComputeError::Serialization(err.to_string())
}
}