pub struct ExecGraph { /* private fields */ }Expand description
An instantiated executable graph: a validated topology snapshot plus the per-node parameters that an in-place update may modify.
ExecGraph is cheap to clone and clones preserve topology exactly.
Implementations§
Source§impl ExecGraph
impl ExecGraph
Sourcepub fn instantiate(graph: &ComputeGraph) -> GraphResult<Self>
pub fn instantiate(graph: &ComputeGraph) -> GraphResult<Self>
Instantiates graph into an executable graph.
Validates the graph is a non-empty DAG (by computing a topological order) and snapshots its topology and node parameters.
§Errors
GraphError::EmptyGraphif the graph has no nodes.- Propagates any error from
ComputeGraph::topological_order.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes in the executable graph.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Returns the number of dependency edges.
Sourcepub fn execution_order(&self) -> &[NodeId]
pub fn execution_order(&self) -> &[NodeId]
Returns the cached topological execution order.
Sourcepub fn node_kind(&self, id: NodeId) -> GraphResult<&NodeKind>
pub fn node_kind(&self, id: NodeId) -> GraphResult<&NodeKind>
Returns the operation kind of a node.
§Errors
Returns GraphError::NodeNotFound if id is out of range.
Sourcepub fn has_edge(&self, from: NodeId, to: NodeId) -> bool
pub fn has_edge(&self, from: NodeId, to: NodeId) -> bool
Returns true if the dependency from → to is present.
Sourcepub fn update_node(
&mut self,
id: NodeId,
update: NodeParamUpdate,
) -> GraphResult<()>
pub fn update_node( &mut self, id: NodeId, update: NodeParamUpdate, ) -> GraphResult<()>
Applies a single-node parameter update in place.
Validates that the update variant matches the target node’s kind and that no topology-affecting parameter would change.
§Errors
GraphError::NodeNotFoundifidis out of range.GraphError::ValidationFailedif the update variant does not match the node’s kind.
Sourcepub fn update(&mut self, new_graph: &ComputeGraph) -> GraphResult<()>
pub fn update(&mut self, new_graph: &ComputeGraph) -> GraphResult<()>
Applies a whole-graph update against a freshly built ComputeGraph.
This mirrors cudaGraphExecUpdate: the new graph must have identical
topology (same node count, same node kinds in the structural sense,
same edge set). Only updatable parameters (kernel config / function
name, memset value) may differ; differing topology or non-updatable
parameters (e.g. a memcpy size) make the update impossible and the
caller must re-instantiate.
On success, all node parameters are refreshed from new_graph and the
cached execution order is preserved (topology is unchanged).
§Errors
Returns GraphError::ValidationFailed describing the first
incompatibility found.
Sourcepub fn diff(&self, other: &ComputeGraph) -> GraphResult<ExecGraphDiff>
pub fn diff(&self, other: &ComputeGraph) -> GraphResult<ExecGraphDiff>
Computes a structural / parameter diff against other.
Reports whether an in-place update is possible and,
if so, which nodes changed parameters.
§Errors
Returns GraphError::EmptyGraph if other is empty (it could not
have been instantiated).