Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation & Toolchain

Rust

Most teeny-* crates build with a plain stable (or nightly) Rust toolchain and no system dependencies — see each crate’s own README (linked from its API docs) for specifics. Two crates are exceptions:

  • teeny-cuda requires the CUDA toolkit headers/libraries on the host at build time (its build.rs runs bindgen against them unconditionally). See its README for CUDA_INCLUDE_DIR/CUDA_LIB_DIR.
  • teeny-onnx vendors the upstream ONNX proto schema as a git submodule — run git submodule update --init support/teeny-onnx/onnx in a workspace checkout (not needed when depending on the published crate).

The teenyc compiler (runtime only)

Compiling/running kernels — through teeny-compiler’s LLVM/MLIR backend, teeny-triton’s DSL, or teeny-cuda’s AOT/JIT path — shells out at runtime to a custom compiler binary, teenyc (a fork of rustc with an MLIR codegen backend). This is not needed to cargo build/cargo doc any teeny-* crate, only to actually compile and run kernels.

export TEENYC_PATH=/path/to/teenyc   # falls back to `teenyc` on $PATH if unset

The supported way to obtain it is via cargo-teeny:

cargo install --git https://github.com/spinorml/cargo-teeny
cargo teeny install-toolchain

This mirrors the toolchain setup used by downstream projects such as vision-rs.

System setup (Ubuntu)

For working on the teenygrad workspace itself (not just depending on its published crates):

sudo apt-get install build-essential z3 libz3-dev lld

or run ./setup_ubuntu.sh from the repository root.

TODO: expand this chapter with GPU compute-capability selection, PTX ISA version overrides (TEENYC_PTX_VERSION), and cross-compilation notes once they’re documented per-crate.