pub fn dump_session_ep_context(
model: &Model<'_>,
orig_path: &Path,
partitions: &[CompiledPartition<'_>],
config: &EpContextDumpConfig,
) -> Result<PathBuf, SessionError>Expand description
Drive the §55.4 dump path: serialise model to a *_ctx.onnx context-cache
model, replacing each compiled partition’s subgraph with a single
com.microsoft::EPContext node.
For each partition the driver calls ExecutionProvider::save_context to
obtain the runtime context (blob + ep_version) and takes the EP’s first
declared ExecutionProvider::context_source_keys as the node’s source
key (§55.6 — model-agnostic; no vendor name is hardcoded here). It then hands
the neutral partition views to the loader-owned writer
(onnx_runtime_loader::dump_ep_context). Returns the written model path.
If EpContextDumpConfig::enable is false this is a no-op: it does not
call any EP’s save_context, writes no files, and returns the path it would
have written to — so a disabled config has no side effects by construction.
§Errors
EpError::UnsupportedContext— an EP with no compile step (itssave_contextdefault).SessionError::Internal— an EP that participates in compilation but declares nosourcekey (it cannot be dispatched on reload).- loader errors from the writer (I/O, encoding).