Home Lex Fridman Notes
Lex Fridman · 2023-06-02 · 3h 34m

Chris Lattner: Future of Programming and AI | Lex Fridman Podcast #381

Chris Lattner explains Mojo, a Python superset built for AI that he claims can run up to 35,000x faster, and his mission to kill complexity in AI infrastructure.

Chris Lattner: Future of Programming and AI | Lex Fridman Podcast #381
The guest

Chris Lattner — Legendary compiler engineer who created LLVM, the Clang compiler, and the Swift language, led key work on TPUs at Google and Autopilot software at Tesla, and now co-founded Modular to build a new full-stack AI infrastructure and the Mojo programming language.

The gist

Lattner walks through Mojo, a new programming language designed as a full superset of Python that adds systems-level features so code can run from interpreters to GPUs and AI accelerators without a rewrite. He explains how Mojo achieves massive speedups by moving from CPython's interpreter to a compiler, dropping boxed objects into registers, adding optional types, value semantics, ownership, and auto-tuning. The bigger picture is Modular's mission to unify the fragmented AI stack so models don't need to be rewritten in C++ or hand-tuned with CUDA kernels for every new chip. He recounts hard-won lessons from launching Swift and from the painful Python 2-to-3 migration, shaping his deliberate, community-driven, no-fragmentation approach to releasing Mojo. The conversation closes on the future of programming, LLMs as coding companions, and making AI accessible to far more people.

Big reveals

  • Lattner claims Mojo code has demonstrated over 30,000x (up to 35,000x) speedups over Python.
  • He bluntly argues that people who prefer curly braces over indentation 'are just wrong.'
  • Reveals he left Apple in January 2017 specifically to go work on AI, ending up at Google on TPUs.
  • Admits his earlier Swift-for-TensorFlow project 'did not work out super well' because Swift isn't Python.
  • Tells the story of Swift's stressful, buggy 2014 launch as the reason he deliberately released Mojo as a rough 0.1.
  • Says he doesn't spend time worrying about Skynet because 'if Skynet takes over and kills us all then I'll be dead.'
  • Credits Jeremy Howard as the person who pushed him for years toward building Mojo: 'Chris finally listened to Jeremy.'

Things worth remembering

  • Mojo can use the fire emoji as a file extension, which Lattner calls one of the first emojis ever used that way.
  • Mojo's compiler embeds an interpreter, letting it run Python-style dynamic metaprogramming at compile time.
  • CPython boxes every integer as a heap object with reference counting, which is tightly intertwined with Python's GIL.
  • Mojo gained over 10,000-11,000 Discord members within roughly two weeks of release.
  • Over 70,000 people signed up for the Mojo Playground in the first two weeks, about one person per minute.
  • When Swift launched at WWDC, only about 250 people at Apple even knew the project existed.
  • Jeremy Howard and a researcher beat Google in the DAWNBench ImageNet training competition using progressive image resizing rather than brute-force compute.
  • Mojo was only about seven months old at the time of the interview and still lacks classes, lambda syntax, and list comprehensions.
  • In C++, throwing a 'zero-cost' exception can be roughly 10,000x more expensive than a normal function return.
  • Lattner argues Excel is arguably the most popular programming language in the world.