1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! Code generation for svod tensor operations.
//!
//! This crate provides backend-agnostic code generation infrastructure
//! for converting optimized UOp graphs into executable code.
//!
//! # Architecture
//!
//! - **Traits**: Backend-agnostic interfaces (`Renderer`)
//! - **LLVM**: LLVM IR code generation for CPU execution
//! - **Future**: CUDA, Metal, OpenCL renderers
//!
//! # Usage
//!
//! ```ignore
//! use svod_codegen::{llvm, program_pipeline};
//!
//! let linear = svod_ir::UOp::linear(svod_schedule::linearize_with_cfg(optimized_uop_graph).into());
//! let kernel = llvm::text::render(&linear, Some("kernel"))?;
//! // Canonical staged flow: PROGRAM -> LINEAR -> SOURCE -> BINARY.
//! // See `program_pipeline` for the strict staged entrypoints.
//! ```
//!
//! # Pre-render invariants
//!
//! Direct callers of [`Renderer::render`] (and the per-backend `render` free
//! functions) must pass a LINEAR-stage UOp produced by
//! [`svod_schedule::linearize::line_rewrite_cleanups`]. The cleanup pass
//! lowers gated LOADs into IF/STORE/ENDIF and provides the `alt` value that
//! per-backend op handlers rely on; backends report `Error::InvalidGraph` if
//! these invariants are violated. The staged entrypoints in
//! [`program_pipeline`] run the cleanup pass automatically.
pub use collect_buffers_and_vars;
pub use *;
pub use *;
pub use *;