Skip to main content

NodeGraph

Struct NodeGraph 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for NodeGraph

Source§

fn clone(&self) -> NodeGraph

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NodeGraph

Source§

fn default() -> NodeGraph

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more