Skip to main content

kaio_runtime/
error.rs

1//! KAIO error types.
2
3/// Errors that can occur during KAIO runtime operations.
4#[derive(Debug, thiserror::Error)]
5pub enum KaioError {
6    /// A CUDA driver API call failed.
7    #[error("CUDA driver error: {0}")]
8    Cuda(#[from] cudarc::driver::DriverError),
9
10    /// Device memory allocation failed.
11    #[error("out of device memory: requested {requested} bytes")]
12    OutOfMemory {
13        /// Number of bytes requested.
14        requested: usize,
15    },
16
17    /// Invalid kernel launch configuration.
18    #[error("invalid kernel configuration: {0}")]
19    InvalidConfig(String),
20
21    /// No GPU device found at the given ordinal.
22    #[error("device not found: ordinal {0}")]
23    DeviceNotFound(usize),
24
25    /// Failed to load a PTX module into the driver.
26    #[error("PTX module load failed: {0}")]
27    PtxLoad(String),
28}
29
30/// Convenience alias for `std::result::Result<T, KaioError>`.
31pub type Result<T> = std::result::Result<T, KaioError>;