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: usizeTotal statement-node count (includes nested children).
region_count: u32Number of Node::Region nodes in the full tree.
call_count: u32Number of Expr::Call expressions.
opaque_count: u32Number of Node::Opaque nodes and Expr::Opaque expressions.
top_level_regions: u32Number of top-level Node::Region wrappers in program.entry().
static_storage_bytes: u64Sum of statically-known buffer byte sizes.
instruction_count: u64Estimated scalar/vector IR instruction count.
memory_op_count: u64Number of explicit memory operations (loads, stores, async copies).
atomic_op_count: u64Number of atomic read-modify-write expressions.
control_flow_count: u64Number of control-flow operations.
register_pressure_estimate: u32Coarse register pressure estimate from simultaneously named SSA-ish values.
capability_bits: u32Bitmask of capability requirements (see CAP_* constants).
node_kinds_present: u32Bitset 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
impl ProgramStats
Sourcepub fn subgroup_ops(&self) -> bool
pub fn subgroup_ops(&self) -> bool
True when the program uses subgroup operations.
Sourcepub fn async_dispatch(&self) -> bool
pub fn async_dispatch(&self) -> bool
True when the program requires async dispatch semantics.
Sourcepub fn indirect_dispatch(&self) -> bool
pub fn indirect_dispatch(&self) -> bool
True when the program requires indirect dispatch support.
Sourcepub fn tensor_ops(&self) -> bool
pub fn tensor_ops(&self) -> bool
True when the program uses tensor / tensor-core operand types.
Sourcepub fn distributed_collectives(&self) -> bool
pub fn distributed_collectives(&self) -> bool
True when the program uses distributed collective communication nodes.
Sourcepub fn has_any_node_kind(&self, mask: u32) -> bool
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
}Sourcepub fn has_node_let(&self) -> bool
pub fn has_node_let(&self) -> bool
True when the program contains at least one Node::Let.
Sourcepub fn has_node_loop(&self) -> bool
pub fn has_node_loop(&self) -> bool
True when the program contains at least one Node::Loop.
Sourcepub fn has_node_if(&self) -> bool
pub fn has_node_if(&self) -> bool
True when the program contains at least one Node::If.
Sourcepub fn has_node_store(&self) -> bool
pub fn has_node_store(&self) -> bool
True when the program contains at least one Node::Store.
Sourcepub fn has_node_barrier(&self) -> bool
pub fn has_node_barrier(&self) -> bool
True when the program contains at least one Node::Barrier.
Sourcepub fn has_node_assign(&self) -> bool
pub fn has_node_assign(&self) -> bool
True when the program contains at least one Node::Assign.
Sourcepub fn has_node_region(&self) -> bool
pub fn has_node_region(&self) -> bool
True when the program contains at least one Node::Region.
Trait Implementations§
Source§impl Clone for ProgramStats
impl Clone for ProgramStats
Source§fn clone(&self) -> ProgramStats
fn clone(&self) -> ProgramStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ProgramStats
Source§impl Debug for ProgramStats
impl Debug for ProgramStats
Source§impl Default for ProgramStats
impl Default for ProgramStats
Source§fn default() -> ProgramStats
fn default() -> ProgramStats
impl Eq for ProgramStats
Source§impl PartialEq for ProgramStats
impl PartialEq for ProgramStats
impl StructuralPartialEq for ProgramStats
Auto Trait Implementations§
impl Freeze for ProgramStats
impl RefUnwindSafe for ProgramStats
impl Send for ProgramStats
impl Sync for ProgramStats
impl Unpin for ProgramStats
impl UnsafeUnpin for ProgramStats
impl UnwindSafe for ProgramStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.