1use zer_core::error::ZerError;
2
3#[derive(Debug, thiserror::Error)]
7pub enum GpuError {
8 #[error("CUDA error: {0}")]
9 Cuda(String),
10
11 #[error("Vulkan error: {0}")]
12 Vulkan(String),
13
14 #[error("shader not compiled: {0}. Rebuild with the appropriate feature flag.")]
15 ShaderNotFound(String),
16
17 #[error("kernel launch failed: {0}")]
18 LaunchFailed(String),
19
20 #[error("device memory allocation failed: requested {requested_bytes} bytes, {detail}")]
21 AllocationFailed { requested_bytes: u64, detail: String },
22
23 #[error("host↔device transfer failed: {0}")]
24 TransferFailed(String),
25
26 #[error("schema mismatch in GPU kernel: expected {expected} fields, got {got}")]
27 SchemaMismatch { expected: usize, got: usize },
28
29 #[error("backend not available: {0}")]
30 BackendUnavailable(String),
31}
32
33impl From<GpuError> for ZerError {
34 fn from(e: GpuError) -> Self {
35 ZerError::Gpu(e.to_string())
36 }
37}