pub mod abi;
pub mod epcontext;
pub mod kernel;
pub mod provider;
pub mod registry;
pub mod tensor;
pub mod weight;
pub use epcontext::{EpContext, EpContextRegistry, build_ep_context_registry};
pub use error::{EpError, Result};
pub use kernel::{
ARG_BYTES, ARG_DEVICE, ARG_FLOPS, ARG_KERNEL_VARIANT, ARG_KERNEL_VARIANT_REASON,
CAT_KERNEL_WORKER, CaptureSupport, Cost, Kernel, KernelInput, KernelMatch,
KernelVariantSelection, ViewOutput, kernel_variant_tracing_enabled, kernel_worker_span,
record_kernel_metrics, record_kernel_variant_selection, record_kernel_variant_stage_selection,
};
pub use onnx_runtime_optimizer::OptimizationPass as OptimizerPass;
pub use provider::{
CaptureRegionShapeStatus, DeviceBuffer, EpConfig, EpId, ExecutionProvider, Fence,
OrtPluginExport, StructuralCaptureDecline,
};
pub use registry::{EpRegistry, KernelFactory, OpKey, OpRegistry};
pub use tensor::{
DevicePtr, DevicePtrMut, ExternalMmapRegion, TensorBacking, TensorMut, TensorView,
};
pub use weight::{
ExecutionProviderCapabilities, LazyDeviceWeightBinder, LazyWeight, LazyWeightBoundary,
NXRT_WEIGHT_PAGING_CAPABILITY, NegotiatedWeight, Phase3aHostOnlyBinder, ResidentWeight,
ResidentWeightMaterializer, WeightHandle, WeightHandleError,
};
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 handler for {domain}::{op_type} at opset {opset} on any available device")]
NoEpForOp {
domain: String,
op_type: String,
opset: u64,
},
#[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),
#[error(transparent)]
WeightHandle(#[from] crate::weight::WeightHandleError),
}
}