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 /// A `PtxModule` failed validation before being handed to the driver.
30 ///
31 /// Raised by [`KaioDevice::load_module`](crate::KaioDevice::load_module)
32 /// when the module's target SM is too low for a feature it uses
33 /// (e.g. `mma.sync` in a `sm_70` module). Surfacing this before the
34 /// driver compiles the PTX avoids cryptic downstream errors.
35 #[error("PTX module validation failed: {0}")]
36 Validation(#[from] kaio_core::ir::ValidationError),
37}
38
39/// Convenience alias for `std::result::Result<T, KaioError>`.
40pub type Result<T> = std::result::Result<T, KaioError>;