npu_rs/
error.rs

1use thiserror::Error;
2
3/// NPU driver result type.
4pub type Result<T> = std::result::Result<T, NpuError>;
5
6/// Error types for the NPU driver.
7#[derive(Debug, Error)]
8pub enum NpuError {
9    #[error("Device not available")]
10    DeviceNotAvailable,
11
12    #[error("Initialization failed: {0}")]
13    InitializationFailed(String),
14
15    #[error("Computation error: {0}")]
16    ComputationError(String),
17
18    #[error("Memory error: {0}")]
19    MemoryError(String),
20
21    #[error("Invalid shape: {0}")]
22    InvalidShape(String),
23
24    #[error("Unsupported operation: {0}")]
25    UnsupportedOperation(String),
26
27    #[error("Device error: {0}")]
28    DeviceError(String),
29
30    #[error("Performance monitoring error: {0}")]
31    PerformanceError(String),
32
33    #[error("Synchronization timeout")]
34    SyncTimeout,
35
36    #[error("Invalid configuration: {0}")]
37    InvalidConfiguration(String),
38}