Skip to main content

Crate vyre_lower

Crate vyre_lower 

Source
Expand description

Substrate-neutral lowering for vyre.

Source-of-truth: SEPARATION_AUDIT_2026-05-01.md section S3.

Backend drivers used to own lowering, emission, and dispatch in one crate. That made common lowering unshareable, let emit patterns drift, and left substrate-aware-but-driver-agnostic optimizations without a home between lower and emit.

This crate creates the boundary:

vyre-foundation Program
        ↓ lower(program)
KernelDescriptor (this crate's pub type)
        ↓
emit crate
        ↓
backend artifact
        ↓
driver dispatch

KernelDescriptor is the substrate-neutral kernel intermediate representation - binding layout, dispatch shape, lowered kernel body. NOT the same as vyre_foundation::Program (which is the pre-lowered IR with high-level constructs like Node::Region). Drivers stay thin: take a backend artifact + bind buffers + dispatch.

Re-exports§

pub use audit::audit;
pub use audit::audit_optimized;
pub use audit::audit_with_histogram;
pub use audit::PerfAuditReport;
pub use audit::Recommendation;
pub use audit::RecommendationCategory;
pub use verify::verify;
pub use verify::VerifyError;
pub use verify::VerifyErrorKind;
pub use verify::VerifyResult;
pub use descriptor::BindingLayout;
pub use descriptor::BindingSlot;
pub use descriptor::BindingVisibility;
pub use descriptor::DescriptorIntent;
pub use descriptor::DescriptorIntentError;
pub use descriptor::DescriptorIntentEvidence;
pub use descriptor::DescriptorIntentKind;
pub use descriptor::DescriptorIntentSet;
pub use descriptor::DescriptorIntentStrategy;
pub use descriptor::Dispatch;
pub use descriptor::IntentAnnotatedDescriptor;
pub use descriptor::KernelBody;
pub use descriptor::KernelDescriptor;
pub use descriptor::KernelOp;
pub use descriptor::KernelOpKind;
pub use descriptor::LiteralValue;
pub use descriptor::MatrixMmaElement;
pub use descriptor::MatrixMmaLayout;
pub use descriptor::MatrixMmaShape;
pub use descriptor::MemoryClass;
pub use descriptor::OpaqueExprData;
pub use descriptor::OpaqueNodeData;
pub use descriptor::scan_construct_intent_mapping;
pub use descriptor::ScanConstructIntentClass;
pub use descriptor::ScanConstructIntentMapping;
pub use descriptor::DESCRIPTOR_INTENT_SCHEMA_VERSION;
pub use descriptor::SCAN_CONSTRUCT_INTENT_MAPPINGS;
pub use descriptor::TRAP_SIDECAR_NAME;
pub use descriptor::TRAP_SIDECAR_WORDS;
pub use error::LowerError;
pub use lower::lower;
pub use pre_emit::lower_for_emit;
pub use pre_emit::prepare_program_for_emit;
pub use pre_emit::LoweredKernel;
pub use pre_emit::PreEmitError;

Modules§

analyses
Substrate-aware-but-backend-agnostic analyses on KernelDescriptor.
audit
Combined performance audit for vyre kernels.
descriptor
Substrate-neutral kernel descriptor.
emit_adversarial_corpus
Hostile KernelDescriptor corpus shared by vyre-emit-* adversarial matrix tests.
error
Errors surfaced by the lowering pass.
lower
Lower a vyre_foundation::Program into a substrate-neutral KernelDescriptor.
optimization_corpus
Generated optimization corpus for release-scale rewrite coverage.
pre_emit
Canonical pre-emit lowering pipeline.
rewrites
Real rewrite passes on KernelDescriptor.
verify
Descriptor invariant verifier.

Structs§

FullReport
Bundle returned by full_report. Five orthogonal views into the descriptor + standard pipeline output.

Enums§

SubgroupReduceOp
Re-exported so consumers matching/constructing KernelOpKind::SubgroupReduce can name the reduction operator without depending on vyre-foundation. Reduction operator applied across the active subgroup lanes.
VerifyFailure
Which verify step failed in verify_then_optimize.

Functions§

full_report
Single-call diagnostic: runs every analysis vyre-lower offers (summary, histogram, perf audit, verify, optimization stats from the standard pipeline) and bundles them into a single report. Useful for tooling that wants a complete picture without N separate function calls.
verify_then_optimize
Full-power entry point: verify the input descriptor, run the optimization pipeline, verify the optimized output. Returns the optimized descriptor + stats on success; on failure returns whichever verify step failed first.