pub fn compile_graph<'a, L: Lowering<'a>>(
graph: &Graph,
lowering: &L,
mode: LoweringMode,
options: &Options,
cache_dir: &str,
force: bool,
) -> Result<CudaModel<'a>>Expand description
Ahead-of-time compile an already-traced graph to PTX files on disk,
driven by an already-parsed Options (see Options::parse).
This is the same LlvmCompiler + CudaGraphCompiler sequence used for
JIT compilation at runtime (e.g. in models/teeny-vision/examples/mnist.rs),
just parameterized by CLI-driven options/cache_dir instead of hardcoded
values. No live CUDA device/context is required — only .load() on the
returned CudaModel needs one.
cache_dir is where compiled PTX is written/read. Passing the same
directory a later run resolves via TEENYC_CACHE_DIR pre-warms that
runtime JIT cache. The teenyc binary is resolved via
teeny_compiler::compiler::find_teenyc, matching the existing JIT compile path.