teeny_compiler/lib.rs
1/*
2 * Copyright (c) 2026 Teenygrad.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//! Compiles a [teenygrad](https://teenygrad.org) computational graph (FXGraph, traced from
18//! `teeny-core`) down to a target backend — LLVM/MLIR object code today ([`compiler::backend`]),
19//! with an `ndarray`-backed CPU path behind the `ndarray` feature.
20//!
21//! Compiling kernels through the LLVM backend shells out to the custom `teenyc` compiler at
22//! *runtime* (via `TEENYC_PATH`) — not needed to build this crate itself. See the crate README
23//! for the `cargo-teeny`/`TEENYC_PATH` setup.
24
25#![warn(missing_docs)]
26
27/// Compilation backends and drivers (LLVM/MLIR, `ndarray`).
28pub mod compiler;
29/// Error types.
30pub mod errors;
31/// FXGraph, the compiler's intermediate representation.
32pub mod fxgraph;
33
34/// Initialize logging for the teeny-compiler
35pub fn init_logging() {
36 use tracing_subscriber::{EnvFilter, fmt};
37
38 let _ = fmt()
39 .with_env_filter(EnvFilter::from_default_env())
40 .try_init();
41}