[{"data":1,"prerenderedAt":34},["ShallowReactive",2],{"chapter:teenygrad\u002Fgetting-started\u002Finstallation.json":3},{"project":4,"route":5,"title":6,"titleHtml":7,"navTitle":6,"part":8,"sourcePath":9,"editUrl":10,"html":11,"toc":12,"hasMermaid":27,"prev":28,"next":31},"teenygrad","\u002Fteenygrad\u002Fgetting-started\u002Finstallation","Installation & Toolchain","Installation &amp; Toolchain","Getting Started","getting-started\u002Finstallation.md","https:\u002F\u002Fgithub.com\u002Fteenygrad\u002Fteenygrad\u002Fedit\u002Fmain\u002Fbooks\u002Fteenygrad\u002Fsrc\u002Fgetting-started\u002Finstallation.md","\u003Ch2 id=\"rust\">Rust\u003C\u002Fh2>\n\u003Cp>Most \u003Ccode>teeny-*\u003C\u002Fcode> crates build with a plain stable (or nightly) Rust toolchain and no system\ndependencies — see each crate’s own README (linked from its\n\u003Ca href=\"\u002Fapi\u002Fteenygrad\u002Fteenygrad\u002F\">API docs\u003C\u002Fa>) for specifics. Two crates are exceptions:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>\u003Ccode>teeny-cuda\u003C\u002Fcode>\u003C\u002Fstrong> requires the CUDA toolkit headers\u002Flibraries on the host at \u003Cem>build\u003C\u002Fem> time (its\n\u003Ccode>build.rs\u003C\u002Fcode> runs \u003Ccode>bindgen\u003C\u002Fcode> against them unconditionally). See its README for\n\u003Ccode>CUDA_INCLUDE_DIR\u003C\u002Fcode>\u002F\u003Ccode>CUDA_LIB_DIR\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>\u003Ccode>teeny-onnx\u003C\u002Fcode>\u003C\u002Fstrong> vendors the upstream ONNX proto schema as a git submodule — run\n\u003Ccode>git submodule update --init support\u002Fteeny-onnx\u002Fonnx\u003C\u002Fcode> in a workspace checkout (not needed when\ndepending on the published crate).\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2 id=\"the-teenyc-compiler-runtime-only\">The \u003Ccode>teenyc\u003C\u002Fcode> compiler (runtime only)\u003C\u002Fh2>\n\u003Cp>Compiling\u002Frunning kernels — through \u003Ccode>teeny-compiler\u003C\u002Fcode>’s LLVM\u002FMLIR backend, \u003Ccode>teeny-triton\u003C\u002Fcode>’s DSL, or\n\u003Ccode>teeny-cuda\u003C\u002Fcode>’s AOT\u002FJIT path — shells out \u003Cstrong>at runtime\u003C\u002Fstrong> to a custom compiler binary, \u003Ccode>teenyc\u003C\u002Fcode> (a\nfork of \u003Ccode>rustc\u003C\u002Fcode> with an MLIR codegen backend). This is \u003Cem>not\u003C\u002Fem> needed to \u003Ccode>cargo build\u003C\u002Fcode>\u002F\u003Ccode>cargo doc\u003C\u002Fcode>\nany \u003Ccode>teeny-*\u003C\u002Fcode> crate, only to actually compile and run kernels.\u003C\u002Fp>\n\u003Cpre data-lang=\"bash\" class=\"shiki teeny-datasheet\" style=\"background-color:#16181a;color:#e6e8e3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#FF5F9E\">export\u003C\u002Fspan>\u003Cspan style=\"color:#E6E8E3\"> TEENYC_PATH\u003C\u002Fspan>\u003Cspan style=\"color:#8A9088\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E6E8E3\">\u002Fpath\u002Fto\u002Fteenyc   \u003C\u002Fspan>\u003Cspan style=\"color:#7F877D;font-style:italic\"># optional — see detection below\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The supported way to obtain it is via \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fspinorml\u002Fcargo-teeny\" target=\"_blank\" rel=\"noopener noreferrer\">\u003Ccode>cargo-teeny\u003C\u002Fcode>\u003C\u002Fa>,\nwhich downloads a prebuilt release and links it as a named \u003Ccode>rustup\u003C\u002Fcode> toolchain:\u003C\u002Fp>\n\u003Cpre data-lang=\"bash\" class=\"shiki teeny-datasheet\" style=\"background-color:#16181a;color:#e6e8e3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#7FB6D9\">cargo\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> install\u003C\u002Fspan>\u003Cspan style=\"color:#B79AD4\"> --git\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> https:\u002F\u002Fgithub.com\u002Fspinorml\u002Fcargo-teeny\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#7FB6D9\">cargo\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> teeny\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> install-toolchain\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>This mirrors the toolchain setup used by downstream projects such as\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fspinorml\u002Fvision-rs\" target=\"_blank\" rel=\"noopener noreferrer\">\u003Ccode>vision-rs\u003C\u002Fcode>\u003C\u002Fa>.\u003C\u002Fp>\n\u003Ch3 id=\"how-teenyc-is-located\">How \u003Ccode>teenyc\u003C\u002Fcode> is located\u003C\u002Fh3>\n\u003Cp>\u003Ccode>teeny-compiler::compiler::find_teenyc\u003C\u002Fcode> resolves the binary in two steps:\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Ccode>$TEENYC_PATH\u003C\u002Fcode>, if set — used as-is.\u003C\u002Fli>\n\u003Cli>Otherwise, the sole \u003Ccode>rustup\u003C\u002Fcode>-linked toolchain whose name contains \u003Ccode>teenyc\u003C\u002Fcode> (the naming\nconvention \u003Ccode>cargo teeny install-toolchain\u003C\u002Fcode> uses — by default \u003Ccode>&lt;channel&gt;-&lt;host-triple&gt;\u003C\u002Fcode> with\n\u003Ccode>channel\u003C\u002Fcode> defaulting to \u003Ccode>stable-teenyc\u003C\u002Fcode>), resolved to a binary path via\n\u003Ccode>rustup which --toolchain &lt;name&gt; teenyc\u003C\u002Fcode>.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>If neither step finds a binary — no env var, and no matching \u003Ccode>rustup\u003C\u002Fcode> toolchain (or more than one,\nwhich is ambiguous) — this returns an error rather than silently guessing at a bare \u003Ccode>teenyc\u003C\u002Fcode> on\n\u003Ccode>$PATH\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch2 id=\"system-setup-ubuntu\">System setup (Ubuntu)\u003C\u002Fh2>\n\u003Cp>For working on the teenygrad workspace itself (not just depending on its published crates):\u003C\u002Fp>\n\u003Cpre data-lang=\"bash\" class=\"shiki teeny-datasheet\" style=\"background-color:#16181a;color:#e6e8e3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#7FB6D9\">sudo\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> apt-get\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> install\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> build-essential\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> z3\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> libz3-dev\u003C\u002Fspan>\u003Cspan style=\"color:#D8A76B\"> lld\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>or run \u003Ccode>.\u002Fsetup_ubuntu.sh\u003C\u002Fcode> from the repository root.\u003C\u002Fp>\n\u003Cblockquote>\n\u003Cp>\u003Cstrong>TODO\u003C\u002Fstrong>: expand this chapter with GPU compute-capability selection, PTX ISA version overrides\n(\u003Ccode>TEENYC_PTX_VERSION\u003C\u002Fcode>), and cross-compilation notes once they’re documented per-crate.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n",[13,17,20,24],{"id":14,"text":15,"level":16},"rust","Rust",2,{"id":18,"text":19,"level":16},"the-teenyc-compiler-runtime-only","The teenyc compiler (runtime only)",{"id":21,"text":22,"level":23},"how-teenyc-is-located","How teenyc is located",3,{"id":25,"text":26,"level":16},"system-setup-ubuntu","System setup (Ubuntu)",false,{"title":29,"titleHtml":29,"route":30},"Introduction","\u002Fteenygrad",{"title":32,"titleHtml":32,"route":33},"Your First Model","\u002Fteenygrad\u002Fgetting-started\u002Ffirst-model",1786271828999]