vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
use vyre::ir::{AtomicOp, BufferDecl, DataType, Expr, Node, Program};
use vyre_conform::{reference::interp, spec::value::Value};

/// ADVERSARIAL: U64 atomic add drops carry into high word — vector: atomic_add on a U64
/// buffer wraps within the low 32 bits instead of carrying into the high 32 bits, corrupting
/// 64-bit arithmetic.
#[test]
fn u64_atomic_add_propagates_carry_to_high_word() {
    let program = Program {
        entry_op_id: None,
        buffers: vec![BufferDecl::read_write("u64_buf", 0, DataType::U64)],
        workgroup_size: [1, 1, 1],
        entry: vec![Node::store(
            "u64_buf",
            Expr::u32(0),
            Expr::Atomic {
                op: AtomicOp::Add,
                buffer: "u64_buf".to_string(),
                index: Box::new(Expr::u32(0)),
                expected: None,
                value: Box::new(Expr::u32(1)),
            },
        )],
    };

    // U64 element: low word = 0xFFFFFFFF, high word = 0.
    let bytes = vec![0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00];
    let outputs =
        interp::run(&program, &[Value::Bytes(bytes)]).expect("u64 atomic add must propagate carry");

    // Expected per 64-bit arithmetic: 0xFFFFFFFF + 1 = 0x1_0000_0000.
    let expected = vec![0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00];
    assert_eq!(outputs, vec![Value::Bytes(expected)]);
}