vyre-conform 0.1.0

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

/// ADVERSARIAL: duplicate buffer declarations bypass validation — vector: two buffers with
/// the same name but different element types cause the interpreter to overwrite one with the
/// other, producing type confusion and silent data corruption.
#[test]
fn duplicate_buffer_names_are_rejected() {
    let program = Program {
        entry_op_id: None,
        buffers: vec![
            BufferDecl::read_write("x", 0, DataType::U32),
            BufferDecl::read_write("x", 1, DataType::U64),
        ],
        workgroup_size: [1, 1, 1],
        entry: vec![Node::store("x", Expr::u32(0), Expr::u32(0xDEADBEEF))],
    };

    // Spec: Validation requires no duplicate names/bindings.
    let result = interp::run(
        &program,
        &[
            Value::Bytes(vec![0x01, 0x00, 0x00, 0x00]),
            Value::Bytes(vec![0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
        ],
    );

    assert!(
        result.is_err(),
        "duplicate buffer names must be rejected by the interpreter"
    );
}