pub mod abi;
pub mod epcontext;
pub mod kernel;
pub mod provider;
pub mod registry;
pub mod tensor;
pub use epcontext::{build_ep_context_registry, EpContext, EpContextRegistry};
pub use error::{EpError, Result};
pub use kernel::{Cost, Kernel, KernelMatch, ViewOutput};
pub use provider::{
DeviceBuffer, EpConfig, EpId, ExecutionProvider, Fence, OptimizerPass, OrtPluginExport,
};
pub use registry::{EpRegistry, KernelFactory, OpKey, OpRegistry};
pub use tensor::{DevicePtr, DevicePtrMut, TensorMut, TensorView};
pub use onnx_runtime_ir::{DeviceId, DeviceType};
mod error {
use std::path::PathBuf;
pub type Result<T> = std::result::Result<T, EpError>;
#[derive(Debug, thiserror::Error)]
pub enum EpError {
#[error("no EP supports op {op_type} on any available device")]
NoEpForOp { op_type: String },
#[error("kernel execution failed: {0}")]
KernelFailed(String),
#[error("EP panicked during execution")]
EpPanicked,
#[error("EP plugin load failed: {path}: {reason}")]
EpLoadFailed { path: PathBuf, reason: String },
#[error("device OOM: requested {requested} bytes, available {available}")]
OutOfMemory { requested: usize, available: usize },
#[error("allocation alignment mismatch")]
AlignmentError,
#[error("invalid tensor view: {reason}")]
InvalidTensorView { reason: String },
#[error("EP not initialized")]
NotInitialized,
#[error("no EP is registered for EPContext source key {source_key:?}")]
NoEpForContext { source_key: Option<String> },
#[error("EP {ep} does not support EPContext save/load")]
UnsupportedContext { ep: String },
#[error(
"duplicate EPContext source key {source_key:?}: already registered to {existing:?}, \
cannot re-register to {new:?}"
)]
DuplicateContextSource {
source_key: String,
existing: crate::provider::EpId,
new: crate::provider::EpId,
},
#[error(transparent)]
Ir(#[from] onnx_runtime_ir::IrError),
}
}