use thiserror::Error;
#[derive(Error, Debug)]
pub enum HiveGpuError {
#[error("Invalid dimension: expected {expected}, got {got}")]
InvalidDimension { expected: usize, got: usize },
#[error("Dimension mismatch: expected {expected}, got {actual}")]
DimensionMismatch { expected: usize, actual: usize },
#[error("VRAM limit exceeded: requested {requested}, limit {limit}")]
VramLimitExceeded { requested: usize, limit: usize },
#[error("GPU operation failed: {0}")]
GpuOperationFailed(String),
#[error("No GPU device available")]
NoDeviceAvailable,
#[error("Buffer allocation failed: {0}")]
BufferAllocationFailed(String),
#[error("Device initialization failed: {0}")]
DeviceInitializationFailed(String),
#[error("Shader compilation failed: {0}")]
ShaderCompilationFailed(String),
#[error("Memory allocation failed: {0}")]
MemoryAllocationFailed(String),
#[error("Search operation failed: {0}")]
SearchFailed(String),
#[error("Vector not found: {0}")]
VectorNotFound(String),
#[error("Invalid configuration: {0}")]
InvalidConfiguration(String),
#[error("CUDA error: {0}")]
CudaError(String),
#[error("cuBLAS error: {0}")]
CublasError(String),
#[error("HIP error: {0}")]
HipError(String),
#[error("rocBLAS error: {0}")]
RocblasError(String),
#[error("ROCm error: {0}")]
RocmError(String),
#[error("Vulkan error: {0}")]
VulkanError(String),
#[error("Intel backend error: {0}")]
IntelError(String),
#[error("SPIR-V compile error: {0}")]
SpirvCompileError(String),
#[error("Internal error: {0}")]
InternalError(String),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
#[error("JSON error: {0}")]
JsonError(#[from] serde_json::Error),
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, HiveGpuError>;