Paul Krill
Editor at Large

Mojo language marries Python and MLIR for AI development

news
May 4, 20232 mins

New programming language aims to combine full Python compatibility with low-level programming features, along with the ability to harness GPUs and other AI accelerators.

shutterstock 27853015 apple and orange against white background
Credit: Edcel Mayo / Shutterstock

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.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author