use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum AicError {
#[error("unsupported schema version for {kind}: got {got}, expected {expected}")]
UnsupportedSchemaVersion {
kind: &'static str,
got: u32,
expected: u32,
},
#[error("invalid engine config: {0}")]
InvalidEngineConfig(String),
#[error("engine spec wire-format error: {0}")]
EngineSpec(String),
#[error("invalid forward pass metrics: {0}")]
InvalidForwardPassMetrics(String),
#[error("unsupported model for Rust core estimator: {0}")]
UnsupportedModel(String),
#[error("failed to find AIC data roots: {0}")]
DataRoot(String),
#[error("model config error: {0}")]
ModelConfig(String),
#[error("perf database error: {0}")]
PerfDatabase(String),
#[error("missing system flops: {0}")]
MissingSystemFlops(String),
#[error("empirical estimation not implemented: {0}")]
EmpiricalNotImplemented(String),
#[error("SOL estimation not implemented: {0}")]
SolNotImplemented(String),
#[error("I/O error at {path}: {source}")]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("YAML error at {path}: {source}")]
Yaml {
path: PathBuf,
#[source]
source: serde_yaml::Error,
},
#[error("Parquet error at {path}: {source}")]
Parquet {
path: PathBuf,
#[source]
source: parquet::errors::ParquetError,
},
}
impl AicError {
pub fn is_missing_perf_data(&self) -> bool {
matches!(self, Self::PerfDatabase(_) | Self::Io { .. })
}
}