Writing an optimizing tensor compiler from scratch

Solo dev builds a DIY AI math engine; commenters yell 'Try Mojo'

TLDR: A solo developer released TensorFrost, a homegrown compiler that blends graphics-style code with simple math for simulations and AI. Early chatter pits “just use Mojo” against cheering the indie build, with questions about speed and scope—why it matters: it could make wild visuals and learning models live in one place.

Mykhailo Moroz just dropped TensorFrost, a do-it-yourself AI math engine that compiles fast code for graphics and simulations while still speaking easy, NumPy-style math. The post shows flashy GIFs—fluids, path tracing, n‑body orbits, even a neural toy—and tells the origin story: a small Unity project ballooned into a full compiler after “scope creep.” The pitch is simple: shaders are great for pretty pixels, but clunky for machine learning; TensorFrost aims to blend both worlds with automatic differentiation (the math that lets models learn) and a friendly syntax. It’s open source on GitHub, with more in the README and Shadertoy roots on display.

The crowd reaction? The first reply fires the starter pistol: “check out the Mojo language.” Cue the classic internet split. Some swoon over the one‑person‑compiler energy and the mesmerizing demos. Skeptics ask for hard numbers, benchmarks, and why this isn’t just reinventing PyTorch or JAX in a new outfit. Language‑war veterans roll their eyes—Mojo, Rust, CUDA, pick your fighter—while meme lords spam “scope creep speedrun” and cat GIFs. Practical voices wonder about training speed, GPU support, and how big models can get. Love it or doubt it, everyone agrees: those visuals slap, and this rabbit hole looks deep.

Key Points

  • TensorFrost is a static optimizing tensor compiler combining shader-like workflows with high-level tensor algebra for ML.
  • The library offers NumPy-like syntax and automatic differentiation, with several demo applications (e.g., fluid sim, path tracer).
  • Development started 14 months ago from a small Unity-focused goal and expanded into building a full compiler.
  • A previous attempt (TensorCL using OpenCL) reached basic functionality but was hindered by poor debugging tools and kernel-per-operation overhead.
  • The project aims to bridge shader megakernel workflows and ML pipelines, addressing limitations in shaders such as lack of autodiff and difficulty integrating/trainable networks.

Hottest takes

"check out the Mojo language" — deterministic
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.