Skip to main content

ProgramStats

Struct ProgramStats 

Source
pub struct ProgramStats {
Show 13 fields pub node_count: usize, pub region_count: u32, pub call_count: u32, pub opaque_count: u32, pub top_level_regions: u32, pub static_storage_bytes: u64, pub instruction_count: u64, pub memory_op_count: u64, pub atomic_op_count: u64, pub control_flow_count: u64, pub register_pressure_estimate: u32, pub capability_bits: u32, pub node_kinds_present: u32,
}
Expand description

Aggregated statistics computed from a single walk of a Program.

This struct is cached inside Program via a std::sync::OnceLock so that planning passes (execution plan, capability scan, provenance, fusion) can read constant-time summaries instead of re-walking the IR.

Fields§

§node_count: usize

Total statement-node count (includes nested children).

§region_count: u32

Number of Node::Region nodes in the full tree.

§call_count: u32

Number of Expr::Call expressions.

§opaque_count: u32

Number of Node::Opaque nodes and Expr::Opaque expressions.

§top_level_regions: u32

Number of top-level Node::Region wrappers in program.entry().

§static_storage_bytes: u64

Sum of statically-known buffer byte sizes.

§instruction_count: u64

Estimated scalar/vector IR instruction count.

§memory_op_count: u64

Number of explicit memory operations (loads, stores, async copies).

§atomic_op_count: u64

Number of atomic read-modify-write expressions.

§control_flow_count: u64

Number of control-flow operations.

§register_pressure_estimate: u32

Coarse register pressure estimate from simultaneously named SSA-ish values.

§capability_bits: u32

Bitmask of capability requirements (see CAP_* constants).

§node_kinds_present: u32

Bitset of every Node variant observed during the stats walk (see the NODE_KIND_* constants in this module). Lets pass analyze_impl predicates do an O(1) bit test against the shared, OnceLock-cached ProgramStats instead of recursing the entry tree just to check ‘does this program contain at least one Loop / If / Atomic / etc.’.

Implementations§

Source§

impl ProgramStats

Source

pub fn subgroup_ops(&self) -> bool

True when the program uses subgroup operations.

Source

pub fn f16(&self) -> bool

True when the program uses IEEE-754 binary16 values.

Source

pub fn bf16(&self) -> bool

True when the program uses bfloat16 values.

Source

pub fn f64(&self) -> bool

True when the program uses IEEE-754 binary64 values.

Source

pub fn async_dispatch(&self) -> bool

True when the program requires async dispatch semantics.

Source

pub fn indirect_dispatch(&self) -> bool

True when the program requires indirect dispatch support.

Source

pub fn tensor_ops(&self) -> bool

True when the program uses tensor / tensor-core operand types.

Source

pub fn trap(&self) -> bool

True when the program uses Node::Trap.

Source

pub fn distributed_collectives(&self) -> bool

True when the program uses distributed collective communication nodes.

Source

pub fn has_any_node_kind(&self, mask: u32) -> bool

True when at least one node of any kind in mask was observed in the stats walk. Use the NODE_KIND_* constants to compose the mask:

use vyre_foundation::ir::stats::{NODE_KIND_LOOP, NODE_KIND_IF};
if program.stats().has_any_node_kind(NODE_KIND_LOOP | NODE_KIND_IF) {
    // walk the tree
}
Source

pub fn has_node_let(&self) -> bool

True when the program contains at least one Node::Let.

Source

pub fn has_node_loop(&self) -> bool

True when the program contains at least one Node::Loop.

Source

pub fn has_node_if(&self) -> bool

True when the program contains at least one Node::If.

Source

pub fn has_node_store(&self) -> bool

True when the program contains at least one Node::Store.

Source

pub fn has_node_barrier(&self) -> bool

True when the program contains at least one Node::Barrier.

Source

pub fn has_node_assign(&self) -> bool

True when the program contains at least one Node::Assign.

Source

pub fn has_node_region(&self) -> bool

True when the program contains at least one Node::Region.

Trait Implementations§

Source§

impl Clone for ProgramStats

Source§

fn clone(&self) -> ProgramStats

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for ProgramStats

Source§

impl Debug for ProgramStats

Source§

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

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

impl Default for ProgramStats

Source§

fn default() -> ProgramStats

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

impl Eq for ProgramStats

Source§

impl PartialEq for ProgramStats

Source§

fn eq(&self, other: &ProgramStats) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProgramStats

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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