AI infrastructure company Modular has launched Mojo, a programming language for AI developers that aims to combine Python usability—and full compatibility with the Python ecosystem—with C performance. Low-level systems programming and advanced compilation features come by way of MLIR, the Multi-Level Intermediate Representation compiler framework.
Unveiled May 2, Mojo is intended to bridge the gap between research and production, leveraging Python syntax as well as systems programming and compile-time metaprogramming. Modular bills Mojo as faster than C++, more hackable than Nvidia’s CUDA, and as safe as Rust.
Mojo began with the goal of bringing an innovative programming model to accelerators in machine learning. But because today’s CPUs also have tensor and other AI accelerators, Modular decided that Mojo should support general purpose programming and, because Python is so widely used in machine learning and elsewhere, to embrace the Python ecosystem. The embrace of Python also simplified design efforts. With most of the syntax already specified, the company could instead focus on building the compilation model and designing specific programming features, Modular said.
Mojo is intended to be a superset of Python and compatible with existing Python programs. Python core features are supported such as async/await, error handling, and variadics, but other aspects of Python, such as classes, still are missing. Goals of the language as a member of the Python family include:
- Full compatibility with the Python ecosystem.
- Predictable low-level performance and low-level control.
- The ability to deploy code subsets to accelerators.
- Avoidance of ecosystem fragmentation.
The Mojo standard library, compiler, and runtime are not yet available for local development. Modular has created a hosted development environment to try out Mojo, the Mojo Playground. Developers must sign up for access.
The roadmap for Mojo includes features such as tuple support, which is partially implemented now, as well as keyword arguments in functions, improved package management support, and standard library features such as canonical arrays and dictionary types. Full support for dynamic features in Python classes also is eyed, as is C/C++ interoperability.