#[non_exhaustive]pub struct NodeGraph {
pub nodes: Vec<GraphNode>,
pub edges: Vec<DataEdge>,
pub workgroup_size: [u32; 3],
pub buffers: Vec<BufferDecl>,
}Expand description
Graph-IR view over a statement-IR Program.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.nodes: Vec<GraphNode>Nodes indexed by their id.
edges: Vec<DataEdge>Edges between nodes.
workgroup_size: [u32; 3]Original workgroup size. Preserved through view conversion.
buffers: Vec<BufferDecl>Original buffer declarations. Preserved through view conversion.
Implementations§
Source§impl NodeGraph
impl NodeGraph
Sourcepub fn new(nodes: Vec<GraphNode>, edges: Vec<DataEdge>) -> Self
pub fn new(nodes: Vec<GraphNode>, edges: Vec<DataEdge>) -> Self
Construct a NodeGraph from explicit node / edge vectors.
Used by external tooling that synthesizes graphs without
going through from_program (V7-EXT-027).
workgroup_size defaults to [1, 1, 1] and buffers defaults to empty. For full control use struct-literal syntax inside the defining crate.
Sourcepub fn from_program(program: &Program) -> Self
pub fn from_program(program: &Program) -> Self
Lift a statement-IR Program into its graph-IR view.
The 0.6 lifting emits one GraphNode::Statement per top-
level Node::entry() node, connected by Ordering edges in
document order. Later passes refine edges with reaching-
definition / control-flow / dataflow analyses.
VYRE_IR_HOTSPOTS HIGH (graph_view.rs:205): the previous
implementation cloned every top-level node via n.clone().
This helper now delegates to from_program_owned after
cloning the inner structure cheaply via Arc refcount bumps,
so the hot path (when the caller owns the Program) can move
directly into the graph without the per-node clone.
Sourcepub fn from_program_owned(program: Program) -> Self
pub fn from_program_owned(program: Program) -> Self
Build the graph by consuming the Program — moves the entry
Vec<Node> out of its Arc when uniquely owned and avoids
cloning each node. Use this whenever the caller holds the
only Program reference.
Sourcepub fn try_into_program(self) -> Result<Program, GraphValidateError>
pub fn try_into_program(self) -> Result<Program, GraphValidateError>
Lower the graph view back into a statement-IR Program.
Preserves document-order of GraphNode::Statement variants;
Phi and synthetic Barrier variants are dropped (they
don’t round-trip to statement-IR by design).
§Errors
Returns GraphValidateError::DanglingEdge if an edge references
a non-existent node id, GraphValidateError::Cycle if the graph
contains a directed cycle, or GraphValidateError::OrphanPhi if
a Phi node has no predecessors.