Skip to main content

load_ep_context_nodes

Function load_ep_context_nodes 

Source
pub fn load_ep_context_nodes(
    graph: &Graph,
    model_dir: &Path,
    eps: &[(EpId, &dyn ExecutionProvider)],
) -> Result<EpContextPlacement, SessionError>
Expand description

Consume every com.microsoft::EPContext node in graph (§55.3).

Builds the source-keyed [EpContextRegistry] from eps (build_ep_context_registry — propagating EpError::DuplicateContextSource if two EPs claim one key), then for each EPContext node claims the owning EP by its source attribute, maps the loader blob + node attributes into the runtime EpContext, and calls ExecutionProvider::load_context. main_context=1 primaries load first (deduplicating identical payloads); main_context=0 references resolve against an already-loaded primary by (source, partition_name) with no second blob load.

model_dir is the directory of the ONNX model file, needed to resolve embed_mode=0 external blob paths (identical policy to external weights, §19.2). Returns the set of handled node ids so the executor can bypass them.

§Errors