mesh_sieve/accelerator/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Error, Clone, PartialEq, Eq)]
7pub enum AcceleratorError {
8 #[error("accelerator backend unavailable: {0}")]
10 BackendUnavailable(String),
11 #[error("CUDA device {ordinal} was not found")]
13 DeviceNotFound { ordinal: usize },
14 #[error("accelerator resource belongs to backend {expected}, not backend {found}")]
17 BackendMismatch { expected: u64, found: u64 },
18 #[error("FVM state belongs to plan {found}, not plan {expected}")]
20 PlanMismatch { expected: u64, found: u64 },
21 #[error("device allocation of {bytes} bytes failed: {reason}")]
23 AllocationFailed { bytes: usize, reason: String },
24 #[error("CUDA kernel compilation failed: {0}")]
26 KernelCompilationFailed(String),
27 #[error("CUDA module load failed: {0}")]
29 ModuleLoadFailed(String),
30 #[error("CUDA kernel `{0}` was not found")]
32 KernelNotFound(String),
33 #[error("CUDA kernel launch failed: {0}")]
35 KernelLaunchFailed(String),
36 #[error("CUDA stream index {index} is out of range for {stream_count} streams")]
38 InvalidStreamIndex { index: usize, stream_count: usize },
39 #[error("CUDA event operation failed: {0}")]
41 EventFailed(String),
42 #[error("CUDA sparse-library operation failed: {0}")]
44 SparseLibraryFailed(String),
45 #[error("device transfer failed: {0}")]
47 DeviceTransferFailed(String),
48 #[error("stale topology plan: expected version {expected}, found {found}")]
50 StaleTopologyPlan { expected: u64, found: u64 },
51 #[error("stale atlas plan: expected version {expected}, found {found}")]
53 StaleAtlasPlan { expected: u64, found: u64 },
54 #[error("stale geometry plan: expected epoch {expected}, found {found}")]
56 StaleGeometryPlan { expected: u64, found: u64 },
57 #[error("buffer length mismatch: expected {expected}, found {found}")]
59 LengthMismatch { expected: usize, found: usize },
60 #[error("{what} value {value} exceeds the device ABI limit")]
62 IndexOverflow { what: &'static str, value: usize },
63 #[error("unsupported device value type: {0}")]
65 UnsupportedDeviceType(&'static str),
66 #[error("invalid accelerator plan: {0}")]
68 InvalidPlan(String),
69}