weirflow 0.1.0

GPU-first dataflow analysis primitives for Vyre and Santh compiler pipelines.
Documentation
//! `weir::range_check`  -  Program construction + reference oracle parity.
//!
//! Op id: `weir::tests::df::range_check`. Soundness: `Exact`  -
//! the predicate is `interval_hi[n] < bound[n]` per node, mapped
//! into a 0/1 bitset. reference oracle and Program kernel must agree.

use weir::oracle::summary::range_check as cpu_ref;
use weir::range_check::range_check;

#[test]
fn cpu_ref_returns_one_when_hi_strictly_below_bound() {
    let hi = vec![3u32, 5u32, 10u32];
    let bnd = vec![10u32, 5u32, 2u32];
    // hi[0]=3 < bnd[0]=10 → 1
    // hi[1]=5 < bnd[1]=5 → 0 (not strictly less)
    // hi[2]=10 < bnd[2]=2 → 0
    assert_eq!(cpu_ref(&hi, &bnd), vec![1u32, 0u32, 0u32]);
}

#[test]
fn cpu_ref_truncates_to_shorter_input() {
    let hi = vec![1u32, 2u32, 3u32];
    let bnd = vec![10u32, 10u32];
    assert_eq!(cpu_ref(&hi, &bnd), vec![1u32, 1u32]);
}

#[test]
fn cpu_ref_handles_empty_inputs() {
    assert!(cpu_ref(&[], &[]).is_empty());
    assert!(cpu_ref(&[1u32], &[]).is_empty());
    assert!(cpu_ref(&[], &[1u32]).is_empty());
}

#[test]
fn range_check_program_three_buffers() {
    let prog = range_check(64, "hi", "bnd", "out");
    let mut names: Vec<&str> = prog.buffers().iter().map(|b| b.name()).collect();
    names.sort();
    assert_eq!(names, vec!["bnd", "hi", "out"]);
    assert!(!prog.entry().is_empty());
}

#[test]
fn range_check_program_node_count_scales() {
    for &n in &[1u32, 7, 32, 64, 256] {
        let prog = range_check(n, "h", "b", "o");
        assert_eq!(prog.buffers().len(), 3);
        assert!(!prog.entry().is_empty());
    }
}