vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
use crate::proof::comparator::ComparatorKind;
use crate::spec::types::{ChainSpec, OpSpec, Strictness};
pub use super::suite::ConformanceSuite;
use crate::spec::minimums::{MIN_BOUNDARY_VALUES, MIN_EQUIVALENCE_CLASSES};

/// Validate that an op's WGSL fragment produces parseable WGSL when wrapped.
#[inline]
pub fn validate_wgsl_syntax(op: &crate::OpSpec) -> Result<(), String> {
    let wgsl_source = (op.wgsl_fn)();
    let config = crate::pipeline::backend::ConformDispatchConfig::default();
    let wrapped = crate::pipeline::backend::wrap_shader(&wgsl_source, &config);
    let result = naga::front::wgsl::parse_str(&wrapped);
    match result {
        Ok(module) => {
            let info = naga::valid::Validator::new(
                naga::valid::ValidationFlags::all(),
                vyre_minimum_capabilities(),
            )
            .validate(&module);
            match info {
                Ok(_) => Ok(()),
                Err(e) => Err(format!(
                    "Fix: op '{}' WGSL fails naga validation: {e}\n\
                     The shader parses but has semantic errors, OR uses a \
                     naga capability outside vyre's minimum allowlist (see \
                     vyre_minimum_capabilities). If a new capability is \
                     required, opt it in there + update \
                     coordination/wgsl-capability-allowlist.md.",
                    op.id
                )),
            }
        }
        Err(e) => Err(format!(
            "Fix: op '{}' WGSL fails naga parsing: {e}\n\
             The shader source is syntactically invalid.",
            op.id
        )),
    }
}