Skip to main content

onnx_runtime_ep_api/
abi.rs

1//! ORT graph ABI bridge for legacy plugin EPs (§3.4, §4.5).
2//!
3//! Projects our IR through ORT's C graph API so third-party EPs compiled
4//! against upstream ORT can inspect and claim subgraphs. This is a **Phase 2**
5//! deliverable requiring `unsafe` FFI; only the data model is sketched here.
6
7use onnx_runtime_ir::{Graph, NodeId, ValueId};
8
9use crate::provider::{EpId, ExecutionProvider};
10
11/// A read-only projection of a [`Graph`] exposed through the ORT C graph API.
12pub struct OrtGraphView<'a> {
13    #[allow(dead_code)]
14    graph: &'a Graph,
15}
16
17/// An EP's claim over a subgraph it wants to compile and run.
18#[derive(Clone, Debug)]
19pub struct SubgraphClaim {
20    pub ep_id: EpId,
21    pub node_ids: Vec<NodeId>,
22    pub input_values: Vec<ValueId>,
23    pub output_values: Vec<ValueId>,
24    pub meta_def: Option<String>,
25}
26
27impl<'a> OrtGraphView<'a> {
28    /// Wrap a graph for ABI projection.
29    pub fn new(graph: &'a Graph) -> Self {
30        Self { graph }
31    }
32
33    /// Ask an EP which subgraphs it can handle.
34    pub fn query_capabilities(&self, ep: &dyn ExecutionProvider) -> Vec<SubgraphClaim> {
35        let _ = ep;
36        todo!("ort2-ep-api Phase 2: project IR via ORT C graph API and gather EP claims")
37    }
38}