Swift Creator’s Company Builds New Programming Language ‘Mojo’ – Python Superset

AI and ML Jobs


While working at Apple, Chris Lattner designed Swift to “take full advantage of the power of LLVM” and “led a team at Google to push Swift out of Apple’s comfort zone and as an alternative to Python in AI models.” Development.” This is according to a blog post by Jeremy Howard, Advisor at Lattner’s Modular AI (which was co-founded in 2022 to build the next-generation AI platform for developers). Thing.

“But sadly, Swift didn’t get the support it needed from Apple and Google, and ultimately didn’t succeed,” Howard wrote. nevertheless…
[W]hilst Chris from Google has developed another project, MLIR, which has been very successful. MLIR is an alternative to his LLVM intermediate representation [or IR] Meet the modern age of many-core computing and AI workloads. This is important for maximizing the power of hardware such as vector units, which are increasingly being added to GPUs, TPUs, and server-class CPUs.

So if Swift is “syntactic sugar for LLVM”, what is “syntactic sugar for MLIR”? The answer is: Mojo! Mojo is a brand new language designed to take full advantage of MLIR. Also, Mojo is Python.

wait what?

Ok, let me explain. It might be better to say that Mojo is Python++. It will (when complete) be a strict superset of the Python language. But it also has additional features so you can write high performance code that takes advantage of the latest accelerators…

Swift was a brand new language packed with all sorts of cool features based on the latest research in programming language design, while Mojo is essentially just Python. This is not only because Python is already well understood by millions of coders, but also because its capabilities and limitations are well understood after decades of use. . It’s pretty cool to rely on the latest programming language research, but it’s potentially dangerous speculation because you never really know how things will turn out…

A key Mojo trick is that you can always opt into a faster “mode” as a developer by writing functions with “fn” instead of “def”. In this mode, you must declare all variable types correctly so that Mojo can create optimized machine code to implement your functions. Additionally, using “struct” instead of “class” stores attributes densely in memory, so you can also use them in data structures without chasing pointers. These are the kinds of features that allow languages ​​like C to be very fast, and are now available to Python programmers — just learn a few new syntaxes…

It’s impossible to describe all the small (and big!) ideas in Mojo’s overall design and implementation. It’s the result of decades of work by Chris and his team on compiler and language design, and includes all the tricks and hard-earned experience from it. Time — but what I can tell you is the amazing results I’ve seen with my own eyes.
Mojo is not yet available to the public (an online “playground” with a waiting list to “roll out access slowly”). However, the blog post states that creating syntax for programming languages ​​is usually complicated and error prone. Prone and controversial — Mojo cleverly sidesteps the problem by “outsourcing” its syntax to existing languages.

Also, “As a compiled language, Mojo’s evolution story is basically the same as C,” the post claims. [That is, “you can literally just make the compiled program available for direct download. It can be just 100k or so in size, and will launch and run quickly.”]

“In other words, Mojo much more Better than a language for AI/ML applications. This is a version of Python that allows you to write fast, small, and easy-to-deploy applications that take advantage of all the cores and accelerators available!”



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *