use onnx_runtime_ir::ValueId;
use crate::plan::SlotId;
#[derive(Clone, Copy, Debug, PartialEq, Eq, thiserror::Error)]
pub enum PlanError {
#[error("graph is not schedulable (cycle detected); cannot compute liveness")]
Cycle,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, thiserror::Error)]
pub enum ValidateError {
#[error("values {a:?} and {b:?} have overlapping live intervals but share slot {slot:?}")]
SlotConflict {
a: ValueId,
b: ValueId,
slot: SlotId,
},
#[error("value {value:?} needs {needed} bytes but slot {slot:?} has capacity {capacity}")]
UndersizedSlot {
value: ValueId,
slot: SlotId,
needed: usize,
capacity: usize,
},
#[error("buffer owner {value:?} has no slot assignment")]
MissingAssignment { value: ValueId },
#[error("value {value:?} references unknown slot {slot:?}")]
UnknownSlot { value: ValueId, slot: SlotId },
#[error(
"view {view:?} is used at node {view_use} but its source {source_owner:?} is retired at node {source_end}"
)]
ViewOutlivesSource {
view: ValueId,
source_owner: ValueId,
view_use: usize,
source_end: usize,
},
#[error("graph is not schedulable (cycle detected)")]
Cycle,
}