vyre 0.4.0

GPU compute intermediate representation with a standard operation library
Documentation
#![allow(
    missing_docs,
    dead_code,
    unused_imports,
    unused_variables,
    unreachable_patterns,
    clippy::all
)]
use super::{emit_wgsl, Error};
use crate::ir::inline_calls;
use crate::ir::model::program::Program;

/// Lower a vyre `Program` to WGSL after inlining, without optimization.
///
/// This is intended for tests and diagnostics that need to compare the
/// pre-optimization IR shape against the optimized lowering pipeline.
///
/// # Errors
///
/// Returns `Err` if calls cannot be inlined or the inlined program contains
/// constructs that cannot be lowered to WGSL.
#[inline]
pub fn lower_no_optimize(program: &Program) -> Result<String, Error> {
    crate::ops::registry::gate::verify_program_certificate(program)
        .map_err(|err| Error::lowering(err.to_string()))?;
    let program = inline_calls(program).map_err(|err| Error::lowering(err.to_string()))?;
    emit_wgsl(&program)
}