weirflow 0.1.0

GPU-first dataflow analysis primitives for Vyre and Santh compiler pipelines.
Documentation
use vyre::ir::Program;
use vyre_primitives::graph::csr_forward_traverse::csr_forward_traverse;
use vyre_primitives::graph::program_graph::ProgramGraphShape;

use super::OP_ID;

#[must_use]
/// Build one backward live-variable propagation step over a reversed graph.
pub fn live_step(shape: ProgramGraphShape, frontier_in: &str, frontier_out: &str) -> Program {
    // Backward analysis on a forward primitive  -  caller flips edges.
    csr_forward_traverse(shape, frontier_in, frontier_out, 0xFFFF_FFFF)
}

inventory::submit! {
    vyre_harness::OpEntry::new(
        OP_ID,
        || live_step(ProgramGraphShape::new(4, 3), "fin", "fout"),
        Some(|| {
            let to_bytes = crate::dispatch_decode::pack_u32;
            // CFG reversed (backward analysis): 3→2→1→0 in storage.
            vec![vec![
                to_bytes(&[0, 0, 0, 0]),
                to_bytes(&[0, 0, 1, 2, 3]),
                to_bytes(&[0, 1, 2]),
                to_bytes(&[1, 1, 1]),
                to_bytes(&[0, 0, 0, 0]),
                to_bytes(&[0b1000]),
                to_bytes(&[0b1000]),
            ]]
        }),
        Some(|| {
            let to_bytes = crate::dispatch_decode::pack_u32;
            vec![vec![to_bytes(&[0b1100])]]
        }),
    )
}

inventory::submit! {
    vyre_harness::ConvergenceContract {
        op_id: OP_ID,
        max_iterations: 64,
    }
}

/// Marker type for the live-variables dataflow primitive.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Liveness;

impl crate::soundness::SoundnessTagged for Liveness {
    fn soundness(&self) -> crate::soundness::Soundness {
        crate::soundness::Soundness::Exact
    }
}