Max Engine Understanding

Can anyone please guide me what's the purpose of MAX engine? This is what I understood: It's some compiler which compiles the model graphs to boost up their performance. But it's not the Mojo compiler. Assuming I write my whole model in Mojo (I implement all the APIs required for the model in Mojo myself). Then Which compiler will be better? If Mojo is going to be faster (assuming I write the best possible code with Mojo 🔥 ) then what's the purpose of MAX Engine 🏎️ ?
3 Replies
Josh Peterson
Josh Peterson8mo ago
The MAX engine is for inference of machine learning models. In some sense it is orthogonal to Mojo, although the two of them do work well together (think peanut butter and jelly 😀 ). I like this diagram from the docs (https://docs.modular.com/engine/overview): Here is the "MAX model compiler" is what I think you are referring to. This is different from the Mojo compiler. The Mojo compiler takes Mojo language input and produces executable machine code. The MAX model compiler takes a machine learning graph as input, and produces executable machine code. Both are compilers, but they accept different input. Here is the "peanut butter and jelly" part: Those blue boxes on the right - "MAX Graph API" and "Mojo API" mean you can write a model end-to-end in Mojo, expressing the machine learning graph via that MAX Graph API. So to answer your question:
Assuming I write my whole model in Mojo (I implement all the APIs required for the model in Mojo myself). Then Which compiler will be better?
Both! By doing this, you will be using both Mojo and the MAX engine. Also, parts of that "MAX model compiler" block are written in Mojo. So it is turtles all the way down. 🐢
Toji
Toji7mo ago
Has there been anything like MAX in the industry before? Afaik it's the first thing to do this right??
Josh Peterson
Josh Peterson7mo ago
Yes, I don't think anyone else has attempted to unify ML inference like this before.
Want results from more Discord servers?
Add your server